How Switches Work.

 


If you have been in IT for some time you might have heard the statement, “switches operate at layer 2”, but what does that really mean ?

In the TCP/IP reference model, the first “layer” is known as the Network Interface Layer, which is made up of “L1” and “L2”. Layer 2 refers to frames, and the addressing that is used to communicate between devices is known as the MAC address. MAC addresses are 48-bit addresses that are separated with colons(:). An example would look like this: aa:aa:aa:bb:bb:bb. The first 6 a’s(first 24-bits) is known as the Organizational Unique Identifier(OUI) and the last 6 b’s(last 24-bits) make up the unique host portion of the address. Each network device will have a MAC address.

Switches are by default a single broadcast domain(VLAN) and they need a way of forwarding these frames to the correct host efficiently. In order for the switch to be able to do this it keeps a table called the CAM(content addressable memory) table. The CAM table will learn every source MAC address that is on a connected interface and associate it with the interface that it is on and the VLAN associated with the port. Since the switch has a table with all of the mac addresses on each port then it can efficiently forward the frames to the correct destination address. Before we go into what the switch does if it doesn’t have an entry in its CAM table for a destination MAC address we need to talk about BUM. BUM? Broadcast, Unknown Unicast, Multicast. That is the traffic that switches flood out every port that is apart of the same broadcast domain(VLAN) except the port it came in on. So what happens if a switch receives a frame for a destination MAC that is not in its CAM ? It treats it like BUM and sends it out all ports in the same broadcast domain(VLAN) except the port it came in on. So how does it stay efficient ? The switch has a timer that it keeps for every entry in the CAM table. The default aging timer is 300 seconds(5 min). If 300 seconds expire then the switch drops the MAC out of its table. This ensures that only the most up to date MAC addresses get kept in the table. This is a brief overview of how switches store MAC’s and forward frames efficiently.

Comments

Popular posts from this blog

AWS Identity and Access Management(IAM)

AWS Virtual Private Clouds(VPCs)

IPSec VPN - Fundamentals