FirstServed Tech Blog - FirstServed and the Art of Server Tuning

Adding VLANs to XenServer 4.0

In our Xen confidurations, we like to configure different VLANs on the Dom0 network interfaces, which are then bridged to the DomU guests.  Not only is this more secure than configuring the VLAN interfaces on the virtual machine, it’s also the only way we know of that will work with Windows guests, since on Windows you need proprietary software for Broadcom or Intel NICs in order to configure VLANs, and the Xen Virtual Network Adapter NIC certainly doesn’t provide any software to this end.

We were pretty annoyed to say the least, when we found out that the brand new XenServer 4.0 – which costs five times as much as it’s predecessor XenServer 3.2 – doesn’t allow one to add VLANs to the host interfaces.  Both the XenCenter console and the xe vlan-create command return ‘This operation is not allowed with your current license’.
Hope was not lost, however, since we figured out the following workaround:

In /etc/sysconfig/network-scripts, comment out the following line in ifcfg-eth0:

DEVICE=eth0
ONBOOT=yes
TYPE=Ethernet
HWADDR=00:19:b9:ea:4d:b7
BRIDGE=xenbr0
check_link_down() { return 1 ; }

Add a new VLAN interface, called ifcfg-eth0.142:

DEVICE=eth0.142
BOOTPROTO=static
ONBOOT=yes
TYPE=Ethernet
BRIDGE=xenbr0
check_link_down() { return 1 ; }

Add the following line to /etc/sysconfig/network:

VLAN=yes

You can now test the new setup without restarting by using the following commands:

brctl delif xenbr0 eth0
modprobe 8021q
vconfig add eth0 142
ifup ifcfg-eth0.142
brctl addif xenbr0 eth0.142

You should now have connectivity on your newly created VLAN interface.

Leave a Reply

You must be logged in to post a comment.