DNS, connection and TLS failures
Quick answer
Diagnose network failures in layers: name resolution, transport, TLS and application response. An error at one layer does not prove a failure at another.
A resolved hostname does not prove that a port accepts connections, and an accepted connection does not prove valid TLS identity. Record the exact stage and error from an authorized request. Keep certificate verification enabled while diagnosing the failure.
Prepare the practice environment
Run python3 lab-fixtures/troubleshooting/setup.py from the extracted root as an ordinary user. Enter the printed fresh private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. Run each snippet in a separate Bash process, not your interactive shell. Only private files are used; optional examples require an authorized snapshot VM. Do not change live services, mounts, policies or resource limits. All supplied records are fictional; no host incident records are collected. Review the lab guide.
Prerequisites
Review: Package, service and boot failures.
How it works
Use getent ahosts HOST for the system resolver view, and dig for DNS-specific investigation in an authorized VM. Check expected records, resolver and search domains. A TCP refusal can indicate no listener or active rejection; a timeout may reflect packet loss, filtering, routing or an overloaded service. Inspect the intended endpoint, ss on the authorized server and applicable routes or policies. After transport works, verify certificate chain, hostname and clock; do not use curl -k as a fix. Curl exit 6 indicates host resolution failure, 7 connection failure, 28 timeout and 60 peer verification failure. HTTP 404 or 503 is instead an application-layer response; --fail can turn HTTP errors into a nonzero curl exit. Fix only the identified layer, preserve original configuration and retest the same endpoint. Use documented records, renewal monitoring and known-good network configuration to prevent recurrence. The example port is dynamically allocated on loopback; no external network is contacted.
Try the examples
These are annotated teaching records, not raw curl diagnostics.
Expected stdout:
6 resolution7 connection28 timeout60 certificateThe helper binds a private TCP socket without listening, calls curl with a bounded timeout and no proxy, and asserts exit 7.
Expected stdout:
curl exit 7 on bound non-listening socketThe helper creates an ephemeral self-signed certificate, trusts it only for this check and tests two hostnames with openssl verify. No TLS handshake occurs.
Expected stdout:
matching hostname accepted; mismatch rejectedCommon mistakes
Do not treat timeouts as proof of firewall filtering or skip certificate verification. Check the system clock without changing it.
Practice
Classify the four sample failures and reproduce the local refusal and hostname mismatch. For each layer write one non-destructive diagnostic and a verification step.
Related references
Study: getent, ss, curl. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
DNS, connection and TLS failures — Knowledge Check
Apply troubleshooting concepts to synthetic fixtures and VM-only scenarios.
What does curl exit 6 indicate?
A connection timeout proves what?
A trusted certificate has the wrong hostname. What should happen?
What is HTTP 503?