802.1q Non-Native VLAN Tagging on CENTOS 5

Hey, a technical blog post with real, useful information in it!

I was trying to get a server setup at work with 802.1q VLAN tagging and it wasn’t working. It turns out that if you don’t want to use a native VLAN configuration on your switch the doco is all WRONG. I could not find anything on teh Google that explained the correct configuration for this to work.

First off, you need the ‘vconfig’ package installed. All 2.6 kernels support VLAN tagging, so you don’t need anything special there.

If you have a native VLAN configured on the switch, it’s easy. You just configure your NIC device (eg. eth0) to use the native VLAN and then add the tagged VLAN information in an ifcfg-eth0.tag file for each VLAN. That works as described all over the net.

But if you don’t want to have a native VLAN configured on your switch then you have an issue.

Even the RedHat doco is wrong. They say that you can strip out all the lines in your ifcfg-eth0 file leaving just these two:

DEVICE=eth0
ONBOOT=yes

Then you create your tagged interface files (eg. ifcfg-eth0.9) like this:

DEVICE=eth0.9
BOOTPROTO=static
BROADCAST=10.9.255.255
HWADDR=00:22:19:19:52:BB
IPADDR=10.9.0.100
NETMASK=255.255.0.0
NETWORK=10.9.0.0
TYPE=Ethernet
ONBOOT=yes
VLAN=yes

But this DOESN’T work. When you restart the networking stack it tosses an error about wireless networking (?) and then the VLAN creation errors out with “eth0 device doesn’t exist” errors because eth0 doesn’t come up.

WTF?

After beating my head on the desk for a bit, I thought “maybe it’s trying to do a DHCP request or something for eth0 and failing.” And that’s what it appears to be doing.

Adding the line:

BOOTPROTO=none

to the ifcfg-eth0 file makes it all work just fine.