1. Display routing information maintained by kernel
This information can be retrieved using the -r option along with this command.
Consider the following example :
Consider the following example :
So we see that kernel routing table information was displayed using the -r option. The flag 'U' indicates that this entry is up while the flag 'G' indicates that this entry is not a direct entry i.e. the destination indicated in this route entry is not on the same network. A list of flags is given below :
A Receive all multicast at this interface.
B OK broadcast.
D Debugging ON.
M Promiscuous Mode.
O No ARP at this interface.
P P2P connection at this interface.
R Interface is running.
U Interface is up.
G Not a direct entry.
A Receive all multicast at this interface.
B OK broadcast.
D Debugging ON.
M Promiscuous Mode.
O No ARP at this interface.
P P2P connection at this interface.
R Interface is running.
U Interface is up.
G Not a direct entry.
2. Display multicast group membership information
This information is displayed for both IPv4 and IPv6 and can be retrieved using -g option with this command.
Consider the following example :
So we see that the multicast information was displayed in the above output.Consider the following example :
3. Display information related to all network interfaces
This is made possible using the -i option along with this command.
Consider the following example :
Consider the following example :
So we see that all the network information related to individual interfaces was displayed in the output. The RX and TX columns are described as follows :
RX-OK : Correct packets received on this interface.
RX-ERR : Incorrect packets received on this interface
RX-DRP : Packets that were dropped at this interface.
RX-OVR : Packets that this interface was unable to receive.
Similar definition is for the TX columns that describe the transmitted packets.
RX-OK : Correct packets received on this interface.
RX-ERR : Incorrect packets received on this interface
RX-DRP : Packets that were dropped at this interface.
RX-OVR : Packets that this interface was unable to receive.
Similar definition is for the TX columns that describe the transmitted packets.
4. Display summary statistics for each protocol
This is very handy information that netstat command provides. This information can be retrieved by using -s option with this command.
Consider the following example :
So we see that vital statistical information related to each protocol was displayed in the output.Consider the following example :
5. Monitor continuously
Yes, netstat command provides an option -c using which any type of information can be monitored continuously. Here continuously means that same information would be fetched again and again after each second and the netstat output will grow until you choose to stop the command.
Here is an example where the interface information can be monitored continuously :
So we see that the interface information (using -i) was displayed continuously again and again using -c option. The figure change (highlighted in bold) in the output above gives us an idea how -c option is useful to see updates in statistics in real time.Here is an example where the interface information can be monitored continuously :
6. Display extra information
Apart from the information that netstat produces in output, Extra information can be produced in output using -e option.
Consider an example below :
So we see that lots of extra information related to internet connections (like user, Inode etc) was produced in the output.Consider an example below :
7. Display network timer related information
This type of information can be produced in output using -o option with this command.
Consider the following example :
So we see that the timer related information (highlighted in bold) was produced in the output.Consider the following example :
8. Display the PID of the program using socket
The PID of the program using a particular socket can be produced in the output using the option -p with this command.
Consider the following example :
As suggested by the highlighted portion in the output, the PID related information was produced using -p option.Consider the following example :
9. Show only listening sockets
This can be made possible by using the -l option with this command.
Consider the following example :
So we see that only those sockets whose state is LISTEN are produced in the output.Consider the following example :
10. Show routing information from route cache
Information from route cache is produced in the output using -C option with this command.
Consider the following example :
The output above is produced using the information from route cache. Consider the following example :
--
If it says 0.0.0.0 on the Local Address column, it means that port is listening on all 'network interfaces' (i.e. your computer,
your modem(s) and your network card(s))
0.0.0.0 means the process is bound to all interfaces.
127.0.0.1 means the process is bound only to the 127.0.0.1 interface (loopback).
If you had other interfaces you might have x.y.z.a entries indicating the process was bound to those specific interfaces.
A process will only be told if traffic arrives on the interfaces to which it is bound, so yes, it's kind of a filter, although it's not usually described in those terms.
--