Penguin
Note: You are viewing an old revision of this page. View the current version.

Xen has a set of scripts which manage the networking between the priviledged and unpriviledged domains. This 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 ? 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.

Xen and Debian's interfaces file.

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!

Xen and VLANs

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 interfaces file to provide multiple bridges to xen, on different vlans:

(Debian specific)

# 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']

Note that you may have to disable the 'network-script' parameter in the xen-config file in /etc/xen, or else it will try to manage xenbr0 on its own.

Note that 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!

Xen and bonded interfaces

I assume this works on the same theory as the example for vlan interfaces.

Note that 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!

See Also:


Part of CategoryXen, CategoryNetworking