Networking
TCP/IP fundamentals, DNS, NAT, routing, BGP, subnetting and the OSI model for operations engineers.
23 questions
JuniorTheoryVery commonHow is a TCP connection established with the three-way handshake?
How is a TCP connection established with the three-way handshake?
The client sends SYN with its initial sequence. The server replies SYN-ACK, acknowledging the client's and offering its own. The client ACKs the server's. After these three segments both sides have synced sequence numbers and the connection is ESTABLISHED, ready for data.
Common mistakes
- ✗Getting the order wrong — it is
SYN→SYN-ACK→ACK, client-initiated - ✗Thinking no sequence numbers are exchanged during the handshake
- ✗Believing two segments suffice and the final
ACKis optional
Follow-up questions
- →What is a SYN flood, and how does it abuse the half-open state of the handshake?
- →How does the four-way handshake that closes a connection differ from the opening one?
MiddleTheoryVery commonHow does DNS resolve a hostname, and what role do recursive and authoritative servers play?
How does DNS resolve a hostname, and what role do recursive and authoritative servers play?
The client asks a recursive resolver, which walks the hierarchy if not cached: root servers point to the TLD servers, which point to the domain's authoritative servers that return the record. The resolver caches answers up to their TTL. Queries use UDP/53, falling back to TCP for large responses. Recursive resolvers do the legwork; authoritative servers own the zone's records.
Common mistakes
- ✗Swapping recursive and authoritative roles
- ✗Forgetting DNS uses UDP/53 with TCP fallback for large answers
- ✗Ignoring TTL-based caching and assuming every lookup walks the full hierarchy
Follow-up questions
- →When does a DNS query switch from UDP to TCP?
- →How does a negative-cache (NXDOMAIN) entry's TTL affect repeated failed lookups?
MiddleTheoryVery commonOn which OSI layers do a switch, a router, and SSH operate?
On which OSI layers do a switch, a router, and SSH operate?
A switch operates at layer 2 (data link), forwarding Ethernet frames by MAC within a segment. A router operates at layer 3 (network), forwarding IP packets between networks by IP. SSH is a layer 7 (application) protocol. The gotcha: SSH rides on TCP (layer 4) but is application-layer, not transport.
Common mistakes
- ✗Swapping switch (L2/MAC) and router (L3/IP) responsibilities
- ✗Placing SSH at the transport layer because it uses TCP, rather than at the application layer
- ✗Thinking a switch forwards by IP address rather than MAC
Follow-up questions
- →What is a layer-3 switch, and how does it blur the switch/router boundary?
- →Why is the OSI model an abstraction that the TCP/IP stack only loosely follows?
MiddleTheoryVery commonHow do TCP and UDP differ, and why is real-time voice usually carried over UDP?
How do TCP and UDP differ, and why is real-time voice usually carried over UDP?
TCP is connection-oriented and reliable — handshake, ordering, acks, retransmission — at the cost of latency. UDP is connectionless and best-effort: no handshake, no retransmit, lower latency. Real-time voice prefers UDP: a late retransmitted packet is useless to play back, so dropping it keeps latency low, which matters more than perfect delivery.
Common mistakes
- ✗Swapping the properties — TCP is the reliable, ordered one; UDP is best-effort
- ✗Thinking UDP retransmits lost packets like TCP does
- ✗Believing voice wants perfect delivery rather than low latency
Follow-up questions
- →Why does TCP head-of-line blocking hurt latency-sensitive traffic?
- →What reliability features does an application add on top of UDP (e.g. in QUIC or RTP)?
JuniorTheoryCommonWhat is ARP, and how does a host resolve an IP address to a MAC address?
What is ARP, and how does a host resolve an IP address to a MAC address?
ARP (Address Resolution Protocol) maps an IPv4 address to a MAC on a local segment. To reach an IP, a host broadcasts an ARP request ("who has this IP?") to ff:ff:ff:ff:ff:ff; the owner replies with its MAC, cached by the sender. ARP works at layer 2 within one broadcast domain; routers handle traffic beyond it.
Common mistakes
- ✗Confusing ARP (IP↔MAC, layer 2) with DNS (name↔IP, application layer)
- ✗Thinking ARP works across routers rather than within one broadcast domain
- ✗Believing the ARP request is unicast rather than a layer-2 broadcast
Follow-up questions
- →What is ARP spoofing, and what defenses (Dynamic ARP Inspection, static entries) mitigate it?
- →How does a host resolve the MAC for an IP that is on a different subnet?
JuniorTheoryCommonHow do you check whether a remote TCP port is reachable from a Linux host?
How do you check whether a remote TCP port is reachable from a Linux host?
The classic quick test: telnet host port — a successful connect means the port is open. Better tools: nc -zv host port (netcat, scriptable, no payload sent) and nmap -p port host to scan a range. A ping only proves ICMP reachability of the host, not that a specific TCP port is listening.
Common mistakes
- ✗Believing
pingproves a specific TCP port is open rather than just host reachability - ✗Thinking
telnetis only for remote shells, not a generic TCP connect test - ✗Confusing
traceroute(path discovery) with a port-reachability check
Follow-up questions
- →Why might a port be open yet a firewall silently drop the SYN, causing a hang rather than a refusal?
- →What does the
-zflag tellncto do differently from a normal connection?
JuniorTheoryCommonHow many usable host addresses does the network 10.0.0.0/25 provide?
How many usable host addresses does the network 10.0.0.0/25 provide?
A /25 leaves 7 host bits, so 2^7 = 128 total addresses. Two are reserved — the network address (10.0.0.0) and the broadcast (10.0.0.127) — leaving 126 usable for hosts. The general rule is 2^(32−prefix) total addresses, minus 2 for network and broadcast on an IPv4 subnet.
Common mistakes
- ✗Forgetting to subtract the network and broadcast addresses, giving 128 instead of 126
- ✗Miscounting host bits — a
/25has 7, not 8, host bits - ✗Assuming the gateway address is a separate reservation beyond network/broadcast
Follow-up questions
- →What prefix length do you need for a subnet of at least 60 hosts?
- →Which single supernet aggregates 10.0.0.0/24 and 10.0.1.0/24?
MiddleTheoryCommonWalk through everything that happens when you run curl https://example.com
Walk through everything that happens when you run curl https://example.com
The shell finds curl via $PATH. curl resolves example.com to an IP — /etc/hosts then DNS per nsswitch.conf (recursive resolver → root → TLD → authoritative). It opens TCP to port 443 with the three-way handshake, then performs the TLS handshake (certificate validation, key exchange). Over that encrypted channel it sends the HTTP request; the server replies with a status code and body.
Common mistakes
- ✗Skipping the DNS resolution order (
/etc/hoststhen resolver) - ✗Forgetting the TLS handshake comes after the TCP handshake for
https - ✗Thinking the HTTP request is sent before the connection is established
Follow-up questions
- →Where does TLS certificate validation fit, and what makes it fail?
- →How does
nsswitch.confdecide whether/etc/hostsor DNS is consulted first?
MiddleTheoryCommonHow is an FTP connection established, and why does it use two channels?
How is an FTP connection established, and why does it use two channels?
The client opens a TCP connection with the three-way handshake to port 21 — the control channel for commands and replies. Data transfers use a separate data channel. In active mode the server connects back to the client; in passive mode the client opens a second connection to a server-chosen port — passive is firewall/NAT-friendly. Splitting control from data is FTP's defining trait.
Common mistakes
- ✗Thinking FTP uses a single channel for both commands and data
- ✗Not knowing the difference between active and passive mode
- ✗Forgetting FTP rides on TCP with the three-way handshake
Follow-up questions
- →Why is passive-mode FTP easier to use through a client-side NAT than active mode?
- →What problem does the separate data channel create for stateful firewalls?
MiddleTheoryCommonWhat is a load balancer, and how do round-robin, least-connections, and ip-hash differ?
What is a load balancer, and how do round-robin, least-connections, and ip-hash differ?
A load balancer spreads incoming requests across several backends to raise throughput and availability. Round-robin sends each request to the next server in turn, ignoring load. Least-connections picks the backend with the fewest active connections, better for uneven request durations. Ip-hash maps a client's IP to a fixed backend, giving session stickiness.
Common mistakes
- ✗Thinking round-robin accounts for server load — it does not
- ✗Believing a load balancer reduces total work rather than distributing it
- ✗Forgetting that ip-hash is what provides session stickiness
Follow-up questions
- →Why can least-connections outperform round-robin when request durations vary widely?
- →What breaks ip-hash stickiness when clients sit behind a shared NAT or proxy?
MiddleTheoryCommonWhat is NAT, and how do SNAT, DNAT, and PAT differ?
What is NAT, and how do SNAT, DNAT, and PAT differ?
NAT rewrites IP addresses in packets crossing a boundary, mapping private addresses to public ones. SNAT rewrites the source address so internal hosts share a public IP outbound. DNAT rewrites the destination to publish an internal service behind a public IP. PAT (NAT overload) is SNAT that also rewrites ports, so many hosts share one public IP, distinguished by port number.
Common mistakes
- ✗Swapping SNAT (source) and DNAT (destination) rewriting
- ✗Thinking NAT encrypts or secures traffic rather than rewriting addresses
- ✗Forgetting PAT rewrites ports so many hosts share one public IP
Follow-up questions
- →Why does PAT need a connection-tracking table to route replies back correctly?
- →How does NAT complicate protocols that embed IP addresses in their payload, like FTP?
MiddleTheoryCommonHow does a router pick the next hop, and what is administrative distance?
How does a router pick the next hop, and what is administrative distance?
A router matches the destination IP against its routing table and forwards to the next hop of the route with the longest prefix match — the most specific route wins. When several sources offer a route to the same prefix, administrative distance breaks the tie: a lower distance is more trusted (connected < static < OSPF < BGP), so the router installs that one.
Common mistakes
- ✗Thinking the shortest prefix wins instead of the longest (most specific)
- ✗Confusing administrative distance with hop count or metric
- ✗Believing distance ranks routes within one protocol rather than across sources
Follow-up questions
- →How does the metric break ties between two routes of the same prefix from one protocol?
- →Why is a
/32host route preferred over a covering/24to the same destination?
JuniorTheoryOccasionalWhat is AAA in network access control, and which protocols implement it?
What is AAA in network access control, and which protocols implement it?
AAA stands for Authentication (who you are), Authorization (what you may do), and Accounting (logging what you did). Network devices delegate it to a central server so credentials aren't configured per-device. The two main protocols are RADIUS (UDP, combines authn and authz) and TACACS+ (TCP, separates the three A's and encrypts the whole payload, common for device administration).
Common mistakes
- ✗Forgetting the third A — Accounting (logging actions)
- ✗Not knowing RADIUS uses UDP while TACACS+ uses TCP
- ✗Thinking each device must store credentials locally
Follow-up questions
- →Why does TACACS+ separating authn and authz suit device administration better than RADIUS?
- →What does the Accounting phase let an operator reconstruct after an incident?
JuniorTheoryOccasionalWhat are the main categories of DDoS attack, and how does each overwhelm a target?
What are the main categories of DDoS attack, and how does each overwhelm a target?
DDoS attacks fall into three layers. Volumetric attacks (UDP/ICMP floods, amplification) saturate the link with raw bandwidth. Protocol attacks (SYN flood) exhaust connection-table or firewall state. Application-layer attacks (HTTP flood) send valid-looking requests that consume server CPU/DB. Each targets a different resource, and the source is distributed across many hosts to be hard to block.
Common mistakes
- ✗Treating all DDoS as one kind instead of volumetric/protocol/application
- ✗Thinking a single firewall rule or IP block stops a distributed attack
- ✗Confusing DDoS (denial of service) with data theft
Follow-up questions
- →Why is an amplification attack (e.g. DNS reflection) so much larger than the attacker's own bandwidth?
- →Why are application-layer floods harder to filter than volumetric ones?
MiddleTheoryOccasionalWhat are the families of dynamic routing protocols, and how do they differ?
What are the families of dynamic routing protocols, and how do they differ?
Three families. Distance-vector (RIP) shares its whole routing table with neighbours and picks routes by hop count — simple but slow to converge. Link-state (OSPF) floods link descriptions so every router builds a topology map and runs shortest-path (Dijkstra) — fast convergence, more CPU/memory. Path-vector (BGP) advertises full AS-paths and is policy-driven for inter-domain scale. They trade simplicity for convergence and scale.
Common mistakes
- ✗Swapping which family builds a topology map (link-state) vs shares tables (distance-vector)
- ✗Thinking all three converge at the same speed
- ✗Not knowing BGP is path-vector and policy-driven for inter-domain use
Follow-up questions
- →Why does OSPF converge faster than RIP after a link failure?
- →How do OSPF areas and DR/BDR election limit flooding in a large domain?
MiddleTheoryOccasionalHow do an L2 switch, an L3 switch, and a router differ, and what is in an Ethernet frame?
How do an L2 switch, an L3 switch, and a router differ, and what is in an Ethernet frame?
An L2 switch forwards Ethernet frames by MAC address within one broadcast domain. A router forwards IP packets between networks by IP address (L3). An L3 switch is a switch with hardware routing — it does both, fast. An Ethernet frame carries: preamble + start-frame-delimiter, destination MAC, source MAC, EtherType/length, the payload, and a trailing CRC (FCS) for error detection.
Common mistakes
- ✗Swapping which device forwards by MAC (L2) versus IP (L3)
- ✗Thinking an L3 switch is just a router with more ports
- ✗Forgetting the frame's trailing CRC/FCS for error detection
Follow-up questions
- →Why does a router create a new broadcast domain while an L2 switch does not?
- →What does the EtherType field tell the receiver about the frame's payload?
MiddleDebuggingOccasionalping for one domain gets replies from an unrelated host — diagnose the cause
ping for one domain gets replies from an unrelated host — diagnose the cause
Name resolution is overridden locally. ping resolves the name through nsswitch.conf, which usually checks /etc/hosts before DNS — so a static entry there (mapping shop.example.com to the wrong IP) wins over the real DNS answer. The mismatch between ping's IP and nslookup's confirms it, since nslookup queries DNS directly. Fix: clean /etc/hosts and audit how the rogue entry appeared.
Common mistakes
- ✗Forgetting
/etc/hostsis consulted before DNS viansswitch.conf - ✗Not noticing
nslookup(DNS-direct) disagreeing withpingpinpoints the cause - ✗Blaming the remote DNS server when the override is local
Follow-up questions
- →How does
nsswitch.confdecide the order offiles(hosts) versusdns? - →Why should an unexpected
/etc/hostsentry be treated as a security incident?
MiddleTheoryOccasionalWhat is Path MTU Discovery, and why does blocking ICMP break it?
What is Path MTU Discovery, and why does blocking ICMP break it?
Path MTU Discovery finds the largest packet that can cross a path without fragmentation. In IPv4 the sender marks packets Don't-Fragment; a router whose link MTU is too small drops it and returns an ICMP 'fragmentation needed' with the smaller MTU, so the sender shrinks. If a firewall blocks that ICMP, packets vanish silently and connections hang (a black hole). IPv6 has no in-path fragmentation and relies on PMTUD entirely.
Common mistakes
- ✗Not knowing PMTUD relies on ICMP 'fragmentation needed' messages
- ✗Assuming a blocked ICMP only affects ping, not connectivity
- ✗Thinking IPv6 fragments in-path like IPv4
Follow-up questions
- →How does a PMTUD black hole manifest — small requests work but large transfers hang?
- →Why does IPv6 push fragmentation to the sender instead of routers?
SeniorTheoryOccasionalHow do iBGP and eBGP differ, and why does iBGP require a full mesh or route reflectors?
How do iBGP and eBGP differ, and why does iBGP require a full mesh or route reflectors?
eBGP runs between different autonomous systems; iBGP runs between routers inside one AS. A core rule: a router does not re-advertise an iBGP-learned route to another iBGP peer, preventing loops inside the AS. So every iBGP speaker must peer with every other — a full mesh — or use route reflectors, which may pass iBGP routes onward and scale the AS without N² sessions.
Common mistakes
- ✗Swapping which one (iBGP vs eBGP) runs within an AS versus between them
- ✗Not knowing iBGP routes are not re-advertised to other iBGP peers
- ✗Thinking route reflectors are a performance upgrade rather than a propagation fix
Follow-up questions
- →How do confederations offer an alternative to route reflectors for scaling iBGP?
- →Why does eBGP rely on the AS-path attribute for loop prevention while iBGP cannot?
SeniorTheoryOccasionalWhich BGP attributes steer route selection, and how do you influence inbound vs outbound traffic?
Which BGP attributes steer route selection, and how do you influence inbound vs outbound traffic?
BGP picks a path by running attributes in order: highest weight (local), then local-preference, locally-originated, shortest AS-path, lowest origin, lowest MED, eBGP over iBGP, lowest IGP metric, then tie-breakers. To steer your own outbound traffic you set local-preference (it stays inside your AS). To influence inbound traffic you affect what others prefer — AS-path prepend, MED, or communities — which is harder since the choice is theirs.
Common mistakes
- ✗Confusing which attribute is local-only (local-pref) versus advertised
- ✗Thinking inbound traffic is as easy to steer as outbound
- ✗Forgetting the strict order BGP evaluates attributes in
Follow-up questions
- →Why does local-preference control outbound traffic but not inbound?
- →How do BGP communities let you signal routing intent to a neighbour AS?
SeniorTheoryOccasionalHow is an IPsec site-to-site tunnel established, and how do tunnel and transport mode differ?
How is an IPsec site-to-site tunnel established, and how do tunnel and transport mode differ?
IPsec sets up via IKE in two phases. Phase 1 (IKE SA) authenticates the peers (pre-shared key or certificates) and builds a secure channel via a Diffie-Hellman exchange. Phase 2 (IPsec SA) negotiates the data SAs and keys for ESP/AH. Tunnel mode encrypts the whole original IP packet under a new outer IP header — used for site-to-site gateways. Transport mode protects only the payload, keeping the original header — host-to-host.
Common mistakes
- ✗Forgetting IKE runs in two distinct phases before data flows
- ✗Swapping tunnel mode (new outer header) and transport mode (payload only)
- ✗Thinking IPsec runs over TCP rather than its own ESP/AH protocols
Follow-up questions
- →Why does the Diffie-Hellman exchange in Phase 1 give forward secrecy?
- →Why does IPsec tunnel mode complicate NAT, and how does NAT-T help?
SeniorTheoryOccasionalWhat is an overlay network, and how do the tunnelling technologies MPLS and VXLAN differ?
What is an overlay network, and how do the tunnelling technologies MPLS and VXLAN differ?
An overlay is a virtual network built on top of a physical (underlay) one by encapsulating traffic in tunnels, decoupling logical topology from physical wiring. MPLS labels packets and forwards by label-switched paths in provider/WAN cores — fast and traffic-engineered. VXLAN encapsulates L2 Ethernet frames inside UDP/IP, stretching L2 segments across an L3 fabric in data centres and scaling to 16M segments versus VLAN's 4094.
Common mistakes
- ✗Confusing the overlay with the underlay it runs over
- ✗Swapping MPLS (label/WAN) and VXLAN (L2-in-UDP/data-center) roles
- ✗Not knowing VXLAN scales segments far beyond VLAN's 4094
Follow-up questions
- →Why does VXLAN's 24-bit VNI matter for multi-tenant data centres?
- →How does MPLS traffic engineering steer flows the IGP shortest path would not?
SeniorTheoryOccasionalHow does a routing table (RIB) differ from a forwarding table (FIB)?
How does a routing table (RIB) differ from a forwarding table (FIB)?
The RIB (Routing Information Base) is the control-plane table holding all routes from every protocol — possibly several candidates per prefix — used to decide the best path. The FIB (Forwarding Information Base) is the data-plane table, the distilled best paths used to forward packets, programmed into hardware (TCAM) for line-rate lookup. ECMP lets the FIB hold equal-cost next hops. Control plane chooses; data plane forwards.
Common mistakes
- ✗Swapping which table is control-plane (RIB) versus data-plane (FIB)
- ✗Not knowing the FIB is programmed into hardware (TCAM) for line-rate lookup
- ✗Thinking the RIB forwards packets directly
Follow-up questions
- →Why can the RIB hold multiple routes to a prefix while the FIB keeps only the chosen ones?
- →How does ECMP in the FIB distribute flows across equal-cost next hops?