Solutions 3
Solutions 3
(b) What is the key difference between the control and data planes of a router?
Answer. The data plane is associated with the forwarding function, moving data packets at
high speed from input to output ports. The control plane is associated with the routing function,
determining how packets must reach the destination through an end to end path. The control plane
computes some decisions through routing protocols, and the data plane executes those decisions
(encoded in the form of forwarding table) on each packet.
(2) Netmask (2 points). Suppose hosts A and B have the same netmask M. Host A has IP
address 102.45.56.7. Host B has IP address 102.46.47.8. The netmask M is 255.252.0.0. Are A
and B in the same IP network? Why or why not?
Answer. We see that A & M == 102.44.0.0; and that B & M == 102.44.0.0. Since A & M ==
B & M, they are in the same IP network.
(3) Forwarding lookup (2 points). Which field on the packet is used to lookup the router’s
forwarding table? What are the consequences of using this packet field (and ignoring others)?
Answer. The destination IP address on the packet is used for forwarding. There are several
consequences listed in slide 8 of lecture 20.
(4) Benefits of IP aggregation (2 points). Describe any one benefit for aggregating IP ad-
dresses into IP prefixes, or aggregating smaller IP prefixes into larger ones.
Answer. Aggregation reduces the sizes of forwarding tables on routers and the number of rout-
ing protocol messages (e.g., BGP announcements) that routers need to exchange over the Internet.
1
(that may result in queues forming) is sharing the same output port among multiple packets, which
is unavoidable given the routes followed by those packets and the arriving packet workload.
(6) Forwarding table matching (10 points). Suppose a router has the forwarding table entries
shown in the picture below.
For the questions below, partial credit will be provided if you explain the reasoning behind
your answers.
(a) Suppose a packet enters the router with a source IP address of 93.5.6.145 and a destination
IP address of 245.128.45.168. What output port is it forwarded to? (2 points)
Answer. Packets are forwarded using their destination addresses. Hence, we should look up
the table for an IP prefix matching 245.128.45.168. Such a prefix indeed exists, and the router will
forward the packet through output port 3.
(b) Suppose another packet arrives with a destination IP address of 100.31.105.54. What output
port is it forwarded to? (3 points)
Answer. There is only one IP prefix that matches this destination IP address in the table,
and that is 100.16.0.0/12. The corresponding output port is 5. (Note: do not be deceived by the
decimal notation of IP addresses. The first 12 bits of 100.32.0.0 are not the same as the first 12 bits
of 100.31.105.54)
(c) Suppose another packet arrives with a destination IP address of 189.23.80.4. What output
port is it forwarded to? (3 points)
Answer. There are two IP prefixes that match this destination IP address, namely 189.23.64.0/18
and 189.23.64.0/19. (Note: 189.23.96.0/19 does not match this IP address, since 189.23.96.0 does
2
not share its first 19 bits with 189.23.80.4.) Among the matching prefixes, the longest prefix match
is used. Hence, output port 9 is used.
(d) Suppose another packet arrives with a destination IP address of 8.8.8.8. What output port
is it forwarded to? (2 points)
Answer. This IP address is not matched by any of the non-default entries in the forwarding
table. The default entry is used, resulting in the output port 4.
(7) Routing protocols (27 points). Consider the network whose graph abstraction is shown in
this picture. The IP prefixes “owned” by the router, i.e., the set of endpoints reachable directly
through the router, are provided alongside the routers, labeled and identified as A, B, C, etc. The
link metrics are shown next to the edges in the graph.
(a) Suppose the network uses a link state routing protocol. Populate the following informa-
tion in the link state advertisement originating from router B. (5 points)
router ID: B
(For the last question, please write the metrics in the same order as the neighbor IDs before.)
(b) This question builds on part (a). Suppose d(V ) represents the current best estimate of the
shortest path distance from router A to a fixed router V , and p(V ) represents the predecessor on that
shortest path. Suppose router A has received the link state advertisements from all other routers in
the network. What are the initial values of the following? (6 points)
3
Answer. The initial values of distances correspond to the direct edge costs. The predecessor on
each such path is the source node itself. Hence:
d(B), p(B): 3, A
d(C), p(C): 8, A
(c) This question builds on part (b). After 2 iterations of Dijkstra’s algorithm, what are the
values of the following? (6 points)
(d) After all routers have computed their shortest paths, suppose a packet with destination IP
address 128.64.203.67 arrives at router B. Towards which router is this packet directed? (2
points)
Answer. Towards router C. The host with IP address 128.64.203.67 is connected to router E.
You don’t even need to compute the shortest paths from B. You can combine the facts that (i)
the shortest path from A towards E is A → B → C → D → E; and (ii) shortest paths have “sub-
structure”, i.e., if Z is on the shortest path from X to Y, then the sub-path from Z to Y is also a
shortest path. Hence, the shortest path from B to E also goes through the immediate next hop C.
(e) Let’s start afresh from the figure for this question. Suppose the network uses a distance
vector protocol. For this part and the ones that follow, please assume that all routers know the
existence of all other routers in the network. However, initially, each router is unaware of the
shortest distances to any other router. To begin with, each router only knows the costs of its direct
edges to its immediate neighbors. We use dX (Y ) to denote the component of the distance vector of
X corresponding to destination Y at any point in time. What are the initial values of the following
components (4 points)?
4
(f) This question builds on part (e). Suppose router B just shared its current distance vector
with A. This distance vector is:
dB (A) = 3, dB (B) = 0, dB (C) = 1, dB (D) = 4, dB (E) = 6
Show the working of the Bellman-Ford equation at router A for destination D. What is the
value of dA (D) after this exchange? (4 points)
Answer. The Bellman-Ford update states that:
dA (D) = min(dB (D) + c(A, B), dC (D) + c(A,C))
(The minimum is taken over paths through B and C which are the immediate neighbors of A.)
So far, the distance vector from C hasn’t even reached A, so A would just assume that dC (D) is ∞.
Hence, dA (D) is dB (D) + c(A, B), which is 4 + 3 = 7.
(8) Collaboration and References (mandatory). Who did you collaborate with on this prob-
lem set? What resources and references did you consult? Please also specify on what questions
and aspects of the problem set you got help on. If you did not consult any resources other than the
lecture slides and textbook, just say “no collaboration”.