How to Create Virtual Interface on CentOS 6 Linux

How to Create Virtual Interface on CentOS  6 Linux

Creating Virtual Interface and Assign Multiple IP Addresses

Let’s assume you want create new virtual interface ifcfg-eth0:0 device and assign new IP 10.10.10.20

Network device files are located in /etc/sysconfig/network-scripts/ directory.

# cd /etc/sysconfig/network-scripts/
# cp ifcfg-eth0 ifcfg-eth0:0

Then edit new ifcfg-eth0:0 file with your favorite text editor (vi for me). We need to change only two parameters DEVICE, and IPADDR

# vi ifcfg-eth0:0

DEVICE="eth0:0"
BOOTPROTO="static"
GATEWAY="10.10.10.1"
HWADDR="00:10:46:14:33:4D"
IPADDR="10.10.10.20"
NETMASK="255.255.0.0"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"

Then you need save and restart the network service

# /etc/init.d/network restart

Now your new interface with 10.10.10.20 IP ready for use.

arstech

Leave a Reply