Introduction to Netstat Commands on Linux
Netstat (Network Statistics) is a helpful command-line utility available in Linux for monitoring and analysis of networking connections, routing tables, and performance. It also offers detailed information about open ports, listening sockets, and active connections, which can be crucial for network troubleshooting and security monitoring. Netstat is of utmost importance for system administrators who seek to manage Linux network environments
Features of the Netstat Command
Connection Information: Display information about all active and listening network connections, including protocol type, local/remote addresses, and connection states.
Port Analysis: See what services or processes are listening on certain ports.
Routing Information: Show the routing table from the system, important to know how data packets are being routed.
Protocol Stats: 4 – 6 steps Protocol statistics gives the performance data of protocols such as TCP, UDP, ICMP. Including the number of sent packets, received packets, Input errors, Output errors.
List of Netstat Commands with examples
1. An overview of all TCP and UDP connections LISTENING
Listing all TCP and UDP ports using the netstat -a option.
# netstat -a | more
[root@support ~]# netstat -a | more
Active Internet connections (servers and established)
Proto 33109_bb8a72-c8> |
Recv-Q 33109_0bd87e-f7> |
Send-Q 33109_1cade7-5f> |
Local Address 33109_8a65b8-cf> |
Foreign Address 33109_93fced-1d> |
State 33109_00079f-cd> |
---|---|---|---|---|---|
tcp 33109_7ffdef-43> |
0 33109_881fbd-c3> |
0 33109_7e25ad-06> |
0.0.0.0:ssh 33109_8fe252-20> |
0.0.0.0:* 33109_b3efbc-7f> |
LISTEN 33109_b9b175-26> |
tcp 33109_7736b8-1b> |
0 33109_b82a75-89> |
128 33109_28c2d8-79> |
support.testing:ssh 33109_511f64-0d> |
61.2.249.57:56877 33109_da0a3f-40> |
ESTABLISHED 33109_25820d-30> |
tcp6 33109_4a78c9-2b> |
0 33109_a6c66b-2c> |
0 33109_b103fd-b5> |
[::]:ssh 33109_6a0677-a1> |
[::]:* 33109_4e1d33-59> |
LISTEN 33109_89fd5e-fa> |
Active UNIX domain sockets (Servers and established)
Proto 33109_76e07c-fd> |
RefCnt 33109_ad88f7-e3> |
Flags 33109_d07f3e-8f> |
Type 33109_ec7831-24> |
State 33109_adb789-09> |
I-Node 33109_80e5f3-02> |
Path 33109_fd2d82-34> |
---|---|---|---|---|---|---|
unix 33109_91e54e-6f> |
2 33109_dd9fc5-5c> |
[ ACC ] 33109_ffab16-dd> |
STREAM 33109_ef043c-d9> |
LISTENING 33109_f40502-21> |
12572 33109_4c6e99-d8> |
/run/systemd/io.system.ManagedOOM 33109_7df194-62> |
unix 33109_dad216-e1> |
10 33109_3071c4-c7> |
[ ] 33109_7fc260-e1> |
DGRAM 33109_0798ec-88> |
CONNECTED 33109_af3aa8-13> |
12579 33109_4673e3-90> |
/run/systemd/journal/dev-log 33109_be6749-b6> |
unix 33109_16cc6b-d2> |
7 33109_1d92e9-54> |
[ ] 33109_55437c-de> |
DGRAM 33109_374587-06> |
CONNECTED 33109_af9368-33> |
12581 33109_50b50a-71> |
/run/systemd/journal/ 33109_aaacc8-72> |
unix 33109_cb8af3-c6> |
2 33109_47c5e3-9f> |
[ ACC ] 33109_b9f4c5-fa> |
SEQPACKET 33109_e28f07-5e> |
LISTENING 33109_1b03f8-0d> |
15627 33109_63b9fc-9d> |
/run/udev/control 33109_5697ef-fd> |
unix 33109_681f59-00> |
2 33109_ced7e5-fc> |
[ ACC ] 33109_5dae62-bc> |
STREAM 33109_633108-88> |
LISTENING 33109_c039b1-93> |
846 33109_cf6cba-c1> |
/run/systemd/journal/io.systemd.journal 33109_77729b-b4> |
unix 33109_6eba73-34> |
2 33109_3c3637-a1> |
[ ACC ] 33109_265ef0-03> |
STREAM 33109_8886f2-58> |
LISTENING 33109_65b56e-d9> |
15856 33109_b7f2f8-31> |
/run/dbus/system_bus_socket 33109_24bf9f-57> |
unix 33109_9b95ad-f1> |
2 33109_3ac6bd-62> |
[ ACC ] 33109_f0340c-0b> |
STREAM 33109_b5d76e-10> |
LISTENING 33109_406ed2-4d> |
15857 33109_7eeb0f-f0> |
/run/.heim_org.h5l.kcm-socket 33109_b51fdd-07> |
unix 33109_3055ff-98> |
2 33109_247263-45> |
[ ACC ] 33109_334555-39> |
STREAM 33109_a5fa1c-76> |
LISTENING 33109_83dca4-5c> |
12997 33109_40b92c-b1> |
/run/irqbalance/irqbalance563.sock 33109_93a8fb-cb> |
2. Listing TCP Ports connections
netstat usage -at to show only TCP (Transmission Control Protocol) port connections.
# netstat -at
[root@support ~]# netstat -at
Active Internet connections (servers and established)
Proto 33109_6e4802-cd> |
Recv-Q 33109_cb7e6e-e5> |
Send-Q 33109_4ea724-f4> |
Local Address 33109_d147d4-be> |
Foreign Address 33109_8ec84a-6b> |
State 33109_52e581-fc> |
---|---|---|---|---|---|
tcp 33109_c513c7-43> |
0 33109_ef45b3-cb> |
0 33109_f64a5f-87> |
0.0.0.0:ssh 33109_7ad68c-05> |
0.0.0.0:* 33109_1b0f65-0e> |
LISTEN 33109_f32d23-8e> |
tcp 33109_c9205e-09> |
0 33109_daccc9-63> |
958 33109_7add30-be> |
support.testing:ssh 33109_43dbde-17> |
120.26.230.64:35724 33109_50faa5-e0> |
FIN_WAIT1 33109_b88b38-9b> |
tcp 33109_faf744-c7> |
0 33109_8708a9-eb> |
288 33109_c0c3bf-de> |
support.testing:ssh 33109_801969-52> |
61.2.249.57:56877 33109_6a6bec-33> |
ESTABLISHED 33109_c90f78-02> |
tcp 33109_99ef1d-02> |
0 33109_da27bb-e4> |
937 33109_a2d342-58> |
support.testing:ssh 33109_edc2d2-0e> |
120.26.230.64:35918 33109_12a407-ce> |
LAST_ACK 33109_4ae2e5-7b> |
tcp 33109_5c91ae-04> |
0 33109_0905cf-c6> |
957 33109_f485ae-5f> |
support.testing:ssh 33109_d930d1-92> |
120.26.230.64:38656 33109_d229c0-3b> |
ESTABLISHED 33109_26e7b2-43> |
tcp 33109_7dbbe9-d5> |
0 33109_fef1de-8f> |
58 33109_1137af-df> |
support.testing:ssh 33109_c7e75f-a5> |
120.26.230.64:56824 33109_76db83-e9> |
FIN_WAIT1 33109_d444a9-f7> |
tcp6 33109_831487-f8> |
0 33109_788284-a7> |
0 33109_56de74-b1> |
[::]:ssh 33109_9ef7cf-26> |
[::]:* 33109_8508fb-6d> |
LISTEN 33109_82178a-ed> |
3. Listing UDP Ports connections
netstat usage -au, this command lists only UDP (User Datagram Protocol ) port connections.
# netstat -au
[root@support ~]# netstat -au
Active Internet connections (servers and established)
Proto 33109_c005b1-e4> |
Recv-Q 33109_bb3e57-0d> |
Send-Q 33109_6a9975-50> |
Local Address 33109_f53f98-28> |
Foreign Address 33109_6e8956-b9> |
State 33109_835f5a-a1> |
---|---|---|---|---|---|
udp 33109_37739a-d6> |
0 33109_3b261d-24> |
0 33109_60e974-fe> |
support.testing:323 33109_4f53a2-a6> |
0.0.0.0:* 33109_a1d673-1e> | 33109_0a3f1c-51> |
udp6 33109_7f7e39-0d> |
0 33109_a4ada9-88> |
0 33109_75fd0a-a7> |
localhost:323 33109_7ce62a-b9> |
[::]:* 33109_6915d0-35> | 33109_a7583d-0f> |
4. Listing all LISTENING Connections
Netstat -l displays all active listening port connections.
# netstat -l
[root@support ~]# netstat -l
Active Internet connections (only servers)
Proto 33109_0a142d-2c> |
Recv-Q 33109_bc3716-e5> |
Send-Q 33109_622f5f-99> |
Local Address 33109_b45c21-57> |
Foreign Address 33109_8fe03a-ab> |
State 33109_070b8f-43> |
---|---|---|---|---|---|
tcp 33109_d0a365-00> |
0 33109_1db519-bc> |
0 33109_dcf419-40> |
0.0.0.0:ssh 33109_e7a994-35> |
0.0.0.0:* 33109_950bd9-bf> |
LISTEN 33109_28898a-6b> |
tcp6 33109_d5b0f6-6b> |
0 33109_2d6285-e1> |
0 33109_3cbb6e-a0> |
[::]:ssh 33109_d49654-a7> |
[::]:* 33109_dfaecd-70> |
LISTEN 33109_75dc60-79> |
Active UNIX domain sockets (only servers)
Proto 33109_5f4572-2d> |
RefCnt 33109_5075bd-e4> |
Flags 33109_b18fc8-1c> |
Type 33109_058237-56> |
State 33109_7094ec-77> |
I-Node 33109_45188e-b1> |
Path 33109_78f586-c2> |
---|---|---|---|---|---|---|
unix 33109_7065d2-aa> |
2 33109_2e531f-2a> |
[ ACC ] 33109_55c8ad-fd> |
STREAM 33109_0dd5ae-b4> |
LISTENING 33109_a29c3b-0c> |
12583 33109_45795b-9f> |
/run/systemd/journal/stdout 33109_c53bc4-de> |
unix 33109_248561-29> |
2 33109_7f2f68-32> |
[ ACC ] 33109_461750-70> |
STREAM 33109_f0b282-1d> |
LISTENING 33109_adca97-7a> |
846 33109_c90b63-26> |
/run/systemd/journal/io.systemd.journal 33109_b5a701-b7> |
unix 33109_02b7e4-23> |
2 33109_e4c797-0e> |
[ ACC ] 33109_815659-de> |
STREAM 33109_820b08-23> |
LISTENING 33109_c69213-2d> |
15856 33109_46f674-25> |
/run/dbus/system_bus_socket 33109_0f8102-42> |
unix 33109_939663-3b> |
2 33109_e7e753-b7> |
[ ACC ] 33109_d9849b-f1> |
STREAM 33109_c7b070-da> |
LISTENING 33109_403f05-1a> |
15857 33109_fac064-93> |
/run/.heim_org.h5l.kcm-socket 33109_66e914-90> |
unix 33109_f766d8-b5> |
2 33109_320ea3-32> |
[ ACC ] 33109_2ce80b-3a> |
STREAM 33109_4bc8e7-51> |
LISTENING 33109_dc6cc0-81> |
12997 33109_7e2f21-22> |
/run/irqbalance/irqbalance563.sock 33109_c3bc3a-56> |
Proto Destination Source State PSM DCID SCID IMTU OMTU Security
Proto Destination Source State Channel
5. Listing all TCP Listening Ports
Use the option netstat -lt to list all active TCP ports.
# netstat -lt
[root@support ~]# netstat -lt
Active Internet connections (only servers)
Proto 33109_8e9660-3a> |
Recv-Q 33109_00ebf1-c3> |
Send-Q 33109_cc4528-79> |
Local Address 33109_ed618d-ce> |
Foreign Address 33109_3874f2-88> |
State 33109_3ec0dc-5a> |
---|---|---|---|---|---|
tcp 33109_9a5b8b-ff> |
0 33109_b29d30-88> |
0 33109_6ca322-9b> |
0.0.0.0:ssh 33109_b8313d-21> |
0.0.0.0:* 33109_ba663f-c2> |
LISTEN 33109_4547e6-0b> |
tcp6 33109_eb1695-c3> |
0 33109_f469fc-0f> |
0 33109_97da0d-f2> |
[::]:ssh 33109_f19a2f-9f> |
[::]:* 33109_5d6482-1d> |
LISTEN 33109_f46ac3-e7> |
6. Listing all UDP Listening Ports
The option netstat -lu lists all UDP ports that are actively listening.
# netstat -lu
[root@support ~]# netstat -lu
Active Internet connections (only servers)
Proto 33109_bfac5e-a4> |
Recv-Q 33109_9a2cbb-61> |
Send-Q 33109_f351e3-d2> |
Local Address 33109_68bc6a-16> |
Foreign Address 33109_8ebb5b-42> |
State 33109_5acb1d-a4> |
---|---|---|---|---|---|
udp 33109_eb72e7-38> |
0 33109_9cf97a-96> |
0 33109_0f71bc-68> |
amansupport.testing:323 33109_2fad3c-71> |
0.0.0.0:* 33109_51ae9b-b1> | 33109_834780-6d> |
udp6 33109_c0fba4-54> |
0 33109_99bfa6-5f> |
0 33109_03c1c6-82> |
localhost:323 33109_cbe460-f4> |
[::]:* 33109_785585-f1> | 33109_1408ee-e5> |
7. Listing all UNIX Listening Ports
Listing all active UNIX listening ports using netstat -lx.
# netstat -lx
[root@support ~]# netstat -lx
Active UNIX domain sockets (only servers)
Proto 33109_188a4c-43> |
RefCnt 33109_300674-8e> |
Flags 33109_724933-f8> |
Type 33109_9ed3b2-f9> |
State 33109_50034f-0f> |
I-Node 33109_2bfe2e-57> |
Path 33109_7517c3-ee> |
---|---|---|---|---|---|---|
unix 33109_07d4be-7b> |
2 33109_ef1172-13> |
[ ACC ] 33109_e9463c-64> |
STREAM 33109_89b546-96> |
LISTENING 33109_883008-1b> |
17419 33109_4bb565-26> |
/run/user/0/systemd/private 33109_c99683-02> |
unix 33109_59684a-23> |
2 33109_b689de-1f> |
[ ACC ] 33109_449c6c-0e> |
STREAM 33109_2a7e38-e6> |
LISTENING 33109_4ba178-e2> |
17427 33109_856bc8-43> |
/run/user/0/bus 33109_20ab61-2c> |
unix 33109_5fb9be-74> |
2 33109_827427-fe> |
[ ACC ] 33109_4560ac-da> |
STREAM 33109_0d79e0-38> |
LISTENING 33109_4fed12-dc> |
12571 33109_460c77-0a> |
/run/systemd/userdb/io.systemd.DynamicUser 33109_9759d3-d3> |
unix 33109_ff3181-d2> |
2 33109_4c3749-63> |
[ ACC ] 33109_2880f5-30> |
STREAM 33109_af53d7-d9> |
LISTENING 33109_37ab5d-f1> |
12572 33109_2fc4e1-85> |
/run/systemd/io.system.ManagedOOM 33109_a28bd4-48> |
unix 33109_c770cb-2f> |
2 33109_ffc9e0-65> |
[ ACC ] 33109_dfd503-9e> |
STREAM 33109_09174e-af> |
LISTENING 33109_fbd155-e5> |
12583 33109_ae5d56-e5> |
/run/systemd/journal/stdout 33109_a27f34-d0> |
unix 33109_03c7d5-33> |
2 33109_48e955-80> |
[ ACC ] 33109_dd9c71-52> |
STREAM 33109_e55a5b-b4> |
LISTENING 33109_e7fe75-b7> |
15613 33109_30fe83-f7> |
/run/systemd/private 33109_e47cc3-80> |
unix 33109_6341af-02> |
2 33109_0fc568-32> |
[ ACC ] 33109_3178e2-45> |
SEQPACKET 33109_2f1814-77> |
LISTENING 33109_1b8626-eb> |
15626 33109_ec64c1-ec> |
/run/systemd/coredump 33109_68652c-1d> |
unix 33109_b03357-5f> |
2 33109_008186-11> |
[ ACC ] 33109_3bfc4c-bd> |
SEQPACKET 33109_fd2d91-08> |
LISTENING 33109_1884eb-53> |
15627 33109_b09f3c-32> |
/run/udev/control 33109_d0dd0e-b1> |
unix 33109_509956-a3> |
2 33109_119506-5b> |
[ ACC ] 33109_5cc66b-d8> |
STREAM 33109_3d8a09-a5> |
LISTENING 33109_46e902-c2> |
846 33109_aa1d97-04> |
/run/systemd/journal/io.systemd.journal 33109_e81099-30> |
unix 33109_f1b5b1-b1> |
2 33109_dc79ba-d7> |
[ ACC ] 33109_495c28-3d> |
STREAM 33109_167574-47> |
LISTENING 33109_2ad255-9b> |
15856 33109_c2f551-a6> |
/run/dbus/system_bus_socket 33109_eb9756-ec> |
unix 33109_f5845a-6f> |
2 33109_eeb574-70> |
[ ACC ] 33109_c684b4-59> |
STREAM 33109_3ba744-4f> |
LISTENING 33109_319a8a-76> |
15857 33109_7941b8-3f> |
/run/.heim_org.h5l.kcm-socket 33109_d41de6-e2> |
unix 33109_6eeb92-ca> |
2 33109_ba08ae-2f> |
[ ACC ] 33109_a64957-5d> |
STREAM 33109_e3b7f2-c9> |
LISTENING 33109_98c174-e3> |
12997 33109_a4d207-a1> |
/run/irqbalance/irqbalance563.sock 33109_12ef2d-db> |
8. Showing Statistics by Protocol
Displays statistics by protocol. By default, statistics are shown for the TCP, UDP, ICMP, and IP protocols. The -s parameter can be used to specify a set of protocols.
# netstat -s
[root@support ~]# netstat -s
Ip:
Forwarding: 2
12062 total packets received
0 forwarded
0 incoming packets discarded
12062 incoming packets delivered
5445 requests sent out
8 dropped because of missing route
Icmp:
1 ICMP messages received
0 input ICMP message failed
ICMP input histogram:
echo requests: 1
28 ICMP messages sent
0 ICMP messages failed
ICMP output histogram:
destination unreachable: 27
echo replies: 1
Showing statistics of only TCP protocol by using option netstat -st.
# netstat -st
[root@support ~]# netstat -st
IcmpMsg:
InType8: 2
OutType0: 2
OutType3: 27
Tcp:
21 active connection openings
11 passive connection openings
4 failed connection attempts
3 connection resets received
2 connections established
8150 segments received
10. Showing Statistics by UDP Protocol
# netstat -su
[root@support ~]# netstat -su
IcmpMsg:
InType8: 2
OutType0: 2
OutType3: 29
Udp:
176 packets received
29 packets to unknown port received
0 packet receive errors
176 packets sent
0 receive buffer errors
0 send buffer errors
IgnoredMulti: 4343
UdpLite:
IpExt:
InBcastPkts: 4343
InOctets: 18365002
OutOctets: 459359
InBcastOctets: 1492868
InNoECTPkts: 12767
MPTcpExt:
11. Displaying Service name with PID
Displaying service name with their PID number, using option netstat -tp will display “PID/Program Name“
# netstat -tp
[root@support ~]# netstat -tp
Active Internet connections (w/o servers)
Proto 33109_615e00-8e> |
Recv-Q 33109_39ec39-c4> |
Send-Q 33109_c1e087-d6> |
Local Address 33109_ce0c53-32> |
Foreign Address 33109_523d7c-69> |
State 33109_404bd3-71> |
PID/Program name 33109_19ce46-f4> |
---|---|---|---|---|---|---|
tcp 33109_84d64f-25> |
0 33109_e947f9-11> |
96 33109_0e571f-2a> |
support.testing:ssh 33109_c1c36b-e5> |
61.2.249.57:26813 33109_93d076-10> |
ESTABLISHED 33109_f85d54-46> |
907/sshd: root [pri 33109_86b66d-45> |
tcp 33109_c42742-12> |
0 33109_a2ff5d-2c> |
0 33109_9190da-67> |
support.testing:ssh 33109_9d86f8-c9> |
61.2.249.57:56877 33109_608ab4-b5> |
ESTABLISHED 33109_04c99b-7b> |
787/sshd: root [pri 33109_1dd391-9f> |
12. Displaying Promiscuous Mode
When using the -ac switch, you can display promiscuous mode or refresh the screen every five seconds. It is set to refresh every second by default.
# netstat -ac 5 | grep tcp
tcp 33109_ad1489-f5> |
0 33109_d4f1a4-ec> |
0 33109_eab167-eb> |
0.0.0.0:ssh 33109_dad34b-ee> |
0.0.0.0:* 33109_0df947-23> |
LISTEN 33109_ba36d7-bb> |
tcp 33109_6f07ab-7b> |
0 33109_881bfb-e5> |
160 33109_8a1a74-57> |
support.testing:ssh 33109_cc7f45-42> |
61.2.249.57:26813 33109_0d8e7f-a1> |
ESTABLISHED 33109_0d6f9f-d1> |
tcp 33109_52ec9c-e7> |
0 33109_c1bbc4-bc> |
0 33109_c0b6bc-4c> |
support.testing:ssh 33109_f59b8d-9f> |
61.2.249.57:56877 33109_3b1d5e-68> |
ESTABLISHED 33109_5f0c28-c8> |
tcp6 33109_ee0728-bd> |
0 33109_08b4da-24> |
0 33109_29da46-9a> |
[::]:ssh 33109_cb047c-ef> |
[::]:* 33109_4157d4-f3> |
LISTEN 33109_16743b-01> |
tcp 33109_e76c09-12> |
0 33109_2c086c-db> |
0 33109_99b3fd-1b> |
0.0.0.0:ssh 33109_db7ef6-42> |
0.0.0.0:* 33109_c69229-f2> |
LISTEN 33109_8977f5-96> |
tcp 33109_08bc62-4d> |
0 33109_09a600-55> |
0 33109_dbb5a2-e0> |
support.testing:ssh 33109_c2b4d0-b8> |
61.2.249.57:26813 33109_9e0f0d-9b> |
ESTABLISHED 33109_03bd43-4b> |
tcp 33109_8df5ea-b3> |
0 33109_8bcfb8-24> |
0 33109_129471-87> |
support.testing:ssh 33109_6e20c2-7a> |
61.2.249.57:56877 33109_76d384-d7> |
ESTABLISHED 33109_82b712-f1> |
tcp6 33109_622870-92> |
0 33109_d51770-17> |
0 33109_406d99-f5> |
[::]:ssh 33109_72830b-bf> |
[::]:* 33109_bd612e-c8> |
LISTEN 33109_d930c7-49> |
13. Displaying Kernel IP routing
With the netstat and route commands, you can display the kernel IP routing table.
# netstat -r
[root@support ~]# netstat -r
Kernel IP routing table
Destination 33109_b2e52b-ed> |
Gateway 33109_e991ca-13> |
Genmask 33109_e7412d-d9> |
Flags 33109_e0ce33-79> |
MSS 33109_0aef46-01> |
Window 33109_fa0cda-ed> |
irtt 33109_c8eed0-29> |
Iface 33109_d7927d-c9> |
---|---|---|---|---|---|---|---|
default 33109_10d9c9-bd> |
gateway.reserve 33109_ad0763-12> |
0.0.0.0 33109_26793f-b6> |
UG 33109_a747d3-c3> |
0 33109_d96b32-26> |
0 33109_4b7ef4-d5> |
0 33109_4e0358-03> |
eth0 33109_74c637-e5> |
subnet.reserved 33109_24ff22-3c> |
0.0.0.0 33109_0f5905-1b> |
255.255.255.128 33109_688f2b-89> |
U 33109_791c6c-4b> |
0 33109_de08bf-ff> |
0 33109_e98d6d-7a> |
0 33109_9f1596-75> |
eth0 33109_c59c12-f8> |
gateway.reserve 33109_275287-8c> |
0.0.0.0 33109_eaa683-24> |
255.255.255.255 33109_b9edb1-18> |
UH 33109_730163-7c> |
0 33109_c83f5d-86> |
0 33109_f97ba0-d8> |
0 33109_0c7769-20> |
eth0 33109_58942d-fb> |
14. Showing Network Interface Transactions
Displays both the transferring and receiving packet transactions for the network interface.
# netstat -i
[root@support ~]# netstat -i
Kernel Interface table
Iface 33109_2cd9c9-47> |
MTU 33109_9674d5-e2> |
RX-OK 33109_780e81-f9> |
RX-ERR 33109_7448ef-7d> |
RX-DRP 33109_789a94-7a> |
RX-OVR 33109_c1eb8b-98> |
TX-OK 33109_dfde6f-67> |
TX-ERR 33109_c181eb-19> |
TX-DRP 33109_07788e-21> |
TX-OVR 33109_af897b-39> |
Flg 33109_49d8f0-0b> |
---|---|---|---|---|---|---|---|---|---|---|
eth0 33109_326069-8f> |
1500 33109_54cf8c-46> |
334283 33109_e6fc9a-d4> |
0 33109_922bb7-5e> |
2166 33109_8ad058-70> |
0 33109_0f6cac-c4> |
5962 33109_27fd42-0f> |
0 33109_a4bbcf-fb> |
0 33109_a1fd5b-92> |
0 33109_e762ec-4f> |
BMRU 33109_777c39-be> |
lo 33109_3385c1-84> |
65536 33109_bd7df6-20> |
0 33109_7f2aac-30> |
0 33109_1503e3-d2> |
0 33109_6519d3-48> |
0 33109_d1eea1-37> |
0 33109_93cd64-58> |
0 33109_834afb-e7> |
0 33109_406e7b-5c> |
0 33109_cea88d-ab> |
LRU 33109_4e9806-95> |
15. Showing Kernel Interface Table
Like ifconfig, this command displays the kernel interface table.
# netstat -ie
[root@support ~]# netstat -ie
Kernel Interface table
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 185.226.67.150 netmask 255.255.255.128 broadcast 185.226.67.255
inet6 fe80::216:3eff:feed:b877 prefixlen 64 scopeid 0x20<link>
ether 00:16:3e:ed:b8:77 txqueuelen 1000 (Ethernet)
RX packets 346609 bytes 38938070 (37.1 MiB)
RX errors 0 dropped 2245 overruns 0 frame 0
TX packets 5994 bytes 579658 (566.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
16. Displaying IPv4 and IPv6 Information
Information about multicast group membership is displayed for both IPv4 and IPv6.
# netstat -g
[root@support ~]# netstat -g
IPv6/IPv4 Group Memberships
Interface 33109_7ff483-3c> |
RefCnt 33109_56c981-25> |
Group 33109_54685a-cf> |
---|---|---|
lo 33109_0a1e3b-78> |
1 33109_295d3a-1f> |
all-systems.mcast.net 33109_fdbad8-29> |
eth0 33109_a94fec-1c> |
1 33109_96c666-ab> |
all-systems.mcast.net 33109_295f20-ca> |
lo 33109_30bcfb-3d> |
1 33109_68aaff-16> |
ff02::1 33109_99b35c-41> |
lo 33109_e32f8a-c8> |
1 33109_c904d4-ff> |
ff01::1 33109_0b0c74-35> |
eth0 33109_a24c0a-10> |
1 33109_d52e19-7d> |
ff02::1:ffed:b877 33109_e0d235-9c> |
eth0 33109_ca0bf7-95> |
1 33109_d76925-c4> |
ff02::1 33109_a060bb-b6> |
eth0 33109_ef00d7-70> |
1 33109_09b2e9-4a> |
ff01::1 33109_9a52b0-9b> |
17. Print Netstat Information Continuously
Using the following command will print network statistics every few seconds, so you can get it continuously.
# netstat -c
18. Finding non-supportive Address
Finding un-configured address families with some useful information.
# netstat –verbose
[root@support ~]# netstat –verbose
Active Internet connections (w/o servers)
Proto 33109_9fdb22-f1> |
Recv-Q 33109_537c8b-d4> |
Send-Q 33109_be5785-ff> |
Local Address 33109_ee23e1-9b> |
Foreign Address 33109_d275f1-29> |
State 33109_18b28f-d8> |
---|---|---|---|---|---|
tcp 33109_10a668-71> |
0 33109_d35666-0e> |
0 33109_99f319-1c> |
support.testing:ssh 33109_4a6ba5-19> |
218.92.0.174:11692 33109_6ea9b7-60> |
ESTABLISHED 33109_66f5a0-2a> |
tcp 33109_4f6fa3-e2> |
0 33109_95644f-48> |
96 33109_d59eaf-7d> |
support.testing:ssh 33109_b7b98f-10> |
152.59.173.19:56633 33109_c7a24d-32> |
ESTABLISHED 33109_2b9b49-3e> |
tcp 33109_188f6d-c8> |
0 33109_66d5e4-3c> |
0 33109_9e7317-6c> |
support.testing:ssh 33109_b34a15-44> |
218.92.0.174:32239 33109_3a928a-92> |
ESTABLISHED 33109_f16e53-e9> |
tcp 33109_837bba-00> |
0 33109_83adf6-d7> |
0 33109_b0a658-cf> |
nsupport.testing:ssh 33109_05e2da-1e> |
209.97.139.238:41070 33109_04e8c9-5e> |
ESTABLISHED 33109_5792cb-4a> |
netstat: no support for `AF INET (sctp)’ on this system.
netstat: no support for `AF INET (sctp)’ on this system.
Active UNIX domain sockets (w/o servers)
19. Finding Listening Programs
You can find out how many programs are listening on a port.
# netstat -ap | grep http
tcp 0 0 *:http *:* LISTEN 9056/httpd
tcp 0 0 *:https *:* LISTEN 9056/httpd
tcp 0 0 tecmint.com:http sg2nlhg008.shr.prod.s:35248 TIME_WAIT –
tcp 0 0 tecmint.com:http sg2nlhg007.shr.prod.s:57783 TIME_WAIT –
tcp 0 0 tecmint.com:http sg2nlhg007.shr.prod.s:57769 TIME_WAIT –
tcp 0 0 tecmint.com:http sg2nlhg008.shr.prod.s:35270 TIME_WAIT –
tcp 0 0 tecmint.com:http sg2nlhg009.shr.prod.s:41637 TIME_WAIT –
tcp 0 0 tecmint.com:http sg2nlhg009.shr.prod.s:41614 TIME_WAIT –
unix 2 [ ] STREAM CONNECTED 88586726 10394/httpd
20. Displaying RAW Network Statistics
# netstat –statistics –raw
Forwarding: 2
141504 total packets received
0 forwarded
0 incoming packets discarded
141504 incoming packets delivered
53601 requests sent out
8 dropped because of missing route