Xen 3.2 networking: private and public hosts

networkingxen

I've got Xen 3.2 running on Debian Lenny, and I'm essentially trying to recreate the setup I had on another server that was running OpenVZ.

My dom0 has a static IP address and is Internet facing. Let's say for example, I have 4 domUs. I want dom1 and dom2 to be public facing on the Internet with public IP addresses. I want dom3 and dom4 to have private network addresses (192.168.x.x) yet able to be reached from dom0, dom1, dom2.

This was a snap with OpenVZ, but unfortunately I can't find any good examples of combination setups like these. Either all the domUs are public or they're all private. Any suggestions?

Best Answer

You could simply create a virtual bridge, which is not connected to any physical interfaces for your domU3 and domU4. You other 2 domU's can have an interface on each bridge (physical and virtual) and you can use NAT on dom0 to allow domU3/4 to access the internet through the virtual bridge, by assigning it an IP in dom0. RedHat's libvirt does just this by creating a default "virbr0" which can be used for creating a private domU LAN.

With debian you can easily setup a bridge on startup by: a. installing "bridge-utils" (which you most likely already have if you have xen installed) b. adding something along the following to /etc/network/interfaces:

auto virbr0
iface br0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1

and adding an interface to your domU's which is connected to virbr0 in your domU configuration

vif = [ "bridge=virbr0" ]
Related Topic