Connecting switches

Network switches can be connected with each other to form larger networks. Besides the MAC addresses that are directly attached to a switch, they will also learn the MAC addresses that are reachable through ports that are connected to another switch.

In the example below you can see that Switch A is connected to host A and B, and port 3 is connected to Switch B port 2. Switch B is connected to Host C. When a frame from host A is addressed to host C, the switch will initially not know where to send the frame to. It therefore broadcasts the frame. This broadcast reaches Switch B, which will again broadcast to its own ports.

Switch B learns that port 2 is a source of frames from host A. If host C responds to host A, it will learn the port of host C too. Over time, as frames flow between the switches their forwarding table gets filled.

../../_images/connecting_switches.png
Switch A

Port

MAC

1

A

2

B

3

C

Switch B

Port

MAC

1

C

2

A, B

Connections between switches are typically established with better network interfaces to ensure enough bandwidth/throughput. E.g., a 48 port 1GbE Ethernet switch might have 4 ports with 10GbE, which are meant to connect to other switches. Sometimes they are also called uplinks, since they are used to connect the switch to the rest of the network.

../../_images/switch_1GbE.png

Network Switch with 48x 1GbE ports

../../_images/sfp_ports.png

4x SFP+ ports for 10Gb/s connections

Switching Loops and STP

When connecting switches with each other, what might happen is the creating of loops within the network. Due to the way broadcasting is used, these loops can cause frames to be transmitted indefinitely. This will lead to high CPU and/or dropped packages, since normal traffic can no longer flow.

../../_images/switch_loops.png

due to broadcasting, loops will cause frames to re transmitted many times

One way how switches avoid this is by using the Spanning Tree Protocol (STP). As soon as switches are connected with each other, they will start exchanging information to learn about their topology. With STP they can detect loops and disable links. Should one of the links fail, the disabled link will be enabled.

../../_images/stp.png

STP disable links that could lead to loops