NivaarExam PrepOfficial exam papers ↗

22-Elec-B4 Information Technology Networks · December 2019

Question 3 of 5: IP Packet Routing

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

Paper format. National Examinations, December 2019 — 16-Elec-B4, Information Technology Networks. Three hours, closed book; an approved Casio or Sharp calculator is permitted. The paper prints five questions of 25 marks each, and any four constitute a complete paper worth 100 marks, with the marks for every sub-part shown in the left margin. All five questions are solved here, because this set is a study resource rather than an exam attempt, and a candidate choosing which four to write benefits from seeing the fifth worked out.

Reference texts. A. Leon-Garcia and I. Widjaja, Communication Networks: Fundamental Concepts and Key Architectures, 2nd ed. (the syllabus reference for this code); J. F. Kurose and K. W. Ross, Computer Networking: A Top-Down Approach, 8th ed.; A. S. Tanenbaum and D. J. Wetherall, Computer Networks, 5th ed.; W. Stallings, Wireless Communications and Networks, 2nd ed.; S. Sesia, I. Toufik and M. Baker, LTE — The UMTS Long Term Evolution, 2nd ed.; T. H. Cormen, C. E. Leiserson, R. L. Rivest and C. Stein, Introduction to Algorithms, 4th ed.

Question 3: IP Packet Routing (25 marks)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Part (a) — The size of the IPv6 address space (5 marks)

Given. An IPv6 address is 128 bits wide (RFC 4291), against 32 bits for IPv4.

Find. The total number of distinct addresses the format can express, ignoring reservations.

  1. Every bit pattern is an address. With $n$ independent binary digits there are $2^{n}$ patterns, so the count is $2^{128}$.
  2. Evaluate it. $$2^{128} = \boxed{340\,282\,366\,920\,938\,463\,463\,374\,607\,431\,768\,211\,456 \approx 3.403\times10^{38}}$$
  3. Put it in proportion. $2^{128}/2^{32} = 2^{96} \approx 7.92\times10^{28}$, so IPv6 holds about eighty octillion times as many addresses as IPv4 — roughly $6.7\times10^{17}$ addresses for every square millimetre of the Earth's surface.

The number is deliberately extravagant, and the reason is worth stating: IPv6 spends the lower 64 bits of almost every address on a host identifier so that stateless address autoconfiguration can derive it from the interface's MAC address or a random draw, and it hands out a $/48$ or $/56$ prefix to each subscriber site so that internal subnetting never needs renumbering. The usable count is therefore far smaller than $2^{128}$ in practice — about $2^{64}$ subnets — but even that, $1.8\times10^{19}$, is four billion times the whole IPv4 space.

Part (b) — Routing tables at both routers (10 marks)

Given. Three broadcast domains, all $/24$: 128.100.11.0, 128.100.12.0 and 128.100.13.0. Two routers, each drawn as a dark square straddling two of the buses:

RouterInterface on 128.100.11.0Interface on 128.100.12.0Interface on 128.100.13.0Other
R1128.100.11.3128.100.12.3——
R2—128.100.12.254128.100.13.3Internet uplink

Find. A forwarding table for each router giving destination network, netmask, gateway (next hop) and outgoing interface for every reachable destination.

Approach. Enter each directly connected subnet first, then one entry per remote subnet with the neighbouring router as gateway, then a default route towards the Internet; check that every gateway named lies on the subnet of the interface used to reach it.

[Figure not reproduced: Q3(b): the printed network, redrawn from the examination page. Two dark router boxes straddle three /24 broadcast domains — R1 joins 128.100.11.0 to 128.100.12.0, and R2 joins 128.100.12.0 to 128.100.13.0 and carries the Internet uplink. Each box owns exactly one address per bus it touches. See the official exam paper.]

  1. Read the topology off the drawing, not the labels alone. There are exactly two dark squares, and each owns one address on each bus it touches, so the four interface addresses pair as R1 = {128.100.11.3, 128.100.12.3} and R2 = {128.100.12.254, 128.100.13.3}. Both routers sit on 128.100.12.0, which is what makes them neighbours; the Internet arrow leaves R2.
  2. Fix the netmask. All three networks are $/24$, i.e. netmask $255.255.255.0$: the first three octets identify the network and the last identifies the host.
  3. Enter the directly connected networks. A router needs no gateway for a subnet it is attached to — it resolves the destination's link-layer address with ARP and delivers the frame itself.
  4. Enter the remote network. R1 reaches 128.100.13.0 only through R2, whose address on their shared subnet is 128.100.12.254; R2 reaches 128.100.11.0 only through R1 at 128.100.12.3. Each gateway lies on 128.100.12.0, the subnet of the interface used to reach it — the consistency check every routing table must pass.
  5. Add the default route. Anything outside these three prefixes goes to the Internet, which is reached through R2; R1's default therefore points at 128.100.12.254 and R2's points out of its own uplink.

Routing table at R1

DestinationNetmaskGatewayInterface
128.100.11.0255.255.255.0— (directly connected)128.100.11.3
128.100.12.0255.255.255.0— (directly connected)128.100.12.3
128.100.13.0255.255.255.0128.100.12.254128.100.12.3
0.0.0.0 (default)0.0.0.0128.100.12.254128.100.12.3

Routing table at R2

DestinationNetmaskGatewayInterface
128.100.12.0255.255.255.0— (directly connected)128.100.12.254
128.100.13.0255.255.255.0— (directly connected)128.100.13.3
128.100.11.0255.255.255.0128.100.12.3128.100.12.254
0.0.0.0 (default)0.0.0.0ISP next hopInternet link

Every host on the three LANs also needs a default gateway of its own — 128.100.11.3 for hosts on the first LAN, 128.100.12.3 or 128.100.12.254 for the second, 128.100.13.3 for the third — because a host with no route of its own sends anything off-subnet to its default router.

Part (c) — The path from 128.100.13.1 to 128.100.11.2 (5 marks)

The packet crosses two routers and three link-layer hops. Following it step by step:

  1. The source host decides the destination is off-subnet. Host 128.100.13.1 masks its own address and the destination with its netmask: $128.100.13.1\ \wedge\ 255.255.255.0 = 128.100.13.0$, but $128.100.11.2\ \wedge\ 255.255.255.0 = 128.100.11.0$. The prefixes differ, so the destination is not on the local LAN and the packet must go to the default gateway, 128.100.13.3 (R2). The host ARPs for R2's MAC address and sends an Ethernet frame addressed to R2 carrying an IP packet still addressed to 128.100.11.2.
  2. R2 forwards by longest-prefix match. R2 looks 128.100.11.2 up in its table. The entry 128.100.11.0/255.255.255.0 matches on 24 bits and the default matches on none, so the 24-bit entry wins and names gateway 128.100.12.3 out of interface 128.100.12.254. R2 decrements the TTL, recomputes the header checksum, ARPs for 128.100.12.3 and puts the packet into a new frame on the 128.100.12.0 LAN.
  3. R1 delivers it. R1's table shows 128.100.11.0/24 as directly connected on interface 128.100.11.3, so no further gateway is involved. R1 decrements the TTL again, ARPs for 128.100.11.2 on the first LAN, and delivers the packet in a third frame.

In summary the path is 128.100.13.1 → R2 (128.100.13.3 in, 128.100.12.254 out) → R1 (128.100.12.3 in, 128.100.11.3 out) → 128.100.11.2: two router hops, three Ethernet frames. Two properties of IP forwarding are worth naming explicitly. The IP source and destination addresses never change — they identify the endpoints end to end — while the link-layer addresses are rewritten on every hop, because they identify only the two ends of one wire. And the TTL falls by one per router, so a packet leaving the source with TTL 64 arrives with 62; if a routing loop ever formed, the TTL would reach zero and the packet would be discarded with an ICMP “time exceeded” report rather than circulating forever.

Part (d) — The range covered by 10.0.0.0/24 (5 marks)

Given. The CIDR block 10.0.0.0/24.

Find. The netmask, the range of addresses covered, and the addresses actually assignable to hosts.

  1. Split the address. The prefix length 24 means the leading 24 bits are the network number and the remaining $32 - 24 = 8$ bits identify the host, so the netmask is 24 ones followed by 8 zeros: $255.255.255.0$.
  2. Count the addresses. Eight host bits give $2^{8} = 256$ addresses.
  3. Write the range. Holding the first three octets at 10.0.0 and running the last from 0 to 255: $$\boxed{10.0.0.0 \ \text{through}\ 10.0.0.255}$$
  4. Deduct the two reserved addresses. 10.0.0.0 (all host bits zero) is the network address and 10.0.0.255 (all host bits one) is the directed broadcast, so the assignable range is $\boxed{10.0.0.1\ \text{to}\ 10.0.0.254,\ \text{i.e. } 254\ \text{usable hosts}}$, one of which is normally the default gateway.

Two remarks. This block lies inside 10.0.0.0/8, one of the RFC 1918 private ranges, so these addresses are not routable on the public Internet and would be translated at the site border. And the arithmetic generalises: a $/n$ block holds $2^{32-n}$ addresses and $2^{32-n}-2$ usable hosts, so $/25$ gives 126, $/30$ gives 2 (the classic point-to-point link) and $/31$ is a special case defined by RFC 3021 for point-to-point links where the two reserved addresses are dispensed with.

QuantityResult
Total IPv6 addresses$2^{128} = 340\,282\,366\,920\,938\,463\,463\,374\,607\,431\,768\,211\,456 \approx 3.403\times10^{38}$
R1 table11.0/24 and 12.0/24 direct; 13.0/24 via 128.100.12.254; default via 128.100.12.254
R2 table12.0/24 and 13.0/24 direct; 11.0/24 via 128.100.12.3; default out of the Internet link
Netmask on all three LANs255.255.255.0
Path 128.100.13.1 → 128.100.11.2host → R2 → R1 → host; 2 router hops, 3 frames, TTL 64 → 62
10.0.0.0/24 covers10.0.0.0 – 10.0.0.255 (256 addresses)
Usable hosts in that block10.0.0.1 – 10.0.0.254 (254)