HW2 Solutions - EECS: www

EE122 Homework 2
Due Oct 21st 2013, 5pm
Version 1.2
Instructions
Record your answers in a file called hw2.pdf. Make sure to write your name and SID at the top of
your assignment. For each problem, clearly indicate your final answer, bold and underlined. You
do not need to explain your answer unless explicitly told to do so. Submit your answers via your
instructional account using submit hw2.
Use the following in your calculations:
 1B (byte) = 8b (bits)
 1k = 103
Questions? Post on piazza, or email Andrew (andrewor at berkeley) or Steve (steve.wang at
berkeley)!
Change Log
10/17
Q3: Added additional assumption - Receiver application buffers out-of-order packets
Q2: Clarify that only the path from A to B must satisfy the given property
Q5g: Change “after the 25th RTT” to “on the 26th RTT”
10/18
Q3a: Added additional assumption – Negligible ACK size
Q5g: Specify more precisely when the duplicate ACKs arrive
Q1 – IP Addressing and Forwarding (5pt)
A new era has dawned upon us. This is the age of intergalactic battles, and you are the chief
network advisor to the Commander of Earth. But first, let’s look at some forwarding tables.
The following is the forwarding table of router R1 that is connected to other routers, R2 – R6.
Assume the router does longest prefix match.
Subnet Number
Next Hop
128.96.39.0/25
R2
128.96.39.0/27
R3
128.96.40.0/25
R4
192.4.153.0/26
R5
(default)
R6
How will the router handle packets addressed to each of the following destinations?
(a) 128.96.40.12 R4
(b) 128.96.39.10 R3 (longest prefix)
(c) 128.96.39.48 R2
(d) 192.4.153.17 R5
(e) 192.4.153.90 R6
Q2 – RIP vs BGP Routing (10pt)
The Commander has assigned a new mission to you. You are tasked with designing the
placement of routers grouped into autonomous systems (AS) that satisfy the following: The
shortest path from router A to router B visits the same AS twice.
By visit the same AS twice, we mean the path includes a hop in a particular AS, leaves this
particular AS, and returns to it later. By shortest path, we mean the path with the fewest number
of hops (i.e. all link weights are 1).
Here is an example that doesn’t work:
In the topology above, the shortest path from A to B in terms of ASes is 1 → 2 → 3, which doesn’t
visit the same AS twice. Instead, what we want is something like 1 → 3 → 2 → 3.
(a) (4pt) Draw a topology of routers grouped into ASes that satisfies the above property for
the path from A to B. You may use no more than 10 routers and 5 ASes. Clearly indicate
the shortest path, both in terms of routers (e.g. A → C → D → B) and ASes (e.g. 1 → 2 → 3).
Figure 1: Shortest paths are
Routers: A – T – R –Q –B
ASes: 1 – 2 – 3 – 2 – 4
(Note that there are many other possible configurations)
(b) (3pt) In your topology from part (a), what path would RIP choose from A to B? Explain.
(That is, if we were to run RIP over the complete router topology, ignoring AS
boundaries.)1
RIP uses distance vectors to choose the least cost path, if one is available. In the above
topology, RIP will choose A – T – R – Q – B / 1 – 2 – 3 – 2 – 4.
(c) (3pt) In your topology from part (a), what path would BGP choose from A to B? Explain.
BGP uses path vectors to choose the path that is policy compliant. The elements of the
path vector are ASes, not routers. In the topology above, as soon as AS3 advertises the
path 3 – 2 – 4 to AS2, AS2 will discard this path because it sees that this path already
traverses itself. This leads an AS to rely on its internal links, rather than routing through
another AS even if doing so leads to a shorter path. Thus, BGP will choose A – T – U – V –
Q – B / 1 – 2 – 4.
Note that in real networks RIP is used for intra-AS routing, rather than inter-AS routing. In this problem, we relax
this assumption.
1
Q3 – Reliable Transport (10pt)
The Commander has spoken again. Earth has negotiated a new alliance with Alderaan, and is in
need of a new reliable transport protocol to communicate with our new ally. You are tasked with
designing this as a sliding-window protocol. The bandwidth of this link is 160kbps in both
directions, the latency is 125ms, and the maximum packet size is 1kB.
A few additional assumptions:




No re-ordering and processing delays
Sender application always has data to send
Receiver application always picks up data right away
Receiver application buffers out-of-order packets (that result from packet drops)
(a) (3pt) What is the minimum sender window size (in packets) that will allow you to take
full advantage of the bandwidth? For this part only, assume maximum packet size, no
packet loss, and negligible ACK size. Justify your answer.
We accept all of the following answers, as long as the assumptions are clearly specified.
Solution 1:
We want the window size to be equal to the bandwidth-delay product of the link to fill it
up completely. This gives
B * RTT = 160kbps * (2 * 125ms) = 40kb
Express this in terms of packets by dividing by the maximum packet size:
40kb / 1kB = 40kb / 8kb = 5 packets
Solution 2:
At time t = 0ms, the sender begins transmitting the first packet, which finishes at t =
50ms. Then, the ACK for this packet arrives after 1 RTT at t = 300ms. Within these
300ms, the number of packets that can be sent is:
300ms / (transmission delay of one packet) = 300ms / 50ms = 6 packets
Solution 3:
This solution explicitly assumes that ACKs are the same size as the packet. Following a
similar reasoning in Solution 2, the first packet arrives at the receiver at t = 175ms, then
the ack for this packet takes 50ms to be transmitted, finally arriving at the sender at t =
350ms. The window size in this case is:
350ms / 50ms = 7 packets
(b) (3pt) After deciding the sender window size WS in part (a), you and your colleagues are
debating how large to set the receiver window size WR.
Luke: WR = 1
If there is no re-ordering of packets, then there is no
benefit to setting WR > 1.
Leia:
WR = W S
This gives better performance than WR = 1. However,
setting WR > WS offers no advantages over WR = WS.
Han:
WR >> WS
The larger WR is, the higher the throughput. Hence, WR
should be as large as possible.
Who is right? Circle the best answer, and justify your choice.
Luke is incorrect because even in the absence of re-ordering, setting WR to less than WS
means that if a packet is lost, anything beyond the first packet is dropped by the receiver,
and must be retransmitted by the sender. This is even worse than stop-and-wait in terms
of bandwidth usage by placing more stress on the network, contributing to congestion.
Han is incorrect in his assertion that “the larger WR, the higher the throughput.” The
throughput is the amount of data transmitted within a period of time. Simply making WR
larger does not mean that the sender can send at a faster rate.
Leia is correct in that setting WR > WS offers no advantages over WR = WS, simply
because the receiver cannot receive more quickly than the sender sends.
(c) (4pt) Han now refines his argument. He suggests making WR as large as possible but using
selective acknowledgments to avoid ever needing to retransmit a packet unnecessarily.
Selective acknowledgments indicate any packets that have been successfully received after a
lost packet. If, for instance, packets P1; P2; P4; P5 arrive, the receiver will acknowledge P2, but
in the acknowledgment indicate that P4 and P5 have also been received and do not need to be retransmitted. Though the sender still cannot send packets beyond P2+WS, it will know not to
retransmit P4 and P5.
Leia then argues we can just use selective acknowledgement with WR=WS for the same
benefit.
Luke still thinks WR=1 is sufficient.
Who is right? Circle the best answer, and justify your choice.
Luke: WR = 1
With selective acknowledgements and no re-ordering
of packets, then there is no benefit to setting WR > 1.
Leia:
WR = W S
This gives better performance than WR = 1. However,
setting WR > WS offers no advantages over WR = WS
whether or not we use selective acknowledgements.
Han:
WR >> WS
The use of selective acknowledgment allows us to use
such larger windows because we continue to ack
specific packets in the event of packet loss/corruption.
The larger WR is, the higher the throughput. Hence, WR
should be as large as possible.
Luke is still incorrect for the same reason as part (b).
Han is still incorrect for the same reason as part (b). The use of selective
acknowledgments is a useful performance optimization, as it enables the sender to only
resent lost packets, but this is completely orthogonal to determining window sizing.
Leia is still correct for the same reason as part (b). Additionally, if WS is large, her
scheme can also benefit from selective acknowledgments for the same reason as
discussed above.
Q4 – BGP Policy (5pt)
The Commander is devising an invasion strategy based on the enemy network’s communication
patterns. You have mapped out the enemy’s network below, and in addition, you discover that
they, just like Earth, also use standard BGP routing policies. In particular, they also follow the
Gao-Rexford model, which includes valley-free routing.
Which paths are possible? Circle ALL that are true.
(a) x1 → X → Y → Z → z1
(b) x1 → X → U → W → Y → V→ v1
(c) v1 → V → Y → Z → z1
(d) v1 → V → Y → Z → W → w1
(e) u1 → U → W → Y → y1
Note: (b) is not valid because X prefers to route through Y (a peer) instead of U (a
provider), so this route would never be selected. This means x1 would never even know
about the route x1 – X – U – W – Y – V – v1.
Q5 – TCP Congestion Control (8pt)
A new piece of intel has arrived. Your subordinates, putting their lives at risk, have retrieved the
following graph from the enemy’s base. Having recognized the shape of the graph instantly from
EE122 many years ago, you conclude that the enemy is using TCP Reno (i.e. TCP with Fast
Retransmit and Fast Recovery).
Assume that the TCP flow has been operating for some time, meaning the number of RTTs shown
are with respect to when your subordinates started observing the flow’s behavior.
a) (1pt) Identify the time periods when TCP slow start is operating.
1-6, 22-25
b) (1pt) Identify the time periods when TCP congestion avoidance is operating.
6-14, 15-21 (We also accept 15-19, or simply 6-21)
c) (1pt) After the 14th RTT, is the segment loss detected by a triple duplicate ACK or by a timeout?
Triple duplicate ACK
d) (1pt) What is the initial value of SSTHRESH, before the first congestion avoidance interval?
32
e) (2pt) What is the value of SSTHRESH at the 19th RTT?
20
f) (2pt) What is the value of SSTHRESH at the 24th RTT?
12
g) (Extra credit, 3pt) In the beginning of the 26th RTT (immediately after the CWND = 8), three
duplicate ACKs were received. What will the values of the CWND and SSTHRESH after the third
duplicate ACK?
Solution 1:
The three duplicate ACKS arrive immediately after CWND = 8, in which case
SSTHRESH = CWND / 2 = 8/2 = 4
CWND = CWND / 2 = 4
Alternatively, we also accepted CWND = CWND / 2 + 3 = 7
Solution 2:
The three duplicate ACKS occur immediately before the end of the 26th RTT. This case is tricky
because between t = 25 and t = 26, the CWND hits the previous SSTHRESH of 12 and enters
congestion avoidance.
Of the 8 ACKs within this RTT, the first five are new ACKs, and the last three are duplicate ACKs.
After the first 4 new ACKs, CWND = 12. On the arrival of the fifth new ACK, however, CWND +=
1/8, so CWND = 12.125. Then three duplicate ACKs are received, which do not change the value of
CWND, and then the window is halved:
SSTHRESH = CWND / 2 = 12.125 / 2 = 6.0625
CWND = CWND / 2 = 12.125 / 2 = 6.0625
We also accepted SSTHRESH = 6 and CWND = 6. Alternatively, if the +3 version of Fast Recovery
is used, then CWND = 9.
Q6 – Fun with traceroute! (12pt)
The Commander suspects that an enemy is spying on our communication with Alderaan. To find
out, you decide to use traceroute, a program that traces the path (a sequence of routers) a
packet follows to a destination.
(a) (2pt) In no more than two sentences, explain how traceroute works.
traceroute is a series of pings of increasing TTL values, starting at 1. Every time a
ping is dropped, the router sends an ICMP TTL expired message back to the host, from
which the host learns which routers are traversed after how many hops.
(b) (2pt) Use traceroute from a UCB machine to record the path taken to
216.81.59.173, the IP address of Alderaan’s planet gateway router. Attach a printout
of the traceroute output.
Note: There are certainly other answers! We grade parts b-d quite leniently.
traceroute to 216.81.59.173 (216.81.59.173), 64 hops max, 52 byte packets
1 [AS25] citris156-gw.eecs.berkeley.edu (128.32.156.1) 7.564 ms 8.334 ms 9.973 ms
2 [AS25] soda-10g-citris.eecs.berkeley.edu (169.229.59.233) 1.528 ms 1.312 ms 1.003 ms
3 [AS25] edge-10g-soda.eecs.berkeley.edu (169.229.59.241) 1.540 ms 3.345 ms 1.424 ms
4 [AS25] t1-2.inr-202-reccev.berkeley.edu (128.32.255.57) 0.889 ms 0.913 ms 0.760 ms
5 [AS25] xe-5-1-0.inr-001-sut.berkeley.edu (128.32.0.66) 0.954 ms 0.513 ms 0.482 ms
6 [AS2152] cenic.net (137.164.50.16) 1.132 ms 1.268 ms 1.078 ms
7 [AS2152] oak-agg2--sfo-agg1-10g.cenic.net (137.164.22.25) 6.780 ms 5.640 ms 3.623 ms
8 [AS2152] dc-paix-px1--oak-core1-ge.cenic.net (137.164.47.18) 3.473 ms 3.543 ms 3.369 ms
9 [AS2152] hurricane--paix-px1-ge.cenic.net (198.32.251.70) 13.155 ms 9.504 ms 3.495 ms
10 [AS6939] 10gigabitethernet3-1.core1.sjc2.he.net (72.52.92.70) 4.193 ms 5.818 ms 4.216 ms
11 [AS6939] 10gigabitethernet14-7.core1.lax2.he.net (184.105.213.5) 11.572 ms 11.778 ms 17.632 ms
12 [AS46841] 10gigabitethernet2-3.core1.phx2.he.net (184.105.222.85) 22.638 ms 32.310 ms 24.970
ms
13 [AS46841] 10gigabitethernet5-3.core1.dal1.he.net (184.105.222.78) 42.419 ms 50.321 ms 50.216 ms
14 [AS6939] 10gigabitethernet5-4.core1.atl1.he.net (184.105.213.114) 64.947 ms 62.717 ms 71.870 ms
15 [AS6939] 216.66.0.26 (216.66.0.26) 63.236 ms 63.082 ms 63.051 ms
16 * * *
17 [AS21513] episode.iv (206.214.251.1) 103.519 ms 103.872 ms 103.387 ms
18 [AS21513] a.new.hope (206.214.251.6) 103.690 ms 104.135 ms 103.796 ms
19 [AS21513] it.is.a.period.of.civil.war (206.214.251.9) 104.073 ms 104.156 ms 103.142 ms
20 [AS21513] rebel.spaceships (206.214.251.14) 103.840 ms 103.700 ms 104.549 ms
21 [AS21513] striking.from.a.hidden.base (206.214.251.17) 103.671 ms 104.060 ms 104.085 ms
22 [AS21513] have.won.their.first.victory (206.214.251.22) 107.678 ms 103.875 ms 103.630 ms
23 [AS21513] against.the.evil.galactic.empire (206.214.251.25) 103.363 ms 104.505 ms 103.804 ms
24 [AS21513] during.the.battle (206.214.251.30) 104.235 ms 104.441 ms 103.736 ms
25 [AS21513] rebel.spies.managed (206.214.251.33) 105.769 ms 104.695 ms 103.812 ms
26 [AS21513] to.steal.secret.plans (206.214.251.38) 104.263 ms 106.472 ms 103.722 ms
27 [AS21513] to.the.empires.ultimate.weapon (206.214.251.41) 104.146 ms 104.246 ms 104.615 ms
28 [AS21513] the.death.star (206.214.251.46) 103.991 ms 104.797 ms 104.286 ms
29 [AS21513] an.armored.space.station (206.214.251.49) 103.752 ms 105.814 ms 104.233 ms
30 [AS21513] with.enough.power.to (206.214.251.54) 103.616 ms 104.274 ms 106.933 ms
31 [AS21513] destroy.an.entire.planet (206.214.251.57) 105.052 ms 104.002 ms 103.707 ms
32 [AS21513] pursued.by.the.empires (206.214.251.62) 104.316 ms 104.106 ms 104.611 ms
33 [AS21513] sinister.agents (206.214.251.65) 104.048 ms 104.905 ms 105.448 ms
34 [AS21513] princess.leia.races.home (206.214.251.70) 105.356 ms 104.346 ms 104.378 ms
35 [AS21513] aboard.her.starship (206.214.251.73) 118.150 ms 106.645 ms 105.331 ms
36 [AS21513] custodian.of.the.stolen.plans (206.214.251.78) 105.240 ms 105.349 ms 104.474 ms
37 [AS21513] that.can.save.her (206.214.251.81) 104.909 ms 104.950 ms 104.125 ms
38 [AS21513] people.and.restore (206.214.251.86) 105.082 ms 104.948 ms 105.393 ms
39 [AS21513] freedom.to.the.galaxy (206.214.251.89) 105.829 ms 104.828 ms 105.761 ms
40 [AS21513] 0-----i-------i-----0 (206.214.251.94) 105.025 ms 107.496 ms 104.985 ms
41 [AS21513] 0------------------0 (206.214.251.97) 104.687 ms 105.478 ms 105.052 ms
42 [AS21513] 0-----------------0 (206.214.251.102) 104.949 ms 105.201 ms 108.060 ms
43 [AS21513] 0----------------0 (206.214.251.105) 104.997 ms 105.945 ms 105.557 ms
44 [AS21513] 0---------------0 (206.214.251.110) 105.240 ms 104.927 ms 105.537 ms
45 [AS21513] 0--------------0 (206.214.251.113) 107.348 ms 105.493 ms 104.953 ms
46 [AS21513] 0-------------0 (206.214.251.118) 105.824 ms 105.016 ms 105.447 ms
47 [AS21513] 0------------0 (206.214.251.121) 105.887 ms 105.627 ms 104.941 ms
48 [AS21513] 0-----------0 (206.214.251.126) 105.444 ms 105.858 ms 105.970 ms
49 [AS21513] 0----------0 (206.214.251.129) 105.004 ms 104.903 ms 105.484 ms
50 [AS21513] 0---------0 (206.214.251.134) 106.216 ms 105.366 ms 105.974 ms
51 [AS21513] 0--------0 (206.214.251.137) 106.327 ms 105.488 ms 105.383 ms
52 [AS21513] 0-------0 (206.214.251.142) 106.260 ms 105.698 ms 106.314 ms
53 [AS21513] 0------0 (206.214.251.145) 106.109 ms 105.232 ms 105.437 ms
54 [AS21513] 0-----0 (206.214.251.150) 105.956 ms 108.384 ms 106.560 ms
55 [AS21513] 0----0 (206.214.251.153) 106.585 ms 106.296 ms 106.348 ms
56 [AS21513] 0---0 (206.214.251.158) 106.042 ms 107.667 ms 106.024 ms
57 [AS21513] 0--0 (206.214.251.161) 105.511 ms 106.398 ms 105.220 ms
58 [AS21513] 0-0 (206.214.251.166) 105.923 ms 106.307 ms 105.447 ms
59 [AS21513] 00 (206.214.251.169) 105.890 ms 106.347 ms 106.176 ms
60 [AS21513] i (206.214.251.174) 107.645 ms 106.203 ms 107.331 ms
61 [AS21513] by.ryan.werber (206.214.251.177) 106.967 ms 109.308 ms 106.413 ms
62 [AS21513] blizzards.breed.ccie.creativity (206.214.251.182) 106.421 ms 106.800 ms 106.134 ms
63 [AS21513] please.try.again.tracerote.to.obiwan.scrye.net (206.214.251.185) 106.047 ms 105.971 ms
107.457 ms
64 [AS21513] read.more.at.beaglenetworks.net (206.214.251.190) 106.802 ms * 107.219 ms
(c) (3pt) What are the ASes traversed, and in what order? For each AS, list the <AS Number,
Organization Name>.
(25, University of California at Berkeley)
(2152, California State University Network)
(6939, Hurricane Electric, Inc.)
(46841, Fork Networking. LLC)
(6939, Hurricane Electric, Inc.)
(21513, Epik Networks, Inc.)
(d) (3pt) What are the ISPs traversed, and in what order? Stop once you reach AS-21513.
Cenic, Hurricane Electric, Epik
(e) (2pt) In your trace you encounter rows with three asterisks ***. What is going on? What
might have caused it? (No star wars references!)
*** means that an ICMP TTL expired response was not received, in which each * is a
timeout on the pong. A likely explanation is that the particular router does not accept
ping packets, and has a firewall that automatically drops them.