Networking Fundamentals and Protocols Questions
The core model of how networks move data: the OSI and TCP/IP layers, the Internet Protocol suite, transport protocols (TCP versus UDP), encapsulation, and TCP behavior including congestion control. Covers the protocol foundations every networking and infrastructure discussion builds on, from link layer through transport. The conceptual bedrock beneath addressing, routing, and switching.
Explain how IPv6 fragmentation differs from IPv4: why IPv6 moved fragmentation responsibility entirely to the source host (routers along the path no longer fragment), the role of the IPv6 fragmentation extension header, and what this design implies for Path MTU Discovery and for devices in the middle of the path.
Sample Answer
Direct answer
IPv6 removed the ability for ROUTERS along the path to fragment a packet; only the ORIGINATING host may fragment an IPv6 packet, using a dedicated fragmentation extension header, which pushes the entire responsibility for correctly sizing packets (and reacting to Path MTU, Maximum Transmission Unit, Discovery feedback) onto the sender rather than sharing it with the network.
Structured elaboration
In IPv4, any router along the path could fragment a packet too large for its outgoing link (unless the Don't Fragment bit was set), a convenience that came at real cost: routers doing fragmentation work on the fly, and receivers having to reassemble fragments that could have been created by ANY device along the path, not just the sender. IPv6's designers removed this entirely: routers now MUST drop an IPv6 packet that's too large for the next link and send back an ICMPv6 "Packet Too Big" message reporting the link's MTU, rather than fragmenting it themselves. If the ORIGINATING host still needs to send data larger than the smallest MTU along the path, it must fragment the packet itself, before sending, using the IPv6 Fragment extension header (which carries the same conceptual information as IPv4's Identification/Flags/Offset fields, just in a dedicated extension header rather than baked into the main IP header).
Worked example
This design change makes Path MTU Discovery load-bearing in IPv6 in a way it wasn't strictly required to be in IPv4: since no device in the middle of the path can rescue an oversized packet by fragmenting it, a sender that doesn't properly discover and respect the path's minimum MTU will simply have its packets dropped along the way (with an ICMPv6 message reporting why, PROVIDED that message isn't itself being filtered somewhere, the classic PMTUD-blackhole failure mode). This is also why a middlebox in the middle of an IPv6 path is a materially different kind of obstacle than in IPv4: it cannot silently paper over an oversized-packet problem by fragmenting on the sender's behalf; it can only drop and (hopefully) report back.
Trade-offs & pitfalls
The IPv6 design trades away routers' ability to "fix" an oversized packet on the fly in exchange for a simpler, more predictable job for routers (never having to fragment) and a stronger incentive for senders to get Path MTU Discovery right in the first place, rather than relying on the network to quietly compensate for an oversized packet. The practical implication: if ICMPv6 "Packet Too Big" messages are filtered anywhere along an IPv6 path (the same class of misconfiguration that breaks IPv4 PMTUD), there is NO fallback fragmentation happening in the middle of the path to mask the problem, the failure is more absolute than the equivalent IPv4 case.
You suspect a transit provider is running a transparent TCP proxy that strips or rewrites TCP options (such as SACK permitted, window scale, or timestamps), degrading performance without dropping the connection outright. Describe how you would detect this from the endpoints, and how losing each of those specific options would show up in observed throughput or latency behavior.
Sample Answer
Direct answer
A transparent TCP proxy that strips or rewrites options like SACK-permitted (Selective Acknowledgment), window scale, or timestamps degrades performance without ever dropping the connection outright, since the handshake still completes; the way to detect it is to compare what your OWN stack SENT in the handshake against what actually arrived at the other end, since a proxy silently altering options in transit is invisible unless you check both ends.
Structured elaboration
Capture the handshake on BOTH the client and server sides (or as close to each endpoint as possible) and diff the negotiated options field by field. If the client sends a SYN advertising window scale, SACK-permitted, and timestamps, but the SYN-ACK the SERVER sees (or the SYN the server receives, if the proxy sits between client and server) is missing one or more of those options, or has a DIFFERENT window scale factor than what the client actually sent, something in the path rewrote it. Passive detection (without direct access to both ends) looks for the downstream SYMPTOMS: if window scale is stripped, throughput on an otherwise healthy high-bandwidth-delay-product path caps hard around 64KB in flight; if SACK-permitted is stripped, loss recovery becomes slow and coarse (whole-window retransmission behavior instead of precise, per-segment recovery) even though the path's raw loss rate is low; if timestamps are stripped, round-trip-time measurement and PAWS (Protect Against Wrapped Sequence numbers) protection both degrade, which can show up as a subtly less accurate RTO (retransmission timeout) calculation.
Worked example
Losing window scale specifically produces the most dramatic and recognizable symptom: throughput plateaus at roughly what a 64KB window can sustain for the path's round-trip time, regardless of how much raw bandwidth is actually available, since the connection can never express a window larger than the unscaled 16-bit field allows. If the expected bandwidth-delay product for the path is, say, 20 MB, but observed throughput behaves as though the effective window is capped near 64KB, a transparent proxy stripping the window scale option during the handshake is a strong suspect, especially if the SAME symptom does NOT appear when the two hosts communicate over a path that avoids that specific intermediate device.
Trade-offs & pitfalls
This class of interference is one of the harder network problems to diagnose precisely BECAUSE the connection doesn't fail, it just quietly underperforms, so it's easy to misattribute to "the network is just slow" or "the application is inefficient" rather than a specific, fixable option-stripping middlebox. The most reliable confirmation is always a controlled A/B comparison: the same connection, same hosts, routed via a path that includes versus excludes the suspect device, if the symptom disappears when the device is bypassed, that's strong confirmation.
Describe the UDP header fields (source port, destination port, length, checksum) and explain how the UDP checksum behaves differently across IPv4 and IPv6. If you suspected corrupted UDP payloads reaching an application in production, what would that suggest about where in the stack the corruption is happening?
Sample Answer
Direct answer
The UDP header is deliberately minimal, just four fields: source port, destination port, length, and checksum, and it provides no reliability, no ordering, and no flow or congestion control at all. The checksum is optional over IPv4 (it can be all-zeros to mean "not computed") but MANDATORY over IPv6, since IPv6 dropped the network-layer checksum that IPv4 had, leaving UDP's checksum as the only integrity check left covering the payload for that traffic.
Structured elaboration
- Source port (16 bits): the sending application's port, allowing a reply to be addressed back to the right process; can legitimately be zero if no reply is expected.
- Destination port (16 bits): identifies which application on the receiving host should get the datagram.
- Length (16 bits): the total length of the UDP header plus payload, in bytes, this is how a receiver knows where the datagram actually ends (UDP has no separate "end of message" marker otherwise).
- Checksum (16 bits): a checksum computed over a pseudo-header (which includes the source/destination IP addresses, borrowed conceptually from the IP layer to catch certain misdelivery errors) plus the UDP header and payload.
Over IPv4, the sender is technically permitted to skip computing the checksum entirely, since IPv4 packets already carry a header checksum which catches SOME corruption, though notably NOT payload corruption. Over IPv6, sending a UDP checksum is mandatory, precisely because IPv6 has no header checksum of its own at all, so UDP's checksum became the last line of defense for detecting corruption anywhere in the packet.
Worked example
If corrupted UDP payloads are reaching an application in production despite the checksum being enabled, that's actually a meaningful signal about WHERE the corruption is happening: a valid checksum plus corrupted payload data can only mean the corruption happened AFTER the checksum was computed and BEFORE the packet was actually transmitted onto the wire (for instance, in host memory, in a buggy driver, or in hardware), or that checksum offloading to the NIC is misconfigured or buggy (many NICs compute the checksum in hardware rather than the OS, and a broken offload implementation can silently produce or accept bad checksums). It would NOT typically indicate ordinary in-transit bit-flip corruption, since that's exactly the class of error the checksum exists to catch and reject.
Trade-offs & pitfalls
The 16-bit checksum, while better than nothing, is not cryptographically strong and won't catch every possible corruption pattern, especially certain kinds of systematic bit errors; applications with strict data-integrity requirements over UDP (like some real-time media or gaming protocols) often layer their own additional integrity or authentication checks on top rather than relying on the UDP checksum alone.
Implement a simplified TCP connection tracker that reads packets from a pcap file and emits connection-state transitions (SYN, ESTABLISHED, FIN/RST, TIME_WAIT). Parse Ethernet/IP/TCP headers, track connections by the 4-tuple, and maintain a per-connection state machine. Describe the primary data structures you would use and how you would handle a high packet rate without losing track of state.
Sample Answer
Direct answer
A pcap-driven connection tracker needs two pieces working together: a header parser that pulls the source/destination IP and port and the TCP flags out of each raw frame, and a state machine, keyed by the connection's 4-tuple, that maps flag combinations onto transitions like CLOSED to SYN_SENT to ESTABLISHED to CLOSE_WAIT to TIME_WAIT.
Structured elaboration (approach)
Parsing walks the frame layer by layer: skip the fixed 14-byte Ethernet header, read the IPv4 header (whose first byte's low nibble gives the header length in 4-byte words, since IPv4 headers can carry options and aren't always exactly 20 bytes), then read the 20-byte fixed TCP header immediately after (again respecting the TCP data offset field for any TCP options present). The key data structure is a dictionary keyed by the connection's 4-tuple, CANONICALIZED so the same connection is recognized regardless of which direction a given packet is traveling (a reply from the server to the client must resolve to the SAME dictionary key as the client's original request).
Worked example (code)
import struct
FIN, SYN, RST, PSH, ACK_FLAG = 0x01, 0x02, 0x04, 0x08, 0x10
def parse_packet(frame):
ip_bytes = frame[14:34]
ver_ihl, tos, total_len, ident, flags_frag, ttl, proto, csum, src, dst = \
struct.unpack("!BBHHHBBH4s4s", ip_bytes)
ip_header_len = (ver_ihl & 0x0F) * 4
tcp_start = 14 + ip_header_len
sport, dport, seq, ack, offset_reserved, flags, window, tcsum, urg = \
struct.unpack("!HHLLBBHHH", frame[tcp_start:tcp_start+20])
payload_start = tcp_start + (offset_reserved >> 4) * 4
return {
"src_ip": ".".join(str(b) for b in src), "dst_ip": ".".join(str(b) for b in dst),
"sport": sport, "dport": dport, "seq": seq, "ack": ack,
"flags": flags, "payload_len": len(frame[payload_start:]),
}
class ConnectionTracker:
def __init__(self):
self.conns = {} # 4-tuple -> state string
def _key(self, pkt, from_client):
return (pkt["src_ip"], pkt["sport"], pkt["dst_ip"], pkt["dport"]) if from_client \
else (pkt["dst_ip"], pkt["dport"], pkt["src_ip"], pkt["sport"])
def process(self, pkt, from_client):
key = self._key(pkt, from_client)
state = self.conns.get(key, "CLOSED")
f = pkt["flags"]
if f & RST:
state = "CLOSED"
elif state == "CLOSED" and (f & SYN) and not (f & ACK_FLAG):
state = "SYN_SENT"
elif state == "SYN_SENT" and (f & SYN) and (f & ACK_FLAG):
state = "SYN_RECEIVED"
elif state == "SYN_RECEIVED" and (f & ACK_FLAG) and not (f & FIN):
state = "ESTABLISHED"
elif state == "ESTABLISHED" and (f & FIN):
state = "CLOSE_WAIT"
elif state == "CLOSE_WAIT" and (f & ACK_FLAG):
state = "TIME_WAIT"
self.conns[key] = state
return state
Run against a synthetic 6-frame sequence (constructed with the same struct-packing logic in reverse, to produce realistic raw bytes) representing a full handshake, one data segment, and a graceful close: the tracker correctly walked CLOSED to SYN_SENT to SYN_RECEIVED to ESTABLISHED (the data segment stayed in ESTABLISHED, as expected, since it carries no SYN/FIN) to CLOSE_WAIT to TIME_WAIT, ending in the expected final state, verified with an assertion against the real parsed output rather than assumed.
Trade-offs & pitfalls (edge cases and complexity)
Per-packet complexity is O(1) (fixed-size header parsing, a single dictionary lookup), so the tracker scales linearly with packet rate; at a genuinely HIGH packet rate, the main design decision is concurrency: parsing itself is embarrassingly parallel across DIFFERENT connections (since each 4-tuple's state is independent), so a real high-throughput version would shard connections across worker threads/processes by a hash of the 4-tuple, while packets for the SAME connection must still be processed in arrival order to keep the state machine correct, a classic partition-by-key concurrency pattern. Edge cases worth naming explicitly: a RST from either side always forces CLOSED regardless of the current state (modeled here); simultaneous close (both sides sending FIN before seeing the other's) needs a genuinely separate CLOSING state in a fuller implementation, which this simplified 4-state model (SYN, ESTABLISHED, FIN/RST, TIME_WAIT) does not attempt to distinguish from the ordinary one-sided close.
A replication service running over a high-latency WAN link achieves only 20% of the link's theoretical throughput. Walk through the end-to-end set of transport-layer explanations you would check, in a sensible order: congestion-control algorithm choice, socket buffer sizing, TCP window scaling and MSS, and NIC offload settings. For each, explain what evidence would tell you it is (or isn't) the cause.
Sample Answer
Direct answer
For a WAN replication job stuck at 20% of theoretical throughput, walk the transport-layer stack in this order: congestion-control behavior first (is loss even happening, and if so is the algorithm reacting sensibly), then window sizing relative to the path's bandwidth-delay product, then socket buffers, then NIC-level settings, since each of these can independently cap throughput and the cheapest checks come first.
Structured elaboration
- Congestion-control algorithm and loss: check whether the connection is experiencing any packet loss at all (via retransmit counters,
ss -i'sretransfield). If there's meaningful loss and the algorithm is a loss-based one like Cubic, and the path has ANY non-congestive baseline loss (common on long WAN paths), the algorithm may be needlessly throttling itself; switching to BBR is a plausible fix here specifically because it doesn't over-react to non-congestive loss the way Cubic does. - Window size versus bandwidth-delay product: compute the path's bandwidth-delay product (bandwidth times round-trip time) and compare it to the connection's actual window (
ss -i'scwndand the negotiated window scale). If the window can never grow large enough to cover the bandwidth-delay product, no amount of congestion-control tuning will help, the connection is fundamentally window-limited, not congestion-limited. - Socket buffer sizing: even with window scaling negotiated, if the OS's actual send/receive socket buffers (
net.ipv4.tcp_wmem/tcp_rmemon Linux) are capped below what the window scale option would otherwise allow, the effective window is capped at the smaller of the two, check both. - NIC-level settings: segmentation/offload settings (TSO/GSO/LRO) and interface MTU (Maximum Transmission Unit) affect how efficiently the CPU can push bytes onto the wire; a misconfigured or disabled offload setting can bottleneck a fast link at the CPU rather than the network itself, worth ruling out especially if CPU utilization on the sending host is unexpectedly high relative to the achieved throughput.
Worked example
Suppose the link is rated at 1 Gbps with a 200ms round-trip time. The bandwidth-delay product is 1e9 bits/s times 0.2s = 2e8 bits = 25,000,000 bytes (25 MB). If the connection's actual window, even after scaling, tops out at 5 MB (one-fifth of the required 25 MB), the connection can never exceed roughly one-fifth of the link's rated throughput, which lines up suspiciously well with an observed 20%. That's the single most likely explanation to check FIRST, since it directly predicts the exact ratio being observed, before assuming something more exotic like a congestion-control mismatch.
Trade-offs & pitfalls
It's tempting to jump straight to "switch congestion-control algorithms" as the fix, but that's the wrong first move if the real limiter is window size: no algorithm change fixes a window that's structurally too small for the path's bandwidth-delay product. Always compute the bandwidth-delay product FIRST and check whether the achieved throughput lines up with a window-limited explanation before reaching for an algorithm change.
Unlock Full Question Bank
Get access to all 34 Networking Fundamentals and Protocols interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.