XEN Mixed Networking (Direct Routing + Internal Bridge)

Hi Everybody,

in order to setup a new server, I had to deal with this more or less troublesome topic. I want to give everybody a hint who is facing trouble with this.

The Setup:
– Debian Lenny (Kernel 2.6.26-2-xen-amd64) 64 Bit host and 64 Bit guests
– xen-hypervisor 3.2-1

The Goal:
I. have a directly routed interface for the public IPs
II. create a virtual LAN between the domUs
III. let the hosts on the virtual LAN talk to the outside world (those are mostly the domUs, which do not have a public IP)

First, for I. and II. go ahead and apply the tutorial in [1]

In addition to that, I had to perform the following operations:
edit /etc/xen/scripts/vif-common.sh and add the two lines indicated

vifname=$(xenstore_read_default "$XENBUS_PATH/vifname" "")
if [ "$vifname" ]
if [ "$command" == "online" ] && ! ip link show "$vifname" >&/dev/null
do_or_die ip link set "$vif" down ### ADD THIS LINE
do_or_die ip link set "$vif" name "$vifname"
do_or_die ip link set "$vifname" up ### ADD THIS LINE

Ok, now there is something you should keep in mind:
While editing your domU config be sure to keep the vifname parameter SHORT!! I called it ‘mysql-mirror-vif-br’ which was way too long, which then resulted in a non-starting script. The script did not tell me anything. Not on stdout not in the logs. Now it’s ‘mymirr-vif-br’ which is fine.

For III. do the following for every IP you want to have internet access from the inside of the respective domU:

iptables -t nat -A POSTROUTING -o eth0 -s virtualLanIP/32 -j MASQUERADE

Hope this helps someone.


[1] Hetzner Dokuwiki: http://wiki.hetzner.de/index.php/Xen_mit_Routing_und_Bridge


  • Barry

    Thanks for this update.

    I was struggling with the same problem

    One request, for us English only, people.
    Is there an English translation for your step 1 reference? (Xen_mit_Routing_und_Bridge).

    I can make out what you have done, no problem, but I’d like to make sure I did not miss something important.



  • henning

    Hi Barry,

    thanks for your comment!
    I’ll try to go ahead and translate the howto into English and make it public in a new post.


Leave a Reply

Your email address will not be published. Required fields are marked *