https://linuxconfig.org/how-to-switch-back-networking-to-etc-network-interfaces-on-ubuntu-20-04-focal-fossa-linux
This article will explain how to switch back networking from NetPlan/CloudInit on Ubuntu 20.04 Focal Fossa Linux to yet now already obsolete networking
managed via /etc/network/interfaces
.
In this tutorial you will learn:
ifupdown
WARNING Switching back from NetPlan/CloudInit to the now obsolete networking daemon is not supported nor recommended as you might end up with a broken system.
Software Requirements and Linux Command Line Conventions
Category | Requirements, Conventions or Software Version Used |
---|---|
System | Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa |
Software | N/A |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions | # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ – requires given linux commands to be executed as a regular non-privileged user |
First step is to install tools to configure network interfaces
$ sudo apt update
$ sudo apt install ifupdown net-tools
Next, change from current enp0s3
to old network interfaces naming convention eth0
. To do so with administrative privileges edit the /etc/default/grub
file anf change the following line:
FROM:
GRUB_CMDLINE_LINUX=""
TO:
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
Edit Grub boot to change to old network interfaces naming convention eg. eth0
Once ready update Grub with:
$ sudo update-grub
Reboot your system:
As root or any administrative user edit the /etc/network/interfaces
file and set eth0
network interface to obtain the IP address from DHCP:
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
Check this article if you need to set your network interface to a static IP address.
Restart eth0
interface: NOTE Network restart via /etc/init.d/networking
is not functional. To restart your network use the ifdown
and ifup
commands as shown above.
$ sudo ifdown --force eth0
$ sudo ifup eth0