Interview Prep/Linux/Networking, DNS and firewalls

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.

All Linux questions Roadmap: Linux

More on Networking, DNS and firewalls