Ports, Sockets, and Netstat, Oh My

When you’ve restarted a daemon, checked the log files, and nothing seems to be working, you’ll need finer diagnostics. A good place to start is by checking the ports and socket pairs on your UNIX server.

Enter netstat -a . This command is to network sockets what ps is to processes. You’ll remember from Hour 1, “Understanding Networking: The Telephone Analogy,” that a listening socket means that a service is listening at a certain extension (port) for calls.

The netstat command can list each socket that’s being used for a current connection or being listened to for a connection. It tells you whether things are backlogged, where they are backlogged from, and which socket is in use on both sides of the call. ...

Get Sams Teach Yourself Network Troubleshooting in 24 Hours, Second 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.