Debian network bridge configuration - /etc/network/interfaces

18,015

Solution 1

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".

Solution 2

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

Share:
18,015

Related videos on Youtube

maff
Author by

maff

Updated on September 17, 2022

Comments

  • maff
    maff almost 2 years

    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

    • M_1
      M_1 about 14 years
      Have you checked the Xen mailing list and wiki.xensource.com/xenwiki/XenNetworking ?
    • maff
      maff about 14 years
      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
    maff about 14 years
    Sure, that would be possible, but using debian's built in network scripts would be the cleaner way.
  • maff
    maff about 14 years
    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 :)