Topic 4 Midterm Notes
Topic 4 Midterm Notes
Introduction to Routers
1. Routers: The Most Complex Networking Device in This Course
Routers are critical for managing network traffic in large-scale networks,
ensuring data packets reach the correct destination efficiently. They operate
at Layer 3 (Network Layer) of the OSI model and work with IP addresses to
make forwarding decisions.
4. Anatomy of a Router
A router is like a specialized computer with:
CPU & Memory: Has RAM, ROM, and a special OS (like Cisco IOS or
Juniper JunOS).
Interfaces/Ports: Each port connects to different networks and has a
specific role:
o WAN interfaces (e.g., Ethernet, Fiber, Serial) for connecting to
ISPs or external networks.
o LAN interfaces (e.g., Gigabit Ethernet) for internal connections.
o Management interfaces (e.g., Console, AUX, USB) for
configuration.
Routing Logic: Processes data using:
o Routing tables – store known routes to different networks.
o Routing protocols – dynamically update routing tables based on
network conditions.
o ACLs – filter and secure traffic.
Transport Layer: Functions & Protocols
The transport layer (Layer 4 of the OSI model) is responsible for ensuring
reliable (or fast) data transmission between devices by managing
segmentation, delivery, and error handling.
2️Broadcast Address
The last address in an IP subnet.
Used to send messages to all devices in the network.
All host bits are set to 1.
Devices use this to send announcements (e.g., ARP requests).
Example (Class C Network - /24):
For 192.168.1.0/24
Broadcast Address = 192.168.1.255
Any packet sent to 192.168.1.255 is received by all devices in
192.168.1.0/24.
Final Answer
For 192.168.1.64/26:
Network ID: 192.168.1.64
Broadcast Address: 192.168.1.127
Usable Host Range: 192.168.1.65 - 192.168.1.126
2. Broadcast Address
The Broadcast Address is the last address in a subnet.
It is used for sending messages to all devices in the network.
When a device sends a packet to the Broadcast Address, all hosts in
that subnet receive it.
Example: For 192.168.1.64/26, the Broadcast Address is
192.168.1.127.
Comparison Table
Address Type Layer Example Used For
Application (Domain Layer www.yorku.ca Human-friendly naming
Address Type Layer Example Used For
Name) 7
Layer Device identification,
Network (IP Address) 192.168.1.10
3 routing
Data Link (MAC Layer 00:1A:2B:3C:4D: Local network
Address) 2 5E communication
Key Takeaways
Application Layer → Human-readable (domain names).
Network Layer → Logical addressing (IP addresses for routing).
Data Link Layer → Physical addressing (MAC addresses for direct
communication).
2. Why Subnetting?
Problem:
An organization needs multiple internal networks, but getting multiple Class
A, B, or C addresses from an ISP isn't practical.
Solution: Subnetting
Instead of requesting multiple network addresses, one network address is
subdivided into multiple smaller subnets.
Key Benefits:
✔ Efficient IP allocation → No wasted addresses.
✔ Better traffic management → Routers use Net IDs to direct packets
efficiently.
✔ Greater network control → Security policies and VLANs can be applied per
subnet.
3. Planning a Subnet
When subnetting, you usually start with one of two requirements:
1️Given the number of required subnets, determine hosts per subnet.
2️Given the number of required hosts per subnet, determine the number of
subnets.
Each subnet has:
A unique Network ID
A range of usable Host IDs
A Broadcast Address
Subnetting Process
📌 Rule: We "borrow" bits from the Host ID to create a Subnet ID
📌 Formula for Hosts per Subnet:
Max Hosts=(2h)−2\text{Max Hosts} = (2^h) - 2Max Hosts=(2h)−2
(where h = number of bits remaining for Host ID)
📌 Formula for Subnets:
Max Subnets=2s\text{Max Subnets} = 2^sMax Subnets=2s
(where s = number of borrowed bits for Subnet ID)
Answering Questions
Q1: How many bits must remain in the Host ID portion?
We need at least 20 hosts per subnet. Using the host formula:
(2h)−2≥20(2^h) - 2 \geq 20(2h)−2≥20
Testing values:
h=5⇒(25)−2=30h = 5 \Rightarrow (2^5) - 2 = 30h=5⇒(25)−2=30 ✅
(Enough hosts)
h=4⇒(24)−2=14h = 4 \Rightarrow (2^4) - 2 = 14h=4⇒(24)−2=14 ❌
(Not enough hosts)
So, at least 5 bits must remain for the Host ID.
Final Answers
1️⃣ At least 5 bits must remain for the Host ID
2️⃣ Each subnet can support up to 30 hosts
3️⃣ A maximum of 8 subnets can be created
4️⃣ The subnet mask required is /27 (255.255.255.224)
Packet Forwarding & Next Hop Selection
Concept of Packet Forwarding
Routers are responsible for forwarding IP packets across networks.
A router determines where to send a packet next based on:
1. The destination IP address in the packet.
2. The router’s routing table.
Table-Driven Routing
Uses a static or dynamic routing table to determine the next hop.
Types:
1. Static Routing → Manually configured routes (used in small
networks).
2. Dynamic Routing → Routes learned automatically via routing
protocols (e.g., OSPF, BGP, RIP).
3. Default Routing → A fallback route for unknown destinations
(0.0.0.0/0).
Summary
Routers forward packets by looking up the destination IP address in their
routing table.
The best match (longest prefix) determines the next hop.
The router updates the Layer 2 header and forwards the packet via the
chosen interface.
If no route exists, the packet is sent to the default gateway or dropped.
How It Works
The router checks all network prefixes (subnet masks) in the routing
table.
It selects the route with the most specific (longest) subnet mask that
matches the destination IP address.
Example Routing Table
Destination
Subnet Mask Next Hop
Network
255.255.255.0
192.168.1.0 Router A
(/24)
255.255.255.128
192.168.1.128 Router B
(/25)
255.255.255.192
192.168.1.192 Router C
(/26)
Default
0.0.0.0 0.0.0.0 (/0)
Gateway
Key Takeaways
1. More specific prefixes take priority (higher subnet mask means a
smaller network, so it's more precise).
2. Routers perform a bitwise comparison to find the best match.
3. Default route (0.0.0.0/0) is the last resort when no other match exists.
3. Types of NAT
Type Description Common Use Case
One private IP is permanently Hosting a server
Static NAT
mapped to one public IP behind NAT
A private IP is mapped to a Businesses with
Dynamic NAT
public IP from a pool multiple public IPs
PAT (Port Address Multiple private IPs share a
Home networks &
Translation) aka "NAT single public IP using different
Small offices
Overload" port numbers
Routing Explained
Routing is how a packet gets from source to destination through a network,
guided by routers that use routing tables.
1. Types of Routing
1. Centralized Routing (Obsolete)
One central computer makes all routing decisions.
Not used anymore due to scalability issues and single point of failure.
2. Static Routing
Manually configured by a network admin.
Routing tables never change unless manually updated.
Used in small/simple networks where traffic is predictable.
Pros: Simple, no overhead.
Cons: Doesn’t adapt to network failures or congestion.
3. Dynamic Routing
Routers communicate and update routing tables automatically.
Adjusts routes in real time based on network conditions.
Used in large networks and the internet.
Pros: More efficient, adapts to failures/congestion.
Cons: Adds processing overhead on routers.
3. Routing Protocols
Routing protocols decide how routers share information.
Interior Routing Protocols (Inside an Autonomous System)
Used within a single organization’s network (e.g., a company or ISP).
Examples:
o RIP (Distance Vector, rarely used)
o OSPF (Link State, commonly used)
o EIGRP (Hybrid, used in Cisco networks)
Exterior Routing Protocols (Between Different Organizations/ISPs)
Used between different ISPs/networks on the internet.
Example:
o BGP (Border Gateway Protocol) → Used for routing between ISPs
and large networks.
Dynamic Routing
Routes update automatically based on network conditions.
Routers exchange information periodically or in response to link
changes.
Used in large and changing networks (e.g., the internet).
Example Protocols:
o OSPF, IS-IS (Link State)
o RIP, EIGRP (Distance Vector/Hybrid)
o BGP (for internet routing between ISPs)
🔹 Analogy: Google Maps updating your route in real time based on traffic
conditions.
Comparison Table
Classification Static Routing Dynamic Routing
Adaptability Manual updates Automatic updates
Small/stable Large/changing
Best for
networks networks
No automatic Automatically finds new
Failure Handling
recovery path
Configuration
High (manual) Low (self-updating)
Effort
Example None (manual
RIP, OSPF, BGP
Protocols routing)
2️.Administrative Autonomy 🏢
Organizations (e.g., ISPs, corporations, universities) want to manage
their own internal routing policies.
Each AS can choose its routing protocol (e.g., OSPF, EIGRP for internal
routing) instead of following a global standard.
Security and privacy: An AS can hide its internal network structure from
the outside world.
Example:
Google (AS15169) manages its own massive internal network using
custom routing policies.
ISPs like Bell (AS577) and Rogers (AS812) manage their own routing
policies while connecting to other ISPs.