Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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/ubuntnu 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

share|improve this question

3 Answers 3

up vote 7 down vote accepted

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.

share|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.

share|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 127.0.0.1 via different ports. This should work well for your purposes.

E.g.:

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.

share|improve this answer

Your Answer

 
discard

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.