SkillPilotAI

Networking interview questions

The 15 most asked networking interview questions, each answered with one 4-step template: define, how it works, example, tool. The interviewer checks understanding, not memorised definitions, so a structured answer with a real example and a verifying command stands out.

277.1 The answer template

StepWhat to say
1 DefineA one-line definition
2 How it worksWhat happens inside
3 ExampleOne real example
4 Tool / commandA command that verifies it
Flow for every answer
  1. 1.Repeat the question in your own words

  2. 2.Define in one line

  3. 3.Explain how it works inside

  4. 4.Give one real example

  5. 5.Name the tool that verifies it

  6. 6.Draw a small whiteboard diagram where possible (handshake, DORA)

277.2 Basics: Q1, Q2, Q4

QuestionDefineHowExampleTool
Q1 OSI vs TCP/IPOSI = 7-layer reference model; TCP/IP = 4-layer practical model the internet usesEach layer serves the layer above and adds its own headerHTTP L7, TCP L4, IP L3, Ethernet L2Wireshark shows every layer
Q2 TCP vs UDPTCP connection-oriented, reliable; UDP connectionless, fast, no guaranteeHandshake, sequence numbers, ACKs, retransmissionTCP: HTTPS, SSH; UDP: DNS queries, video calls, gamingtcpdump -n 'tcp or udp'
Q4 You type a URLA chain of protocols, layer by layerDNS > ARP > TCP > TLS > HTTP GETRouter NATs it, server sends the HTMLcurl -v https://example.com

277.3 Q3: TCP 3-way handshake

TCP 3-way handshake
  1. 1.Server port 8080 is in LISTEN state

  2. 2.Client -> SYN with its starting sequence number

  3. 3.Server -> SYN-ACK with its own seq and ack = client seq + 1

  4. 4.Client -> ACK

  5. 5.Both sides ESTABLISHED: data can flow

Terminal
# server: nc -lk 8080 (listening)tcpdump -i eth0 -n -p -c 3 \  'tcp port 8080' > /tmp/cap.txt &nc -zv -w 2 192.168.77.20 8080cat /tmp/cap.txt
Output
$ nc -zv -w 2 192.168.77.20 8080Connection to 192.168.77.20 8080 port [tcp/http-alt] succeeded!$ cat /tmp/cap.txtlistening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes22:14:21.683427 IP 192.168.77.10.59792 > 192.168.77.20.8080: Flags [S], seq 3003941275, win 64240, options [mss 1460,sackOK,TS val 4138303238 ecr 0,nop,wscale 10], length 022:14:21.683542 IP 192.168.77.20.8080 > 192.168.77.10.59792: Flags [S.], seq 3221057457, ack 3003941276, win 65160, options [mss 1460,sackOK,TS val 649072264 ecr 4138303238,nop,wscale 10], length 022:14:21.683563 IP 192.168.77.10.59792 > 192.168.77.20.8080: Flags [.], ack 1, win 63, options [nop,nop,TS val 4138303238 ecr 649072264], length 03 packets captured
  • Exactly three packets: [S] = SYN, [S.] = SYN-ACK, [.] = ACK.
  • SYN-ACK ack 3003941276 = client seq 3003941275 + 1.

277.4 Addressing: Q5, Q6

QuestionDefineHowExampleTool
Q5 DNS resolutionName -> IP, mostly over UDP 53Browser/OS cache > resolver > root > TLD > authoritativewww.example.com -> A recorddig +trace example.com
Q6 ARPFinds the MAC for a known IPv4 addressBroadcast "who has?", only the owner sends a unicast replyPC asks for gateway 192.168.1.1's MAC, saved in ARP cacheip neigh / arp -a

277.5 Q7: DHCP DORA

DHCP DORA
  1. 1.New laptop has no IP: Discover broadcast, switch floods it on every port

  2. 2.DHCP server 192.168.77.2 sends an Offer with a free IP

  3. 3.Laptop broadcasts a Request for that same IP

  4. 4.Server sends Acknowledge: the lease is confirmed

  5. 5.Laptop now has IP, gateway and DNS

Tool: dhclient -v shows the four messages live

277.6 Q8: subnetting, hosts in a /26

  • IPv4 = 32 bits; /26 leaves 6 host bits; 2^6 = 64 addresses.
  • First = network, last = broadcast, so 62 usable hosts.
Terminal
# /26: 32 - 26 = 6 host bits, 2^6 = 64sipcalc 192.168.77.0/26sipcalc 192.168.77.64/26
Output
$ sipcalc 192.168.77.0/26Network address      - 192.168.77.0Network mask         - 255.255.255.192Broadcast address    - 192.168.77.63Addresses in network - 64Usable range         - 192.168.77.1 - 192.168.77.62$ sipcalc 192.168.77.64/26Network address      - 192.168.77.64Broadcast address    - 192.168.77.127Addresses in network - 64Usable range         - 192.168.77.65 - 192.168.77.126
PrefixHost bitsAddressesUsable hosts
/248256254
/2666462
/2753230

277.7 Q9: NAT vs PAT

NAT and PAT at the home router
  1. 1.PC 1 192.168.77.10 sends a request to 198.51.100.80

  2. 2.Router replaces the source with public IP 203.0.113.10, writes a NAT table entry

  3. 3.Laptop 192.168.77.11 sends from the same source port

  4. 4.Router changes the port too: PAT (NAT overload)

  5. 5.Reply comes back: router looks up the table and forwards to the right device

  • NAT translates private IPs to a public IP because private ranges are not routed on the internet.
  • PAT lets many devices share one public IP by also translating ports.

277.8 Devices and security: Q10, Q11, Q13, Q14

QuestionDefineHowExampleTool
Q10 Switch vs routerSwitch = L2 (MAC), router = L3 (IP)MAC address table vs routing tableSwitch inside the LAN, router to the internetbridge fdb show / ip route
Q11 VLANOne switch, many separate L2 networks (own broadcasts)802.1Q tag on trunk carries a 12-bit VLAN IDVLAN 10 HR, VLAN 20 Dev; between them a router / L3 switchshow vlan brief / bridge vlan show
Q13 HTTP vs HTTPSHTTPS = HTTP inside TLS, port 443TLS handshake: cert check, key agreementA capture in the middle shows only encrypted bytesopenssl s_client -connect host:443
Q14 Stateful vs stateless firewallStateless checks each packet alone (IP, port rules)Stateful tracks every connectionReplies pass as ESTABLISHED; AWS SG stateful, NACL statelessconntrack -L

277.9 Troubleshooting: Q12 TTL/traceroute, Q15 ping OK website not

How traceroute uses TTL
  1. 1.Every router reduces TTL by 1, so no packet loops forever

  2. 2.Probe TTL=1 hits 0 at Router 1 192.168.10.1 -> Time Exceeded = hop 1

  3. 3.Probe TTL=2 dies at Router 2 10.10.0.1 -> hop 2

  4. 4.Probe TTL=3 reaches server 10.20.0.20 -> its reply = destination reached

Terminal
ping -c 2 -W 1 192.168.77.20traceroute -n -m 3 192.168.77.20
Output
$ ping -c 2 -W 1 192.168.77.2064 bytes from 192.168.77.20: icmp_seq=1 ttl=64 time=0.203 ms64 bytes from 192.168.77.20: icmp_seq=2 ttl=64 time=5.23 ms2 packets transmitted, 2 received, 0% packet loss, time 1021ms$ traceroute -n -m 3 192.168.77.20traceroute to 192.168.77.20 (192.168.77.20), 3 hops max, 46 byte packets 1  192.168.77.20  0.012 ms  0.008 ms  0.008 ms
  • ttl=64 is the Linux default: no router reduced it; traceroute shows one hop because the server is on the same LAN.
  • Q15 ping works, website does not: L3 is fine, the problem is above it. Check DNS, port, service and firewall (ICMP allowed, TCP 443 blocked). Tools: nslookup, nc -zv, curl -v.

277.10 Common mistakes

  • Myth: you must memorise every command and RFC. The interviewer checks concept and step-by-step problem solving.
  • Don't know an answer? Say so honestly and explain how you would find out.
  • Usable hosts: forgetting to subtract network and broadcast (/27 = 32 addresses, 30 usable).
  • Giving only a definition with no example or verifying tool.

277.11 Interview tips

  • Repeat the question in your own words before answering.
  • Use the template every time: define, how, example, tool.
  • Draw a small whiteboard diagram (handshake, DORA, NAT table): it makes the answer clear immediately.
  • Revise in five groups: basics (OSI, TCP/UDP, handshake, URL), addressing (DNS, ARP, DHCP, subnet, NAT), devices (switch/router, VLAN, HTTPS, firewall), troubleshooting (TTL, traceroute, ping vs website).