Layer 3 Switches..
By default, routing is disabled on many Cisco Layer 3 switches.
Switch(config)# ip routing
This enables routing between VLANs.
A Layer 3 (L3) switch is a network device that combines the functions of a Layer 2 switch and a Layer 3 router. It can switch frames based on MAC addresses and route packets based on IP addresses.
Layer 3 Switches are used in 2 Tier architectures..
1. What is a Layer 3 Switch?
Imagine a company has three departments:
- VLAN 10 – Sales
- VLAN 20 – HR
- VLAN 30 – IT
A Layer 2 switch can connect devices within each VLAN, but it cannot route traffic between VLANs.
A Layer 3 switch can do both:
- ✅ Switch traffic within the same VLAN.
- ✅ Route traffic between different VLANs.
2. OSI Layers
| Device | OSI Layer | Uses |
|---|---|---|
| Hub | Layer 1 | Electrical signals |
| Layer 2 Switch | Layer 2 | MAC addresses |
| Layer 3 Switch | Layer 2 & 3 | MAC + IP addresses |
| Router | Layer 3 | IP addresses |
3. How Does an L3 Switch Work?
Suppose:
PC1
IP: 192.168.10.10
Gateway: 192.168.10.1
|
VLAN 10
|
+----------------------+
| Layer 3 Switch |
| VLAN10:192.168.10.1 |
| VLAN20:192.168.20.1 |
+----------------------+
|
VLAN 20
|
PC2
IP:192.168.20.20
Gateway:192.168.20.1
When PC1 sends data to PC2:
- PC1 sees the destination is in another subnet.
-
It sends the packet to its default gateway (
192.168.10.1). - The Layer 3 switch routes the packet.
- The switch forwards it to VLAN 20.
- PC2 receives it.
4. Layer 2 vs Layer 3 Switch
| Feature | Layer 2 Switch | Layer 3 Switch |
|---|---|---|
| Uses MAC addresses | ✅ | ✅ |
| Uses IP addresses | ❌ | ✅ |
| Inter-VLAN Routing | ❌ | ✅ |
| Static Routing | ❌ | ✅ |
| Dynamic Routing | ❌ | ✅ |
| Default Gateway | Management only | Can act as gateway for VLANs |
5. Main Features
VLAN Support
Creates separate broadcast domains.
Example:
VLAN 10
VLAN 20
VLAN 30
Inter-VLAN Routing
Instead of using a router-on-a-stick, the Layer 3 switch routes between VLANs internally.
VLAN10
\
\
L3 Switch
/
/
VLAN20
This is much faster because packets do not leave the switch to be routed.
Static Routing
Example:
ip routing
ip route 172.16.0.0 255.255.0.0 10.1.1.2
Dynamic Routing
Many enterprise Layer 3 switches support routing protocols such as:
- OSPF
- EIGRP (Cisco platforms that support it)
- RIP
Higher-end models may also support BGP.
6. Configuration Example
Enable Routing
Switch(config)# ip routing
Without this command, the switch behaves like a Layer 2 switch.
Create VLANs
vlan 10
name SALES
vlan 20
name HR
Configure SVIs (Switch Virtual Interfaces)
interface vlan 10
ip address 192.168.10.1 255.255.255.0
no shutdown
interface vlan 20
ip address 192.168.20.1 255.255.255.0
no shutdown
These IP addresses become the default gateways for hosts in each VLAN.
Assign Access Ports
interface g0/1
switchport mode access
switchport access vlan 10
interface g0/2
switchport mode access
switchport access vlan 20
7. Routing Table
You can verify routes using:
show ip route
Example:
C 192.168.10.0/24 is directly connected, Vlan10
C 192.168.20.0/24 is directly connected, Vlan20
8. SVI (Switch Virtual Interface)
An SVI is a virtual Layer 3 interface associated with a VLAN.
Example:
VLAN 10
PC1
PC2
PC3
|
+----- Layer 3 Switch
|
+-- Interface VLAN 10
IP: 192.168.10.1
The SVI is the default gateway for devices in that VLAN.
9. Layer 3 Switch vs Router
| Feature | Layer 3 Switch | Router |
|---|---|---|
| LAN Routing | Excellent | Excellent |
| WAN Connections | Limited | Excellent |
| Internet Edge | Usually not used | Primary choice |
| NAT/PAT | Limited platform support | Common |
| Routing Speed | Very fast (hardware forwarding) | Fast, but depends on platform |
| VLAN Support | Excellent | Supported, but often via subinterfaces |
10. Where Is It Used?
A typical enterprise network looks like this:
Internet
|
Firewall
|
Edge Router
|
Core Layer 3 Switch
/ \
Access Switch Access Switch
| |
PCs PCs
The Layer 3 switch is commonly placed at the core or distribution layer, where it performs high-speed inter-VLAN routing.
11. Important CCNA Commands
show vlan brief
show interfaces trunk
show ip interface brief
show ip route
show running-config
show arp
show mac address-table
12. CCNA Interview Questions
Q: Why use a Layer 3 switch instead of Router-on-a-Stick?
- Router-on-a-Stick sends inter-VLAN traffic to an external router over a trunk link, which can become a bottleneck.
- A Layer 3 switch routes traffic internally using dedicated hardware, making it much faster and more scalable.
Q: Can a Layer 3 switch replace a router?
- Inside a LAN: Often yes, for inter-VLAN routing and internal routing.
- At the Internet edge: Usually no. Routers are typically used for WAN connections, Internet connectivity, and advanced edge services.
CCNA Tip
For the CCNA exam, remember this distinction:
- Layer 2 Switch → Switching based on MAC addresses within the same VLAN.
- Router → Routing between different networks.
- Layer 3 Switch → A switch that also performs routing, most commonly inter-VLAN routing at very high speed using SVIs and hardware forwarding.
Comments
Post a Comment