Xen has a set of scripts which manage the networking between the priviledged and unpriviledged domains. It defaults into bridged mode, but can be set up in a routed mode as well, or with any sort of topology you like.
See the pages at FIXME for a run down on the differences and what is possible.
As of Xen 3.0.2 (possibly earlier?), Xen will manage renaming your physical Ethernet interface to peth0 (from eth0), and will bring up a dummy eth0 interface with the original IP address and join this to the xenbr0 bridge device. This makes it effectively transparent to the OS running in the priviledged domain.
As of Xen 3.0.2, the Xen-provided network scripts mean you don't need to do anything special. If you find yourself running an earlier version of Xen, I use a set of interfaces stanzas like these to manage my networking:
# The physical device xen will take over. Note that I'm not setting an IP address on this device as # doing so will interfere with the bridging that occurs later auto eth0 iface eth0 inet manual # The xen bridge device. Note that in xen 2.x this should be xen-br0, in xen 3.x is should be xenbr0 auto xenbr0 iface xenbr0 inet static bridge-ports eth0 address 192.168.1.253 netmask 255.255.255.0 gateway 192.168.1.254
This will cause debian to bring up eth0 without an IP address, then bring up a bridge device xenbr0 and add eth0 to the bridge, and then set up the IP address specified.
Note again: the above is NOT needed it you are running Xen 3.0.2 or more recent!
As of this writing, it seems there is no nice integration with Xen and VLANs. To work around this I use a modification of the above (Debian-specific) interfaces file to provide multiple bridges to Xen, on different VLANs:
# Physical device accepting vlan-tagged frames auto eth0 iface eth0 inet manual # Vlan device auto eth0.1234 iface eth0.1234 inet manual # Vlan device auto eth0.2000 iface eth0.2000 inet manual # first bridge, for vlan 1234 auto xenbr0 iface xenbr0 inet static bridge-ports eth0.1234 address 192.168.1.1 netmask 255.255.255.0 gateway 192.168.1.254 # second bridge, for vlan 2000 auto xenbr1 iface xenbr1 inet static bridge-ports eth0.2000 address 192.168.2.1 netmask 255.255.255.0
This will bring up two bridges with the specified IP addresses. When you create a Xen domU, you can specifiy which VLAN (or bridge) it belongs to with the vif parameters in its config file:
# one network interface in the first bridge (vlan 1234) vif = [ 'bridge=xenbr0'] # two network interfaces, one in each (vlan 1234, vlan 2000) # vif = [ 'bridge=xenbr0', 'bridge=xenbr1']
Notes:
I assume this works on the same theory as the example for VLAN interfaces. (Again, this may change with newer versions of Xen – make sure to check out what Xen supports before assuming you have to do it this way!)
Part of CategoryXen, CategoryNetworking
One page links to XenNetworking: