Virtualization

Bridge multiple network interfaces to guest OS

Create /etc/xen/scripts/network-xen-custom with: #vi /etc/xen/scripts/network-xen-custom Copy the script below into /etc/xen/scripts/network-xen-custom.

#!/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

Then change the file permissions with:

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

Next to last, edit /etc/xen/xend-config.sxp and comment out the entries:

# ออกไปในบรรทัดที่มีข้อความ (network-script network-bridge)
(network-script network-xen-custom)

Finally, reboot with:

#reboot

EOF.← Back to articles