configuring private interfaces for your domUs
Friday, September 28th, 2007This is on CentOS5, default Xen packages.
===Physical interfaces===
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.
===Virtual interfaces===
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’
===domU===
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…
===References===
(in order of usefulness):
#http://wiki.xensource.com/xenwiki/XenNetworking
#http://lists.xensource.com/archives/html/xen-users/2007-07/msg00800.html
#http://felipe-alfaro.org/blog/2006/07/21/xen-network-configuration-and-multiple-vlans/
#http://www.shorewall.net/XenMyWay-Routed.html