Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 11 down vote accepted

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

share|improve this answer
Works. Thanks! But what is the difference between lo and lo: and how to remove an interface from lo:? – Leviathan Apr 6 '14 at 20:01
never saw lo: before. Remove with ifconfig lo: down – user224465 Apr 6 '14 at 20:46
Alright, thank you! – Leviathan Apr 6 '14 at 20:49
What is the difference between ifconfig lo: and route add -host ? Are they doing the same thing? – hengxin Jul 30 '14 at 8:00
lo:<foo> is a new interface that use lo as a base, its called a alias and you can operate it as a normal interface: set it up, down, etc. It creates a separation between just adding more ips to a interface or creating a new interface. It is useful when you dont want actions applied on one ip to be done also to the rest of the ips in one interface – Bruno Pereira Jun 3 '15 at 14:09

If you keep using "ifconfig lo..." you're not creating a new interface, you're overwritting the previous one. You could try editing your interfaces file:

sudo vim /etc/network/interfaces

Mine looks like this:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

So, you could try and modifying it to create new interfaces:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto lo2
iface lo2 inet loopback
auto lo3

Then, restart the network, or the whole system, and try to interact with the new interfaces with "sudo ifconfig lo2/lo3 etc..."

share|improve this answer
Looks great thanks! Would like to upvote this but i have too less reputation. – Leviathan Apr 6 '14 at 19:54
What are the ips for the new created lo2 and lo3? By the way, what do the numbers (interfaces(5), ifup(8), and ifdown(8)) mean? Thanks. – hengxin Jul 30 '14 at 8:05
Those numbers are references to the man pages, but don't know exactly how they work. The lines are comented anyway. About the IP, you'll need to set them with ifconfig or with address etc under each interface. – darent Oct 7 '14 at 17:25
If you're curious what the numbers mean, run man man; the numbers indicate what section of the manual each manpage is in. Section 5 is for file formats and conventions, for example, and section 8 is for system administration commands (that usually are only expected to be run by root). – Parthian Shot Jul 6 '15 at 23:36
I don't think that this actually works. You can only have on "lo" device per namespace according to driver/net/loopback.c. The "dummy" device may do everything you need, "sudo ip link add name loop1 type dummy" – mcr Sep 25 '15 at 13:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.