Say I create a bridge interface on linux (br0) and add to it some interfaces (eth0, tap0, etc.). My understanding is that this interface act like a virtual switch with all its interfaces/ports that I add to it.

What is the meaning of assigning a MAC and an IP address to that interface? Does the interface act as an additional port on the switch/bridge which allows other ports to access the host machine?

I have seen some pages talk about assigning an IP address to a bridge. Is the MAC assignation implied (or automatic)?


Because a bridge is an ethernet device it needs a MAC address. A linux bridge can originate things like spanning-tree protocol frames, and traffic like that needs an origin MAC address.

A bridge does not require an ip address. There are many situations in which you won't have one. However, in many cases you may have one, such as:

  • When the bridge is acting as the default gateway for a group of containers or virtual machines (or even physical interfaces). In this case it needs an ip address (because routing happens at the IP layer).

  • When your "primary" NIC is a member of the bridge, such that the bridge is your connectivity to the outside world. In this case, rather than assigning an ip address to (for example) eth0, you would assign it to the bridge device instead.

If the bridge is not required for ip routing, then it doesn't need an ip address. Examples of this situation include:

  • When the bridge is being used to create a private network of devices with no external connectivity, or with external connectivity provided through a device other than the bridge.
  • 1
    "Because a bridge is an ethernet device it needs a MAC address." Why? The devices connected to the bridges do have MAC addresses. But I don't think the bridge itself need one. As for the rest of the answer, does that means that the bridge interface act as an additional "port" on the bridge which allows other ports to access the host machine? – Gradient Oct 31 '16 at 2:29
  • The bridge is able to originate Ethernet frames, so it needs an address. Re: the second part of your question...sure. – larsks Oct 31 '16 at 2:55
  • 2
    But is it mandatory that the bridge interface has a MAC address? I mean, a physical switch does not have to have a MAC address to do its job, does it? So I would think that the interface does not require one either. – Gradient Oct 31 '16 at 3:32
  • 3
    A simple bridge is effectively a two-port switch, so it does not necessarily need any addresses. A simple bridge does not originate frames, it just receives a frame on one port and either forwards it on the other port, or drops it. – Johan Myréen Oct 31 '16 at 7:23
  • "such that the bridge is your connectivity to the outside world." Why? Why can't the primary NIC be still the connection to the outside world? Real hardware bridges also keep the IP address of the real link partners connected to them. Why not the linux wirtual bridge? – Johannes Schaub - litb Nov 9 '18 at 12:16

Yes, the bridge interface acts as an additional port.

After man 5 systemd.netdev:

A bridge device is a software switch, and each of its slave devices and the bridge itself are ports of the switch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.