A host can resolve and ping IPv4 but apps hang for a long time before connecting; `getent ahosts` shows IPv6 addresses first.
IntermediateTroubleshootingNetworking, DNS and firewalls
Answer
Likely causes → AAAA records are returned and the client tries IPv6 first, but there is no working IPv6 route, so it waits for timeout before falling back.
Diagnose →
getent ahosts api.example.com
ip -6 route
curl -6 -v https://api.example.com --max-time 5
Fix → Fix IPv6 connectivity, or prefer IPv4 in /etc/gai.conf (precedence ::ffff:0:0/96 100), or disable IPv6 on that interface if it's not used.
Prevent → Either support IPv6 properly or disable it consistently.
More on Networking, DNS and firewalls
`curl http://10.0.1.20:8080` returns `curl: (7) Failed to connect to 10.0.1.20 port 8080: Connection refused`.BeginnerThe same request instead hangs and ends with `curl: (28) Failed to connect to 10.0.1.20 port 8080 after 130000 ms: Connection timed out`. How is this different from "refused"?Beginner`ping google.com` fails with `ping: google.com: Temporary failure in name resolution`, but `ping 8.8.8.8` works.Beginner`dig api.internal` works, but the application and `curl` fail with `Could not resolve host: api.internal`.Intermediate`/etc/resolv.conf` changes you made disappear after a reboot or a few minutes.BeginnerDNS lookups take exactly 5 seconds before succeeding.Intermediate