Thursday, July 12, 2012

Centos vlan configuration

On our Centos boxes, we start with a minimal installation, and then add additional rpm packages as required. Today, we wanted to add a vlan trunk interface on an existing box. We created the config file as follows:
# cat /etc/sysconfig/network-scripts/ifcfg-eth5.800
# Intel Corporation 82546GB Gigabit Ethernet Controller (Copper)

But when we tried to bring up the vlan interface, we got this error:
# ifup eth5.800
Device eth5.800 does not seem to be present, delaying initialization.

This was caused because the 'vconfig' program was missing, and so we had to install that package:
# which vconfig
/usr/bin/which: no vconfig in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
# yum install vconfig
# which vconfig

Then everything worked as expected:
# ifup eth5.800
Added VLAN with VID == 800 to IF -:eth5:-
# ls -l /proc/net/vlan
-rw------- 1 root root 0 Jul 12 10:35 config
-rw------- 1 root root 0 Jul 12 10:35 eth5.800
# lsmod | grep 8021q
8021q 57425 0

BTW, the above commands were run on the following version of Centos:
# cat /etc/redhat-release
CentOS release 5.8 (Final)

1 comment:

FlakRat said...

Thanks for logging this info. I was running into the same problem bring the vlan interface up due to the missing "vfconfig" package.

Didn't think at all that the package wasn't installed until I found this post.