Skip to content

W2·A2 - Bridge the network

Time: 20 min

Needs:: A1's topology

GNS3 project:: w02-a1-dedicated-links (reuse it)

Info

Times listed are approximate and provided as timing guidelines only. Take as much time as you need to complete the activity.

Question

How do you collapse three distinct links into a single network


Do this - build it

On H1:

nmcli con add type bridge ifname br0 con-name br0 connection.autoconnect-slaves 1
nmcli con mod eth0 type bridge-slave master br0
nmcli con mod eth1 type bridge-slave master br0
nmcli con mod br0 ipv4.method manual ipv4.addresses 192.168.10.1/24
nmcli con up br0

Give the bridge a few moments to activate, then:

ip -brief addr show

Do the same on H2 and assign 192.168.10.2/24 to br0

Do the same on H3 and assign 192.168.10.3/24 to br0

What just happened

  • nmcli con add type bridge ifname br0 creates a new type of interface called a bridge and gives it the name br0.
    • con-name br0: tells NetworkManager to save this interfaces configuration under the name br0
    • connection.autoconnect-slaves 1: tells NetworkManager to start the associated physical interfaces when this interface is activated.
  • nmcli con mod eth0 type bridge-slave master br0 tells NetworkManager to treat the physical interface named eth0 as a port of br0. The next command does the same for eth1
    • the result is that the devices on the other ends of both eth0 (H2 Ethernet0) and eth1 (H3 Ethernet0) are now on the same link
  • We then assign an address to the bridge interface itself
  • Repeating this on H2 and H3 essentially places the three nodes on the same link, instead of the three distinct links we had previously.

Do this - test it

On H1:

ping -c1 192.168.10.2
ping -c1 192.168.10.3

What just happened

  • H1 is still able to reach H2 and H3, but it now needs just one address to achieve this.
  • The physical topology is still mesh, but the logical topology is something akin to a star topology

Do this

  • Stop all three nodes
  • Delete H2 and H3, then rename H1 as SW
  • Drag two VPCS and cable them on to SW

Log on to SW as root, then:

nmcli con mod br0 -ipv4.addresses 192.168.10.1/24 \
ipv4.method disabled ipv6.method disabled

nmcli con up br0

On PC1:

ip 192.168.10.11/24
save

On PC2:

ip 192.168.10.12/24
save

On PC1:

ping 192.168.10.12 -c 1

What just happened

  • SW is just H1 in new clothes. We disabled IP to show that a bridge is just a link, a medium, and does not need an address
  • PC1 and PC2 are cabled to the two ends of the bridge and are able to communicate through it.
  • You've just created your first "switch"!

If it went wrong

Sympton Cause Fix
bridge fails to activate the attached interfaces (ports) are down start each interface manually, or enable connection.autoconnect-slaves
ping fails with Destination unreachable incorrect address ensure the address you are trying to ping exists
ping fails with Network unreachable incorrect subnet check the address at destination and ensure it matches 192.168.10.x