I'm doing some computer network homework and I'm supposed to develop some sort of Peer to Peer file sharing software, and when I wanna test it I need to run a few (5) instances on my linux/Ubuntu 11.10 . which means each one need to has a unique IP address. I heard I can do that but I dunno how. how can I have many IP addresses on a single computer? thanks


You need to create aliases of you network interface.

You have two options for doing this.

  1. one is to create temporary aliases using ifconfig command. The aliases setup this way will be lost upon a reboot and you will need to recreate those aliases;

  2. if you need a more permanent solution, you can edit /etc/network/interfaces file and add alias' definitions there.

For more details on these two methods please visit Ubuntu Linux: Creating ethernet alias for eth0 network device.

If you only needed 2 instances of your program, I would recommende using a virtual machine, but for running five instances you will need 4 virtual machines which is not practical as it will almost halt your machine.

| improve this answer | |

In NetworkManager's applet you can choose Manual instead of DHCP.

Then, you can add to the list more than one address.

| improve this answer | |

Actually this is not an answer to the question in the tilte, but to the question in the body!

The easiest way might be to just use different port numbers for your instances. Then all instances share the same ip address, you send the data to via different ports. This should work well for your purposes.


client one listening on port 1234

client two listening on port 2345

client three listening on port 3456

So client one connects to client two via port 2345, to client three via port 3456, etc. etc.

| improve this answer | |

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.