Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. 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

closed as off topic by splattne Feb 2 '12 at 11:47

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

up vote 5 down vote accepted

It is not really clear what you are trying to do, but you can run multiple virtual machines (virtualization) on your PC to do your tests using a single machine.

If you want to have multiple IP addresses on the same physical interface, that is another thing. If this is what you want, you can do it the old way using ifconfig or the new way using ip addr add.

The old way:

$ sudo ifconfig eth0:0 your.ip.addr.ess netmask your.sub.net.mask up

The new way:

$ sudo ip addr add your.ip.addr.ess/mask.bits dev eth0

Of course, you need to replace your.ip.addr.ess with real value like 192.168.1.1 and your.sub.net.mask with something like 255.255.255.0. The mask.bits can be something like 24. You may need also to change the device name eth0. To view the IPs currently added, you can use ifconfig (old) or ip addr show (new).

share|improve this answer
    
yes I want multiple IP addresses on the same physical interface –  ePezhman Feb 2 '12 at 9:31

You need to create a subinterface inorder to assign a multiple ip to the same interface (for e.g. eth0). The command for assigning suppose 2 Ip address like 10.100.10.1/24 & 10.100.10.2/24 to interface eth0 will be as follows

# ifconfig eth0 10.100.10.1 netmask 255.255.255.0 up

# ifconfig eth0:1 10.100.10.2 netmask 255.255.255.0 up

After this restart the network

service network restart

I hope this answers your question...

share|improve this answer

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