Determining the Cause of Inaccessible Services

To confirm that a problem exists with a service, any number of commands can be used. netstat is very useful, but so are applications such as nmap, lsof, and strace. You can also inspect your system's configuration files to see whether unexpected changes have been made to your configuration.

Using netstat

While netstat is useful, it does not always reveal all information concerning a service. Review the following netstat output:

# netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address     Foreign Address    State
tcp   0      0      0.0.0.0:6000      0.0.0.0:*          LISTEN
tcp   0      0      127.0.0.1:53      0.0.0.0:*          LISTEN
tcp   0      0      0.0.0.0:22        0.0.0.0:*          LISTEN
tcp   0      0      10.0.0.5:34386    80.232.36.131:22   ESTABLISHED
tcp   0      0      10.0.0.5:35191    80.232.36.131:993  ESTABLISHED
tcp   0      0      10.0.0.5:35190    80.232.36.131:993  ESTABLISHED
tcp   0      0      10.0.0.5:35189    80.232.36.131:993  ESTABLISHED
tcp   0      0      10.0.0.5:35188    80.232.36.131:993  ESTABLISHED
tcp   0      0      10.0.0.5:34387    10.0.0.1:22        ESTABLISHED
tcp   0      0      10.0.0.5:35193    10.0.0.4:993       ESTABLISHED
tcp   0      0      10.0.0.5:35196    10.0.0.4:993       ESTABLISHED
tcp   0      0      10.0.0.5:35187    10.0.0.4:993       ESTABLISHED
udp   0      0      0.0.0.0:32779     0.0.0.0:*
udp   0      0      127.0.0.1:53      0.0.0.0:*

The first connection shown indicates that this host presumably has an X server running, because X uses port 6000. The second connection shows that a DNS server is presumably listening on port 53, ready for a zone transfer. The next lines show port 22 open, so there is likely ...

Get LPI Linux Certification in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.