By virtual IP I assume you mean a second IP on the same NIC in the same OS? (That is as opposed to setting up one for Xen/KVM or other virtualization platform.)
In RHEL5.x it is simply a matter of creating a new file and restarting networking.
You should have a file such as ifcfg-eth0 (for first NIC) that would look something like:
Code:
# Intel Corporation 82546EB Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=none
BROADCAST=10.0.15.255
HWADDR=01:03:05:D2:47:E1
IPADDR=10.0.9.1
NETMASK=255.255.0.0
NETWORK=10.0.9.0
ONBOOT=yes
ETHTOOL_OPTS="autoneg off speed 100 duplex full"
GATEWAY=10.0.9.1
TYPE=Ethernet
That is the one that would setup the main IP on eth0.
You can create another file named ifcfg-eth0:1 for the virtual that might look like:
Code:
# Intel Corporation 82546EB Gigabit Ethernet Controller (Copper)
# Alias for eth0
DEVICE=eth0:1
IPADDR=10.0.9.2
ONBOOT=yes
The next one after that would be ifcfg-eth0:2 then ifcfg-eth0:3 etc...
If it is the second NIC you'd substitute eth1 for eth0. Third NIC would be eth2 etc...
Once you've done this you should be able to ifup the interface. e.g. "ifup ifcfg-eth0:1".
CAUTION: This will disconnect any network sessions currently open so should only be run from Console: You can restart networking with "service network restart" if the ifup doesn't work for you.