script to create multiple network interface in xen host – node/xenbr0-xenbr1-xend-config

Hi all, In this article we will learn how to setup multiple network interfaces for your virtual machine using xen. by default it creates 1 interface and 1 bridge interface but when you want to create more then 1 interfaces then you need to do some work manually.

please follow steps mentioned below and you will find it working.

First of all we will create a script as /etc/xen/scripts/network-xen-custom with the following content:

# network-xen-custom
# Exit if anything goes wrong
set -e

# First arg is operation.
case ${OP} in
$script start vifnum=0 bridge=xenbr0 netdev=eth0
$script start vifnum=1 bridge=xenbr1 netdev=eth1
$script stop vifnum=0 bridge=xenbr0 netdev=eth0
$script stop vifnum=1 bridge=xenbr1
br1 netdev=eth1
$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

Now we need to Set correct permissions:
# chmod 755 /etc/xen/scripts/network-xen-custom

Then edit the /etc/xen/xend-config.sxp file to comment out your old configuration and add a new line to call the script we just created:
#(network-script network-bridge)
(network-script network-xen-custom)

In most cases just starting newer script works fine but if that does not work then restart the system for the new bridge interfaces to start up correctly.

Hope this will help to lot other people…

Share this post

Post Comment