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)
DEVICE=eth5.800
BOOTPROTO=static
HWADDR=00:1B:21:52:09:0F
ONBOOT=yes
IPADDR=192.168.51.193
NETMASK=255.255.255.192
VLAN=yes
#

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
/sbin/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)
#

3 comments:

Unknown 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.

Anonymous said...

Thanks man!

I had the same problem and I resolved with your explanation.

Cheers from Brazil!

Unknown said...

Thanks Nigel, the info about vconfig made my day

Regards.