I am developing a web app that has to produce different output based on ip. For testing and during development it would help a lot if I could have more loopback ip addresses besides Is there a way to create (and latter destroy) these?


Edit /etc/network/interfaces

add the following at the bottom of the file

auto lo:0
iface lo:0 inet static

Documentation on interfaces file can be found here : http://manpages.ubuntu.com/manpages/lucid/man5/interfaces.5.html

The definition above firstly tells the system to automatically bring the new lo:0 virtual interface (alias) up when the system starts. Then it sets interface lo:0 (bound to the loopback interface) to be a static address. The last two lines set the address and the netmask.

After you have added the above you will need to restart networking

sudo /etc/init.d/networking restart

or reboot the computer.


The whole address space is reserved for loopback addresses. So you can use any address from up to


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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