Fetching latest headlines…
I Finally Understood Routers and Switches by Connecting Them to Real-Life Examples
NORTH AMERICA
πŸ‡ΊπŸ‡Έ United Statesβ€’May 7, 2026

I Finally Understood Routers and Switches by Connecting Them to Real-Life Examples

0 views0 likes0 comments
Originally published byDev.to

Introduction

While studying for CompTIA Network+, I couldn't totally grasp the difference between routers and switches. Even when I memorized their functions, the knowledge never stuck. However, once I knew the reason why they are needed, everything clicked. So, I decided to write it down.

Understand the difference between routers and switches

Comparing these two devices side by side makes it much easier to understand.

Switch:
γ€€β†’ Transfer data inside the same network
γ€€β†’ Use MAC address
γ€€β†’ Layer 2(Data Link LayerοΌ‰

Router:
γ€€β†’ Transfer data in different networks
γ€€β†’ Use IP Address
γ€€β†’ Layer 3(Network LayerοΌ‰

Familiar example

Switch = extension call in the office
γ€€β†’ Connect with people from the same company

Router = international telephone exchange
γ€€β†’ Connects people from different countries (networks)
γ€€β†’ Determines which route to use

Division of roles of routers and switches

γ€€γ€€γ€€γ€€γ€€γ€€        Internet
γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€  γ€€    β”‚
γ€€γ€€γ€€γ€€γ€€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
γ€€γ€€γ€€γ€€γ€€β”‚      Router           β”‚ ← Layer 3
γ€€γ€€γ€€γ€€γ€€β”‚ Different NW Transfer β”‚ Judge from IP address
γ€€γ€€γ€€γ€€γ€€β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€      γ€€β”‚
γ€€γ€€γ€€γ€€γ€€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
γ€€γ€€γ€€γ€€γ€€β”‚            Switch         β”‚ ← Layer 2
γ€€γ€€γ€€γ€€γ€€β”‚ The same NW Transfer      β”‚ Judging from MAC address
γ€€γ€€γ€€γ€€γ€€β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
γ€€γ€€γ€€γ€€γ€€  γ€€  γ€€β”‚γ€€γ€€γ€€     β”‚
γ€€γ€€γ€€γ€€  γ€€   β”Œβ”€β”€β”΄β”€β”€β”   γ€€β”Œβ”€β”€β”΄β”€β”€β”
γ€€γ€€γ€€γ€€     γ€€β”‚PC-A β”‚γ€€   β”‚PC-B β”‚
γ€€γ€€γ€€γ€€  γ€€   β””β”€β”€β”€β”€β”€β”˜γ€€   β””β”€β”€β”€β”€β”€β”˜

The main role of routers

1. Routing ( Route Selection )

It decides routes that head to the destination.

Tokyo β†’ Osaka:
  Route A: Tokyo β†’ Nagoya β†’ Osaka
γ€€Route B: Tokyo β†’ Kyoto β†’ Osaka
  ↓
γ€€Choose the best path for data transfer  

2. Network segmentation・ border

The router acts as the boundary between the Internet and the internal network.

   γ€€γ€€γ€€γ€€γ€€γ€€Internet
γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€β”‚
γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€β”‚ Global IP
γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€β”‚ 203.0.113.1
γ€€γ€€γ€€γ€€γ€€β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
γ€€γ€€γ€€γ€€γ€€β”‚   Router    β”‚
γ€€γ€€γ€€γ€€γ€€β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€β”‚ Private IP
γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€β”‚ 192.168.1.1
γ€€γ€€γ€€γ€€γ€€β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
γ€€γ€€γ€€γ€€γ€€β”‚   Switch    β”‚
γ€€γ€€γ€€γ€€γ€€β””β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”˜
γ€€γ€€γ€€γ€€γ€€ γ€€β”‚γ€€γ€€  γ€€β”‚
γ€€γ€€γ€€γ€€γ€€β”Œβ”€β”€β”΄β”€β”€β” β”Œβ”€β”€β”΄β”€β”€β”
γ€€γ€€γ€€γ€€γ€€β”‚PC-A β”‚ β”‚PC-B β”‚
γ€€γ€€γ€€γ€€γ€€β”‚~.1.2β”‚ β”‚~.1.3β”‚
γ€€γ€€γ€€γ€€γ€€β””β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”˜

3. NAT ( Network Address Translation)

NAT is a mechanism that allows multiple devices to share a single global IP address.

【NAT( Sharing one IP address by multiple PCs)】

Internal Network (Office)        Internet
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ PC-A 192.168.1.2  β”‚            β”‚               β”‚
β”‚ PC-B 192.168.1.3  β”œβ”€β”€ Router ───  203.0.113.1  β”‚
β”‚ PC-C 192.168.1.4  β”‚            β”‚  (Just oneοΌ‰ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Multiplex private IPs           γ€€1 Global IP

4. Data flow

【PC-A β†’ Data flow to the Internet】

PC-A(192.168.1.2οΌ‰
 ↓ " I need to send this to the Internet"
Switch
 ↓ head to Router
Router
 ↓ exchange to global IP(NATοΌ‰
 ↓ select the best path
Internet
 ↓
Destination server

5. Packet filtering


A basic security feature that blocks unauthorized access 
from outside the network.

Routing Table

Routers have maps called routing table.
They look at it and select the path for destinations.

Destination network  | Next router      | Distance
192.168.1.0/24  | Direct connection        | 0
10.0.0.0/8      | 192.168.2.1     | 1
0.0.0.0/0       | 203.0.113.1     | Default

Static routing and Dynamic routing

Static routing

It is a method to configure the routing tables by hand.

Administrator
 ↓ Configure the route by hand
Router A ──→ Router B ──→ Router C
               ↓
γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€γ€€Destination NW

Static route β†’ If you need change, you have to update it by hand as well
Features:
・For small scale network
・Best suited for environments where routes rarely change 
・Simple settings
・Gives administrators full control over routing decisions

Dynamic routing

It is a method to configure the routing tables automatically.

Router A ←→ Router B ←→ Router C
 ↕      ↕      ↕
Exchange routing information each otherγ€€
Choose the best path automatically 
Handle automatically, if routes change
Features:
・For large scale network
・Best suited for environments where routes change frequently
・Handle automatically, if routes change
・Protocols: RIP・OSPF・BGP etc…

Proper use

Static Routing  β†’ Small scale and the least update environment
Dynamic Routing β†’ Large scale and frequent update environment

Links with OSI reference model

Layer 7  Application  β”‚
Layer 6  Presentation β”‚
Layer 5  Session      β”‚  Not applicable for routers
Layer 4  Transport    β”‚
─────────────────────────────
Layer 3  Network      ← Router function (IP AddressοΌ‰
─────────────────────────────
Layer 2  Data Link    ← Switch function (MAC AddressοΌ‰
Layer 1  Physical     ← Cable・ Physical signal
─────────────────────────────

Familiar example for routers

A home Wi-Fi router is actually an all-in-one device that combines a router, a switch, and a Wi-Fi access point.

Domestic Wi-Fi Router
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
│ Router function→ Connect between domestic network and Internet  │
│ Switch function→ Connect PC with wired connection               │
│ Wi-Fi AP function→ Connect devices with wireless connection     │          
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       ↕
γ€€γ€€     Internet

Summary

Router = Devices that transfer data between different networks

Main role:
γ€€β†’ Routing( Selection for the best routeοΌ‰
γ€€β†’ Border for network
γ€€β†’ NAT( Sharing one IP by multiple PCsοΌ‰
γ€€β†’ Packet filtering

The difference of Router and Switch:
γ€€Router β†’ Layer 3・IP address・ Between different NWs
γ€€Switch β†’ Layer 2・MAC address・ Between same NWs

Routing kinds:
γ€€Static  β†’ manual・ for small scale
γ€€Dynamic β†’ automatic・ for large scale

OSI Layer: Layer 3(Network LayerοΌ‰

Conclusion

When I started to study for them, I couldn't remember each functions of these devices.
Once I connected each function to a familiar real-world example, everything fell into place. Understanding the difference between routers and switches makes these types of questions much easier to handle.

Comments (0)

Sign in to join the discussion

Be the first to comment!