Displaying connection statistics with netstat

The netstat command is a useful utility to allow you to view some statistics regarding your current connection. We touched on it a bit in the last chapter. This command allows you to show useful networking information, such as showing you services that are listening for connections on your network card, and printing your routing table, among other things.

In the last chapter, I gave the example of netstat -tulpn to allow you to view currently connected and listening services. This command shows everything that's listening, as well as the port that it's listening on. Breaking this command down, we passed along some parameters. The first, -t, identifies that we would like to view information pertaining to TCP, -u represents UDP, -l requests listening sockets, -p attempts to show the name of the program, and -n also shows numeric values. Putting it all together, we get netstat -tulpn. In the industry, this is the most common usage of netstat that I've seen.

Other uses of netstat include showing your routing table (netstat -r), which gives you similar output as route -n. To view connection statistics, use netstat -s. Finally, you can also view a list of network interfaces on your system with netstat -i. For the most part though, this command is something you would use most often to print networking information to your terminal, that you would use for further analysis when trying to troubleshoot an issue or lock down a node.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset