You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Switching moves data within a local network (Layer 2), while routing moves data between different networks (Layer 3). Together, they form the backbone of how data travels from source to destination across the Internet and private networks.
A switch connects devices on the same local area network (LAN) and forwards frames based on MAC addresses.
MAC Address Table (CAM Table):
| MAC Address | Port |
|--------------------|------|
| AA:BB:CC:DD:EE:01 | 1 |
| AA:BB:CC:DD:EE:02 | 3 |
| AA:BB:CC:DD:EE:03 | 5 |
| Feature | Description |
|---|---|
| Full duplex | Devices can send and receive simultaneously |
| Microsecond latency | Switches forward frames very quickly |
| Collision-free | Each port is its own collision domain |
| Broadcast domain | All ports on a switch share a single broadcast domain (unless VLANs are used) |
VLANs allow you to logically segment a single physical switch into multiple isolated broadcast domains.
Physical Switch:
Port 1-8: VLAN 10 (Engineering)
Port 9-16: VLAN 20 (Marketing)
Port 17-24: VLAN 30 (Management)
Devices in VLAN 10 cannot communicate with VLAN 20
without a router (inter-VLAN routing).
A trunk port carries traffic for multiple VLANs between switches using 802.1Q tagging:
Switch A ══════ Trunk (carries VLAN 10, 20, 30) ══════ Switch B
Each frame on the trunk is tagged with a VLAN ID
so the receiving switch knows which VLAN it belongs to.
A router connects different networks and forwards packets based on IP addresses. Every time data crosses from one network to another, a router makes the forwarding decision.
A routing table contains entries that map destination networks to next hops:
# View the routing table on Linux
ip route show
# Example output:
default via 192.168.1.1 dev eth0
192.168.1.0/24 dev eth0 proto kernel scope link
10.0.0.0/8 via 192.168.1.254 dev eth0
| Destination | Next Hop | Interface | Metric |
|---|---|---|---|
| 0.0.0.0/0 (default) | 192.168.1.1 | eth0 | 100 |
| 192.168.1.0/24 | Directly connected | eth0 | 0 |
| 10.0.0.0/8 | 192.168.1.254 | eth0 | 50 |
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.