Skip to content

Quiz: TCP/IP

← Back to quiz index

5 questions

L1 (3 questions)

1. How do you troubleshoot a connection timeout vs connection refused?

Show answer Timeout = packets not reaching destination (firewall, routing, wrong IP). Refused = reached destination but no listener (service down, wrong port). Use tcpdump to differentiate.

2. Explain the TCP three-way handshake.

Show answer Client sends SYN. Server responds SYN-ACK. Client sends ACK. Connection established. If SYN-ACK never comes back, you get a timeout (firewall or no listener).

3. Describe the TCP three-way handshake.

Show answer 1. Client sends SYN (picks initial sequence number).
2. Server responds SYN-ACK (acknowledges client's SYN, picks its own sequence number).
3. Client sends ACK. Connection is now ESTABLISHED. If step 2 fails: connection timeout. If step 3 fails: server has half-open connection.

L2 (2 questions)

1. What does TIME_WAIT mean and why do you see thousands of them?

Show answer TIME_WAIT = connection closed, waiting 2*MSL (60-120s) to ensure late packets don't corrupt new connections on same port. Thousands = high connection churn. Fix: connection pooling, SO_REUSEADDR, or longer keep-alives.

2. You see many connections in TIME_WAIT on a server. Is this a problem?

Show answer TIME_WAIT is normal — it lasts 2*MSL (typically 60s) after active close to handle late packets. It's a problem only if you exhaust ephemeral ports. Mitigate: enable tcp_tw_reuse (safe for clients), use connection pooling, or increase the ephemeral port range.