Starting sometime around Ubuntu 18.04, the Ubuntu devs stopped using the classic /etc/init.d/networking
and /etc/network/interfaces
method of configuring the network and switched to some thing called netplan
. This has made a lot of people very angry and been widely regarded as a bad move. Is it possible to remove netplan
and use the correct /etc/network/interfaces
method for configuring the network?
The following procedure works for Ubuntu 18.04 (Bionic Beaver)
I. Reinstall the ifupdown package:
II. Configure your /etc/network/interfaces file with configuration stanzas such as:
III. Make the configuration effective (no reboot needed):
IV. Disable and remove the unwanted services:
Then, you're done.
Note: You MUST, of course, adapt the values according to your system (network, interface name...).
V. DNS Resolver
Because Ubuntu Bionic Beaver (18.04) make use of the DNS stub resolver as provided by SYSTEMD-RESOLVED.SERVICE(8), you SHOULD also add the DNS to contact into the /etc/systemd/resolved.conf file. For instance:
and then restart the systemd-resolved service once done:
The DNS entries in the ifupdown INTERFACES(5) file, as shown above, are only relevant if you make use of RESOLVCONF(8) or similar.
The Netplan team has posted an official answer on their FAQ here:
See Nuxwin's answer for more complete instructions.
The answer of Nuxwin is great and almost complete, I'd just add the lines:
This will make sure that the resolver can be updated by the DHCP-client, like it was before when using interfaces.
(I would have added this as a comment but somehow one need 50 reputation to post a comment)
Why not just configure with netplan?
Well, as it is configured in 18.04-Desktop, it is a single line handing over control to all interfaces to NetworkManager.
While that is probably suitable for 95% of users, remember that NetworkManager is only run once you are logged in to a session.
Should you want your machine to act as a server/desktop, for example start serving files to local machines, acting as VNP server, etc... or anything "fancy" before anyone is ever logged in, just by the simple fact it is on, you will have trouble with how it is configured in standard 18.04-Desktop.
Of course, the alternative would be to use the server-Netplan configuration, which, as far as I have read (not checked by myself), hands control over to systemd-networkd instead. In this case you'd better learn how systemd does things as a replacement of the old System V init.
Should you go this path, you still have to make change to the netplan yaml, since on a desktop version the control is given to NetworkManager.
Why not just remove netplan:
Once for all!
The key is knowing that
cloud.init
is the real control program.That being said the line in the
netplan
config file "optional: true" is mandatory.Knowing that made it easy.
I just removed
01-network-manager-all.yaml
and copied it to/root/save/
. Then put a known good config in place instead of it,50-cloud-init.yaml
: its contents follow:Then reboot and it should be working fine.
The known good config came from Configure bonded 802.3ad network using netplan on Ubuntu 18.04.
According to this answer, the solution is to remove all operational .yaml files: Ubuntu 17.10 disable netplan
I wouldn’t remove anything without backing up. We can do so easily by simply moving the files aside. First, locate the files:
On my 18.04 system, it appears that the only operational file is /etc/netplan/01-network-manager-all.yaml. Let’s move it:
...where user is your user name.
Now check to make sure the file is truly gone:
Now make your additions to /etc/network/interfaces as required.
Reboot.
Any improvement?
Footnote: The exact process to do this is hard to find. We may need to refine a bit as we go.