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.
INTRODUCTION
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.
USAGE
Using "netstat" command without any parameters displays all active internet connections and active UNIX domain sockets.
netstat
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.
netstat -a
HELP
To get help use the command
netstat --help
Using parameter "-l" displays all listening state servers in the system. The state field of the result of this command will be "LISTEN"
netstat -l
ROUTING TABLE
To display routing table a system use the parameter "-r".
Command to display routing table is
netstat -r
It shows each entry with its destination, gateway, interface and other fields like mss(maximum segment size) etc.
INTERFACE LIST
Interface list can be displayed by using the following command
netstat -i
It shows various fields like interface name, MTU (maximum transfer unit) etc
VIEWING STASTISTICS
To view the network statistics of the system use the following command
netstat -s
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.
You can also use Wireshark for Network Monitoring. There is also a Linux distro with all the network monitoring tools built in - Bactrack Linux 5
I am a linux user interested in networking and operating systems.I like to explore new tools and concepts every day.




















