This is on CentOS5, default Xen packages.
The physical machine has three GigE interfaces: eth0,eth1,eth2. eth0 is currently not connected to anything. eth1 is connected to a public network, e.g. xxx.xx.xx.0/23. eth2 is connected to a private network, e.g. 10.10.0.0/8.
We want to have the same setup for the VMs, two interfaces, one private, one public. Thanks to the wonder of Free Software, this is very easy.
#make new script called /etc/xen/scripts/network-bridge-2
#modify /etc/xen/xend-config.sxp to use network-bridge-2 instead of network-bridge
The contents of network-bridge-2:
#!/bin/sh dir=$(dirname "$0") "$dir/network-bridge" "$@" vifnum=2 netdev=eth2 "$dir/network-bridge" "$@" vifnum=1 netdev=eth1
It simply calls network-bridge which creates the bridges and vifs, etc.
Look at ‘brctl show’ for information or ‘/etc/xen/scripts/network-bridge status’
In the domU config file, simply specify which virtual interface belongs to which bridge:
vif = [ 'mac=00:16:3e:01:01:9f, bridge=xenbr1', 'mac=00:16:3e:01:01:9e, bridge=xenbr2', ]
They will show up in order as eth0, eth1…
(in order of usefulness):