Featured image

Table of Contents Link to heading

Switch Fundamentals Link to heading

The switch makes its forwarding decisions based solely on the L2 MAC addresses and is completely unaware of the L3 protocol being carried in the data portion of the frame, such as an IPv4 packet, an ARP message, or an IPv6 ND packet.

Switch Operation Link to heading

Learning Link to heading

Info
The dynamic process of populating the MAC table with MAC entries (MAC addresses and their corresponding ports/interfaces).

When a frame reaches into the port of a switch, the switch reads the MAC address of the source device from the Ethernet frame and compares it to its MAC table. If the switch cannot find a corresponding entry in the MAC table, the switch will add the address to the table with the ingress port number and a timer.

Aging Link to heading

Info
The entries in the MAC table acquired by the learning process are time stamped, aka a refresh timer (default, 300 seconds), which is used as a means for removing outdated entries in the MAC table.

After an entry is added to the MAC table, a procedure begins a countdown. After the value reaches 0, the entry in the table is aged out and thus removed from the MAC table.

If a frame from the same node on the same port is received node within the refresh timer, this refresh timer will be reset and thus not removed from the MAC table.

Selective Forwarding Link to heading

Info
When a switch receives a frame, it reads the destination MAC address of the frame and looks for a matching entry in the MAC address table. If the switch finds an entry for the destination MAC address, it forwards the frame via the corresponding port.

Flooding Link to heading

Info
If the switch does not have a MAC address entry in its MAC table that matches the destination MAC address of a received frame, the switch will forward the frame out all ports in the same network segment except the ingress port.

The incoming interface is not forwarded to because any destination populated on that segment will have already received the frame.

Although flooding can help the switch learn new MAC addresses and deliver packets to unknown destinations, it can also cause network congestion and performance issues.

Filtering Link to heading

Info

Situations when a frame is not forwarded:

  1. A switch does not forward a frame to the same port on which it arrived.
  2. A switch discards a corrupt frame that fails a CRC check.
  3. A switch has security settings for blocking frames to or from selective MAC addresses or specific ports.

Preventing Link to heading

Info
The process of avoiding switching loops in a network when there are multiple paths between two devices in a network, and the switches forward the same frame endlessly, creating a broadcast storm.
Note
Read more at ๐Ÿ”—.

Frame Forwarding Decision Link to heading

The switch dynamically builds the MAC address table by examining the source MAC address of the frames received on a port. The switch forwards frames by searching for a match between the destination MAC address in the frame and an entry in the MAC address table.

Learning Phase - Examine the Source MAC Address Link to heading

As each frame enters the switch, the switch examines the source MAC address of the frame and the port number where the frame entered the switch.

If the source MAC address does not exist, it and the ingress port number are added to the table.

If the source MAC address does exist, the switch resets the refresh timer for that entry.

Tip
If the source MAC address exists in the table but on a different port, the entry is replaced using the same MAC address but with the more current port number.

Forwarding Phase - Find the Destination MAC Address Link to heading

The switch forwards the frame based on the type of the destination MAC address.

Unicast Address Link to heading

Info
The switch looks for a match between the destination MAC address of the frame and an entry in its MAC address table.

If the destination MAC address is in the table, the switch forwards the frame out the specified port.

Tip
If the destination MAC address is not in the table, the switch floods an unknown unicast address that forwards the frame out all ports except the ingress port.

Broadcast and Multicast Addresses Link to heading

Info
The switch floods the frame out all ports except the ingress port.

This is because multicast and broadcast addresses are never learned by the switch, and they always remain unknown in the switch’s forwarding table.

Frame Forwarding Mechanisms Link to heading

Store-and-Forward Switching (Cisco Preference) Link to heading

Info
The switch receives the entire frame and computes a CRC before forwarding the first bit of the frame.

If the CRC is valid, the switch looks up the destination address and forwards the frame out the correct port.

When an error is detected in a frame, the switch discards the frame. Discarding frames with errors reduces the amount of bandwidth consumed by corrupt data.

This switching method is required for QoS analysis on converged networks where incoming frames needs classifying according to QoS parameters, which means that traffic can then be marked, prioritised, or rate-limited. For example, VoIP data streams need to have priority over web-browsing traffic.

Cut-Through Switching Link to heading

Info
The switch only reads up to the destination MAC address (the first 6 bytes of the frame following the preamble field) to determine the egress interface.

The switch does not perform any error checking on the frame.

There are two variants of this switching mechanism.

Fast-Forward Switching Link to heading

Info
The switch immediately forwards a frame after reading the destination address.

Therefore, there may be times, albeit infrequently, when frames are relayed with errors. The destination NIC discards the faulty packet upon receipt, which wastes network bandwidth.

Fast-forward switching is the typical cut-through mechanism and offers the lowest level of latency (measured from the first bit received to the first bit transmitted).

Fragment-Free Switching Link to heading

Info
The switch buffers/stores the first 64 bytes (during which most network errors and collisions occur) of the frame before forwarding it.

By performing an error checking on the first 64 bytes of the frame, it helps to ensure that there is no runt frame or that a collision has not occurred before forwarding the frame.

Fragment-free switching is a compromise between the high latency and high integrity of store-and-forward switching and the low latency and reduced integrity of fast-forward switching.

Automatic Mechanism Link to heading

Some switches are configured to perform cut-through switching on a per-port basis until a user-defined error threshold is reached, and then they automatically change to store-and-forward. When the error rate falls below the threshold, the port automatically changes back to cut-through switching.

Memory Buffering on Switches Link to heading

Info
Used to store frames before forwarding them or used when the destination port is busy due to congestion.

Port-Based Memory Buffering Link to heading

Info
Frames are stored in a queue linked to specific ports until they can be transmitted. Each port has a fixed amount of memory buffer.

A frame is only transmitted to the egress port when all the frames ahead in the queue have been successfully transmitted.

There are two major drawbacks to this buffering:

  1. Frames can be dropped when the port runs out of buffer space.
  2. A single frame can delay the transmission of all the frames in memory if the destination port is busy, while other ports are idle.

Shared Memory Buffering Link to heading

Info
Frames are stored in a single queue or multiple queues based on priority. All ports shares a common memory buffer.

The frames in the buffer are dynamically linked to the destination port, enabling a frame to be received on one port and then transmitted on another port, without moving it to a different queue.

Shared memory buffering results in the ability to store larger frames with potentially fewer dropped frames, which is important with asymmetric switching which allows for different data rates on different ports, such as when connecting a server to a 10 Gbps switch port and PCs to 1 Gbps ports.