Multiple network interfaces in Xen
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, multi-network-bridge:
vim /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 your interfaces, you need to edit xend-config.spx file:
vim /etc/xen/xend-config.spx
Find a line defining network script, it should by default look like this:
(network-script network-bridge)
Edit it so it contains 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.
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.
For example, if 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