15

My understanding of a network bridge is having a kind of "virtual switch" which virtually connects the network devices (that were added to the bridge) as if I would connect them to a real switch with cables... but something must be wrong with that kind of analogy, as for some reason I need to set my IP address on the bridge device.

Example

For example let us take the following setup: I've got a machine that acts as a host for multiple virtual machines (having their own virtual network devices vnet0, vnet1, vnet2, ...). This machine has one physical network interface eth0, which I want to use for all virtual machines and my host machine to communicate with the outside world.

As my host machine shall have an IP address, I would therefore think that I should configure this IP (inkl. default gateway, DNS servers, ...) on eth0. Then I would create a bridge br0 and add all interfaces (eth0, vnet0, vnet1, vnet2, ..) to that bridge. This doesn't work...

Instead, I need to configure the bridge br0 to have the IP address of my host machine (and also have configured the default gateway and DNS servers) and then add all interfaces (eth0, vnet0, vnet2, ...) to the bridge br0.

Well, ... this works. But I'm actually wondering why defining the IP onto eth0 doesn't work. I seem to be missing some fundamental knowledge of how this is actually working. So I would be glad if someone could explain me what is wrong about that. I usually want to really understand how those things work. So I would be glad if you're going into detail with protocols.

2
  • A bridge connects 2 or more networks to become one networjk with one IP-address. An IP-address for a single device of the bridge is useless.
    – ott--
    Apr 18, 2015 at 20:21
  • @ott: In fact this is the usual setup for KVM virtualization. Multiple vnet devices and a physical device are bridged. Whereas all of the virtual machines have their own IP. Also, for MikroTik routers you can define various IP addresses on physical ports (=devices) or bridges defined over those devices. It seems Linux has a different meaning of "bridge" than some router operating systems have.
    – SDwarfs
    Apr 18, 2015 at 21:23

1 Answer 1

6

Thee was a very similar q on UL: https://unix.stackexchange.com/questions/86056/why-does-linux-require-moving-ip-from-eth-interface-to-bridge-interface

The analiogy is that ETH resembles an uplink L1 cable.

1
  • Didn't expect it on stackexchange... Thanks for the Link!
    – SDwarfs
    Apr 18, 2015 at 20:19

Not the answer you're looking for? Browse other questions tagged .