In previous article, we understood the column wise
information about netstat output. In this article, we will understand the
different examples and uses of this command.
How to get interface statistics?
When we use –i flag with netstat command, it gives the
currently configured interface statistics. If we use –a option then it gives all interface’s
statistics.
[root@server1
Downloads]# netstat –I
Kernel Interface
table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500
0 39784 0
0 0 568
0 0 0 BMRU
lo 16436 0
16 0 0
0 16 0
0 0 LRU
[root@server1
Downloads]#
[root@server1
Downloads]# netstat -ia
Kernel Interface
table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500
0 40698 0
0 0 639
0 0 0 BMRU
lo 16436 0
16 0 0
0 16 0
0 0 LRU
pan0 1500
0 0 0
0 0 0
0 0 0 BM
sit0 1480
0 0 0
0 0 0
0 0 0 O
[root@server1
Downloads]#
|
Columns showing information about the packet status as
follow:
MTU
|
Maximum transmission unit
|
Met
|
Metric values for that interface
|
RX-OK/TX-OK
|
How many packets received or transmitted successfully
|
RX-ERR/TX-ERR
|
Errors in packets(not delivered successfully)
|
RX-DRP/TX-DRP
|
Number of packets dropped
|
RX-OVR/TX-OVR
|
Number of packets are lost because of overrun
|
Flags
|
Flags that have been set for interface.
|
There are different types of flags. We got four types of
flag in above example. Below is the short information about these flags.
B
|
Broadcast address has been set for this interface
|
O
|
Address resolution protocol is turned off for this interface
|
U
|
Interface is up
|
P
|
Point to point connection
|
R
|
Interface is running
|
L
|
Interface is a loopback device
|
M
|
All packets received successfully
|
How to display different types of connections using netstat
command?
TCP, UDP and RAW and unix socket connection we can see by
using –t, -u, -w, and –x flags with netstat command. Detailed description about
this you will get in this article.