3

I'm running a Lenny Xen dom0 hosting multiple virtual machines in a routed IP setup. To get an additional private subnet, I created the bridge xenbr0 in the dom0 with the following commands:

brctl addbr xenbr0
ifconfig xenbr0 10.0.0.1 netmask 255.255.255.0
ifconfig xenbr0 up

This works as expected, and domU interfaces are added to the bridge by Xen on VM start. My only problem is: how the heck do i specify this configuration in /etc/network/interfaces that it remains permanent and the bridge is available after a reboot? I tried the following config as found on a lot of tutorials:

auto xenbr0
iface xenbr0 inet static
  address 10.0.0.1
  netmask 255.255.255.0
  network 10.0.0.0
  broadcast 10.0.0.255
  bridge_stp no

I get 2 different errors, depending on if the bridge already exists or not. If it doesn't exist:

root@dom0:~# brctl show
bridge name     bridge id               STP enabled     interfaces
root@dom0:~# /etc/init.d/networking restart
Reconfiguring network interfaces...if-up.d/mountnfs[eth0]: waiting for interface xenbr0 before doing NFS mounts (warning).
SIOCSIFADDR: No such device
xenbr0: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device
SIOCSIFBRDADDR: No such device
xenbr0: ERROR while getting interface flags: No such device
xenbr0: ERROR while getting interface flags: No such device
Failed to bring up xenbr0.
done.

And if it exists:

root@dom0:~# brctl show
bridge name     bridge id               STP enabled     interfaces
xenbr0          8000.000000000000       no
root@dom0:~# /etc/init.d/networking restart
Reconfiguring network interfaces...if-up.d/mountnfs[eth0]: waiting for interface xenbr0 before doing NFS mounts (warning).
RTNETLINK answers: File exists
Failed to bring up xenbr0.
done.

Could anyone point me in the right direction please? The bridge works fine when created manually, i just need the right config file entries. The most tutorials I found add some devices to the bridge in the config, is that maybe the problem why it is not working? I don't have any interfaces I want to add to the bridge on creation as they get added later on VM start...

Thanks, Mathias

maff
  • 311
  • 1
  • 4
  • 14
  • Have you checked the Xen mailing list and http://wiki.xensource.com/xenwiki/XenNetworking ? – M_1 Jun 14 '10 at 22:37
  • Sure, the setup works as desired. I just need to know how to setup the bridge in /etc/network/interfaces to have it available on a dom0 reboot without having to manually create the bridge over the shell. So it's not a Xen specific problem, but debian-related (I just need to know the right config file syntax). – maff Jun 14 '10 at 23:16

3 Answers3

4

You seem to miss the most important line:

auto xenbr0
iface xenbr0 inet static
  bridge_ports eth0 eth4 eth7    # bridge traffic between these interfaces
  bridge_stp no
  address 10.0.0.1
  netmask 255.255.255.0
  network 10.0.0.0
  broadcast 10.0.0.255

man says: If you need to specify the interfaces more flexibly, you can use the following syntax (most useful on a Xen dom0):

     bridge_ports regex (eth|vif).*

This means to evaluate (as in egrep(1)) the expressions that follow after "regex".

kubanczyk
  • 13,502
  • 5
  • 40
  • 55
  • I don't have any ports to bridge when the bridge is created as the only bridged interfaces belong to the VMs which get created later. However, i re-checked my config and noticed that I had 2 "up route add..." entries standing below the bridge config which belonged to the eth0 interface. I also added "bridge_ports none" to the bridge config and now it works :) – maff Jun 16 '10 at 19:59
1

How about a script that runs after startup to perform the commands you want?

Jed Daniels
  • 7,172
  • 2
  • 33
  • 41
  • Sure, that would be possible, but using debian's built in network scripts would be the cleaner way. – maff Jun 15 '10 at 07:40
0

You may need to remove the network-manager package. It often interferes with manual interface settings.

Axel Beckert
  • 398
  • 2
  • 17
Posipiet
  • 1,725
  • 14
  • 13