1

I'm a little bit confused with the use of network bridges in docker / k8s setups.

My understanding is that a network bridge operates exclusively at layer 2 and is used to combine 2 network segments into a single broadcast domain.

When reading about docker / K8s I see network bridges used to link the host NIC (e.g. eth0) with the internal docker / pod NIC (veth0) e.g within a single host:

eth0 [192.168.1.100] <----> docker0(bridge)[172.17.0.1] <----> veth0 [172.17.0.2]

My first point of confusion is that it seems strange to link two seperate subnets with a layer 2 device, don't we need to route from the 192... network to the 172... or does it not matter due to the bridge operating only at layer 2? E.g. it doesn't care about the actual IP addresses

My second thought is that judging by the routing table on my docker host, there is a route defined to reach the 172.17.0.0 network:

 172.17.0.0/16 dev docker0

so why do we need the bridge device, couldn't the host just route packets from eth0 directly to the docker container NICs?

I'm clearly missing something here so apologies in advance. Any help is greatly appreciated.

3
  • Your diagram is wrong. eth0 is not part of the docker0 bridge. Apr 4, 2018 at 21:36
  • @MichaelHampton Thanks for your response, although my diagram shows a link between eth0 and the docker0 bridge opposed to them being the same entity, so i'm not sure I understand :)
    – Xerphiel
    Apr 4, 2018 at 21:44
  • eth0 is not part of the bridge. The host routes between them at layer 3. Apr 4, 2018 at 21:49

0

You must log in to answer this question.

Browse other questions tagged .