Monday, April 30, 2007

Define Two IPs on a Network Interface Card (NIC)

A friend and I were talking about creating a virtual network connection. In this case, we were thinking about defining two IPs on one physical Network Interface Card (NIC). I will use the FastEthernet interface, hme, as an example.

#vi /etc/hostname.hme0
esofthub

For the virtual
#vi /etc/hostname.hme0:1
esofthub-virt

To activate virtual connection without rebooting
#ifconfig hme0:1 plumb
#ifconfig hme0:1 inet 192.xxx.xx.xx netmask 255.255.255.0 broadcast 192.xxx.xx.xx
#ifconfig hme0:1 up
#ifconfig -a

Ensure that you populate the name service (files, nis, nis+, etc) with the virtual's IP address.

2 comments:

borer said...

Congratulations ,very good idea .I hope you guys do that "real".

PD sorry for the bad english.

esofthub said...

Don't worry about the English. I appreciate your comment.

We've done it before and it was just one of those things that came up in conversation when we needed another NIC card but didn't want to pay for it.