← all topics

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

WhatFormulaTopic
TCP sequence and ACK numbers
Next segment's seq #next seq = seq + bytes of data (counts bytes, not segments) (3-45)m2-1
ACK numberACK = next byte expected = last in-order byte received + 1. Cumulative. (3-46)m2-1
Reply to a segmentReply 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 FINEach 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 arrivalReceiver sends a duplicate ACK carrying the seq # of the next expected byte (3-55)m2-1
Max file without wrapping seq #s32-bit seq field → 232 = 4,294,967,296 bytes ≈ 4.29 GB. MSS does not matter.m2-1
Time to send that filesegments = ⌈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
EstimatedRTTEstimatedRTT = (1 − α)·EstimatedRTT + α·SampleRTT, α = 0.125 (3-49)m2-2
DevRTTDevRTT = (1 − β)·DevRTT + β·|SampleRTT − EstimatedRTT|, β = 0.25 (3-50)m2-2
TimeoutTimeoutInterval = 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 SampleRTTnm2-2
Timer on timeoutRetransmit the smallest unACKed seq #, double the timeout interval; recompute from EstimatedRTT/DevRTT when a new ACK arrivesm2-2
Fast retransmit3 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 windowrwnd = RcvBuffer − (LastByteRcvd − LastByteRead)m2-3
Sender limitLastByteSent − LastByteAcked ≤ min(cwnd, rwnd) (3-79 states the cwnd half)m2-3
Sending raterate ≈ cwnd / RTT bytes/s (3-79)m2-5
Slow startStart 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, Renossthresh = 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, Tahoessthresh = cwnd/2, cwnd = 1 (Tahoe always goes to 1) (3-81)m2-5
Odd cwnd at lossFloor: cwnd 29 → ssthresh 14 (HW4 P40g)m2-5
Average TCP throughput0.75 · W / RTT (W = window when loss occurs; sawtooth between W/2 and W)m2-5
Delay-basedUncongested throughput = cwnd / RTTmin; measured = bytes sent in last RTT / RTTmeasured (3-88)m2-6
Fairness goalK sessions on a bottleneck R → R/K each (3-92)m2-6
Parallel TCPApp 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 lostAt λ'in = R/2, 1 of every 3 packets leaving is a retransmission → λout = R/3 (HW4 P39)m2-4
Scenario 2, premature timeoutsEach 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 3439B = RTT · C (250 ms × 10 Gbps = 2.5 Gbit) (4-25)m2-7
Buffer, N flowsB = RTT · C / √N (4-25)m2-7
WFQ shareClass i gets R · wi / Σj wj (minimum bandwidth guarantee) (4-30)m2-7
Switching rateN inputs at R → ideally N·R (4-17)m2-7
IPv4 addressing and fragmentation
IPv4 header20 bytes without options; TCP + IP = 40 bytes overhead (4-34)m2-8
Data per fragmentLargest multiple of 8 ≤ MTU − 20 (1500 → 1480; 1400 → 1376)m2-8
Number of fragments⌈(total length − 20) / data per fragment⌉m2-8
Fragment fieldslength = 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 /x232−x (/24 = 256, /26 = 64). Usable hosts: subtract 2 if the question asksm2-8
Sub-blocksA /x holds 2y−x blocks of /y (a /20 = 8 × /23, 4-51). A /y block starts at a multiple of 232−ym2-8
Prefix rangeFirst = host bits all 0, last = host bits all 1m2-8
Longest prefix matchAmong all matching entries pick the one with the most prefix bits (4-15)m2-8
IPv6 header40 bytes fixed; 128-bit addresses (4-61, 4-62)m2-9
NAT capacity16-bit port field → about 60,000 simultaneous connections per WAN addressm2-9
DHCP portsServer 67, client 68; discover from 0.0.0.0:68 to 255.255.255.255:67 (4-46)m2-9
Routing
Dijkstra updateD(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-Forddx(y) = minv { c(x,v) + dv(y) } over neighbours v; the minimizing v is the next hop (5-14, 5-15)m2-12
DV updateDx(y) ← minv{ c(x,v) + Dv(y) }; notify neighbours only if Dx changed (5-17, 5-18)m2-12
LS complexityn(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-infinityGood 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

ItemValue
TCP RFCs793, 1122, 2018, 5681, 7323 (3-44)
TCP propertiesPoint-to-point, reliable in-order byte stream (no message boundaries), full duplex, MSS, cumulative ACKs, pipelined, connection-oriented, flow controlled (3-44)
TCP header fieldssrc 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)
FlagsA = ACK field valid · R, S, F = RST, SYN, FIN: connection management · C, E = CWR, ECE: congestion notification · U, P = urgent, push
TCP header size20 bytes without options
Delayed ACKIn-order segment, nothing pending: wait up to 500 ms (RFC 1122, 2581) (3-55)
RcvBuffer default4096 bytes, set via socket options; many OSes auto-adjust (3-58)
Initial cwnd / ssthreshcwnd = 1 MSS; ssthresh = 64 KB in the FSM (3-83)
3-way handshakeSYN (Seq=x) → SYNACK (Seq=y, ACKnum=x+1) → ACK (ACKnum=y+1, may carry data). States: LISTEN, SYNSENT, SYN RCVD, ESTAB (3-63)
CloseEach side sends FIN = 1; the other ACKs it (ACK may be combined with its own FIN) (3-64)
CUBICWmax = window at loss; grows as the cube of the distance to time K; default in Linux (3-84, 3-85)
Delay-basedBBR on Google's internal backbone (3-90)
ECN2 bits in the IP ToS field; router marks ECN = 11; receiver sets ECE on the ACK (3-91)
Network-assisted CC examplesTCP ECN, ATM, DECbit (3-76)
QUICApplication 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 modelsInternet 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 speedControl: software, milliseconds. Forwarding: hardware, nanoseconds (4-11)
TCAMLookup in one clock cycle regardless of table size; Cisco Catalyst ~1M entries (4-16)
Switching fabricsMemory (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 policiesTail drop, priority drop; marking: ECN, RED (4-26)
SchedulersFCFS (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 fieldsver, 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)
ReassemblyOnly at the destination (4-35)
CIDRa.b.c.d/x, x = bits in subnet part; e.g. 200.23.16.0/23 (4-42)
DHCP messagesDiscover, 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 blocks10/8, 172.16/12, 192.168/16 (4-57)
Address allocationICANN → 5 regional registries; last IPv4 chunk handed out in 2011 (4-55)
IPv6 headerver, priority, flow label, payload len, next hdr, hop limit, 128-bit src/dst. Gone: checksum, fragmentation, options (4-62)
IPv6 adoptionGoogle ~40% of clients (2023); NIST: 1/3 of US gov domains (4-67)
OpenFlowMatch 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 unifiesRouter (longest IP prefix → forward), switch (dst MAC → forward/flood), firewall (IP + ports → permit/deny), NAT (IP + port → rewrite) (4-75)
MiddleboxRFC 3234; firewalls, IDS, NAT, load balancers, caches (4-78, 4-79)
ArchitectureRFC 1958: connectivity, IP thin waist, intelligence at the edge (4-80, 4-82)
Routing classesGlobal = link state; decentralized = distance vector; static vs dynamic (5-7)
DV propertiesIterative, asynchronous, distributed; a node notifies neighbours only when its DV changes (5-18)

all topics · review sheet →