Assign additional IP address on the interface
If you need additional IP address and you have only one interface, you can create a virtual interface and assign the ipaddress.
Make a copy of primary interface.
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
here, 0 is the first instance.
Edit the file and change the device name, ipaddress.
You may want to remove the hostname, UUID info..
Below is a comparison of two files. The one on the left is the original ifcfg-eth0 file, the one on the right is ifcfg-eth0:0 with the changes and deletions.
Restart network services for the additional interface to be activated:
$ sudo service network restart
Verify the new interface is active and has the correct IP. Ex:
$ ifconfig eth0:0
Output should resemble the following:
OLD info NEW info
--------- ---------
DEVICE=eth0 DECVICE=eth0:0
BOOTPROTO=static BOOTPROTO=static
GATEWAY=192.168.10.1 HWADDR=00:00:00:00:00:00
HOSTNAME=sam IPADDR=192.168.10.201
IPADDR=... IPV6INIT=yes
IPV6INIT=yes MTU=1500
MTU=1500 NETMASK=255.155.155.0
NETMASK=255.155.155.0 NM_CONTROLLED=yes
NM_CONTROLLED=yes ONBOOT=yes
ONBOOT=yes TYPE=Ethernet
TYPE=Ethernet
UUID=0000000-0000-2222-2222-000000000000
Now, restart network service
# service network restart
# ifcfg eth0:0
If you need additional IP address and you have only one interface, you can create a virtual interface and assign the ipaddress.
Make a copy of primary interface.
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
here, 0 is the first instance.
Edit the file and change the device name, ipaddress.
You may want to remove the hostname, UUID info..
Below is a comparison of two files. The one on the left is the original ifcfg-eth0 file, the one on the right is ifcfg-eth0:0 with the changes and deletions.
Restart network services for the additional interface to be activated:
$ sudo service network restart
Verify the new interface is active and has the correct IP. Ex:
$ ifconfig eth0:0
Output should resemble the following:
OLD info NEW info
--------- ---------
DEVICE=eth0 DECVICE=eth0:0
BOOTPROTO=static BOOTPROTO=static
GATEWAY=192.168.10.1 HWADDR=00:00:00:00:00:00
HOSTNAME=sam IPADDR=192.168.10.201
IPADDR=... IPV6INIT=yes
IPV6INIT=yes MTU=1500
MTU=1500 NETMASK=255.155.155.0
NETMASK=255.155.155.0 NM_CONTROLLED=yes
NM_CONTROLLED=yes ONBOOT=yes
ONBOOT=yes TYPE=Ethernet
TYPE=Ethernet
UUID=0000000-0000-2222-2222-000000000000
Now, restart network service
# service network restart
# ifcfg eth0:0
No comments:
Post a Comment