LX0-103 · Question #172
Suppose that the command netstat a hangs for a long time without producing output. You might suspect:
The correct answer is B. a problem with DNS.. When netstat -a hangs, it is almost always because the tool is waiting for DNS to resolve IP addresses to hostnames before displaying output.
Question
Suppose that the command netstat a hangs for a long time without producing output. You might suspect:
Options
- Aa problem with NFS.
- Ba problem with DNS.
- Ca problem with NIS.
- Da problem with routing.
- Ethat the netstat daemon has crashed.
How the community answered
(50 responses)- A10% (5)
- B82% (41)
- C2% (1)
- D2% (1)
- E4% (2)
Why each option
When `netstat -a` hangs, it is almost always because the tool is waiting for DNS to resolve IP addresses to hostnames before displaying output.
NFS issues can cause hangs in file operations or mount-related commands, but would not specifically cause `netstat` to stall during hostname resolution.
By default, `netstat -a` attempts to resolve all numeric IP addresses in active connections and sockets to their corresponding hostnames using DNS. If the DNS resolver is unreachable or not responding, `netstat` blocks indefinitely waiting for each lookup to time out, producing no output until resolution completes or fails. Running `netstat -an` (with the `-n` flag to suppress resolution) would confirm this by returning immediately.
NIS problems could affect user/group lookups but would not directly block the hostname resolution step that `netstat` performs via DNS.
Routing problems would prevent packets from reaching destinations but `netstat` reads local kernel socket tables, so it would still produce output rather than hang.
`netstat` is a stateless command-line utility, not a daemon, so there is no `netstat` daemon process that could crash.
Concept tested: DNS dependency in netstat hostname resolution behavior
Source: https://linux.die.net/man/8/netstat
Topics
Community Discussion
No community discussion yet for this question.