Mentor: Let’s See What are Layer 2 & Layer 3 switches
- Layer 2 Switches
- Operates at Layer 2 of OSI Model
- The primary role is to communicate within the same LAN by using a MAC address to forward data packets.
- MAC learning: learns MAC from all devices connected and builds a MAC Table. This MAC table is used to forward data frame to intended recipients.
Student: How does it decide who is the intended recipient?
Mentor: Frame Forwarding / Switching process – We will look at it in detail when i explain the MAC Learning Process – Right now you can know – it looks up the MAC table and the appropriate port is decided based on the destination MAC address so only the recipient port gets the data not all ports.
Student: So layer 2 switches only forwards to the required port? Unlike Hub which forwards it to all ports
Mentor: You are correct on Hubs. For Layer 2 switch its like this…
Switch looks at the MAC Table
Known Destination MAC – Forward it to the right associated port
Unknown MAC – Broadcast the frame to all the ports except where it came from
Broadcast MAC – Same case as Unknown MAC
Student: So layer 2 switches only forwards to the required port? Unlike Hub which forwards it to all ports
Mentor: You are correct on Hubs. For Layer 2 switch it’s like this…
Switch looks at the MAC Table
Known Destination MAC – Forward it to the right associated port
Unknown MAC – Broadcast the frame to all the ports except where it came from
Broadcast MAC – Same case as Unknown MAC
Broadcast Domain – All the ports in a switch are in the same broadcast domain. If you want to separate them then you use VLANs – we will look into it later.
Collision Domain – Each port in a switch is a separate collision domain – a frame from one port does not collide with a frame from another port. So the collisions are drastically reduced.
- Layer 3 switches
- Operates at both Layer 2 and Layer 3 of the OSI model.
- Has the abilities of Layer 2 switches with additional routing capabilities.
Routing Capabilities:
Layer 3 switches can make routing decisions based on IP address and by looking at the routing table.
They can make forwarding decision by looking at the MAC Address Table & ARP table
So this makes them able to route traffic between different subnets and VLANs efficiently
Since they are able to use the routing table and are layer 3 they can use the Routing protocols too so that the routing decsions are made in an optimal manner
They are optimized for high-speed routing with specialized hardware (such as ASICs).
They also support basic security features like ACLs to manage traffic and restrict access.