Add Virtual Interfaces in Linux - Quick HOWTO

By Parthiban Ponnusamy

Add Virtual Interfaces in Linux - Quick HOWTO       


To add a virtual interface in Linux, Type the following command in your Linux Terminal 
Command: 


ifconfig <VIRTUAL_INTERFACE_DEVICE> <IP_ADDRESS> netmask <SUBNET_MASK> up 


For example, 


ifconfig eth0:1 192.168.1.6 netmask 255.255.255.0 up This will create a new 


virtual interface named eth0:1 and assigns the IP Address 192.168.1.6 to that 


To Make this Virtual Interface Permenant


Create a new file /etc/sysconfig/network-scripts/ifcfg-eth0:1 with the following contents DEVICE=eth0:1 
ONBOOT=yes 
BOOTPROTO=static 
IPADDR=192.168.1.99 
NETMASK=255.255.255.0 


In this way you can assign mutiple IP Address to a Single Network Card (NIC) You can create multiple Virtual Network Interfaces 


To Up and Down the Virtual Interface, use the following commands

ifup eth0:1  - To Make Up
ifdown eth0:1  - To make down

For Further Reading,
Linux, Quick HOWTO

My Profile PhotoAbout the Author

I'm Parthiban, An UNIX System Admin by Profession. I'm Experienced in Linux/Unix System Administration and Scripting. I have done lot of work on the infrastructure Mgmt side in Linux, UNIX and Windows system administration, Hardware, Storage and Data center. I'm blogging since 2008.
Follow Me On Twitter or On Facebook

{ 0 comments... read them below or add one }

Post a Comment

What do you think about this Article? Add your Opinion..!