Switching Concepts
This module will portray the fundamentals of switching and switch operations.
Switching in Networking
As we all know, switches are found everywhere when it comes to networking, LANs, WANs and PSTN (Public Switched Telephone Network).
A switch forwarding decision is made on the flow of traffic. Frames will enter and leave switch interfaces for communication to happen. The terms Ingress and Egress are used to describe a frame which is entering or leaving an interface
- Ingress – When a Frame enters the interface (Incoming)
- Egress – When a Frame leaves the interface (Outgoing)
As you might already be aware of, a switch maintains a table that is referenced when forwarding traffic. This is known as a Mac Address Table or CAM Table. The only function of a Layer 2 Switch is to use such a table to forward traffic.
A Switch forwards traffic based on the ingress port and the destination MAC Address of a Frame.
When it comes to switching, there is always only one master switching table that represents a strict association between MAC addresses and ports. This means that a frame with a specified destination will always exit the same egress port, regardless of the ingress port it enters on.
[NOTE] A Frame will never be forwarded out the same port on which it was received.
In other words, if a Frame was received on port 1 it will never exit that same port again.
The Mac Address Table
Switches use destination MAC addresses to forward traffic through the switch, out the right port toward the destination.
For a switch to know which port to use to forward a frame, it must first learn which devices reside on each port. When the switch learns such information (the relationship of ports to devices), it will build what’s called a MAC Address Table.
Such a table is stored in the “Content Addressable Memory” or CAM which is a special type of memory used in high-speed searching applications, hence the name CAM Table.
Switches learn and determine how to handle incoming frames by maintaining this table. A switch will populate the CAM table by recording the source MAC Address of each device connected to each of its ports.
A switch will reference the information in the CAM table to forward frames destined for a specific device on the port that device resides.
The Learn and Forward Method
A 2 step process is always performed on every Frame that enters the switch.
| Step 1 |
| Learn (Examine the Source MAC Address) |
| Step 2 |
| Forward (Examine the Destination MAC Address) |
Step 1. Learn (Examine the Source MAC Address)
Every frame that enters the switch is checked for new information to learn. The switch does this by examining the source MAC address of the frame and the port number where the frame entered
- If the Source MAC Address does not already exist in the CAM table, the MAC Address and the Ingress port
- If the source MAC Address already exists on the switch, the switch will update the refresh timer for that entry.
[NOTE] By default, most Switches keep an entry in the table for five minutes but some brands/models vary.
If the source MAC Address already exist in the table but is associated to a different port, the switch will treat this address as a new entry. The entry will be replaced using the same MAC Address but with a more current port number
Step 2. Forward (Examine the Destination MAC Address)
If the destination MAC Address is a unicast address, the switch will search for a match between the destination MAC Address of the received frame and an existing entry in its CAM Table
- If the destination MAC Address is present in the CAM Table, the switch will forward the frame out of the specified port.
- If the destination MAC Address is not present in the CAM Table, the switch will forward the frame out all ports except the ingress port (the port on which the frame arrived). This is also known as an Unkown Unicast.
- If the destination MAC Address is a broadcast or a multicast, the exact same process will occur and it will be flooded out all ports except the ingress port