How do I set up several interfaces all bridged onto eth0?

15,106

Maybe you have it backwards. You don't bridge br0 onto eth0, but eth0 onto br0. And yes, you can put any number of devices on a bridge, so you can also put eth1 and eth2 onto br0, using the brctl addif br0 eth1 command. Does that answer your question?

Share:
15,106

Related videos on Youtube

George M
Author by

George M

Consider following or committing to the Area 51 proposal for Virtualization and Cloud Computing.

Updated on September 18, 2022

Comments

  • George M
    George M over 1 year

    I have found several guides to bridging a single interface (eg br0) onto eth0 but none for multiple interfaces (eg br0, br1 etc).

    Is this possible?

  • rpi
    rpi over 11 years
    It is helpful for clarification (+1) but isn't what I'm after: I think I have the answer I'm looking for though, I need aliases for eth0 (eg eth0:0, eth0:1 etc) bridged onto br0, br1 etc.
  • frostschutz
    frostschutz over 11 years
    eth0:0 is IP aliasing, but it's not needed anymore as you can just ip addr add to the main eth0 interface. What problem are you trying to solve?
  • rpi
    rpi over 11 years
    I want to set up private networks manually on my CentOS/KVM host rather than use the NAT/networking component of libvirt. Each brX is a private network that is then bridged to (from?) eth0 the public interface. The inter-network traffic is then controlled by iptables. when you say "you can just ip addr add to the main eth0", afaik I can only specify one BRIDGE line in each /etc/sysconfig/network-scripts/ifcfg-ethX, right? That's why I think I need the aliases defined in this way...
  • frostschutz
    frostschutz over 11 years
    If you bridge private networks with eth0, they're on eth0 and as such, visible to whatever eth0 is connected to. Datacenters often do not allow bridging like that, they require you to run a routed setup. This should be described in their documentation though. If you really want multiple VMs to share a bridge with eth0, you can put them all on the same bridge device.
  • rpi
    rpi over 11 years
    Yes it is a routed setup, iiuc none of the private traffic is being broadcast on eth0 as the host is the gateway for the VMs and I have NAT set up in iptables to translate the private network addresses. Am I understanding this all wrong, is all the private traffic being broadcast?
  • frostschutz
    frostschutz over 11 years
    With bridging it's broadcast transparently, that's what bridges do; with routing it all depends on your routes - in a routed setup the bridges only serve as a means of providing VMs with virtual network devices, they do not actually attach eth0 or any other device, so the bridge is not connected to the physical network by itself.
  • rpi
    rpi over 11 years
    many thanks, I have moved to a routed setup as you suggest!