- Forums
- Networking
- Adding A Virtual IP Address In Linux
this short and simple tutorial will show you each step by step instruction on how you can add a new virtual ip address on another interface on your linux server [3578], Last Updated: Mon Jun 24, 2024
Webune Support
Sun Oct 03, 2010
0 Comments
605 Visits
welcome to webune - today we are going to show you how you can add another ip address to your linux server using the same interface nic card.
its very easy, the first step is to copy the same configurations we have on etho and the new virtual interface we will call eth0:0
so send this command:
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
now lets open the newly created interface. i will be using nano as my text editor, but you can use vi if you are more familiar with vi
nano /etc/sysconfig/network-scripts/ifcfg-eth0:0
when you first open it it might look like something like this:
NETMASK=255.255.255.0
DEVICE=eth0
ONBOOT=yes
TYPE=Ethernet
ETHTOOL_OPTS="duplex full speed 100 autoneg off wol g"
IPADDR=10.0.0.01
now change it to this:
NETMASK=255.255.255.0
DEVICE=eth0:0
ONBOOT=yes
TYPE=Ethernet
ETHTOOL_OPTS="duplex full speed 100 autoneg off wol g"
IPADDR=10.0.0.02
as you can see, i only changed the following:
DEVICE=eth0:0
IPADDR=10.0.0.02save the changes and restart your network with this command:
service network restart
or
/etc/init.d/network restart
Done
try pinging your new ip address