Virtualization

Make bridge multiple network interfaces on Xen host to guests os.

xen First create a script file with:

# vi /etc/xen/scripts/network-xen-custom

Then copy the following text into the file:

#!/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    # map xenbr0 -> eth0
$script start vifnum=1 bridge=xenbr1 netdev=eth1 ;; # map xenbr1 -> eth1
stop)
$script stop vifnum=0 bridge=xenbr0 netdev=eth0     #unmap xenbr0
$script stop vifnum=1 bridge=xenbr1 netdev=eth1 ;;  #unmap xenbr1
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

After creating the file, use chmod to make it executable:

#chmod 755 /etc/xen/scripts/network-xen-custom

Then edit the Xen configuration file with:

#vi /etc/xen/xend-config.sxp

Edit and add the entries as shown below, commenting out the old script and adding the new script we created.

#(network-script network-bridge)
(network-script network-xen-custom)
EOF.← Back to articles