Thursday, February 10, 2011

Netstat in Unix

Unix Commands are the most robust to use and easier to implement and understand. Unix is provided with some of the unique and the best networking commands which are used for varied activities from packet sniffing to packet analysis. In this tutorial we will discussing about netstat command which is widely used for statistically analysing the network .



Netstat : Is basically used for displaying the network statistics which include routing tables, network and interface connections .

Usage : netstat [options]



Examples of usage :

$ netstat
The command displays the list of all of the open sockets for all the address families it was configured . It also displays the state of all those active connections .

$ netstat -r
This command displays the kernel routing tables which includes destination,flags,interfaces involved and the gateway . This statistics can be used for analysis of the routing of the packets .

$ netstat -s
This is used to get a complete summary and the statistics of all the packets being transmitted arranged by protocol. This command gets mainly the total number of packets sent ,the packets received , number of packets dropped and all the send buffer errors for each of the protocols available.

$ netstat -c
Used for printing a specified information given to netstat continuously .

$ netstat -o
Used to get the complete information of all the networking timers set in the network . Networking timers are usually set to synchronize packet transfer efficiently. As soon as the packet of data is sent by a station , the station sets a timer to resend the packet if the acknowledgement of the packet sent is not recieved in the specified time in the timer from the destination station.

$ netstat -p
Used to get the process ID and the name of the open sockets for the address families configured.

$ netstat -l
Used to get the statistics of the sockets which are listening for your connection request .

$ netstat -a
Used to get complete information about all the listening as well as the non-listening ports in the network address family configured.

$ netstat -C
Used for getting network routing information from the network cache.

$ netstat -sp tcp
Used to display statistics only for tcp protocol

$ netstat -sp udp
Used to display statistics only for udp protocol.


Netstat is indeed the best tool for network analysis.







1 comment:

Javin @ FIX Protocol Tutorial said...

Thanks for sharing information. netstat is indeed most useful command for networking purpose and one of the top commands included in my list top 10 basic networking command in unix .

you can also include "netstat -g" which shows the service names subscribed by Tibco RVD.

Thanks
Javin
FIX Protocol tutorial