8

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

3 Answers 3

8

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.

3

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

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

2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .