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
| Step | What to say |
|---|---|
| 1 Define | A one-line definition |
| 2 How it works | What happens inside |
| 3 Example | One real example |
| 4 Tool / command | A command that verifies it |
- Step 1
1.Repeat the question in your own words
- Step 2
2.Define in one line
- Step 3
3.Explain how it works inside
- Step 4
4.Give one real example
- Step 5
5.Name the tool that verifies it
- Step 6
6.Draw a small whiteboard diagram where possible (handshake, DORA)
277.2 Basics: Q1, Q2, Q4
| Question | Define | How | Example | Tool |
|---|---|---|---|---|
| Q1 OSI vs TCP/IP | OSI = 7-layer reference model; TCP/IP = 4-layer practical model the internet uses | Each layer serves the layer above and adds its own header | HTTP L7, TCP L4, IP L3, Ethernet L2 | Wireshark shows every layer |
| Q2 TCP vs UDP | TCP connection-oriented, reliable; UDP connectionless, fast, no guarantee | Handshake, sequence numbers, ACKs, retransmission | TCP: HTTPS, SSH; UDP: DNS queries, video calls, gaming | tcpdump -n 'tcp or udp' |
| Q4 You type a URL | A chain of protocols, layer by layer | DNS > ARP > TCP > TLS > HTTP GET | Router NATs it, server sends the HTML | curl -v https://example.com |
277.3 Q3: TCP 3-way handshake
- Step 1
1.Server port 8080 is in LISTEN state
- Step 2
2.Client -> SYN with its starting sequence number
- Step 3
3.Server -> SYN-ACK with its own seq and ack = client seq + 1
- Step 4
4.Client -> ACK
- Step 5
5.Both sides ESTABLISHED: data can flow
# 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$ 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
| Question | Define | How | Example | Tool |
|---|---|---|---|---|
| Q5 DNS resolution | Name -> IP, mostly over UDP 53 | Browser/OS cache > resolver > root > TLD > authoritative | www.example.com -> A record | dig +trace example.com |
| Q6 ARP | Finds the MAC for a known IPv4 address | Broadcast "who has?", only the owner sends a unicast reply | PC asks for gateway 192.168.1.1's MAC, saved in ARP cache | ip neigh / arp -a |
277.5 Q7: DHCP DORA
- Step 1
1.New laptop has no IP: Discover broadcast, switch floods it on every port
- Step 2
2.DHCP server 192.168.77.2 sends an Offer with a free IP
- Step 3
3.Laptop broadcasts a Request for that same IP
- Step 4
4.Server sends Acknowledge: the lease is confirmed
- Step 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.
# /26: 32 - 26 = 6 host bits, 2^6 = 64sipcalc 192.168.77.0/26sipcalc 192.168.77.64/26$ 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| Prefix | Host bits | Addresses | Usable hosts |
|---|---|---|---|
| /24 | 8 | 256 | 254 |
| /26 | 6 | 64 | 62 |
| /27 | 5 | 32 | 30 |
277.7 Q9: NAT vs PAT
- Step 1
1.PC 1 192.168.77.10 sends a request to 198.51.100.80
- Step 2
2.Router replaces the source with public IP 203.0.113.10, writes a NAT table entry
- Step 3
3.Laptop 192.168.77.11 sends from the same source port
- Step 4
4.Router changes the port too: PAT (NAT overload)
- Step 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
| Question | Define | How | Example | Tool |
|---|---|---|---|---|
| Q10 Switch vs router | Switch = L2 (MAC), router = L3 (IP) | MAC address table vs routing table | Switch inside the LAN, router to the internet | bridge fdb show / ip route |
| Q11 VLAN | One switch, many separate L2 networks (own broadcasts) | 802.1Q tag on trunk carries a 12-bit VLAN ID | VLAN 10 HR, VLAN 20 Dev; between them a router / L3 switch | show vlan brief / bridge vlan show |
| Q13 HTTP vs HTTPS | HTTPS = HTTP inside TLS, port 443 | TLS handshake: cert check, key agreement | A capture in the middle shows only encrypted bytes | openssl s_client -connect host:443 |
| Q14 Stateful vs stateless firewall | Stateless checks each packet alone (IP, port rules) | Stateful tracks every connection | Replies pass as ESTABLISHED; AWS SG stateful, NACL stateless | conntrack -L |
277.9 Troubleshooting: Q12 TTL/traceroute, Q15 ping OK website not
- Step 1
1.Every router reduces TTL by 1, so no packet loops forever
- Step 2
2.Probe TTL=1 hits 0 at Router 1 192.168.10.1 -> Time Exceeded = hop 1
- Step 3
3.Probe TTL=2 dies at Router 2 10.10.0.1 -> hop 2
- Step 4
4.Probe TTL=3 reaches server 10.20.0.20 -> its reply = destination reached
ping -c 2 -W 1 192.168.77.20traceroute -n -m 3 192.168.77.20$ 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).