Ubuntu – How to add a loopback interface


I want to add two more loopback interfaces.

I used the following command:

ifconfig lo: netmask up

and type in ifconfig, i can see the loopback address was added.

But if i want to add one more interface… (for example the previous interface ( was overwritten.

Also when i look in /etc/network/interfaces i see no entry.

How can i add multiple loopback interfaces permanently?

Best Answer

It depends what you want lo or lo: which is an interface alias.

ifconfig lo:0 netmask up
ifconfig lo:1 netmask up
ifconfig lo:2 netmask up

works. If you want to have more IP's on lo use

route add -host dev lo
route add -host dev lo
route add -host dev lo

works too. If you want to remove it, use:

route del -host
route del -host
route del -host

See also IP-Aliasing Linux Networking-HOWTO