I have recently installed Kubuntu 18.04 which uses netplan instead of the old networking subsystems. In the past I have set up a few extra loopback addresses for a variety of reasons using /etc/network/interfaces
, however that doesn't work in 18.04 anymore. For my work development environment, I also need 172.16.123.1 added to a loopback interface.
What I noticed is that the current netplan configuration file just diverts all network management to NetworkManager, however from what I can tell NetworkManager has no ability to manage loopback devices or add loopback addresses.
So what is the correct way with netplan to configure some additional loopback addresses but still primarily use NetworkManager for interface configuration?
Update 2021-12-10 In newer versions of netplan, the format of the file in this answer has changed from the accepted answer, as has the default file location in later revisions of Ubuntu 20.04 as well as newer Ubuntu releases.
The file is now /etc/netplan/01-netcfg.yml
and the format needs to look like
network:
version: 2
renderer: networkd
ethernets:
lo:
match:
name: lo
addresses: [ 172.16.123.1/32 ]
Netplan seems to be extremely fussy about the layout and format of this file, and I've taken down a few VMs trying to set them up the old way.
man systemd.network
. Not sure about that but you may be able to set up interface by using systemd-networkd. I failed in a quick test but Id on't know your setup requirementsudo ifconfig lo:1 172.16.123.1 netmask 255.255.255.0 up
and I basically need this equivalent functionality at system boot.