Switches

A switch is a device that operates at layer 2 of the OSI stack, and is the most common device that you would find in the network.

Many layer 2 technologies came into existence at different times, to meet user requirements. Some of these layer 2 technologies are X.25, Frame Relay, ATM, and Ethernet. There are switches available for each of these technologies.

Out of the multiple layer 2 competing technologies, Ethernet became the de facto standard at layer 2 of the OSI model, primarily driven by its low cost and the fact that Ethernet scales from 10 Mbps to 40 Gbps and beyond. This book will use the term switch in general for an Ethernet switch.

A typical model of a Cisco catalyst switch with Ethernet ports is shown in the following figure:

Figure 1: A Cisco Catalyst 2960 Switch; source: www.cisco.com

A switch is a device that works at layer 2 of the OSI model, and switches frames from one port to another. A switch is a device that has multiple hosts connected to it, and hence is the first point of access into the network for wired users. A switch may be thought of as a black box that has Ethernet ports to which hosts are connected using physical cables. The frames from one host is switched to the other hosts connected to the switch based on the layer 2 or data link addresses only. In the case of Ethernet, these addresses are the Media Access Control (MAC) addresses.

There are some switches that just switch frames between ports and have very limited abilities to implement traffic controls or run any networking protocols. These switches are called unmanaged switches. Some switches have additional management functionality inbuilt that allows them to run networking protocols and implement advanced features, such as filtering traffic based on layer 2 frames. These switches have a data plane for switching frames and a control plane that implements these advanced functions. Such switches are called managed switches. The building blocks of a managed switch are as shown in the following figure:

Figure 2: Parts of a managed switch

A switch, in addition to having the physical ports to connect, would also have a Switch Processor, which is a mini computer that controls the switch. The switching processor has a CPU for processing, Memory and Console Port, and AUX Port. While the CPU runs the software that controls the switching functions, the software for the same is stored in the memory.

The memory can be divided into two parts. One part runs the software that controls the various hardware elements in the switch and runs the software that implements the various protocols and features supported by the switch. This software in Cisco is called the Internetworking Operating System (IOS).

The other part of the memory is used to store the transient data that is created, and deleted as the switch starts to perform the switching functions. The most common use of this memory is to save the switching tables. These switching tables essentially contain the MAC address to port mappings, so that when a frame is received to be forwarded to a particular destination MAC address, the same is switched to the relevant port by referring to the switching table.

The ports on the Switch Processor are used to get access to the switch for downloading software images, and getting access to the IOS software for configuration and troubleshooting the switch. There is a console port, which is an asynchronous port with a USB port or a RJ45 connector for connecting external devices such as a PC or a laptop to gain access to the command-line interface of the switch. Some switches also have an auxiliary port (AUX) that can be used to connect to the switch remotely using a modem.

Each switch has buffers for each port so that frames can be buffered if there are multiple frames to be forwarded on a particular port for small intervals of time. This helps when there is congestion on a port, and some frames can be buffered and sent after the earlier frames have been transmitted.

The buffering adds additional latency to the switching time, and hence should be avoided for low latency scenarios.

Switches perform additional functions over and above the basic switching function for the data frames. These include marking traffic received on specific ports as priority traffic, and setting the DSCP bits or 802.1p bits in the IP or Ethernet headers. This classification is then used to provide the right quality of service to the packets when they are being transported over the rest of the network. We will cover these details in Chapter 9, Understanding and Configuring Quality of Service.

Additionally, since the switch is the point of access to the network for all wired users, the switch port can be used to group the users and assign them to specific VLANs. These vlans can be used to restrict access for specific users, or can be used to provide access only to certain parts of the network. Ports can be assigned to separate vlans either statically by configuration, or dynamically using specific protocols such as 802.1x, which is a protocol used for Network Access Control (NAC). We will cover details about network access control in Chapter 8, Understanding and Configuring Network Security.

Switches are also important sources of information about the traffic flowing on the network. Since the switch is where the users are directly connected, we can get exact information about the traffic on a per port basis, which translates into traffic per user if the user connects directly to a physical port on the switch. This information is generally exported to external systems for analysis in the form of Netflow records.

Switches come in various models depending upon the number of ports, type of ports, and the features supported by the switch. The type of port could be depending upon the physical connectors, for example, copper ports or optical ports. Also, the copper ports could be normal ports or Power over Ethernet (PoE) ports, which provide power to the devices that are connected to the switch on these ports, such as VoIP phones or wireless access points (WAPs). Further, switches could be of a fixed form factor or modular. Fixed form factor switches have a fixed number of ports, and, if more ports are needed, you need to add more switches to the network. Modular switches, on the other hand, are switches that are modular and have a chassis that has multiple line cards. There could be one or more processor cards and line cards of different types that can be inserted into the chassis to add more ports to the switch.

Further, some switches may be stackable using a stacking cable. Stacking cables connect to special ports called stacking ports of different switches at the two ends. These cables connect the processors and the switching fabrics between the two switches, thus allowing the two switches to look like an integrated switch that can be managed using a single console through a single switch processor. Different types of switches have different limits on the number of switches that can be stacked together.

You can apply the concepts of resiliency, redundancy, scalability, and modularity that we discussed in the last chapter, to a standalone switch to understand how the network can be designed efficiently. For example, if a network needs to be scalable to address more users at a location, it would be a good idea to use a stackable switch or a modular switch. If the switch is critical, and is required to have a high uptime, the switch should have redundant components such as power supplies and switch processors that can keep the switch up and running even if one of the redundant components goes down.

Cisco has different models of switches for different uses, such as the Catalyst 2k, Catalyst 3k, and Catalyst 4k, Catalyst 6500, and the recently launched Catalyst 9k series at the campus edge, and the Nexus series of switches for the Data Center.