Multiple Interfaces for Xen and KVM

Why Use Multiple Interfaces?

On a simple Xen or KVM host system there is only one network interface (such as eth0), typically connected to the Internet. All Xen systems have their own virtual eth0 interface which is bridged to the host system via Xen's xenbr0 interface. Similarly, KVM systems bridge eth0 to the br0 interface on the host.

However, you may want to configure host systems with two interfaces, one connected to the Internet and one on a private network for transfers between host or virtual systems. This involves adding an additional bridge (usually xenbr0) to the Xen configuration on the host, and configuring Cloudmin to create new Xen systems with a second interface this is connected to the bridge.

Configuring Xen on the Host System

This configuration must be done manually, as Cloudmin does not yet support managing the xend configuration file on a host. The steps to follow are :

  1. SSH into the host system as root, and create the file /etc/xen/scripts/multiple-bridge with the following contents :
dir=$(dirname "$0")
"$dir/network-bridge" "$@" vifnum=0 netdev=eth0 bridge=xenbr0
"$dir/network-bridge" "$@" vifnum=1 netdev=eth1 bridge=xenbr1
  1. Make the file executable with the command chmod +x /etc/xen/scripts/multiple-bridge
  2. Edit the file /etc/xen/xend-config.sxp and find the line like (network-script network-bridge) line, and change it to (network-script multiple-bridge)
  3. Restart Xen with the command /etc/init.d/xend restart
  4. Verify that the xenbr1 bridge has been created with the ifconfig -a command.

If you have multiple host systems, these steps must be performed on each of them.

Configuring KVM on the Host System

This can be done by logging into Webmin on the host, and going to Networking -> Network Interfaces -> Activated at boot. Create a new bridge interface named br1 that is connected to an un-used ethernet interface (like eth1) , and then save and apply the configuration.

Configuring Cloudmin

Once the additional bridge is active on the Xen host, you can configure Cloudmin to use it as follows :

  1. Go to Host Systems -> Xen Host Systems, and click on the host.
  2. In the Bridges on host system for Xen interfaces field, select both xenbr0 and xenbr1.
  3. In the IP address allocation range table, add a row with a range of IPs to use on your internal network, such as to, with CIDR set to 24. Select your new xenbr1 bridge in the For interface column.
  4. Click the Save button.

How you can create a new Xen virtual system, and it should be configured with two network interfaces, with eth1 connected to eth1 on the host system, and an IP assigned from the 192.168.1 range.

In Cloudmin 5.8 and later, you can select on the creation form which bridges to connect the virtual system's network interfaces to. This can be used to create a VM that is only on your internal network, for example.

When adding a network interface to a Xen instance, you can also select which network bridge the new interface will be connected to.