Configuring VLAN interfaces on CentOS Linux hosts

I recently needed to configure a CentOS Linux host to use 802.1Q tagged queuing. This turned out to be super easy, and allowed me place the physical server on multiple layer-2 networks. To configure an 802.1Q interface, I first checked the ifcfg-eth0 script for the interface that was planning to participate in 802.1Q:

$ cd /etc/sysconfig/network-scripts

$ cat ifcfg-eth0
DEVICE=eth0 BOOTPROTO=dhcp HWADDR=00:1B:24:5C:2C:DD ONBOOT=yes TYPE=Ethernet

Once I had the interface information, I created a ifcfg-vlan301 interface file with the VLAN number as well as the VLAN options:

$ cat ifcfg-vlan301

After the files were created, I used service to restart networking and everything came up smoothly. There are much better references on the Internet for Linux 802.1Q configuration, but I’m posting this here so I have a handy reference (and one I know works!).

This article was posted by Matty on 2009-02-28 12:11:00 -0400 -0400