How to use NETSTAT to monitor your network statistics in Ubuntu
NetStat unlike Wireshark is a command line tool used to show the network status. It is used to monitor incoming and outgoing network connections. It is also used for monitoring various network interface statistics. So lets see how to use NetStat to monitor the network connections.
NetStat is a command line tool used in network monitoring. It is available for both Windows and Linux. It is used for finding problems in your network and to determine the amount of traffic on the network.
Using "netstat" command without any parameters displays all active internet connections and active UNIX domain sockets.
The below picture shows the output of netstat command.
Each field in active internet connections contains Protol, Receive queue, Sendqueue, Local Address, Foreign Address, State.
Each field in Active UNIX domain sockets contains Protocol, Reference Count, Flags, Type, State, Inode number and path of process.
To see all sockets in the system use the parameter in the system use the following command.
To get help use the command
Using parameter "-l" displays all listening state servers in the system. The state field of the result of this command will be "LISTEN"
To display routing table a system use the parameter "-r".
Command to display routing table is
It shows each entry with its destination, gateway, interface and other fields like mss(maximum segment size) etc.
Interface list can be displayed by using the following command
It shows various fields like interface name, MTU (maximum transfer unit) etc
To view the network statistics of the system use the following command
It displays statistics for each type of protocol as shown in the below picture.
There are many other features like viewing multicast groups, timers, display routing cache which is documented and can be viewed by using the help command.