configure multiple IP for a same network interface

October 15th, 2006 mysurface Posted in ifconfig, Network, ping | Hits: 39763 | No Comments »

To configure an IP for network interface eth0, do this

ifconfig eth0 netmask up

How about I need another one? For linux, you can do IP alias by given an additional name for network interface by adding : and a number start from 1, such as

eth0:1 eth0:2 eth0:3

Therefore configure a second IP for eth0, do this

ifconfig eth0:1 netmask

Usually, if you wanna check for the network interface whether it can access to internet, you can ping a well known host. I usually pick yahoo or google.


If it return that means it works. But what if i have second IP or I have a second interface, what can I do? You can specified your interface name with -I, for this case, I have (eth0:1), I can do this

ping -I eth0:1

The example works for linux but for BSD or other Unix variant, check out the manual for more details.

Leave a Reply