← all topics

Midterm 2 review sheet: question types, short answers, traps

Slides 3-43 → 5-23 · Sample midterm 2 + HW4, HW5, HW6 · Links go to the full topic page

1. Question types · 2. Short answers to have ready · 3. Traps · 4. Time plan · Formula sheet

1. Question types (sample + homework)

The sample has three numbered problems (four short answers, a TCP seq/ACK fill-in, a distance-vector update) and then says "review all homework problems", with the HW4 P40 cwnd graph as the example. Expect the rest to look like the rows below.

TypeSeen inHow to attack itTopic
Short conceptual answersSample P1 (1–4)1–3 sentences: the fact + the reason. Bank in section 2.all
TCP seq/ACK fill-inSample P2Reply seq = their ACK; reply ACK = their seq + bytes. Sample: client (seq=20, ACK=46, 'c') → server (seq=46, ACK=21, 'c').m2-1
Two segments, ports, out of order, lost ACKHW4 P27Seq of 2nd = seq + len of 1st. ACK swaps ports. Out-of-order arrival → ACK = still the old expected byte. Lost ACK + late cumulative ACK → timeline with one retransmission.m2-1
Max file size / transmit timeHW4 P26232 bytes; segments = ⌈L/MSS⌉; add header per segment; × 8 / R.m2-1
EstimatedRTT formula / why no RTT on retransmitsHW4 P32, P33, sample P1.4Unroll the EWMA: weights α, α(1−α), α(1−α)², …; last term (1−α)n−1. Ambiguity argument for P33.m2-2
What limits the sender (flow vs congestion vs buffer)HW4 P43Receiver buffer holds the file → not flow control. No loss → not congestion control. The small send buffer fills, so the process is held to R.m2-3
Connection management bitSample P1.3FIN to close, SYN to open, RST to abort.m2-3
Congestion scenarios: buffers, timeouts, R/3 vs R/4HW4 P30, P39, sample P1.1Fixed timeouts + bigger buffer → premature timeouts → duplicates → lower goodput. R/2 cap per session; 1/3 retransmissions → R/3; every packet twice → R/4.m2-4
TCP Reno cwnd graph (a–k)HW4 P40, sample page 3Mark doubling stretches (slow start), +1 stretches (CA), drops to ~half+3 (3 dup ACKs) vs to 1 (timeout). ssthresh = half the peak. Count segments cumulatively for "the Nth segment".m2-5
AIMD vs AIAD fairness diagramHW4 P41AIAD keeps the difference between the two flows constant → never moves toward the equal-share line. AIMD halves the difference at every loss → converges.m2-6
Switch fabric: two packets at once?HW5 P2Bus: no. Memory: no (one read/write at a time). Crossbar: yes to different outputs, no to the same output.m2-7
Scheduling: FIFO, priority, RR, WFQ timelinesHW5 P3One packet per slot; pick by the rule; list departure slot and delay per packet. Average delay is the same in all four (work-conserving).m2-7
Destination-based forwarding tableHW5 P1One row per destination → interface. Cannot split by source: forwarding uses only the destination address.m2-8
Longest prefix match table / rangesHW5 P4, P5Write addresses in binary, find every matching prefix, take the longest. Range of a prefix: host bits 0…0 to 1…1, size 2bits left.m2-8
Subnet split of a /24HW5 P6Round each need up to a power of two, place the biggest first on an aligned boundary. 90 → /25, 60 → /26, 12 → /28.m2-8
IP fragmentationSlide 4-36Data per fragment = multiple of 8 ≤ MTU − 20; offset = bytes before / 8; flag 1 except last.m2-8
DHCP / NAT tableHW5 P7, sample P1.2LAN side: private IP + original port. WAN side: router's public IP + a new unique port per connection.m2-9
OpenFlow flow table / firewallHW5 P8, P9One row per rule: match (ingress port, IP src/dst with wildcards, protocol, port) → action (forward(k), drop).m2-10
Dijkstra tableHW6 P3, P4Each step: add the cheapest node not in N', then relax its neighbours with D(v)+c(v,w). Write D,p for every column every row.m2-11
DV update at one nodeSample P3New D1(6) = min over neighbours of (link cost + reported cost). Sample: min(2+7, 5+3, 1+9) = 8 via N3.m2-12
DV tables from start to stableHW6 P5Row per node the table knows; round 0: own row only; each round copy neighbours' latest rows and recompute own row with Bellman-Ford.m2-12
DV link-cost change: does x tell its neighbours?HW6 P7x notifies only if its own least cost changes. Change a link not on the current best path that stays worse → no message.m2-12

2. Short answers to have ready

Sample Problem 1, with model answers

QuestionAnswer
Senders have low processing power, receivers high. Will congestion occur? Why? (P1.1)Yes, it can. Congestion happens in router buffers when the total traffic from many senders exceeds a link's capacity. Fast receivers only rule out flow-control overflow, not a shared bottleneck link.
My address behind NAT on Comcast is 10.0.0.1. Which protocol gave it to me? Is it used on the Internet directly? Why? (P1.2)DHCP (served by the home NAT router). No: 10.0.0.1 is in the private block 10/8, valid only inside the home network. The NAT router rewrites it to its one public address (from Comcast) plus a new port.
Which TCP header bit means disconnect? (P1.3)The FIN bit = 1.
Does TCP use a retransmitted segment to measure RTT? Why? (P1.4)No. When the ACK arrives it is ambiguous whether it acknowledges the original or the retransmission, so the SampleRTT could be wrong (too long or too short) (HW4 P33).

TCP

QuestionAnswer
Flow control vs congestion control?Flow control: one sender too fast for one receiver; receiver advertises rwnd. Congestion control: too many senders too fast for the network; sender adjusts cwnd from loss or delay (3-65).
Why a 3-way handshake and not 2-way?With variable delay, retransmitted and reordered messages, a 2-way handshake can open a half-open connection or accept old duplicate data after the client has gone. The third message proves both sides are live and agree on both initial seq #s (3-61 → 3-63).
What does a duplicate ACK mean?A segment arrived out of order (a gap); the receiver re-ACKs the next byte it expects. Three duplicates → the segment is probably lost → fast retransmit (3-55, 3-56).
What does the ACK number mean?The seq # of the next byte expected from the other side; cumulative, so it covers every byte before it (3-46).
Why is TimeoutInterval = EstimatedRTT + 4·DevRTT?The timeout must exceed the RTT, but RTT varies. Too short → premature timeouts and needless retransmissions; too long → slow reaction to loss. The margin grows with the variation (3-48, 3-50).
Reno vs Tahoe?Both: timeout → cwnd = 1, ssthresh = cwnd/2. On 3 dup ACKs: Reno ssthresh = cwnd/2, cwnd = ssthresh + 3, then linear; Tahoe cwnd = 1 and slow start. Dup ACKs show the network still delivers segments, so Reno does not restart from 1 (3-81).
Why switch from slow start to CA at ssthresh?ssthresh = half the window at the last loss. Below it, growing fast is safe; near it, grow 1 MSS per RTT to probe gently (3-82).
Why is AIMD fair and AIAD not? (HW4 P41)Additive increase moves both flows along a 45° line; multiplicative decrease halves both, so the gap halves at each loss → converges to the equal share. Additive decrease subtracts the same amount from both, so the gap never shrinks and the flows stay unequal.
ECN?Router sets 2 bits in the IP ToS field (ECN = 11) to signal congestion; receiver sets ECE on its TCP ACK; sender reduces cwnd. Network-assisted, no loss needed (3-91).
CUBIC in one line?After a loss, ramp quickly back toward Wmax (the window at the loss), then approach it slowly; growth is a cubic function of time to K. Linux default (3-84, 3-85).
Delay-based CC?Compare measured throughput with cwnd/RTTmin: close → increase linearly, far below → decrease linearly. "Keep the pipe just full, but no fuller." BBR (3-88 → 3-90).
Is TCP fair to UDP / parallel connections?No police: UDP apps ignore congestion control; an app opening many TCP connections gets more (9 existing + 11 new → R/2) (3-94).
QUIC vs TCP?QUIC runs at the application layer over UDP; one handshake sets up reliability, congestion control, auth, and crypto (TCP + TLS needs 2 serial handshakes); several streams per connection so one lost packet does not block the others (no HOL blocking) (3-96 → 3-99).

Network layer: data plane

QuestionAnswer
Forwarding vs routing?Forwarding: move a packet from an input link to the right output link at one router (local, ns). Routing: decide the end-to-end path (network-wide, ms) (4-3).
Data plane vs control plane?Data plane: per-router forwarding by header fields. Control plane: network-wide logic that computes the tables, either per-router algorithms or a remote SDN controller (4-4 → 4-6).
Why longest prefix match?Address blocks don't divide evenly: an organization that moved ISPs is advertised as a more specific prefix inside another ISP's aggregate (200.23.18.0/23 inside 200.23.16.0/20), and the more specific entry must win (4-15, 4-53).
HOL blocking?At an input queue, the datagram at the front waits for a busy output, and blocks datagrams behind it even if their outputs are free (4-22).
Where does a router queue and drop?Input ports if the fabric is slower than all inputs combined; output ports when packets arrive from the fabric faster than the link rate (4-22 → 4-24).
Why are fragment offsets in 8-byte units?The offset field is 13 bits but the datagram can be 216 bytes; counting in 8-byte units (213 × 8 = 65,536) covers it. So every fragment but the last carries a multiple of 8 data bytes.
What happens if one fragment is lost?Reassembly is only at the destination, which can't complete the datagram and discards it; TCP retransmits the whole segment.
Why does IPv6 drop the header checksum?To speed processing at routers: IPv4 routers recompute it at every hop because TTL changes. Link and transport layers check errors already (4-62).
What else did IPv6 remove or add?Removed fragmentation at routers and options; fixed 40-byte header, 128-bit addresses, flow label (4-61, 4-62).
Tunneling?Carry the IPv6 datagram as the payload of an IPv4 datagram between IPv4-only routers (4-63).
What does DHCP give a host?IP address (with a lease), first-hop router, DNS server name and IP, subnet mask. Four messages: discover, offer, request, ACK; broadcast because the client has no address yet (4-44 → 4-47).
What does NAT break?A layer-3 device rewrites port numbers (layer 4), violating the end-to-end argument; hosts behind NAT can't be reached by an outside client without NAT traversal; the address shortage should be solved by IPv6 (4-60).
OpenFlow match plus action?Each flow-table row matches header fields from layers 2–4 (with wildcards and a priority) and takes an action: forward, drop, modify, or send to the controller; counters track bytes and packets. One abstraction covers router, switch, firewall, NAT (4-71 → 4-75).
Can a traditional router send H1→H3 out one interface and H2→H3 out another? (HW5 P1b)No: destination-based forwarding looks only at the destination address. Generalized forwarding (OpenFlow) can, by matching on the source.

Routing (5-1 → 5-23)

QuestionAnswer
LS vs DV in three linesLS: every router knows the full topology, runs Dijkstra; O(n²) work and O(n²) messages; may oscillate. DV: each router knows only neighbours' vectors, runs Bellman-Ford iteratively; convergence time varies, routing loops, count-to-infinity. Robustness: an LS error stays in one table; a DV error (black-holing) spreads through the network (5-23).
Count-to-infinity and poisoned reverseWhen a link cost rises, nodes keep routing through each other on stale costs and raise them a little each exchange (4 → 60 takes 44 iterations). Poisoned reverse: if z routes to x via y, z tells y its cost to x is ∞. It fixes 2-node loops, not loops of 3 or more (5-22).
Why can Dijkstra oscillate?If link cost = traffic carried, every reroute changes the costs, which triggers the next reroute (5-13).
When does a DV node send its vector?Only when its own distance vector changes (after a local link-cost change or a neighbour's update) (5-18).

3. Traps

• ACK = next byte expected, not the last byte received. Bytes 350–409 received → ACK 410.
• Reply in a seq/ACK fill-in: seq = their ACK, ACK = their seq + data length. A 1-character segment adds 1.
• SYN and FIN each consume one seq #; a pure ACK consumes none.
• Out-of-order arrival: the ACK still carries the old expected byte.
• The ACK reverses the ports: src = server port, dst = client port.
• Reno after 3 dup ACKs: cwnd = ssthresh + 3 (cwnd 42 → 24). Tahoe: cwnd = 1. Timeout: 1 in both.
• ssthresh = half the cwnd at the loss (the peak), floored: 29 → 14.
• Slow start stops at ssthresh: 8 → 9, not 16, if ssthresh = 9.
• "During what round is the Nth segment sent?": add cwnd values from round 1 (1, 3, 7, 15, …).
• Interval answers: the slow-start interval ends where the curve turns linear; give both ends.
• Fragment data = MTU − 20 rounded down to a multiple of 8. Offset is in 8-byte units; length includes the 20-byte header; last flag = 0.
• Count the original datagram's data as total length − 20.
• LPM: check all entries, take the longest match; an address that matches none goes to "otherwise".
• Subnets: round up to a power of two and start each block at a multiple of its size.
• Dijkstra: never update a node already in N'; write ∞, and carry D,p forward every row.
• DV: new cost = link cost + the neighbour's newly reported cost. The old table entry doesn't count, and the new cost can be higher than the old one.
• NAT: two LAN hosts may use the same source port; the WAN ports must still be different.
• DHCP: client 0.0.0.0:68 → 255.255.255.255:67, not the other way round.
• Buffer RTT·C/√N: take the square root of N, not of RTT·C.

4. Time plan (50 minutes)

MinutesDo
0–2Read every problem. Note which are calculations.
2–10Problem 1 short answers: fact + reason, 1–3 sentences each. Don't write essays.
10–14TCP seq/ACK fill-in. Write the rule beside it, then the numbers.
14–19DV update: write min( , , ) with every neighbour; give cost and next hop.
19–31cwnd graph: first label every slow-start, CA, and drop point on the figure, then answer the parts in order.
31–45Remaining homework-style problems (Dijkstra table, LPM / subnets, fragmentation, NAT, OpenFlow). Full tables, every row.
45–50Check: ACK numbers (+1?), ssthresh values, offsets ÷ 8, Dijkstra final column against a direct path check.

← formula sheet · all topics · mock midterm →