Midterm 2 formula sheet (memorize)
Slides 3-43 → 5-23 · No cheat sheet allowed, so every line here has to be in your head · Topic column links to the full page
Formulas
| What | Formula | Topic |
|---|---|---|
| TCP sequence and ACK numbers | ||
| Next segment's seq # | next seq = seq + bytes of data (counts bytes, not segments) (3-45) | m2-1 |
| ACK number | ACK = next byte expected = last in-order byte received + 1. Cumulative. (3-46) | m2-1 |
| Reply to a segment | Reply seq = the ACK you were sent; reply ACK = their seq + their bytes. Telnet: Seq=42, ACK=79, 'C' → Seq=79, ACK=43, 'C' (3-47) | m2-1 |
| SYN and FIN | Each consumes one seq #: SYN seq = x → SYNACK has ACKnum = x+1; client ACK has ACKnum = y+1 (3-63). A pure ACK consumes none. | m2-3 |
| Out-of-order arrival | Receiver sends a duplicate ACK carrying the seq # of the next expected byte (3-55) | m2-1 |
| Max file without wrapping seq #s | 32-bit seq field → 232 = 4,294,967,296 bytes ≈ 4.29 GB. MSS does not matter. | m2-1 |
| Time to send that file | segments = ⌈L / MSS⌉; time = (L + segments × header) × 8 / R. HW4 P26: ⌈232/536⌉ = 8,012,999; × 66 = 528,857,934 B; total 4.825×109 B → 249 s at 155 Mbps. | m2-1 |
| RTT and timeout | ||
| EstimatedRTT | EstimatedRTT = (1 − α)·EstimatedRTT + α·SampleRTT, α = 0.125 (3-49) | m2-2 |
| DevRTT | DevRTT = (1 − β)·DevRTT + β·|SampleRTT − EstimatedRTT|, β = 0.25 (3-50) | m2-2 |
| Timeout | TimeoutInterval = EstimatedRTT + 4·DevRTT (3-50) | m2-2 |
| EWMA unrolled (HW4 P32) | Sample 1 newest: EstRTT(n) = α Σj=1n−1 (1−α)j−1 SampleRTTj + (1−α)n−1 SampleRTTn | m2-2 |
| Timer on timeout | Retransmit the smallest unACKed seq #, double the timeout interval; recompute from EstimatedRTT/DevRTT when a new ACK arrives | m2-2 |
| Fast retransmit | 3 duplicate ACKs (4 ACKs with the same number) → resend smallest unACKed segment without waiting for the timer (3-56) | m2-1 |
| Flow and congestion windows | ||
| Receive window | rwnd = RcvBuffer − (LastByteRcvd − LastByteRead) | m2-3 |
| Sender limit | LastByteSent − LastByteAcked ≤ min(cwnd, rwnd) (3-79 states the cwnd half) | m2-3 |
| Sending rate | rate ≈ cwnd / RTT bytes/s (3-79) | m2-5 |
| Slow start | Start cwnd = 1 MSS, +1 MSS per ACK → doubles every RTT: round k has 2k−1, rounds 1..k send 2k − 1 segments total. Stops at ssthresh (3-80) | m2-5 |
| Congestion avoidance | +1 MSS per RTT (per ACK: cwnd += MSS·MSS/cwnd) (3-83) | m2-5 |
| Timeout (Reno and Tahoe) | ssthresh = cwnd/2, cwnd = 1 MSS, back to slow start (3-83) | m2-5 |
| Triple dup ACK, Reno | ssthresh = cwnd/2, cwnd = ssthresh + 3, then linear (fast recovery: +1 MSS per extra dup ACK; new ACK → cwnd = ssthresh) (3-83) | m2-5 |
| Triple dup ACK, Tahoe | ssthresh = cwnd/2, cwnd = 1 (Tahoe always goes to 1) (3-81) | m2-5 |
| Odd cwnd at loss | Floor: cwnd 29 → ssthresh 14 (HW4 P40g) | m2-5 |
| Average TCP throughput | 0.75 · W / RTT (W = window when loss occurs; sawtooth between W/2 and W) | m2-5 |
| Delay-based | Uncongested throughput = cwnd / RTTmin; measured = bytes sent in last RTT / RTTmeasured (3-88) | m2-6 |
| Fairness goal | K sessions on a bottleneck R → R/K each (3-92) | m2-6 |
| Parallel TCP | App with k of n+k connections gets k·R/(n+k): 9 existing + 1 → R/10; + 11 → R/2 (3-94) | m2-6 |
| Congestion scenarios | ||
| Scenario 1 (infinite buffers) | λout max R/2 per flow; delay → ∞ as λin → R/2 (3-66) | m2-4 |
| Scenario 2, resend only lost | At λ'in = R/2, 1 of every 3 packets leaving is a retransmission → λout = R/3 (HW4 P39) | m2-4 |
| Scenario 2, premature timeouts | Each packet forwarded twice → λout = (R/2)/2 = R/4 (HW4 P39) | m2-4 |
| Scenario 3 (multi-hop) | As red λ'in grows, blue throughput → 0; upstream capacity spent on dropped packets is wasted (3-73, 3-74) | m2-4 |
| Router | ||
| Buffer, RFC 3439 | B = RTT · C (250 ms × 10 Gbps = 2.5 Gbit) (4-25) | m2-7 |
| Buffer, N flows | B = RTT · C / √N (4-25) | m2-7 |
| WFQ share | Class i gets R · wi / Σj wj (minimum bandwidth guarantee) (4-30) | m2-7 |
| Switching rate | N inputs at R → ideally N·R (4-17) | m2-7 |
| IPv4 addressing and fragmentation | ||
| IPv4 header | 20 bytes without options; TCP + IP = 40 bytes overhead (4-34) | m2-8 |
| Data per fragment | Largest multiple of 8 ≤ MTU − 20 (1500 → 1480; 1400 → 1376) | m2-8 |
| Number of fragments | ⌈(total length − 20) / data per fragment⌉ | m2-8 |
| Fragment fields | length = data + 20; offset = (bytes of data before it) / 8; flag = 1 on all but the last; same ID. 4000 B, MTU 1500 → 1500/1500/1040, offsets 0/185/370 (4-36) | m2-8 |
| Addresses in a /x | 232−x (/24 = 256, /26 = 64). Usable hosts: subtract 2 if the question asks | m2-8 |
| Sub-blocks | A /x holds 2y−x blocks of /y (a /20 = 8 × /23, 4-51). A /y block starts at a multiple of 232−y | m2-8 |
| Prefix range | First = host bits all 0, last = host bits all 1 | m2-8 |
| Longest prefix match | Among all matching entries pick the one with the most prefix bits (4-15) | m2-8 |
| IPv6 header | 40 bytes fixed; 128-bit addresses (4-61, 4-62) | m2-9 |
| NAT capacity | 16-bit port field → about 60,000 simultaneous connections per WAN address | m2-9 |
| DHCP ports | Server 67, client 68; discover from 0.0.0.0:68 to 255.255.255.255:67 (4-46) | m2-9 |
| Routing | ||
| Dijkstra update | D(w) = min( D(w), D(v) + c(v,w) ) for each w adjacent to the node v just added to N' (5-9) | m2-11 |
| Bellman-Ford | dx(y) = minv { c(x,v) + dv(y) } over neighbours v; the minimizing v is the next hop (5-14, 5-15) | m2-12 |
| DV update | Dx(y) ← minv{ c(x,v) + Dv(y) }; notify neighbours only if Dx changed (5-17, 5-18) | m2-12 |
| LS complexity | n(n+1)/2 comparisons → O(n²) (O(n log n) with a heap); messages O(n²) per slide 5-23, O(nE) per the book (5-12, 5-23) | m2-11 |
| DV count-to-infinity | Good news travels fast, bad news slow: link 4 → 60 takes 44 iterations. Poisoned reverse: if z routes to x via y, z tells y Dz(x) = ∞ (5-21, 5-22) | m2-12 |
Units: bytes × 8 = bits · G = 10⁹, M = 10⁶ · RTT·C comes out in bits · √N: N = 100 → 10, N = 10,000 → 100.
Numbers and names to recall
| Item | Value |
|---|---|
| TCP RFCs | 793, 1122, 2018, 5681, 7323 (3-44) |
| TCP properties | Point-to-point, reliable in-order byte stream (no message boundaries), full duplex, MSS, cumulative ACKs, pipelined, connection-oriented, flow controlled (3-44) |
| TCP header fields | src port, dst port (16 bits each); seq # (32); ACK # (32); header length; flags C E U A P R S F; receive window (16); checksum; urgent pointer; options (3-45) |
| Flags | A = ACK field valid · R, S, F = RST, SYN, FIN: connection management · C, E = CWR, ECE: congestion notification · U, P = urgent, push |
| TCP header size | 20 bytes without options |
| Delayed ACK | In-order segment, nothing pending: wait up to 500 ms (RFC 1122, 2581) (3-55) |
| RcvBuffer default | 4096 bytes, set via socket options; many OSes auto-adjust (3-58) |
| Initial cwnd / ssthresh | cwnd = 1 MSS; ssthresh = 64 KB in the FSM (3-83) |
| 3-way handshake | SYN (Seq=x) → SYNACK (Seq=y, ACKnum=x+1) → ACK (ACKnum=y+1, may carry data). States: LISTEN, SYNSENT, SYN RCVD, ESTAB (3-63) |
| Close | Each side sends FIN = 1; the other ACKs it (ACK may be combined with its own FIN) (3-64) |
| CUBIC | Wmax = window at loss; grows as the cube of the distance to time K; default in Linux (3-84, 3-85) |
| Delay-based | BBR on Google's internal backbone (3-90) |
| ECN | 2 bits in the IP ToS field; router marks ECN = 11; receiver sets ECE on the ACK (3-91) |
| Network-assisted CC examples | TCP ECN, ATM, DECbit (3-76) |
| QUIC | Application layer over UDP; 1 handshake (reliability, congestion control, auth, crypto) vs TCP + TLS 2 serial handshakes; streams, no HOL blocking; HTTP/3 (3-96 → 3-99) |
| Service models | Internet best effort: no bandwidth, loss, order, or timing guarantee. ATM CBR: all yes. Intserv RFC 1633, Diffserv RFC 2475 (4-9) |
| Control vs data plane speed | Control: software, milliseconds. Forwarding: hardware, nanoseconds (4-11) |
| TCAM | Lookup in one clock cycle regardless of table size; Cisco Catalyst ~1M entries (4-16) |
| Switching fabrics | Memory (2 bus crossings per datagram), bus (32 Gbps, Cisco 5600), interconnection network / crossbar / Clos (Cisco CRS, 100s of Tbps) (4-19 → 4-21) |
| Drop / mark policies | Tail drop, priority drop; marking: ECN, RED (4-26) |
| Schedulers | FCFS (FIFO), priority, round robin, WFQ (4-27 → 4-30) |
| Net neutrality (2015 FCC) | No blocking, no throttling, no paid prioritization; 2017 rollback; 2024 rollback of the rollback |
| IPv4 header fields | ver, header len, ToS (diffserv 0:5, ECN 6:7), total length (16 bits, max 64 KB, typically ≤ 1500), 16-bit identifier, flags, fragment offset, TTL (decremented each router), upper-layer protocol, header checksum, 32-bit src and dst, options (4-34) |
| Reassembly | Only at the destination (4-35) |
| CIDR | a.b.c.d/x, x = bits in subnet part; e.g. 200.23.16.0/23 (4-42) |
| DHCP messages | Discover, offer (optional), request, ACK; transaction ID; lifetime 3600 s; RFC 2131. Also returns first-hop router, DNS name and IP, subnet mask (4-44 → 4-47) |
| Private address blocks | 10/8, 172.16/12, 192.168/16 (4-57) |
| Address allocation | ICANN → 5 regional registries; last IPv4 chunk handed out in 2011 (4-55) |
| IPv6 header | ver, priority, flow label, payload len, next hdr, hop limit, 128-bit src/dst. Gone: checksum, fragmentation, options (4-62) |
| IPv6 adoption | Google ~40% of clients (2023); NIST: 1/3 of US gov domains (4-67) |
| OpenFlow | Match fields: ingress port, MAC src/dst, Eth type, VLAN ID/pri, IP src/dst/proto/ToS, TCP/UDP src/dst port. Actions: forward, drop, modify, send to controller. Counters: bytes, packets (4-71, 4-72) |
| OpenFlow unifies | Router (longest IP prefix → forward), switch (dst MAC → forward/flood), firewall (IP + ports → permit/deny), NAT (IP + port → rewrite) (4-75) |
| Middlebox | RFC 3234; firewalls, IDS, NAT, load balancers, caches (4-78, 4-79) |
| Architecture | RFC 1958: connectivity, IP thin waist, intelligence at the edge (4-80, 4-82) |
| Routing classes | Global = link state; decentralized = distance vector; static vs dynamic (5-7) |
| DV properties | Iterative, asynchronous, distributed; a node notifies neighbours only when its DV changes (5-18) |