This is the code to make an alias IP address on network interface ethX where X is a number to indicate the device we are attaching the IP.
ifconfig eth0:1 192.168.0.30 netmask 255.255.255.0 up
Your machine will now answer on ping requests 192.168.0.30.
You can see the result by running the command
eth0:1 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx inet addr:192.168.0.30 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:17 Base address:0x1080
To take down this alias use
ifup eth0:1 down
You might experience that the new device/address won’t answer network requests to the IP address after moving it. This happens because the arp cache on the router most likely haven’t discovered that the IP address is on a new MAC address. A solution to this problem is to clear the arp info on the router using the arprelease command
arprelease eth0:1 192.168.0.30
This command can be downloaded from http://sourceforge.net/projects/arprelease/ if it isn’t available on your linux distribution.