Routing Fundamentals and Protocols
Routing Fundamentals and Protocols
Protocols
Contents
1 Introduction to Routers 3
1.1 What is a Router? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Router vs Switch vs Hub . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Role of Routers in Networks . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3.1 Example: Router placement in Computer Lab . . . . . . . . . . . 4
2 Router Architecture 6
2.1 Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 How Do Routers Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Routing Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.1 Structure of a Routing Table . . . . . . . . . . . . . . . . . . . . . 9
2.3.2 Example of a Routing Table . . . . . . . . . . . . . . . . . . . . . 9
2.3.3 Example Scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.4 Static vs. Dynamic Routing Tables . . . . . . . . . . . . . . . . . 10
1
5.6 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2
1 Introduction to Routers
1.1 What is a Router?
A router is a specialized network device responsible for forwarding data packets between
different networks. Unlike switches or hubs that operate mainly within a single network
or LAN, routers connect multiple distinct networks, such as linking a home network to
the Internet or connecting corporate LANs across various locations. Routers perform
packet forwarding based on the destination IP address contained in each packet, making
decisions about the optimal path to send the data further towards its destination.
Fundamentally, routers operate at the Network Layer (Layer 3) of the OSI model,
enabling logical addressing and inter-network communication. They examine the packet’s
header to extract addressing information and consult their internal routing tables to
determine the next hop. Routers help establish an internetwork by managing the traffic
flow between different subnetworks, ensuring that packets take the most efficient route.
This role makes routers a critical component in modern networking, especially with the
expansion of the Internet and large-scale enterprise networks.
Furthermore, routers are equipped to handle packet fragmentation, error detection,
and sometimes security functions such as filtering traffic and implementing access con-
trol lists (ACLs). Their functionality is foundational in enabling the complex, dynamic
routing environment of today’s interconnected systems.
3
Table 1: Comparison of Hub, Switch, and Router
This comparison illustrates the increasing complexity and functionality from hub to
router, aligning with their roles in network infrastructure.
Internet The cloud symbol represents the global Internet network providing exter-
nal connectivity. The connection is labeled ISP Link, indicating the Internet Service
Provider’s connection to the local network.
ISP Modem The ISP modem acts as the interface between the local network and the
ISP. It performs functions such as signal modulation and demodulation and acts as a
gateway to the Internet. It connects directly to the Internet via the ISP Link and to the
Router through the WAN Port.
4
Internet
ISP Link
ISP Modem
WAN Port
File Server PC
LAN Port
Router Lab-1 Switch
Printer
PC 1 PC 2
Router The Router is the central device managing data traffic between the Internet,
internal devices, and local networks. The WAN Port connects to the ISP modem for
external Internet access, while the LAN Port connects to the Lab-1 Switch, linking the
local computers. Additionally, it is directly connected to other devices such as a File
Server PC and a Printer, which are shared resources accessible by lab users. The Router’s
key functions include routing packets between the Internet and local devices, managing
IP addresses, and directing traffic efficiently.
Lab-1 Switch The Lab-1 Switch connects multiple devices within the computer lab
segment. It acts as a network bridge allowing PCs to communicate locally within the lab.
The Switch receives data from the Router’s LAN port and distributes it to the connected
PCs, providing efficient handling of local network traffic.
PC 1 and PC 2 These are individual computers used by students or lab users. They
are connected to the Lab-1 Switch for local network communication and Internet access.
They rely on the Router to manage external connectivity and routing.
Network Traffic Flow Inbound data from the Internet travels through the ISP Link,
ISP Modem, and Router’s WAN Port before being routed via the LAN Port to the Lab-1
Switch, which distributes it to the PCs. Outbound traffic from the PCs follows the reverse
path. Local traffic between PCs is handled directly by the switch without involving the
Router, improving efficiency. The File Server PC and Printer are connected directly to
the Router, allowing access by lab PCs and external users if necessary.
In summary, this network setup enables multiple devices within a computer lab to
share Internet access and resources such as file servers and printers, while facilitating
efficient internal communication. The Router plays a critical role in managing traffic
between internal networks and the external Internet, while the Switch handles local traffic
5
within the lab.
2 Router Architecture
Data Plane
Routing Processor
Routing Decisions
Control Plane
A router is a device that directs data packets between different networks. To under-
stand how it works, we divide its functions into two main parts: the Control Plane and
the Data Plane.
Data Plane: This is the part of the router that actually moves packets from one place
to another. It includes three main components:
Input Ports: These are like the doors where packets enter the router. They check
the packet headers to make sure the data is intact and ready to be processed.
Switching Fabric: Think of this as the router’s internal highway. It carries packets
from the input ports to the correct output ports as quickly as possible.
Output Ports: These are the exit doors where packets leave the router. They
manage packet order and timing, making sure data flows smoothly.
Example: Imagine a post office sorting mail. The input ports are where mail arrives,
the switching fabric is the conveyor belt moving mail to different sorting bins, and the
output ports are the bins where mail is grouped for delivery.
Control Plane: This is the “brain” of the router. It makes decisions about the best
path for each packet by running routing protocols and updating the routing tables. The
key component here is the Routing Processor.
Example: In the post office analogy, the control plane is like the supervisor who decides
which route each letter should take based on the destination address and available delivery
routes.
6
How They Work Together: The control plane figures out the best routes and updates
the routing table. The data plane then uses this information to quickly forward packets
without having to decide the route each time. This separation allows routers to handle
large amounts of data efficiently.
The coordination of these components enables the router to process and forward
packets efficiently, even at very high data rates. The routing processor also communicates
with network administrators for configuration and monitoring.
2.1 Routing
2.1.1 Definition
Routing is the fundamental process by which routers determine the path that data packets
take from a source to a destination across interconnected networks. This process involves
two major functions: path determination (finding the best route) and packet forwarding
(sending the packet along that route).
Routing enables devices in different physical or logical networks to communicate as
if they were part of the same network, by relaying packets through intermediate routers.
It plays a crucial role in internetwork communication, including the global Internet.
The complexity of routing depends on network size and topology. Small networks
may use fixed paths, whereas large and dynamic networks require routers to adapt routes
based on current network conditions such as congestion or failures.
Receiving Data Packets When a device (like your computer or smartphone) sends
data over a network, the data is divided into smaller units called packets. Each
packet contains several important pieces of information:
These packets travel from the source device to the first router in the network.
Examining the Destination Address Once the router receives a packet, it looks at
the destination IP address in the packet header. This tells the router where the
packet is supposed to go.
Consulting the Routing Table The router uses a routing table, which is like a map
of network paths, to decide the best next step for the packet. The routing table
contains:
7
– Metrics such as the cost or distance of each route.
Using this information, the router determines the most efficient path toward the
packet’s destination.
Making a Routing Decision Based on the routing table and routing algorithms, the
router chooses the best next hop for the packet. This could be:
Routing algorithms, such as Distance Vector or Link State protocols, help the router
make these decisions intelligently by calculating the shortest or fastest path.
Forwarding the Packet After deciding the next hop, the router forwards the packet
out through the appropriate interface (network connection) towards the next router
or device.
Handling Special Cases Routers also handle special tasks such as:
– Fragmentation: Breaking down large packets into smaller pieces if the next
network supports smaller packet sizes.
– Network Address Translation (NAT): Changing private IP addresses to
a public IP address when sending packets to the internet.
– Firewall Rules: Filtering packets to block unauthorized access or harmful
traffic.
Reaching the Destination This process repeats as packets hop from router to router
across different networks until they finally reach the destination device. The receiv-
ing device then reassembles the packets into the original data.
Consult Routing Table Select Best Path Forward Packet Next Routeror Destination
8
2.3.1 Structure of a Routing Table
A routing table consists of multiple entries, each corresponding to a destination network
or subnet. Each entry typically contains the following fields:
Destination Network: Specifies the network address or subnet that the route
covers. For example, [Link]/24.
Next Hop: Indicates the IP address of the next router to which packets should be
sent.
Metric: Represents a cost value associated with the route (e.g., hop count, delay,
bandwidth). Lower metric values indicate more preferred routes.
Route Source: Identifies how the route was learned (e.g., static, OSPF, BGP,
connected).
2. Searches the routing table for the longest prefix match — in this case, [Link]/24.
4. Forwards the packet out of the GigabitEthernet0/1 interface toward the next
router.
This process is called IP forwarding or route lookup. The router repeats this for
every incoming packet, ensuring efficient delivery to the correct destination.
9
2.3.4 Static vs. Dynamic Routing Tables
Routing tables can be maintained using two primary methods:
Static Routing: Routes are manually configured by network administrators. They
are suitable for small or stable networks but require manual updates if the network
topology changes.
Dynamic Routing: Routes are automatically updated through routing protocols
such as RIP (distance vector), OSPF (link state), and BGP (path vector). This
approach enables routers to adapt to topology changes and maintain efficient routes
automatically.
Routing Algorithms
Routing algorithms are techniques used in computer networks to determine the best path
for data packets to travel from a source to a destination across interconnected networks.
Their main goal is to find an optimal route based on criteria like shortest distance, lowest
cost, or minimum delay.
Routing algorithms operate within routers or network devices to ensure efficient data
transmission, improve network performance, and avoid congestion or failures. These
algorithms form the basis of routing protocols.
Primary Concepts
Path: The route or sequence of nodes through which data packets pass.
Metric: A value used to evaluate the best path (e.g., distance, cost, delay).
Convergence: The state when all routers have consistent routing information.
Dynamic Routing: Algorithms that adjust routes automatically as the network
changes.
Static Routing: Manually configured routes that remain fixed unless updated.
1. Static Routing
Routes are manually set by network administrators and do not change automatically.
Suitable for small or simple networks.
2. Dynamic Routing
Routes are determined automatically based on current network conditions. Dynamic
routing algorithms exchange routing information and adapt to changes.
Dynamic routing can be further divided into:
10
a) Distance Vector Routing
Routers maintain a table of distances to all destinations.
a) Flooding
Each incoming packet is sent through all outgoing links except the one it arrived
on.
11
b) Hierarchical Routing
The network is divided into regions or levels.
Routing decisions are made hierarchically to reduce routing table size and complex-
ity.
c) Hybrid Routing
Combines features of both distance vector and link state routing.
Examples include protocols like EIGRP (Enhanced Interior Gateway Routing Pro-
tocol).
Summary Table
Type Key Feature Example Pro- Advantages Disadvantages
tocol
Static Rout- Manually config- N/A Simple, low No adaptability
ing ured routes overhead
Distance Vec- Shares distance RIP Simple, easy to Slow convergence,
tor info with neigh- implement routing loops
bors
Link State Shares link state OSPF Fast conver- High memory and
info with all gence, reliable CPU usage
routers
Path Vector Shares full path BGP Scalable, loop- Complex, slower
info to avoid free routing updates
loops
Flooding Sends packets N/A Simple, guaran- High redundancy,
on all outgoing teed delivery congestion
links
Hierarchical Divides network N/A Scalable, re- Complex setup
into regions duces routing
table size
Hybrid Combines dis- EIGRP Efficient and More complex
tance vector and scalable
link state
12
Link State Protocols
Hybrid Protocols
Destination Network
The maximum hop count allowed in RIP is 15 hops. Any route with more than 15
hops is considered unreachable, which limits RIP to small or medium-sized networks.
RIP routers periodically exchange their entire routing tables with neighboring routers
every 30 seconds. This helps all routers update their knowledge of the network topology.
13
4.3 Working Steps
RIP performs route discovery and maintenance through the following steps:
1. Each router initializes its routing table with directly connected networks (hop count
= 0).
2. Every 30 seconds, routers broadcast their routing table to all neighboring routers.
3. Upon receiving a neighbor’s table, a router:
Adds 1 to the hop count of all received routes.
Compares these new routes with existing entries.
Updates its routing table if a shorter path is found.
4. This process continues until all routers have consistent routing tables.
5. If a route becomes unreachable, it is marked with hop count 16 (infinity).
Net A Net C
R1 R2 R3
R4
Net D
Explanation:
R1 is directly connected to Network A.
14
4.5 Step-by-Step Routing Table Updates
Step 1: Initial State
Each router knows only its directly connected network.
Similarly, R2 knows R1, R3, and R4; R3 knows Net C; R4 knows Net D.
Step 2: Exchange of Routing Tables
R1 sends its routing table to R2. R2 updates its table:
R2 learns about Net A via R1 with a hop count of 1.
R3 and R4 similarly send updates to R2, and R2 learns about Net C and Net D.
Step 3: Propagation
R2 now advertises its updated table to R1, R3, and R4.
R1 learns about Net C and Net D via R2 (2 hops).
R3 learns about Net A and Net D via R2 (2 hops).
R4 learns about Net A and Net C via R2 (2 hops).
Final Converged Table (Example for R1):
All routers eventually converge with complete routing knowledge of the network.
15
4.7 Variants of RIP
RIP v1: Classful protocol (does not support subnet masks).
4.8 Applications
RIP is primarily used in:
4.9 Summary
RIP provides a foundational understanding of how routing protocols exchange information
dynamically. Although it has been largely replaced by more advanced protocols such as
OSPF and EIGRP, it remains a key educational tool for understanding distance vector
routing concepts.
4. Uses the Dijkstra Algorithm to calculate the shortest path to every destination.
OSPF organizes routers into areas, reducing routing overhead. The backbone area
(Area 0) connects all other areas.
16
5.2 Network Topology Example
Area 0
R1 R2 R3
R4
Area 1
Explanation: Routers R1, R2, and R3 belong to the backbone (Area 0), while R4
belongs to Area 1. R2 acts as an Area Border Router (ABR) connecting both areas.
5.4 Advantages
Efficient for large and complex networks.
Rapid convergence.
No routing loops.
17
5.5 Limitations
More complex configuration than RIP.
5.6 Applications
Used in large enterprise and service provider networks.
3. Routing Table: Contains the best paths selected from the topology table.
EIGRP shares only partial updates when changes occur, making it bandwidth-efficient.
R1 R2
R3
R4
Explanation: Each router shares its topology and neighbor information using EIGRP
packets. The DUAL algorithm ensures loop-free and efficient path calculation.
18
6.3 EIGRP Metrics
EIGRP uses a composite metric that includes:
6.4 Advantages
Faster convergence than RIP and OSPF.
6.5 Limitations
Proprietary to Cisco (though later partially open).
6.6 Applications
Used in Cisco-based enterprise networks.
19
7.2 BGP Network Example
AS 100 AS 200
eBGP Session
R1 R2 R3 R4
Explanation:
Local Preference: Used to choose the preferred exit point from an AS.
7.4 Advantages
Scalable and reliable for inter-domain routing.
7.5 Limitations
Slow convergence compared to OSPF or EIGRP.
7.6 Applications
Used by ISPs and Internet backbone providers.
20
8 Comparative Summary of Routing Protocols
8.1 Summary
RIP, OSPF, EIGRP, and BGP represent the evolutionary stages of routing protocols.
Together, these protocols form the backbone of modern computer networks and the
Internet.
21