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:
#!/bin/sh
/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        = ['ip=xx.xxx.167.4, vifname=vifbran0, rate = 10000KB/s, bridge=xenbr0']
with another xenbr interface it should look like this
vif        = ['ip=89.201.167.4, vifname=vifbran0, rate = 10000KB/s, bridge=xenbr0', 'ip=192.168.1.10, 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
Info

Published: Oct. 6, 2008

Author: branko

Comments:  

Word Count: 303

Tags

CentOS Linux Network virtualization Xen

Posts
Related

Related Articles

Article Links

  1. Preventing ip conflicts in xen - toic.org -
Trending