Multiple network interfaces in Xen

By branko posted on October 6th, 2008
By default xen tools comes with only one network interface enabled for your dom0 and domU machines. So what if you want to add some more? It's actually very simple. All you need to do is run:
/etc/xen/scripts/network-bridge start vifnum=1 netdev=eth1 bridge=xenbr1
This will effectively create one extra xenbr attached to eth1 interface. You can repeat the above command for all your interfaces, and you can stop them in the same manner, just replace start with stop. To enable this automatically you can create file named, let's say multi-network-bridge...
pico /etc/xen/scripts/multi-network-bridge
paste this:
/etc/xen/scripts/network-bridge $@ vifnum=0 netdev=eth0 bridge=xenbr0
/etc/xen/scripts/network-bridge $@ vifnum=1 netdev=eth1 bridge=xenbr1
Of course you can add up as many interfaces you like in this script. After you have added up as many interfaces you wish, all you need to do is edit xend-config.spx file:
nano /etc/xen/xend-config.spx
Find a line defining network script, it should by default look like this:
(network-script network-bridge)
Edit it and let it reflect your newly created multi network bridge script. In my case it should look like:
(network-script multi-network-bridge)
All you need to do now is restart xend service:
/etc/init.d/xend restart
New network bridge named xenbr1 should be available now. So how can i add up another network bridge to my domU machine. It's pretty simple actually, you already have defined vif statements for current network interface, all you need to do now is edit that domU config file, precisely vif line and add up another xenbr interface. [ad#post] So currently my domU vif line looks like this:
vif        = [', vifname=vifbran0, rate = 10000KB/s, bridge=xenbr0']
with another xenbr interface it should look like this
vif        = ['ip=, vifname=vifbran0, rate = 10000KB/s, bridge=xenbr0', 'ip=, vifname=vifbran1, rate = 10000KB/s, bridge=xenbr1']
Also if you wish to use ip conflict prevention you must add additional mac section in vif configuration. Restart your domU and voila, another network interface is present

Published: Oct. 6, 2008

Author: branko


Word Count: 303


CentOS Linux Network virtualization Xen


Related Articles

Article Links

  1. Preventing ip conflicts in xen - -