π Lecture 43 β Network Address Translation (NAT)
π Overview: This lecture explains the concept of Network Address Translation (NAT), a simpler approach to address allocation that allows multiple devices on a local network to share a single public IP address. It is particularly important for Small Office/Home Office (SOHO) networks where ISPs may not have contiguous address ranges available.
ποΈ Topics Covered
The lecture covers the fundamental concept of NAT as defined in RFC 2663, its application in SOHO networks to solve IP address allocation problems, and a detailed example showing how a NAT-enabled router manages communication between multiple devices on a private network (10.0.0.0/24) and the public internet using a single IP address (138.76.29.7).
π Lecture Summary
Introduction to NAT
A Small Office Home Office (SOHO) subnet connects devices such as cameras, computers, smartphones, and game consoles. Every IP-capable device needs an IP address. A SOHO needs a range of addresses that can be allocated by the ISP. With 32 bits, possible IP addresses are equal to 2Β³Β² or 4 billion.
If the subnet grew bigger, a larger block of addresses would have to be allocated. But what if the ISP had already allocated the contiguous portions of the SOHO network's current address range? Network Address Translation (NAT) is a simpler approach to address allocation. It is defined in RFC 2663 and has found increasingly widespread use.
π‘ Why this matters: NAT solves the critical problem of IPv4 address exhaustion by allowing many devices to share a single public IP address, which is why it is used in virtually every home and small office network today.
An Example
Assume a home network with 3 computers. A NAT-enabled router, residing in the home, has an interface that is part of the home network. All four interfaces in the home network have the same subnet address of 10.0.0.0/24.
In Figure 43.1 (described in text), the NAT-enabled router has:
- An interface on the local home network with IP address 10.0.0.45
- An interface on the public internet with IP address 138.76.29.7
- Three devices connected to the local network: 10.0.0.1, 10.0.0.2, and 10.0.0.3
π Definition β NAT (Network Address Translation): A method by which IP addresses are mapped from one address realm to another, typically allowing multiple devices on a private network to share a single public IP address when communicating with external networks.
π NAT Addressing Scheme:
- Private (local) addresses: 10.0.0.0/24 (used within the home network)
- Public (global) addresses: 138.76.29.7 (used for internet communication)
π Example: There can be hundreds of home networks, many using the same address space, 10.0.0.0/24. Devices within a given home network can send packets using 10.0.0.0/24 addressing. When packets are sent to or from the internet, the NAT-enabled router translates between private and public addresses, allowing all devices in the home network to appear as a single device with IP address 138.76.29.7 to the outside world.
π‘ Why this matters: The use of the 10.0.0.0/24 private address space across many independent home networks is possible because these addresses are not globally unique β they only need to be unique within each local network, and NAT handles the translation to the public internet.
β Key Takeaways
NAT is defined in RFC 2663 and provides a practical solution to IPv4 address exhaustion by allowing multiple devices on a private network to share a single public IP address. In a SOHO network, a NAT-enabled router interfaces both the private network (using addresses like 10.0.0.0/24) and the public internet (using an ISP-assigned address like 138.76.29.7). Thousands of different home networks can independently use the same private address space (e.g., 10.0.0.0/24) because these addresses are not globally routable. The fundamental mechanism of NAT involves translating private source addresses to the public IP address for outbound traffic and performing reverse translation for inbound traffic.
π§ Quick Revision Questions
- What does NAT stand for and in which RFC is it defined?
- Why is NAT important for SOHO networks when ISPs have already allocated contiguous portions of an address range?
- In the example given, what private subnet address space is used by all interfaces within the home network?
- What is the public IP address of the NAT-enabled router's interface connected to the internet in the example?
- How can hundreds of different home networks all use the same 10.0.0.0/24 address space without conflicts?
π Lecture 44 β Dynamic Host Configuration Protocol (DHCP)
π Overview: This lecture explains how devices automatically obtain IP addresses when joining a network using DHCP. It covers the motivations for dynamic address assignment, compares manual vs automatic configuration, and presents real-world examples showing why DHCP is essential for networks with many transient users.
ποΈ Topics Covered
The lecture covers the limitations of manual IP configuration explained in the context of network address translation motivations, followed by a detailed explanation of DHCP as a plug-and-play protocol. Two motivating examples illustrate DHCP's practical necessity: a student moving between subnets on a campus, and an ISP managing limited IP addresses for many customers. The client-server architecture of DHCP is introduced.
π Lecture Summary
Motivations for Network Address Translation
The NAT-enabled router hides the details of the home network from the outside world. It behaves as a single device with a single IP address (138.76.29.7) to the external world. All traffic leaving has source IP 138.76.29.7, and all incoming traffic must have destination 138.76.29.7.
π‘ Why this matters: Without NAT, every device would need a globally unique public IP address, which is impractical for home networks.
Three key motivations for using a single IP address:
- Range of addresses not needed from ISP
- Addresses of devices in local network can change without notifying outside world
- ISP can change without changing addresses of devices in local network
Dynamic Host Configuration Protocol (DHCP)
An organization obtains a block of IP addresses from an ISP and assigns them to host and router interfaces. Host addresses can be configured in two ways:
-
Manual configuration: performed by a system administrator
- Windows: control-panel β network β configuration β tcp/ip β properties
- UNIX: /etc/rc.config
-
DHCP: allows a host to dynamically obtain its IP address from network server when it joins network. Because a host gets connected automatically, it is a "plug-and-play" protocol.
Motivating Example 1
A student carrying a laptop from a dormitory room to a library to a classroom connects to a new subnet in each location and will need a new IP address each time.
Motivating Example 2
A residential ISP has 2,000 customers, but no more than 400 customers are ever online simultaneously. The ISP does not need 2,048 IP addresses; only gets a block of 512 IP addresses. As hosts join and leave, the DHCP server allocates an arbitrary address from its current pool of available addresses. Each time a host leaves, its address is returned to the pool.
DHCP is ideally suited to these situations because there are many users coming and going, and addresses are needed for only a limited amount of time. DHCP is a client-server protocol. A client is typically a newly arriving host wanting to obtain network configuration information, including an IP address for itself.
β Key Takeaways
DHCP automates IP address assignment, making it ideal for networks with transient users like students moving between campus subnets or ISPs with many customers but limited address blocks. The protocol operates on a client-server model where hosts request addresses dynamically and return them when they leave, enabling efficient use of limited IP address pools. Manual configuration remains an alternative but requires administrator intervention for each device. DHCP's plug-and-play nature eliminates the need for users to understand network configuration details.
π§ Quick Revision Questions
- What are the two methods for assigning IP addresses to hosts in an organization?
- In the ISP example, how many IP addresses does the ISP need to purchase for 2,000 customers if only 400 are online at once?
- What happens to a DHCP-assigned IP address when a host leaves the network?
- Which protocol architecture does DHCP use (client-server or peer-to-peer)?
- Why is DHCP called a "plug-and-play" protocol?
π Lecture 45 β Internet Control Message Protocol (ICMP)
π Overview: This lecture covers the Internet Control Message Protocol (ICMP), a key component of the network layer used for error reporting and informational messaging. Understanding ICMP is critical because it underpins essential network diagnostic tools like ping and traceroute, which are used daily to troubleshoot network connectivity.
ποΈ Topics Covered
This lecture explains the role and structure of ICMP within the network layer, including its use for error messages (unreachable host, network, port) and informational messages (echo request/reply). It details how ICMP messages are carried within IP datagrams and provides in-depth explanations of how the ping and traceroute tools leverage ICMP to test reachability and trace network paths.
π Lecture Summary
The Internet Control Message Protocol (ICMP)
ICMP is one of the three major components of the Network Layer, alongside the IP protocol and the routing component. It provides a facility to report errors in IP datagrams. ICMP is used by hosts and routers to communicate network-layer information to each other.
ICMP handles two main categories of messages:
- Error messages: Such as unreachable host, unreachable network, unreachable port, etc.
- Informational messages: Such as echo request and echo reply.
ICMP is often considered part of IP, but architecturally lies just above IP. ICMP messages are carried in IP datagrams as the IP payload. An ICMP message consists of the type, code, and the first 8 bytes of the IP datagram that caused the ICMP message to be generated. This allows the sender to determine which datagram caused the error.
π‘ Why this matters: The inclusion of the first 8 bytes of the offending datagram is crucial for the original sender to identify and respond to the specific problem.
Many tools obtain information about the Internet by sending probes and waiting for ICMP responses. Common examples include ping and traceroute.
Ping and ICMP
The ping program sends a datagram to a specified destination to test if it can be reached. It reports the results by declaring whether the destination responds. Ping uses ICMP echo messages.
When a user invokes ping with an IP address or hostname:
- The ping program sends a datagram containing an ICMP type 8 code 0 message (echo request) to the specified host.
- The destination host, upon seeing an echo request, sends back a type 0 code 0 ICMP echo reply message.
π Definition β Ping: A network utility that sends ICMP echo request messages to a target host to test reachability and measure round-trip time.
π Example: To test if 8.8.8.8 is reachable, a user runs ping 8.8.8.8. The ping program sends an ICMP echo request (type 8, code 0) to 8.8.8.8. If the host is reachable, it responds with an ICMP echo reply (type 0, code 0), and the ping program reports the result.
Traceroute & ICMP
Traceroute allows a user to trace a route from a host to any other host in the world. It employs two types of ICMP messages: TTL expired and destination port unreachable.
The source sends a series of IP datagrams to the destination. Each datagram carries a UDP segment with an unlikely UDP port number.
The process works as follows:
- The source sends a datagram with TTL = 1.
- The first router decrements the TTL to 0, discards the datagram, and sends an ICMP TTL expired message back to the source. This identifies router 1.
- The source then sends a datagram with TTL = 2, which gets past the first router but expires at the second router, which sends back a TTL expired message. This identifies router 2.
- This process repeats. When the datagram finally reaches the destination host, the TTL has not expired. However, the UDP segment contains an unlikely port number.
- The destination host sees this and sends back an ICMP destination port unreachable message.
- The source knows it has reached the destination when it receives a "destination port unreachable" message, as opposed to a "TTL expired" message.
π Definition β Traceroute: A network diagnostic tool that sends a series of IP datagrams with increasing TTL values to map the network path (routers) between a source and a destination.
π Formula: TTL incrementally increased by 1 for each successive probe β each hop's router discards the packet and replies with an ICMP "time exceeded" message.
π Example: To trace the route to google.com, the traceroute program first sends a packet with TTL=1 to google.com. The first router on the path (e.g., 192.168.1.1) drops the packet and sends an ICMP TTL expired message back. Traceroute records this IP address. It then sends a packet with TTL=2. The second router (e.g., 10.0.0.1) sends back the TTL expired message. This continues until a packet reaches google.com, which replies with a "destination port unreachable" message because of the unlikely UDP port, signaling the end of the path.
β Key Takeaways
ICMP is a fundamental network-layer protocol used by hosts and routers for error reporting (unreachable hosts, networks, ports) and informational queries. It is architecturally above IP but is carried as payload within IP datagrams, and its messages include the first 8 bytes of the offending datagram for context. The ping tool leverages ICMP echo request (type 8) and reply (type 0) messages to test host reachability. The traceroute tool cleverly exploits TTL expiration and destination port unreachable ICMP messages to discover the sequence of routers along a network path.
π§ Quick Revision Questions
- What are the three major components of the Network Layer?
- What is the role of the type and code fields in an ICMP message?
- How does the ping program use ICMP to verify host reachability?
- Explain how the traceroute program uses TTL to discover each router on a path to a destination.
- How does the destination port unreachable ICMP message indicate the end of the path traced by traceroute?
π Lecture 46 β End-to-End: Processing IP Packet
π Overview: This lecture explains how IP packets are processed along the end-to-end route, focusing on the problem of fragmentation when packet size exceeds the Maximum Transmission Unit (MTU) of a link-layer protocol. It covers the stopping criterion for traceroute, the concept of MTU, and how routers fragment oversized datagrams, with reassembly performed only at the destination host.
ποΈ Topics Covered
The lecture begins with the stopping criterion for traceroute using ICMP "destination port unreachable" messages. It then introduces the concept of Maximum Transmission Unit (MTU) as a hard limit on IP datagram length imposed by link-layer protocols. The problem arises when different links along a route have different MTUs. The solution is fragmentation of the IP datagram into smaller fragments, which are reassembled only at the destination end system to keep the network core simple.
π Lecture Summary
The Stopping Criterion
The traceroute utility stops when an UDP segment eventually arrives at the destination host. The destination returns an ICMP "destination port unreachable" message (type 3, code 3). When the source host receives this ICMP message, it stops sending probes.
π Definition β Traceroute stopping criterion: The process ends when the UDP probe reaches the destination, which replies with an ICMP "destination port unreachable" message, signaling the source to stop.
End-to-End: Processing IP Packet
In this topic, we describe fragmentation, i.e., processing of IP packets along the end-to-end route.
At the link-layer, an IP datagram is encapsulated within a link-layer frame. All link-layer protocols cannot carry network-layer packets of the same size. For example, Ethernet frames can carry up to 1500 bytes of data. The maximum amount of data a link-layer frame can carry is called Maximum Transmission Unit (MTU). The MTU of the link-layer protocol places a hard limit on the length of an IP datagram.
Problem
Each of the links along the route between sender and destination uses different link-layer protocols with different MTUs. When a router is about to forward an IP packet, it may find that its length is greater than the MTU of the outgoing link.
π Example: A router receives an IP datagram of 4000 bytes but the outgoing link has an MTU of 1500 bytes. This datagram cannot be forwarded as a single unit.
Solution
Fragment the data in the IP datagram into two or more smaller IP datagrams, and encapsulate each of these smaller IP datagrams in a separate link-layer frame.
IP Reassembly & Fragmentation
Each of these smaller datagrams is referred to as a fragment. Fragments need to be reassembled before they reach the transport layer at the destination. Both TCP and UDP are expecting to receive complete, un-fragmented segments from the network layer. Datagram reassembly is done only in the end systems. This design choice keeps the network core simple by avoiding the complexity of reassembly inside routers.
π Definition β Fragmentation: The process of dividing an IP datagram into smaller pieces when its length exceeds the MTU of the outgoing link.
π Definition β Reassembly: The process of reconstructing the original IP datagram from its fragments, performed only at the destination host.
π‘ Why this matters: Reassembly at the end system rather than at intermediate routers reduces processing load on routers and simplifies the network core, which is a fundamental design principle of the Internet.
β Key Takeaways
An IP datagram must fit within the MTU of the link-layer protocol used on each link. Since different links may have different MTUs, routers along the path may need to fragment oversized datagrams into smaller units. These fragments are called fragments and must be reassembled before reaching the transport layer at the destination. Crucially, reassembly is performed only at the destination end system, not at intermediate routers, to keep the network core simple. The traceroute utility stops when the destination replies with an ICMP "destination port unreachable" message.
π§ Quick Revision Questions
- What is the stopping criterion for traceroute, and what ICMP message triggers it?
- Define Maximum Transmission Unit (MTU) and explain why it is a problem for IP datagrams.
- What solution does the IP protocol use when a datagram is larger than the MTU of the outgoing link?
- Where does datagram reassembly occur β at intermediate routers or at the destination? Why?
- Why must fragments be reassembled before the transport layer receives the data?
π Lecture 47 β A Link State Routing Algorithm
π Overview: This lecture explains the working of a link state routing algorithm, which routers use to configure forwarding tables. It focuses on how global knowledge of network topology and link costs enables each router to compute the least-cost path from senders to receivers.
ποΈ Topics Covered
The lecture covers the role of routing algorithms in configuring forwarding tables, the concept of a "good" path using least-cost metrics (e.g., physical length, link speed, monetary cost), and the core operation of the link state routing algorithm which uses global information where each node broadcasts identities and costs of its attached links.
π Lecture Summary
IP Reassembly & Fragmentation (Context from Prior Lecture)
There are three fields in the IP header that support fragmentation and reassembly. Identification allows a destination host to determine which datagram a newly arrived fragment belongs to, and a sender increments this identification number for each datagram. MF stands for "more fragments" and is set for all fragments except the last one. Fragmentation offset tells where in the current datagram this fragment belongs.
The Role of Routing Algorithms
When an IP packet arrives to a router, the router indexes a forwarding table and determines the link interface to which the packet is to be directed. Routing algorithms, operating in network routers, exchange and compute the information that is used to configure these forwarding tables. The job of routing is to determine good paths from senders to receivers, through the network of routers. A "good" path is one that has the least cost, for example, based on the physical length of the link, link speed, or monetary cost associated with it.
How Link State Routing Works
The Link State routing algorithm uses global information such as network topology, and all link costs are known by every router. Each node broadcasts the identities and costs of its attached links to all other nodes in the network. This allows every router to have a complete and identical view of the network, enabling it to independently compute the least-cost path to every destination.
π‘ Why this matters: Because every node has the full map, it can run an algorithm like Dijkstra's to find the optimal path, ensuring efficient data delivery.
β Key Takeaways
The link state routing algorithm relies on global, complete knowledge of the network topology and all link costs. Routers use this algorithm to configure forwarding tables that direct incoming IP packets to the correct outgoing link interface. A "good" path is defined as the least-cost path, where cost metrics can include physical length, link speed, or monetary cost. In this algorithm, each node must broadcast its connected link identities and their costs to all other routers. This distributed global knowledge allows each router to compute the shortest path independently.
π§ Quick Revision Questions
- What three fields in the IP header are used for fragmentation and reassembly?
- What is the primary job of a routing algorithm in a network of routers?
- What defines a "good" path in the context of the link state routing algorithm?
- What type of information does the link state routing algorithm require to operate?
- How does a node participate in the link state routing algorithm to share its local information?
π Lecture 48 β Distance Vector Routing Algorithm
π Overview: This lecture explains the working of a distance vector routing algorithm, a fundamental approach in computer networking for determining the shortest paths between nodes in a network. It introduces the Bellman-Ford Equation and describes how nodes iteratively exchange and update routing information to converge on the least-cost paths, which directly informs the entries in a node's forwarding table.
ποΈ Topics Covered
The lecture begins with the notations used for link costs, path costs, and predecessor nodes. It then introduces the Bellman-Ford Equation as the basis for computing least-cost paths, followed by a detailed explanation of the routing information each node maintains (costs to neighbors, its own distance vector, and neighbors' distance vectors). Finally, it covers the basic iterative process where nodes exchange distance vectors, update their estimates, and propagate changes until convergence.
π Lecture Summary
Notation
The following notations are used throughout the algorithm: c(x,y) is the link cost from node x to y, which is set to β if they are not direct neighbors. D(v) is the current value of the cost of the path from the source to destination v. p(v) is the predecessor node along the path from source to v. N' is the subset of nodes already included in the shortest path tree.
Bellman-Ford Equation
If dx(y) is defined as the cost of the least-cost path from node x to node y, then the Bellman-Ford equation states: dx(y) = min {c(x,v) + dv(y)}, where the minimum is taken over all neighbors v of x. The node that achieves this minimum is the next hop in the shortest path. Thus, the solution to the Bellman-Ford equation provides the entries in a nodeβs forwarding table.
π Definition β dx(y): the cost of the least-cost path from node x to destination y. π Formula: dx(y) = min {c(x,v) + dv(y)} β the least cost from x to y equals the minimum, over all neighbors v of x, of the direct cost from x to v plus the least cost from v to y. π Example: If node x has neighbors v1 and v2, with c(x,v1)=2, c(x,v2)=5, and it knows dv1(y)=3 and dv2(y)=1, then dx(y) = min{2+3, 5+1} = min{5,6} = 5, so the next hop is v1.
Routing Information Maintained by Each Node
Each node x maintains the following routing information:
- For each neighbor v, the cost c(x,v).
- Node xβs own distance vector Dx = [Dx(y): y β N], where Dx(y) is an estimate of the cost of the least-cost path from itself to y.
- The distance vectors of each of its neighbors, i.e., Dv = [Dv(y): y β N] for each neighbor v of x.
π‘ Why this matters: Maintaining these three pieces of information allows each node to independently compute shortest paths using only local knowledge and information exchanged with neighbors.
Basic Idea of the Distance Vector Algorithm
From time to time, each node sends a copy of its distance vector to each of its neighbors. When a node x receives a new distance vector from any of its neighbors v, it saves vβs distance vector, and then uses the Bellman-Ford equation to update its own distance vector. If xβs distance vector has changed as a result of this update step, x will then send its updated distance vector to each of its neighbors, which can in turn update their own distance vectors. The estimate Dx(y) converges to the actual least cost dx(y).
π Definition β Distance Vector (Dx): an array of estimates of the costs of the least-cost paths from node x to all other nodes y in the network. π Convergence: The iterative exchange and updating process ensures that over time, each node's estimated distance Dx(y) approaches the true least cost dx(y).
β Key Takeaways
The Distance Vector Routing Algorithm relies on the Bellman-Ford Equation, which states that the least cost from a node to a destination is the minimum over neighbors of the sum of the direct link cost and the neighbor's least cost to that destination. Each node must maintain its own distance vector, its neighbors' distance vectors, and the costs to its direct neighbors. The algorithm operates iteratively: nodes exchange their distance vectors with neighbors, update their own estimates using the equation, and propagate any changes. This process continues until all distance vectors converge to the true least-cost paths. The node that provides the minimum cost in the Bellman-Ford equation becomes the next hop in the forwarding table.
π§ Quick Revision Questions
- In the notation, what does c(x,y) represent, and what special value does it take if x and y are not direct neighbors?
- Write the Bellman-Ford equation for dx(y), and explain what the min function is taken over.
- What three pieces of routing information does each node x maintain?
- Describe the basic step-by-step process that occurs when a node x receives a new distance vector from a neighbor v.
- What does it mean for the estimate Dx(y) to converge to dx(y)?
π Lecture 49 β Working of Default Gateway Router
π Overview: This lecture explains how a default gateway router functions in an internetwork when a host wants to access a remote web server. Using Hannah's request to reach
www.example.com, it illustrates how packets traverse multiple IP networks, relying on the default gateway to forward traffic beyond the local subnet.
ποΈ Topics Covered
The lecture covers the definition and purpose of a default gateway router, the packet flow from a source host in one IP network to a destination server in another, the role of routing tables and ARP, and how the router forwards data across three different IP networks.
π Lecture Summary
Working of Default Gateway Router
This section walks through the scenario where Hannah wants to access www.example.com on a webserver. The internetwork has three different IP networks, each with a unique IP network number. The key is the default gateway router, which acts as the exit point for packets leaving the local network.
π Definition β Default Gateway Router: A router that serves as the forwarding host for packets destined for networks outside the local subnet. It is the first hop for any off-network traffic. π Example: Hannah's computer (on IP network A) sends a packet to the webserver (on IP network C). The packet is first sent to the default gateway router (on network A), which then routes it through network B to finally reach the webserver on network C. This relies on the router's routing table and ARP to find the next hop.
π‘ Why this matters: Without a default gateway, a host can only communicate within its own subnet. The default gateway is essential for accessing any resource on a different IP network, like websites or remote servers.
β Key Takeaways
- A default gateway router is the critical device that allows hosts to send packets to destinations outside their local IP network.
- When a host (e.g., Hannah) wants to reach a remote server, it sends the packet to the default gateway, which then uses its routing table to forward the packet across multiple networks.
- The internetwork in the example consists of three IP networks, and the packet traverses each hop, relying on ARP for MAC address resolution at each step.
- The default gateway must have an IP address in the same subnet as the host for the host to reach it directly.
- The process assumes the Distance Vector (DV) algorithm has converged, ensuring routing tables are up-to-date.
π§ Quick Revision Questions
- What is the role of a default gateway router in IP networking?
- In the example, what is the first device Hannah's packet is sent to when accessing
www.example.com? - How many different IP networks are involved in the scenario described?
- What protocol is used by the default gateway to find the MAC address of the next hop?
- Why must the default gateway's IP address be on the same subnet as the sending host?
π Lecture 50 β Address Resolution Protocol
π Overview: This lecture explains how IP packets are transmitted over Ethernet networks through encapsulation and the Address Resolution Protocol (ARP). It describes the critical process by which a host determines the MAC address of its default gateway router to deliver packets to destinations on other networks.
ποΈ Topics Covered
The lecture covers two main issues: how IP packets are encapsulated in Ethernet frames for transmission over LANs, and how a host learns the Ethernet (MAC) address of its default router using ARP. It explains the roles of DHCP for learning the router's IP address, ARP broadcasts for MAC address discovery, and the encapsulation process where IP packets are placed between Ethernet headers and trailers.
π Lecture Summary
The Problem β Two Issues
A PC like Hannah's cannot send an IP packet directly over an Ethernet; it must send an Ethernet frame. The IP header contains the destination web server's IP address, but there is no field for the default gateway IP address. Hannah must find a way to ensure that R1 (her default router) receives the packet.
π Definition β Default router/gateway: The router to which a PC sends packets when the destination is in another network or subnet.
Solution of Issue 1 β Encapsulation
Hannah encapsulates the IP packet in an Ethernet frame for transmission over the LAN. Ethernet places the IP packet between a header and a trailer. The Ethernet header contains source and destination Ethernet address fields. The trailer contains a Frame Check Sequence (FCS) field to detect transmission errors.
π Concept: Encapsulation β The process of wrapping an IP packet inside an Ethernet frame (header + data + trailer) for transmission over a LAN.
Solution of Issue 2 β Getting R1's MAC Address
To deliver the packet to R1, Hannah must include R1's Ethernet (MAC) address as the destination in the Ethernet frame. She learns the IP address of the default router either manually or via Dynamic Host Configuration Protocol (DHCP). To learn the MAC address of R1, Hannah uses the Address Resolution Protocol (ARP).
π Definition β ARP (Address Resolution Protocol): A protocol used to map a known IP address to an unknown Ethernet (MAC) address on a local network.
Hannah generates an ARP broadcast β a request saying "Hey, if this is your IP address, tell me your Ethernet MAC address." Every device on the LAN receives this broadcast because the switch forwards LAN broadcasts to all devices in the network.
π Example: Hannah knows R1's IP address (e.g., 192.168.1.1) from DHCP. She does not know R1's MAC address. She sends an ARP broadcast frame to all devices: "Who has IP 192.168.1.1? Tell me your MAC address." R1 replies with its MAC address (e.g., 00:1A:2B:3C:4D:5E). Hannah now encapsulates the IP packet in an Ethernet frame with R1's MAC as destination and sends it to R1.
π‘ Why this matters: Without ARP, a host cannot determine the hardware address needed to deliver an IP packet to the next-hop router, making communication across networks impossible.
β Key Takeaways
The lecture explains that IP packets cannot be sent directly over Ethernet β they must be encapsulated in Ethernet frames with source/destination MAC addresses and an FCS trailer. The destination IP in the packet header is the final web server, not the router, so a host must separately learn its default gateway's MAC address. This is accomplished through ARP, where a host broadcasts "Who has this IP?" and the router with that IP unicasts back its MAC address. The default gateway's IP address itself is learned via manual configuration or DHCP.
π§ Quick Revision Questions
- What is the two-part solution for delivering an IP packet from a host to a router on the same Ethernet?
- How does a host learn the IP address of its default gateway?
- What specific information does an ARP broadcast request ask for?
- Why does the IP header not include the default gateway's IP address?
- What is the role of the Frame Check Sequence (FCS) in the Ethernet trailer?
π Lecture 51 β Routerβs Routing Logic and Table
π Overview: This lecture explains the three-step process a router uses when forwarding packets across an internetwork, from de-capsulation through encapsulation. It covers how routers make forwarding decisions using routing tables and ARP, and examines how the logic differs between intermediate routers and the final router directly connected to the destination.
ποΈ Topics Covered
The lecture covers the three steps of router packet forwarding: de-capsulation (checking frame errors and removing headers), forwarding decision (using the IP routing table to determine next hop), and encapsulation (creating a new frame with appropriate MAC addresses). It also explains the difference between an intermediate router and the final router, including how ARP is used to learn MAC addresses.
π Lecture Summary
Routerβs Routing Logic and Table
This section introduces the scenario of Hannah's PC accessing www.example.com across an internetwork with three different IP networks, each with one IP network number. As R1 receives the packet, it must forward it to R2 next. The process breaks down into three steps: de-capsulation, deciding where to forward the packet, and encapsulation.
π‘ Why this matters: Understanding these three steps is fundamental to grasping how routers move data across networks, forming the backbone of internet communication.
Step 1: De-capsulation
R1 checks the incoming frame's FCS (Frame Check Sequence). If there are errors, the frame is discarded. Otherwise, the router removes the frame header and trailer, leaving the original IP packet with source address 8.1.1.1 and destination address 130.4.3.3.
Step 2: Decide Where to Forward the Packet Next
A router makes a forwarding decision by examining the destination IP address of the IP packet. For routing to work well, the router needs to know how to reach the various IP networks and subnets in the internetwork. This information is contained in a routing table. RIP and OSPF are examples of routing protocols that help build routing tables.
π Definition β Routing Table: A data structure stored in a router that contains information about how to reach various IP networks and subnets in the internetwork.
Step 3: Encapsulation
At this point, R1 has an IP packet sitting in memory. To send the IP packet out on interface E2, R1 needs to encapsulate it in a new Ethernet frame. In the newly created frame: the source MAC address is the MAC address of R1's E2 interface, and the destination MAC address is the MAC address of R2. If R1 does not know R2's MAC address, it uses ARP (Address Resolution Protocol) to find R2's MAC address and stores it in a cache for future use.
π Definition β ARP (Address Resolution Protocol): A protocol used to discover the MAC address associated with a given IP address on a local network.
π Example: If R1 needs to send a packet to R2 but only knows R2's IP address, R1 broadcasts an ARP request asking "Who has IP address X?" R2 responds with its MAC address, which R1 caches for future communications.
Logic of Final Router
R2 follows the same logic as R1, except R2's routing table differs from R1's. Since R2 is the final router, it does not need to send the packet to another router; instead, it sends the packet directly to the web server.
From R2 to the web server: R2 creates a new Ethernet frame using its own Ethernet address on the outgoing interface as the source MAC. R2 uses ARP to learn the web server's MAC address and uses it as the destination MAC in the frame.
π Definition β Final Router: The last router in the path that has a direct connection to the destination network, allowing it to forward packets directly to the destination host without going through another router.
β Key Takeaways
The router's packet forwarding process involves three critical steps: de-capsulation (checking FCS and removing frame headers), routing table lookup (using the destination IP to decide the next hop), and encapsulation (creating a new frame with source and destination MAC addresses). Intermediate routers forward packets to the next router, while the final router sends packets directly to the destination host. ARP is essential for learning MAC addresses when they are not already cached. The routing table is the core database that enables routers to make correct forwarding decisions, and protocols like RIP and OSPF help populate these tables dynamically.
π§ Quick Revision Questions
- What are the three steps a router performs when forwarding a packet?
- What does the router check in the incoming frame during de-capsulation?
- What information does a router use from the IP packet to make its forwarding decision?
- What is ARP and why does a router need it during encapsulation?
- How does the logic of a final router differ from an intermediate router when forwarding a packet?
π Lecture 52 β Routing with Subnets
π Overview: This lecture explains how a router's routing logic functions within an internetwork that uses subnetting. It demonstrates that despite the complexity of subnetting, the fundamental routing principles remain unchanged, using a Class B network example with three subnets to illustrate packet forwarding from source to destination.
ποΈ Topics Covered
The lecture examines routing logic in a subnetted internetwork, using a Class B IP network (150.1.0.0) subdivided into three subnets (150.1.1.0, 150.1.2.0, and 150.1.3.0). It covers how hosts in the same subnet share identical first three octets, the role of default gateways, ARP broadcasts for MAC address resolution, and how routers forward packets based on routing table entries through multiple hops to reach the final destination.
π Lecture Summary
Routing with Subnets
This topic explains how a router's routing logic works with subnets.
Let's assume an internetwork of a single Class B IP network 150.1.0.0. This IP network is subdivided into three subnets namely, 150.1.1.0, 150.1.2.0, and 150.1.3.0. All hosts in a given IP subnet have the same value in the first 3 octets of their IP addresses. Next, we look at the routing tables.
[Figure 52.1: Routing with Subnets]
When Hannah sends a packet to the web server, destination address is 150.1.3.3. Hannah's logic works like it did without subnetting. Hannah's default gateway is R1. Hannah sends an ARP broadcast for IP address 150.1.1.250. R1 replies and Hannah sends a frame to R1 with the IP packet inside the Ethernet frame. R1 receives the frame, and if it is error free, it extracts the IP packet. R1 uses destination address and finds an entry for it in its IP routing table. R1 forwards packet out on its E2 interface to R2 next. Finally, when R2 receives the frame, it does the usual error check and extracts the IP packet. R2 finds an entry for destination IP address. R2 can forward the packet directly to the web server. Whether or not an internetwork uses subnetting, the basic routing logic remains the same. If Hannah sends a packet to someone who's on the same subnet, she can send it directly to the destination without involving default router.
π Definition β Default Gateway: The router that a host uses to send packets to destinations outside its own subnet.
π Definition β ARP (Address Resolution Protocol) Broadcast: A network request sent to all devices on a local subnet to discover the MAC address associated with a given IP address.
π Example: In the subnetted internetwork:
- Source: Hannah (IP address 150.1.1.1, subnet 150.1.1.0)
- Destination: Web Server (IP address 150.1.3.3, subnet 150.1.3.0)
- Hannah sends packet to default gateway R1 (150.1.1.250)
- R1 forwards packet via its E2 interface to R2
- R2 delivers packet directly to web server
- The packet traverses two router hops (R1 and R2) before reaching the destination
π‘ Why this matters: Understanding that subnetting does not change basic routing logic is crucial for network design. The same fundamental forwarding decisions apply whether routing within a simple Class B network or across complex subnetted internetworks.
β Key Takeaways
The essential concept from this lecture is that subnetting adds organization to IP addressing but does not alter the fundamental routing logic. Routers still examine destination IP addresses, consult their routing tables, and forward packets accordingly. Hosts still use default gateways to reach destinations outside their own subnet, and ARP broadcasts remain necessary for local MAC address resolution. The critical insight is that whether an internetwork uses subnetting or not, the basic routing logic remains exactly the same - only the addressing structure changes.
π§ Quick Revision Questions
- What is the primary difference in routing logic between a subnetted and non-subnetted internetwork?
- In the example, which router serves as Hannah's default gateway and what is its IP address?
- How many router hops does Hannah's packet traverse to reach the web server at 150.1.3.3?
- What determines whether a host can send a packet directly to the destination without involving the default gateway?
- What is the role of an ARP broadcast in the packet forwarding process described in this lecture?