Router
1. Definition
A router is a Layer-3 (network layer) device that connects two or more different networks and forwards packets between them using their IP addresses. It joins a LAN to the Internet, links branch offices, or interconnects VLANs/subnets, and it chooses the best path for each packet using a routing table. Every router interface belongs to a different IP subnet and is a separate broadcast domain.
2. How a Router Works
- A packet arrives on an interface; the router strips the incoming frame (Layer-2 header) and reads the destination IP address.
- It looks up the address in its routing table and picks the entry with the longest matching prefix; if none matches, it uses the default route (0.0.0.0/0 — "send everything else to the ISP").
- It decrements the TTL field; if TTL reaches 0 the packet is dropped and an ICMP "time exceeded" message is returned (this prevents packets looping forever).
- It re-encapsulates the packet in a new Layer-2 frame for the chosen outgoing link — with a new source and destination MAC address for that hop. The IP addresses never change along the path (unless NAT is used).
- It forwards the frame out of the chosen interface; the next router repeats the process.
Routing table (example)
┌──────────────────────┬─────────────────┬───────────┐
│ Destination network │ Next hop │ Interface │
├──────────────────────┼─────────────────┼───────────┤
│ 192.168.1.0/24 │ directly connect│ LAN1 │
│ 10.0.0.0/8 │ 192.168.1.2 │ LAN1 │
│ 0.0.0.0/0 (default) │ 203.0.113.1 │ WAN │
└──────────────────────┴─────────────────┴───────────┘
3. Routing — Static and Dynamic
- Static routing — the administrator manually enters routes; simple, predictable, no protocol overhead, but does not adapt to failures and does not scale.
- Dynamic routing — routers exchange information and build tables automatically:
- RIP (distance-vector, hop count, max 15 hops) — small networks.
- OSPF (link-state, cost based, fast convergence) — inside an organisation.
- EIGRP (Cisco hybrid) — enterprise networks.
- BGP (path-vector) — the routing protocol of the Internet, used between ISPs/autonomous systems.
Interior gateway protocols (RIP, OSPF, EIGRP) work inside one administrative domain; exterior gateway protocols (BGP) work between domains.
4. Types of Router
Home broadband router — a multi-function box: router + NAT + DHCP server + 4-port switch + Wi-Fi access point + firewall · Enterprise/branch router — many interfaces (fibre, Ethernet, serial), VPN, QoS, ACLs · Core router — very high throughput, sits in ISP backbones · Edge router — connects the enterprise to the ISP · Virtual router / SD-WAN — software routing with policy-based link selection · Layer-3 switch — a switch that also routes between VLANs at wire speed; it is the practical choice inside a campus, while a router is used at the edge (WAN, NAT, VPN).
5. Router Functions and Features
Path determination and packet forwarding (the core job) · Broadcast containment — routers do not forward broadcasts, so each interface is its own broadcast domain · NAT/PAT — many private addresses share one public IP, conserving IPv4 · DHCP server/relay — hands out IP addresses automatically · Firewall/ACLs, VPN (IPsec/SSL), QoS and traffic shaping, policy routing, NAT traversal, IPv6 support, logging and monitoring.
6. Advantages and Limitations
| Advantages | Limitations |
|---|---|
| Connects dissimilar networks (Ethernet ↔ fibre ↔ 4G/5G ↔ MPLS) | Higher latency per hop than a switch (software/hardware lookup) |
| Reduces broadcast traffic and isolates network segments | More expensive than switches/hubs |
| Intelligent path selection, load balancing, failover | Complex configuration; mistakes can black-hole traffic |
| Security boundary: ACLs, NAT, firewall, VPN | Cannot forward broadcasts (needed by some legacy protocols) |
| Scalable — the Internet is built from routers | A single misconfigured route can break connectivity widely |
7. Hub vs Switch vs Router vs Gateway
| Basis | Hub | Switch | Router | Gateway |
|---|---|---|---|---|
| Layer | 1 | 2 | 3 | Any (often 7) |
| Forwards | Bits | Frames (MAC) | Packets (IP) | Whole protocols/data |
| Connects | Devices in one LAN | Devices in one LAN | Different networks | Dissimilar/heterogeneous networks |
| Broadcast domain | One | One per VLAN | One per interface | Per design |
| Features | None | VLANs, MAC table | Routing, NAT, DHCP, ACL, VPN | Protocol translation |
8. Exam Points
- Define a router and explain how it forwards a packet (step by step) — 5-7 marks, very frequent.
- Differentiate hub, switch and router (tabular) — 5-7 marks, almost certain.
- Differentiate static and dynamic routing; name any three routing protocols — 5 marks, frequent.
- What is the default route and why is it needed? — 3 marks.
- Explain the role of a router in connecting a LAN to the Internet (NAT, DHCP, default gateway) — 5 marks.
- Why does a router not forward broadcast packets? — 3 marks.
- What is the difference between a Layer-3 switch and a router? — 3-5 marks.