03 - Network Layer

Problem 1: Short Answer Questions

Problem 2: IPv4 Subnetting with /24 Networks

Suppose you are a network administrator, and you are given 182.15.11.0/24 IP address range from your ISP. You are asked to set up 4 IP subnets within this address range.

Problem 3: IPv4 Subnetting with /20 Networks

Suppose you are a network administrator, and you are given 10.10.96.0/20 private address range. You are asked to set up 16 IPv4 subnets within this address range.

Problem 4: Variable-Length Subnetting for 30-Host Networks

Suppose you are a network administrator, and you are given 10.10.212.0/24 private address range. You are asked to subnet this range such that each subnet can have up to 30 hosts.

Problem 5: IPv4 Subnet Analysis

The IPv4 address of a host is given as 192.168.27.154/26. What’s the netmask? What is the IP subnet? How many hosts can you attach to this IPv4 subnet? What’s the subnet directed broadcast address? Show your work.

Solution

Netmask: /26 means first 26 bits are network = 11111111.11111111.11111111.11000000 = 255.255.255.192

IP Subnet: 192.168.27.154 = 11000000.10101000.00011011.10000000. Taking first 26 bits (ANDing with netmask): 11000000.10101000.00011011.10000000 = 192.168.27.128/26

Number of Hosts: 6 bits are leftover after the 26 subnet bits → $2^6 - 2 = 62$ hosts

Subnet Directed Broadcast Address: Set all host bits to 1: 11000000.10101000.00011011.10111111 = 192.168.27.191

Problem 6: Large-Scale IPv4 Subnetting

An organization is given the IPv4 address range 45.77.0.0/16 and is asked to create 64 IPv4 subnets. What’s the netmask for each subnet? How many hosts can you attach to each IPv4 subnet. Show your work.

Solution

45.77.0.0 = 00101101.01001101.00000000.00000000

Netmask: 11111111.11111111.11111100.00000000 = 255.255.252.0

Number of Hosts:

Problem 7: Netmask Analysis and Host Capacity

An administrator has the following netmask for one of its IPv4 subnets: 255.255.248.0. How many hosts can the administrator attach to this subnet. Show your work.

Solution

Netmask: 255.255.248.0

Binary: 11111111.11111111.11111000.00000000

Host ID bits: 11 zeros

Number of Hosts: $2^{11} - 2 = 2,046$ hosts

Problem 8: Different Subnet Perspectives with Different Netmasks

Two hosts H1 and H2 are configured as follows: H1’s IP address is 203.197.2.53 and its netmask is 255.255.128.0. H2’s IP address is 203.197.75.201 and its netmask is 255.255.192.0.

Problem 9: Subnet Membership Determination

Two hosts H1 and H2 are configured as follows: H1’s IP address is 10.10.100.120 and its netmask is 255.255.128.0. H2’s IP address is 10.10.100.129 and its netmask is 255.255.128.0. Are these two hosts on the same IP subnet? Show your work.

Solution

H1 Calculation:

H2 Calculation:

Both hosts have the same subnet address (10.10.0.0/17), so YES, they are on the same IP subnet.

Problem 10: Longest Prefix Matching Routing

Suppose a router has built up the routing (forwarding) table shown below. The router can deliver packets directly over interfaces 1 and 2, or it can forward packets to routers R1 or R2. Describe what the router does with a packet addressed to each of the following destinations. You must justify your answer. A simple sends here/there answer is NOT acceptable!

Subnet Number Subnet Mask Next Hop
122.15.10.0 255.255.255.128 R1
122.15.10.96 255.255.255.224 Interface 2
122.15.10.128 255.255.255.224 Interface 1
default - R2

Problem 11: Routing Table Lookup with Overlapping Prefixes

Suppose a router has built up the routing (forwarding) table shown below. The router can deliver packets directly over interfaces 1 and 2, or it can forward packets to routers R1 or R2. Describe what the router does with a packet addressed to each of the following destinations. You must justify your answer. A simple sends here/there answer is NOT acceptable!

Subnet Number Subnet Mask Next Hop
12.45.0.0 255.255.128.0 R1
12.45.128.0 255.255.128.0 R2
12.45.0.0 255.255.192.0 Interface 1
12.45.192.0 255.255.192.0 Interface 2
default - R3

Problem 12: Routing Decisions with Multiple Subnets

Suppose a router has built up the routing (forwarding) table shown below. The router can deliver packets directly over interfaces 1 and 2, or it can forward packets to routers R1 or R2. Describe what the router does with a packet addressed to each of the following destinations. You must justify your answer. A simple sends here/there answer is NOT acceptable!

Subnet Number Subnet Mask Next Hop
128.96.39.0 255.255.255.128 Interface 0
128.96.39.128 255.255.255.128 Interface 1
128.96.40.0 255.255.255.128 R2
192.4.153.0 255.255.255.192 R3
default - R4

Problem 13: ARP and Switch Learning with MAC Addresses

Consider the following LAN consisting of two switches S1 and S2 connecting 4 hosts A, B, C and D. Assume a host H’s MAC address is MACH. The IP address of each host is shown in the figure. Assume the netmask of each host is 255.255.255.0. Assume that the switch forwarding tables are empty to start with. For each of the following cases, show the forwarding tables of the switches and describe which hosts will receive the transmitted packet. For each IP packet show <Destination MAC, Source MAC, Type><Source IP, Destination IP>. For each ARP packet show <Destination MAC, Source MAC, Type><Source IP, Source MAC, Target IP, Target MAC>

Problem 14: ARP Replies and Broadcast Handling in Switched LANs

Consider the following LAN consisting of two switches S1 and S2 connecting 4 hosts A, B, C and D. Assume a host H’s MAC address is MACH. The IP address of each host is shown in the Figure. Assume the netmask of each host is 255.255.255.0. Assume that the switch forwarding tables are empty to start with. For each of the following cases, show the forwarding tables of the switches and describe which hosts will receive the transmitted packet. For each IP packet show <Destination MAC, Source MAC, Type><Source IP, Destination IP>. For each ARP packet show <Destination MAC, Source MAC, Type><Source IP, Source MAC, Target IP, Target MAC>

Problem 15: Packet Encapsulation Across Router Boundaries

Consider the following network consisting of two links connected by a router. For each of the following cases show <Destination MAC, Source MAC, Type><Source IP, Destination IP> of a packet as it traverses from the source to the destination.

Problem 16: Address Resolution Protocol Overview

What’s the Address Resolution Protocol (ARP) and what is it used for. Does ARP run over the link layer or on top of IPv4? Briefly explain.

Solution

ARP runs on top of the link layer and discovers MAC addresses when you only know an IP address.

Problem 17: Internet Control Message Protocol Overview

What’s the Internet Control Message Protocol (ICMP) and what is it used for. Does ICMP run over the link layer or on top of IPv4? Briefly explain.

Solution

ICMP runs on top of IPv4 and is used as an error reporting when a host is not able to be reached. It can also run diagnostics if a host is alive via pings.

Suppose that a transport layer packet of size 2000 bytes is passed to IPv4 for delivery across one link, e.g., source and the destination hosts are on the same link. Assume that the MTU of the link is 500 bytes. Define the MTU of a link to be the maximum payload size of a link layer frame, i.e., maximum size of an IP packet that can fit into a Link Layer frame. Also, recall that the IP header size is 20 bytes. Schematically show the packets that are delivered to the network layer at the destination host by filling out the following table. Suppose the original IPv4 datagram is stamped with id number 100.

id IPv4 length IPv4 offset IPv4 fragmentation flag
       
       
       
       
       
Solution

Each payload can be 500 - 20 = 480 bytes, so divide 2000 bytes into 480 byte pieces (plus 20 byte header):

id IPv4 length IPv4 offset IPv4 fragmentation flag
100 500 0 1
100 500 480 1
100 500 960 1
100 500 1440 1
100 100 1920 0

Suppose that a transport layer packet of size 2048 bytes is passed to IPv4 for delivery across two links of the Internet (i.e., from the source host to a router to the destination host). The first link has an MTU of 1024 bytes; the second link has an MTU of 512 bytes. Define the MTU of a link to be the maximum payload size of a link layer frame, i.e., maximum size of an IP packet that can fit into a Link Layer frame. Also, recall that the IP header size is 20 bytes. Schematically show the packets that are delivered to the network layer at the destination host by filling out the following table. Suppose the original IPv4 datagram is stamped with id number 422.

After first link (1024 MTU):

id IPv4 length IPv4 offset IPv4 fragmentation flag
       
       
       
       
       

At destination (after all refragmentation through second link with 512 MTU):

id IPv4 length IPv4 offset IPv4 fragmentation flag
       
       
       
       
       
       
       
       
       
       
Solution

First link: 1024 MTU (payload is 1004 bytes) Second link: 512 MTU (payload is 492 bytes)

At destination (after all refragmentation):

id IPv4 length IPv4 offset IPv4 fragmentation flag
422 512 0 1
422 512 492 1
422 512 984 1
422 512 1476 1
422 512 1968 1
422 40 2008 0

</details>

Consider the following network. MTU of the link between A and R1 is 1500 bytes. MTU of the link between R1 and R2 is 512 bytes. MTU of the link between R2 and B is 1500 bytes. Assume that the transport layer gives a packet of size 2000 bytes to IPv4 for delivery to B. Define the MTU of a link to be the maximum payload size of a link layer frame, i.e., maximum size of an IP packet that can fit into a Link Layer frame.

Also, recall that the IPv4 header size is 20 bytes. Schematically show the packets that are delivered to the network layer at the destination host by filling out the following table. Suppose the original IPv4 datagram is stamped with id number 200.

Schematically show the packets that are delivered to the network layer at the destination host (the following table has enough rows provided):

id IPv4 length IPv4 offset IPv4 fragmentation flag
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
Solution

First link (1500 MTU): Payload is 1480 bytes Bottleneck link (512 MTU): Payload is 492 bytes Third link (1500 MTU): Payload is 1480 bytes

At destination (after all refragmentation):

id IPv4 length IPv4 offset IPv4 fragmentation flag
200 512 0 1
200 512 492 1
200 512 984 1
200 512 1476 1
200 512 1968 0

Note: The fragments from the bottleneck link (second hop) fit easily into the larger payload of the third link, so they remain unchanged at the destination.

Problem 21: Network Address Translation Table Tracing

Consider the following network where network address translation (NAT) is being used. Assume that the Web browser running at host A sent a TCP connection request to the Web Server shown on the left side of the figure and the server replied back. During this conversation, the NAT router set up the NAT table shown on the figure. Show the source IP, source port, destination IP, destination port number of ALL packets that travel in the network from the time host A sends the TCP connection request, until the reply comes back from the server to host A.

Packet Source IP Source PortNo Dest IP Dest PortNo
From A up to router        
From router to Web Server        
From Web Server to router        
From router to A        
Solution

Port 80 is the well-known HTTP port for web servers. Ports 2500, 3200, 4000 are ephemeral ports (assigned to the client).

The NAT router replaces the source IP and port in outgoing packets with the router’s external IP and a mapped port. On the return path, it reverses this mapping.

Packet Source IP Source Port Dest IP Dest Port
From A up to router 10.0.0.1 3345 128.119.40.186 80
From router to Web Server 138.76.29.7 5001 128.119.40.186 80
From Web Server to router 128.119.40.186 80 138.76.29.7 5001
From router to A 128.119.40.186 80 10.0.0.1 3345

Problem 22: Distance-Vector Routing Protocol

Consider the following network: Assume nodes run a distance-vector protocol to compute the shortest path to all destinations. Show the distance table at node A and derive the forwarding table.

Destination via B via C
B    
C    
D    
E    
F    
Destination Next Hop
B  
C  
D  
E  
F  
Solution

Distance Table at A:

Destination via B via C
B 1 3
C 3 1
D 4 3
E 3 4
F 4 2

Forwarding Table at A:

Destination Next Hop
B B
C C
D C
E B
F C

Explanation: For each destination, we choose the next hop (B or C) that gives us the minimum cost path.

Problem 23: Distance-Vector Routing Distance Table

Consider the following network: Assume nodes run a distance-vector protocol to compute the shortest path to all destinations. Show the distance table at node A and derive the forwarding table.

Destination via B via C
B    
C    
D    
E    
F    
Destination Next Hop
B  
C  
D  
E  
F  

Problem 24: Dijkstra’s Shortest Path Algorithm

Consider the following network: With the indicated link costs, use Dijkstra’s shortest path algorithm to compute the shortest path from A to all network nodes. After computing the shortest paths from A to all other nodes, show the routing (forwarding) table constructed at A. Show your work clearly.

Problem 25: Dijkstra’s Algorithm from Different Source Node

Consider the following network: With the indicated link costs, use Dijkstra’s shortest path algorithm to compute the shortest path from F to all network nodes. After computing the shortest paths from F to all other nodes, show the routing (forwarding) table constructed at F. Show your work clearly.

Problem 26: Multicast Routing Trees

Consider the network topology below.