Ubuntu – How to permanently remove lo:0 interface

ifconfiglinux-networkingUbuntu

I have two ubuntu 16.04 servers here that were upgraded from 10.04 and are now virtual machines but used to be running on physical hardware using two bonded ethernet ports. The bonding configuration is now obsolete due to the virtualization.

When I do an ifconfig on one of these machines, I get the following output:

rh@wstest:~> ifconfig
ens160    Link encap:Ethernet  HWaddr00:50:56:94:1b:59
          inet addr:172.17.1.62 Bcast:172.17.255.255  Mask:255.255.0.0
          inet6 addr:fe80::250:56ff:fe94:1b59/64 Scope:Link
          UP BROADCAST RUNNINGMULTICAST  MTU:1500  Metric:1
          RX packets:202330 errors:0dropped:2209 overruns:0 frame:0
          TX packets:74983 errors:0dropped:0 overruns:0 carrier:0
          collisions:0txqueuelen:1000
          RX bytes:148353176 (148.3MB)  TX bytes:6457904 (6.4 MB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1 Mask:255.0.0.0
          inet6 addr: ::1/128Scope:Host
          UP LOOPBACK RUNNING MTU:65536  Metric:1
          RX packets:605 errors:0dropped:0 overruns:0 frame:0
          TX packets:605 errors:0dropped:0 overruns:0 carrier:0
          collisions:0txqueuelen:1
          RX bytes:149597 (149.5 KB) TX bytes:149597 (149.5 KB)

lo:0      Link encap:Local Loopback
          inet addr:172.17.1.22 Mask:255.255.255.255
          UP LOOPBACK RUNNING MTU:65536  Metric:1

The question is where the lo:0 interface comes from and why it has the ip 172.17.1.22 and how we can get rid of it. I know I can do an ifconfig down lo:0 and remove it but it will be here again after a reboot.

Our /etc/network/interfaces looks as follows with no trace of a lo:0 interface:

auto lo
    iface lo inet loopback

auto ens160
    iface ens160 inet static
    address 172.17.1.62
    netmask 255.255.0.0
    network 172.17.0.0
    gateway 172.17.1.2
    dns-search ....
    dns-nameservers 172.17.1.6 172.17.1.7

Best Answer

After more research, it turned out that the ifconfig statement to add this lo:0 interface was put into a script called from /etc/rc.local and thus always activated on machine startup and on calls to ifup.