How do I bridge multiple network interfaces on my Xen host to my guests?
Environment
- Red Hat Enterprise Linux 5
- xen
Issue
How do I bridge multiple network interfaces on my Xen host to my guests?
Resolution
First, create a new custom script file called /etc/xen/scripts/network-xen-custom with the following content:
#!/bin/sh
# network-xen-custom
# Exit if anything goes wrong
set -e
# First arg is operation.
OP=$1
shift
script=/etc/xen/scripts/network-bridge
case ${OP} in
start)
$script start vifnum=0 bridge=xenbr0 netdev=eth0
$script start vifnum=1 bridge=xenbr1 netdev=eth1
;;
stop)
$script stop vifnum=0 bridge=xenbr0 netdev=eth0
$script stop vifnum=1 bridge=xenbr1 netdev=eth1
;;
status)
$script status vifnum=0 bridge=xenbr0 netdev=eth0
$script status vifnum=1 bridge=xenbr1 netdev=eth1
;;
*)
echo "Unknown command:${OP}"
echo 'Valid commands are: start, stop, status'
exit 1
esac
Make sure that this file has the executable flag set:
chmod 755 /etc/xen/scripts/network-xen-custom
Edit the /etc/xen/xend-config.sxp file to comment out the old script and add a line to call the new script:
#(network-script network-bridge)
(network-script network-xen-custom)
Restart the service xend or restart the system for the new bridge interfaces to start up correctly.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
