Network devices: switches

Network devices: switches

Switches perform the same function as bridges but there are many reasons that switches are preferable. Why?

Switches operate on the Network Access layer of the TCP/IP model and use MAC addresses to make forwarding decisions. Even if you never touch any setup interface and use the switch out of the box, it will provide the same transparent bridging provided by an Ethernet bridge.

Advantages of using switches

There are many advantages of a switch over a bridge:

  • Speed. Bridges perform their bridging function by using software. Switches, on the other hand, are hardware based. The switching is done using ASIC1 chips. As hardware is used for this function, the forwarding process is much quicker.
  • Port density. Bridges tend to have fewer ports. Switches, on the other hand, normally come in 16-, 24-, and even 52-port models.
  • Spanning-Tree Instances. Bridges are limited to a single instance of Spanning Tree. Spanning Tree Protocol (STP) is a protocol used to prevent switching loops2 that can occur when switching path redundancy is present in the network. Switches, on the other hand, can have many instances of STP.

(1) ASIC stands for Application-specific integrated circuits and they are dedicated to a specific function, as opposed to a general-purpose integrated circuit. By using this customized circuitry for the switching function, rather than using the CPU or other more general-purpose circuitry in the switch, performance is greatly enhanced.

(2) Path redundancy creates switching loops, so why would you include them in the design? The reason for this is fault tolerance. Just as multiple routing paths between two destinations allows for a backup route if one of the routes becomes unavailable, switching path redundancy provides the same benefit.

Types of switch

There are two versions of switches: one version that operate exclusively at the Network Access layer and another one called multilayer switches. The latter switches operate at both the Network Access and the Internet layers, which means they perform switching and routing.

Network Access Layer Switches make forwarding decisions based only on MAC addresses and they do not use Internet layer information (IP addresses). They typically act as the connection point to the network for workstations, printers, and other devices on the LAN.

The functions of switches that operate at this layer are listed here:

  • MAC Address Learning. The switch identifies the source MAC address everytime a frame enters one of the ports and stores this in its MAC address table.
  • Forward/Filter decisions. When a frame enters a port, the switch identifies the destination MAC address. If it finds that MAC address in its table, it sends the frame out the port listed for that MAC address only. If it doesn’t find the MAC address listed in its table, it will send the frame out every port except the one on which it arrived.
  • Loop avoidance. If switch path redundancy exists in the network, it is up to the switch to avoid loops. Loops usually occur when a frame doesn’t find its destination and, just because of loops that exist in the network for redundancy purposes, it continues navigating around the network over and over again. Loops are avoided by the switches communicating with one another using STP to close these loops.

Multilayer switches. They perform routing and switching, but what is most impressive is the way in which they combine these functions. To appreciate the operation of these devices, consider one device sending data to another device: it is a not a transmission made up of a single packet, it can be made up of hundreds and even thousands of individual packets in the same transmission. MLS, rather than simply routing each packet (which is what you would expect from a box containing both a router and a switch), it routes only the first packet (routing is a much slower process than switching) and then by maintaining an awareness of that route, it switches all of the other packets in the transmission. This concept is also known as route one and switch many. The result is an impressive increase in speed of the delivery of the entire transmission.

Content addressable memory

Inside the switch there is a volatile dynamic memory called CAM (Content Addressable Memory) which keeps updated a simple table in which all the MAC addresses of the packets passing through its ports are stored. Each row of the table (called filtering database) is a triad that provides the sender MAC address, the port from which the packet has passed and a numeric value that indicates how long the value is present in the table (aging time).

Network devices: switches. CAM
Example 1. A->B, E->C, B->D, D->C

Filtering database of switch-1 after example 1.
Filtering database of switch-1 after example 1.

When a MAC package is presented on a door, it undergoes the learning process, which updates the filtering database; then it is subjected to a forwarding process. This time, the recipient MAC address is analyzed, consulting the table to look for its presence and, in case, the switch forwards the packet only to the corresponding port. If the recipient MAC address does not appear in the filtering database, the package is replicated on all the ports of the switch except the source port (flooding).

In this way the number of packets circulating on the connected stations it is drastically reduced. To prevent some lines of the filtering database from becoming obsolete (for example, when changing
the host on a port), at the end of the aging time the row in the table gets deleted. Packet filtering on the output ports does not occur when the switch is switched on (since the CAM is empty), so the switch behaves for a certain initial period as a hub, ie forwarding received packets on one port to all other ports.

As the packets transit, the CAM of the switch fills up and the filtering operation becomes more and more frequent. In addition, the switch also has the property of keeping collision domains separate: each pair of ports on a switch represents a domain of collision, in contrast to the hub. In this way the local traffic to the stations connected to the single switch remain confined within it and the overall traffic becomes radically optimized, eliminating most of the unnecessary collisions and many packages that would never arrive at their destination.

The introduction of the switch has revolutionized Ethernet LAN technology, making it possible to manage thousands of stations (XLAN, Extended Lan or even switched LAN) on an interconnected switch infrastructure.