DevOps.Academy
CoursesCurriculumInterview prepPricing
◔My learningSign in
DevOps.Academy

Free, hands-on DevOps lessons. Made with care in India.

System status

Learn

All coursesLinux roadmapCurriculumInterview questionsCheat sheetsMy learning

Academy

PricingCertificates

Legal

PrivacyTermsContact

devops.rajeev.pro

NetworkingLesson 12 of 12
Your progress · 0%
On this page
  1. A layer-by-layer method
  2. Packet capture with tcpdump
  3. Real broken scenarios
↖ Course roadmap
Lesson 12 · Network troubleshooting

Network troubleshooting: follow the packet

Test from DNS to the application, compare refused and timed-out connections, and capture packets at a known boundary.

25 min read · beginner · hands-on

By the end of this lesson you'll be able to

0 of 3 complete
Lab status

Verified lab: two temporary Nginx containers and an Alpine client produced a successful HTTP response, a refused connection, a firewall-drop timeout, and a real tcpdump capture. The output is saved in the lab folder. The script removes its containers and Docker network on exit.
Cloud lab: none. No AWS resources were created.

When a page stops loading, restarting the service is the first reaction. It can hide the evidence without fixing the path. A disciplined check follows the request from name lookup to the listening process, and stops where the first check fails. A packet capture confirms what crossed one interface. In this lesson, you will compare common TCP errors and use a short capture to narrow the fault.

A layer-by-layer method

Write down the source, destination, port, protocol, and time. Then test in order:

  1. DNS: does the client resolve the intended name?
  2. Route: does the machine have a next hop for that address?
  3. TCP: does the destination port accept a connection?
  4. TLS and HTTP: is the certificate valid, and what status does the server return?
  5. Application: do logs show the request and its dependency calls?

Each check proves only that boundary. A successful DNS lookup does not prove the route works. A successful TCP connection does not prove the application can serve the request.

Packet capture with tcpdump

tcpdump prints packets seen on one interface. Choose the interface and filter narrowly:

tcpdump -i eth0 -nn -c 4 'tcp port 80'

-i selects an interface, -nn keeps addresses and ports numeric, and -c stops after a packet count. A client capture can show a SYN leaving. A server capture can show whether it arrived and whether a reply left. A capture does not reveal packets on interfaces you did not inspect, and payloads may contain sensitive data. Avoid writing captures to shared locations.

Real broken scenarios

The lab produced different responses for a closed port and a dropped port:

$ nc -zvw 2 server 8081 (closed port)
nc: connect to server (172.19.0.2) port 8081 (tcp) failed: Connection refused
$ nc -zvw 2 server 8082 (firewall drop)
nc: connect to server (172.19.0.2) port 8082 (tcp) timed out: Operation in progress

Refused means something returned a reset; check the listener, bind address, or an explicit reject rule. A timeout means no answer arrived by the deadline; check routes and silent drops. Neither message alone identifies the exact device. Compare captures at both ends before changing firewall rules.

⌘
Mini mission

Find the first failing boundary

Run the disposable lab: make one working HTTP request, compare a closed port with a filtered port, then capture the TCP handshake. The cleanup trap removes every container and network.

Input: DockerOutput: A real HTTP response, distinct TCP errors, and a four-packet capture
Reveal one safe solution
bash devops-academy-tools/networking-lab/12-capture.sh

Read the output from top to bottom. Notice that the closed port resets quickly, while the firewall drop returns no answer before the timeout.

Try it yourself

0 of 4 steps done

Run each task in your own account or terminal, then tick it off.

Knowledge check

Quick check

Question 1 of 3

A TCP connection is refused immediately. What should you check first?

Go deeper

Official reading for this lesson

  • Docstcpdump(8)Linux man-pages ↗
  • Docstraceroute(8)Linux man-pages ↗
  • Docsip-route(8)Linux man-pages ↗

Or get every quiz answer right and it completes itself.

Something unclear, wrong or out of date in this lesson? Tell me, and I'll fix it.

← PreviousContainer networking: bridges, namespaces and PodsUp nextBack to the course roadmap