⚡ What is a router?
A router is a Layer 3 network device that forwards data packets between different networks based on IP addresses. Where a switch connects devices within the same network, a router connects different networks together — including connecting your home or office network to the internet. Every time you load a webpage, your data passes through multiple routers to reach its destination.

What a router actually does

When a device on your network wants to communicate with something outside its own network — a website, a server in another office, a cloud service — the traffic has to cross network boundaries. That's the router's job.

A router receives a packet, reads the destination IP address, looks up that address in its routing table, and forwards the packet out of the appropriate interface toward the destination. It does this for every single packet, millions of times per second in enterprise environments.

The key distinction to understand for the exam: switches use MAC addresses and operate at Layer 2. Routers use IP addresses and operate at Layer 3. A switch keeps traffic within a network; a router moves traffic between networks.

How a router makes a forwarding decision
1. Packet arrives       → Router receives packet on an interface
2. Read destination IP  → Router inspects Layer 3 header for destination address
3. Check routing table → Finds best matching route (longest prefix match wins)
4. Forward packet      → Sends packet out the correct interface toward next hop
5. Decrement TTL       → Reduces Time To Live by 1 — prevents infinite loops

The routing table

The routing table is the router's map of the network. It stores known routes — destination networks, the next-hop router to send traffic to, and which interface to use. When a packet arrives, the router finds the most specific matching route and forwards accordingly.

Example routing table entries
Destination      Next Hop        Interface   Source
192.168.1.0/24   directly connected  eth0        Connected
10.0.0.0/8       192.168.1.1         eth0        Static
172.16.0.0/12    192.168.1.254       eth0        OSPF
0.0.0.0/0        203.0.113.1         eth1        Default route
⚡ Longest prefix match

When multiple routes match a destination, the router always uses the most specific route — the one with the longest subnet mask (highest prefix length). A /28 route beats a /24 route beats the default route /0.

The default route (0.0.0.0/0) matches everything and is used as a last resort when no more specific route exists — typically pointing toward the internet gateway.

Default gateway

The default gateway is the IP address of the router interface that a device uses to reach destinations outside its own subnet. When your laptop wants to load a website, it sends the traffic to the default gateway — the router — which then forwards it toward the internet.

If a device has no default gateway configured, it can only communicate with other devices on its own subnet. Any traffic destined for a different network simply has nowhere to go and is dropped. This is one of the most common causes of connectivity problems and appears regularly in troubleshooting scenarios on both A+ and Network+.

Static vs dynamic routing

✍️
Manually configured
Static Routing
Routes are entered manually by an administrator. Simple and predictable — no routing protocol overhead. Best for small networks or specific fixed paths. Doesn't adapt automatically to network changes.
🔄
Automatically learned
Dynamic Routing
Routers share routing information with each other using routing protocols (OSPF, RIP, EIGRP, BGP). Routes update automatically when the network changes. Scales to large networks but adds protocol overhead.
🌐
Last resort route
Default Route
0.0.0.0/0 — matches any destination. Used when no more specific route exists. In most networks this points toward the ISP or internet gateway. Every packet that doesn't match another route goes here.
🔗
Directly attached
Connected Routes
Networks directly attached to a router interface are automatically added to the routing table as connected routes. No configuration needed — the router knows about its own interfaces automatically.

NAT — Network Address Translation

NAT is one of the most important functions a router performs. It allows multiple devices on a private network to share a single public IP address when communicating with the internet.

Without NAT, every device would need its own public IP address — and with only around 4 billion IPv4 addresses available globally, this would have been exhausted long ago. NAT is why your home network can have 20 devices all using 192.168.x.x addresses while appearing to the internet as a single public IP.

NAT TypeHow it worksUse case
Static NAT One private IP maps to one public IP — permanently Hosting a server that needs a consistent public IP
Dynamic NAT Private IPs mapped to a pool of public IPs as needed Multiple users sharing a small pool of public IPs
PAT / NAT Overload Many private IPs share one public IP using unique port numbers Standard home/office internet connection — most common type
⚡ PAT is what your home router does

Port Address Translation (PAT), also called NAT Overload, is the type of NAT used in virtually every home and small office router. All devices share one public IP, and the router tracks which internal device initiated each connection by assigning unique port numbers. When the reply comes back, the router uses the port number to route the response to the correct internal device.

Router vs wireless router vs access point

DeviceWhat it doesOSI Layer
Router Forwards packets between networks based on IP addresses — connects networks Layer 3
Wireless Router Router + switch + access point combined — the typical home device Layer 2 / 3
Access Point (AP) Connects wireless clients to a wired network — does not route traffic between networks Layer 2
Switch Connects devices within the same network using MAC addresses Layer 2

Exam scenarios

💬 "A user can access shared drives on the local network but cannot reach any websites. What is the most likely cause?" → Missing or incorrect default gateway
💬 "Which device operates at Layer 3 and forwards traffic between networks based on IP addresses?" → Router
💬 "A small office has 30 devices all sharing one public IP address for internet access. What technology enables this?" → NAT (specifically PAT / NAT Overload)
💬 "Which type of route is automatically added to a routing table when an interface is configured with an IP address?" → Connected route (directly connected)
💬 "A router has two matching routes to a destination — one is /24 and one is /28. Which route does the router use?" → The /28 route — longest prefix match wins
💬 "What is the purpose of the 0.0.0.0/0 route in a routing table?" → Default route — forwards traffic when no more specific route matches, typically toward the internet
💬 "Which NAT type maps one private IP address permanently to one public IP address?" → Static NAT
💬 "A device needs to communicate with a server on a different subnet. What must be configured on the device?" → Default gateway — the IP address of the router interface on the local subnet

Studying for A+ or Network+?

The study guides, practice exams, and free courses worth your time for both exams.

See Study Resources →

Related Articles