Cisco Switching in Networking
The concept of switching and forwarding frames is universal in networking and telecommunications. Various types of switches are used in LANs, WANs, and in the public switched telephone network (PSTN).
The decision on how a switch forwards traffic is made based on the flow of that traffic. There are two terms associated with frames entering and leaving an interface:
- Ingress – This is used to describe the port where a frame enters the device.
- Egress – This is used to describe the port that frames will use when leaving the device.
A LAN switch maintains a table that is referenced when forwarding traffic through the switch. The only intelligence of a LAN switch is its ability to use its table to forward traffic. A LAN switch forwards traffic based on the ingress port and the destination MAC address of an Ethernet frame. With a LAN switch, there is only one master switching table that describes a strict association between MAC addresses and ports; therefore, an Ethernet frame with a given destination address always exits the same egress port, regardless of the ingress port it enters.
Note: An Ethernet frame will never be forwarded out the same port it was on which it was received.
The Switch MAC Address Table
A switch is made up of integrated circuits and the accompanying software that controls the data paths through the switch. Switches use destination MAC addresses to direct network communications through the switch, out the appropriate port, toward the destination.
For a switch to know which port to use to transmit a frame, it must first learn which devices exist on each port. As the switch learns the relationship of ports to devices, it builds a table called a MAC address table. This table is stored in content addressable memory (CAM) which is a special type of memory used in high-speed searching applications. For this reason, the MAC address table is sometimes also called the CAM table.
LAN switches determine how to handle incoming data frames by maintaining the MAC address table. A switch populates its MAC address table by recording the source MAC address of each device connected to each of its ports. The switch references the information in the MAC address table to send frames destined for a specific device out of the port which has been assigned to that device.
The Switch Learn and Forward Method
The following two-step process is performed on every Ethernet frame that enters a switch.
Step 1. Learn – Examining the Source MAC Address
Every frame that enters a switch is checked for new information to learn. It does this by examining the source MAC address of the frame and port number where the frame entered the switch:
- If the source MAC address does not exist in the MAC address table, the MAC address and incoming port number are added to the table.
- If the source MAC address does exist, the switch updates the refresh timer for that entry. By default, most Ethernet switches keep an entry in the table for five minutes. If the source MAC address does exist in the table but on a different port, the switch treats this as a new entry. The entry is replaced using the same MAC address, but with the more current port number.
Step 2. Forward – Examining the Destination MAC Address
If the destination MAC address is a unicast address, the switch will look 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, it will forward the frame out of the specified port.
- If the destination MAC address is not in the table, the switch will forward the frame out all ports except the incoming port. This is called an unknown unicast. If the destination MAC address is a broadcast or a multicast, the frame is also flooded out all ports except the incoming port.
Switching Forwarding Methods
Switches make Layer 2 forwarding decisions very quickly. This is because of software on application-specific-integrated circuits (ASICs). ASICs reduce the frame-handling time within the device and allow the device to manage an increased number of frames without degrading performance.
Layer 2 switches use one of two methods to switch frames:
- Store-and-forward switching – This method makes a forwarding decision on a frame after it has received the entire frame and checked the frame for errors using a mathematical error-checking mechanism known as a cyclic redundancy check (CRC). Store-and-forward switching is Cisco’s primary LAN switching method.
- Cut-through switching – This method begins the forwarding process after the destination MAC address of an incoming frame and the egress port have been determined.
Store-and-forward switching, as distinguished from cut-through switching, has the following two primary characteristics:
- Error checking – After receiving the entire frame on the ingress port, the switch compares the frame check sequence (FCS) value in the last field of the datagram against its own FCS calculations. The FCS is an error checking process that helps to ensure that the frame is free of physical and data-link errors. If the frame is error-free, the switch forwards the frame. Otherwise, the frame is dropped.
- Automatic buffering – The ingress port buffering process used by store-and-forward switches provides the flexibility to support any mix of Ethernet speeds. For example, handling an incoming frame traveling into a 100 Mbps Ethernet port that must be sent out a 1 Gbps interface would require using the store-and-forward method. With any mismatch in speeds between the ingress and egress ports, the switch stores the entire frame in a buffer, computes the FCS check, forwards it to the egress port buffer and then sends it.
The figure illustrates how store-and-forward makes a decision based on the Ethernet frame.
The store-and-forward switching method drops frames that do not pass the FCS check. Therefore, it does not forward invalid frames.
By contrast, the cut-through switching method may forward invalid frames because no FCS check is performed. However, cut-through switching has the ability to perform rapid frame switching. This means the switch can make a forwarding decision as soon as it has looked up the destination MAC address of the frame in its MAC address table, as shown in the figure.
shows a diagram of an ethernet frame, and highlights the fact that in cut through switching the switch can forward the frame once it reads the destination MAC address