How to connect different virtual machines to different networks in a Xen virtualization environment with bridged networking setup using 802.1q VLAN support provided by Linux.
Intro
Using a single network interface and a network appliance that support 801.1q VLAN trunking to separate
different virtual machines running on a single phisical host to different network segments is possibile and quiet with VLAN support.
Xen networking relies on standard networking tools used by common GNU/Linux distributions: ip, ifconfig, brctl (bridge-utils)
These are the steps needed to implement the solution:
- use the 8021q module to handle vlan traffic in dom0
- create a bridge for each VLAN the dom0 see
- attach the network interface of the virtual machines to the correct bridge
1) 8021q module
It's important to load the 8021q module at boot time adding the next line to the /etc/modules file:
8021q
2) Networking configuration in dom0
Firstly make sure that Xen doesn't modify your network configuration specifing "network-dummy" per "network-script" in the /etc/xen/xend-config.sxp configuration file.
For each VLAN, bring up a logical network interface for the transport in /etc/network/interfaces:
auto vlan183
iface eth0.vlan180 inet manual
vlan-raw-device eth0
For each VLAN, bring up a bridge adding the following lines to the /etc/network/interfaces configuration file:
auto xenbr183
iface xenbr183 inet manual
bridge_ports eth0.183
bridge_stp off
3) Networking configuration in domUs
Specify the bridge you want to use in the configuration file of the vm for each vif you've assigned:
... vif = [ 'ip=10.20.198.8,mac=00:16:3E:12:FF:69,bridge=xenbr183' ] ...

vlan-raw-device eth0
Good post.
I'm guessing this should be "vlan_raw_device eth0" instead ?
/Kenneth
Some points...
Some points:
1) Here you have named the IF with 2 different names: vlan183 and eth0.vlan180. If I remember correctly only the former is fine.
2)you forgot to set mtu to 1492
3) The post of following links show you how to set all this stuff up defining just 1 interface:
http://debiangeeks.blogspot.com/2008/03/howto-debian-xen-e-vlan.html
Anyway, this is a a nice and useful post.
Host?
If you needed the host itself to have an IP address on the VLAN 183 as well, how would you accomplish this? Do you make another bridge just for that?