Skip to main content

How an Ethernet Switch Works

·2007 words·10 mins
Switch
Table of Contents

What is a Switch?
#

Switching is a general term for the technology that automatically or manually routes information to the required path based on the communication needs of both ends. In a broad sense, a switch is a device that performs the function of information exchange in a communication system. This process was originally established manually. Of course, now we have widely adopted stored-program control switches, where the switching process is completed automatically.

In computer networking systems, the concept of switching was introduced as an improvement over the shared work mode. As we’ve discussed before, a HUB is a shared device. A HUB itself cannot recognize the destination address. When host A on the same LAN transmits data to host B, the data packets are broadcast across the HUB-based network. Each terminal determines whether to accept the packet by verifying the address information in the data packet header. This means that in this mode, only one set of data frames can be transmitted at the same time. If a collision occurs, a re-transmission is required. This method is what’s known as a shared network bandwidth.

A switch has a high-bandwidth backplane bus and an internal switching matrix. All of the switch’s ports are connected to this backplane bus. When the control circuit receives a data packet, the processing port looks up the address lookup table in memory to determine which port the destination NIC (Network Interface Card) with the destination MAC (the hardware address of the network card) is connected to. The internal switching matrix quickly transmits the data packet to the destination port. If the destination MAC does not exist, the packet is broadcast to all ports. After the receiving port responds, the switch “learns” the new address and adds it to its internal address table.

Switching and switches first originated in telephone communication systems (PSTN). We can still see scenes in old movies where a leader (the calling user) picks up the phone and shakes it vigorously. The central office has a row of machines with wires plugged in. A switchboard operator with a headset receives the connection request and plugs the wire into the appropriate port, establishing a connection between the two user ends until the call ends. Similarly, a switch can “segment” a network, and by cross-referencing the address table, the switch only allows necessary network traffic to pass. By filtering and forwarding, switches can effectively isolate broadcast storms, reduce the occurrence of corrupted or wrong packets, and avoid shared conflicts.

A switch can perform data transmission between multiple ports at the same time. Each port can be considered an independent network segment, and the network devices connected to it can independently enjoy the full bandwidth without competing with other devices. When node A sends data to node D, node B can simultaneously send data to node C, and both transmissions enjoy the full network bandwidth and have their own virtual connections. Assuming a 10Mbps Ethernet switch is used here, the total throughput of the switch would be 2 × 10Mbps = 20Mbps. However, when using a 10Mbps shared HUB, the total throughput of one HUB would not exceed 10Mbps.

In short, a switch is a network device that identifies MAC addresses and can encapsulate and forward data packets. A switch can “learn” MAC addresses and store them in an internal address table, establishing a temporary switching path between the data frame’s originator and the intended receiver, allowing the data frame to go directly from the source address to the destination address.

What is the Purpose of a Switch?
#

“Switching” is one of the most frequently used words in networking today. From bridging to routing to ATM and even telephone systems, it can be applied in any context, making it hard to understand what true switching is. In fact, the term “switching” first appeared in telephone systems, specifically referring to the technology that enables the exchange of voice signals between two different telephones. The device that performs this task is a telephone switch. Therefore, in its original meaning, switching is just a technical concept, which is to complete the forwarding of a signal from a device’s entry point to its exit point. As a result, any device that fits this definition can be called a switching device.

From this, it can be seen that “switching” is a broad term. When it is used to describe a Layer 2 data network device, it is actually a bridging device; when it is used to describe a Layer 3 data network device, it refers to a routing device. What we often call an Ethernet switch is actually a multi-port Layer 2 network device based on bridging technology, which provides a low-latency, low-overhead path for data frames to be forwarded from one port to any other port. (For more networking knowledge, follow the WeChat official account: 网络技术联盟站.)

Therefore, a switch’s internal core should have a switching matrix to provide a path for communication between any two ports, or a fast switching bus to allow data frames received from any port to be sent out from other ports. In actual devices, the function of the switching matrix is often performed by a dedicated chip (ASIC). In addition, an important assumption in the design of an Ethernet switch is that the speed of the switching core is extremely fast, so that a large volume of data traffic will not cause congestion. In other words, the switching capacity is infinitely large relative to the amount of information being transmitted. (In contrast, the design of an ATM switch assumes that the switching capacity is limited relative to the amount of information being transmitted.) Although a Layer 2 Ethernet switch has evolved from a multi-port bridge, switching has richer features, making it not only the best way to get more bandwidth but also making the network easier to manage.

Switch Applications
#

As a primary connecting device for LANs, the Ethernet switch has become one of the most rapidly adopted network devices. With the continuous development of switching technology, the price of Ethernet switches has dropped sharply, and switching to the desktop has become a major trend.

If your Ethernet network has a large number of users, busy applications, and various servers, and you have not made any adjustments to the network structure, the performance of the entire network may be very low. One solution is to add a 10/100Mbps switch to the Ethernet. It can not only handle conventional 10Mbps Ethernet data streams but also support 100Mbps Fast Ethernet connections.

If the network utilization exceeds 40% and the collision rate is greater than 10%, a switch can help solve the problem. A switch with 100Mbps Fast Ethernet and 10Mbps Ethernet ports can operate in full-duplex mode, establishing dedicated 20Mbps to 200Mbps connections.

The role of a switch varies in different network environments. Similarly, adding a new switch or increasing the number of ports on an existing switch can have different effects on the network. A thorough understanding of the network’s traffic patterns is a very important factor in maximizing the effectiveness of a switch. Because the purpose of using a switch is to minimize and filter network data traffic, if a switch is improperly positioned and has to forward almost all the packets it receives, it cannot optimize network performance. Instead, it will slow down data transmission and increase network latency.

In addition to installation location, adding switches indiscriminately to networks with low loads and low data volumes can also have a negative impact. Due to factors such as packet processing time, switch buffer size, and the need to regenerate new packets, a simple HUB is more ideal than a switch in such situations. Therefore, we cannot simply assume that a switch is always better than a HUB. Especially when the user’s network is not congested and there is still a lot of available capacity, using a HUB can make better use of existing network resources.

Three Switching Methods
#

Cut-Through Switching
#

A cut-through Ethernet switch can be understood as a telephone switch with a crisscross line matrix between its ports. When it detects a data packet at an input port, it checks the packet header, gets the destination address, and uses the internal dynamic lookup table to convert it to the corresponding output port. It then connects the input and output at the crossover point and forwards the data packet directly to the corresponding port, fulfilling the switching function. The advantage is that since it does not need to store the packet, the delay is very small and switching is very fast. Its disadvantage is that because the data packet content is not saved by the Ethernet switch, it cannot check whether the transmitted data packet is erroneous and cannot provide error detection. Without a buffer, it cannot directly connect input/output ports with different speeds, and it is prone to packet loss. (For more networking knowledge, follow the WeChat official account: 网络技术联盟站.)

Store-and-Forward Switching
#

The store-and-forward method is the most widely used method in the field of computer networking. It stores the data packet from the input port first, then performs a CRC (Cyclic Redundancy Check) inspection. After handling any erroneous packets, it retrieves the destination address of the data packet and sends it out through the corresponding output port using the lookup table. For this reason, the store-and-forward method has a large delay in data processing, which is its drawback. However, it can perform error detection on data packets entering the switch, effectively improving network performance. Most importantly, it can support conversion between ports of different speeds, maintaining collaborative work between high-speed and low-speed ports.

Fragment-Free Switching
#

This is a solution that is in between the other two. It checks whether the data packet is at least 64 bytes long. If it is less than 64 bytes, it is considered a jabber packet and is discarded. If it is greater than 64 bytes, the packet is sent. This method does not provide data validation. Its data processing speed is faster than store-and-forward but slower than cut-through.

Switch Classification
#

Broadly speaking, there are two types of switches: WAN switches and LAN switches. WAN switches are mainly used in the telecommunications field to provide a basic platform for communication. LAN switches are used in local area networks to connect terminal devices such as PCs and network printers.

Based on transmission media and speed, they can be classified as Ethernet switches, Fast Ethernet switches, Gigabit Ethernet switches, FDDI switches, ATM switches, and Token Ring switches, among others.

Based on application scale, they can be classified as enterprise-level switches, departmental-level switches, and workgroup-level switches. The criteria for classification by different manufacturers are not completely consistent. Generally, enterprise-level switches are rack-mounted, departmental-level switches can be either rack-mounted (with fewer slots) or fixed-configuration, and workgroup-level switches are fixed-configuration (with simpler functions). On the other hand, from the perspective of application scale, a switch that supports large enterprise applications with more than 500 information points as a backbone switch is an enterprise-level switch, one that supports medium-sized enterprises with less than 300 information points is a departmental-level switch, and a switch that supports less than 100 information points is a workgroup-level switch.

Switch Functions
#

The main functions of a switch include:

  • Physical addressing
  • Network topology
  • Error checking
  • Frame sequencing and flow control
  • VLAN (Virtual Local Area Network)
  • Link aggregation
  • Firewall

In addition to connecting networks of the same type, switches can also interconnect different types of networks (such as Ethernet and Fast Ethernet). Many modern switches can provide high-speed connection ports that support Fast Ethernet or FDDI, which are used to connect other switches in the network or to provide additional bandwidth for critical servers with high bandwidth usage.

Generally, each port of a switch is used to connect an independent network segment. However, sometimes to provide faster access speed, we can directly connect some important network computers to the switch’s ports. This way, critical network servers and important users have faster access speeds and support larger data traffic.

Related

Nvidia HGX B200主板上的NVLink Switch变化
·76 words·1 min
AI NVLINK Switch HGX B200 H100
Linux C自动化编译
·6796 words·32 mins
Autotools Makefile Linux
Difference Between Wifi 6 and Wifi 7
·232 words·2 mins
Wifi 6 Wifi 7