Chapter 11. Pre-Red Hat Enterprise Linux 5.4 Xen networking
This chapter covers special topics for networking and network configuration with the Xen hypervisor.
Most guest network configuration occurs during the guest initialization and installation process. To learn about configuring networking during the guest installation process, read the relevant sections of the installation process, Chapter 7, Guest installation overview.
Network configuration is also covered in the tool specific reference chapters for
virsh
(Chapter 26, Managing guests with virsh) and virt-manager
(Chapter 27, Managing guests with the Virtual Machine Manager (virt-manager)). Those chapters provide a detailed description of the networking configuration tasks using both tools.
Note
Using para-virtualized network drivers improves performance on fully virtualized Linux guests. Chapter 12, Xen Para-virtualized Drivers explains how to utilize para-virtualized network drivers.
11.1. Configuring multiple guest network bridges to use multiple Ethernet cards
To set up network bridges (with the Xen hypervisor):
- Configure another network interface using either the
system-config-network
application. Alternatively, create a new configuration file namedifcfg-ethX
in the/etc/sysconfig/network-scripts/
directory whereX
is any number not already in use. Below is an example configuration file for a second network interface calledeth1
:$ cat /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 BOOTPROTO=static ONBOOT=yes USERCTL=no IPV6INIT=no PEERDNS=yes TYPE=Ethernet NETMASK=255.255.255.0 IPADDR=10.1.1.1 GATEWAY=10.1.1.254 ARP=yes
- Copy the file
/etc/xen/scripts/network-bridge
to/etc/xen/scripts/network-bridge.xen
. - Comment out any existing network scripts in
/etc/xen/xend-config.sxp
and add the line(network-xen-multi-bridge)
.A typicalxend-config.sxp
file should have the following line. Comment this line out. Use the # symbol to comment out lines.network-script network-bridge
Below is the commented out line and the new line, containing thenetwork-xen-multi-bridge
parameter to enable multiple network bridges:#network-script network-bridge network-script network-xen-multi-bridge
- Create a script to create multiple network bridges. This example creates a script called
network-xen-multi-bridge.sh
in the/etc/xen/scripts/
directory. The following example script will create two Xen network bridges (xenbr0
andxenbr1
); one will be attached toeth1
and the other one toeth0
. To create additional bridges, follow the example in the script and copy and paste the lines as required:#!/bin/sh # network-xen-multi-bridge # Exit if anything goes wrong. set -e # First arg is the operation. OP=$1 shift script=/etc/xen/scripts/network-bridge.xen case ${OP} in start) $script start vifnum=1 bridge=xenbr1 netdev=eth1 $script start vifnum=0 bridge=xenbr0 netdev=eth0 ;; stop) $script stop vifnum=1 bridge=xenbr1 netdev=eth1 $script stop vifnum=0 bridge=xenbr0 netdev=eth0 ;; status) $script status vifnum=1 bridge=xenbr1 netdev=eth1 $script status vifnum=0 bridge=xenbr0 netdev=eth0 ;; *) echo 'Unknown command: ' ${OP} echo 'Valid commands are: start, stop, status' exit 1 esac
- Make the script executable.
# chmod +x /etc/xen/scripts/network-xen-multi-bridge.sh
- Restart networking or restart the system to activate the bridges.
# service network restart
Multiple bridges should now be configured for guests on the Xen hypervisor.