Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use the netstat command of linux to display the network status

Shulou Source: shulou.com Published: 2022-06-02 16:16:12 09月27日 Update

This article will explain in detail about the use of linux netstat command to display network status, Xiaobian feel quite practical, so share to everyone as a reference, I hope you can have some harvest after reading this article.

The netstat command is used to display various network-related information, such as network connections, routing tables, Interface statistics, masquerade connections, multicast Memberships, and so on.

Overall, netstat's output can be divided into two parts: one is Active Internet connections, called Active TCP connections, where "Recv-Q" and "Send-Q" refer to %0A's receive queue and send queue. These numbers should usually be 0. If not, the package is piling up in the queue. This can only be seen in very rare cases; the other is Active UNIX domain sockets, called Active Unix Domain Sockets (which are the same as network sockets, but can only be used for native communication and double the performance).

Syntax format: netstat [parameter]

Common parameters:

-a Show Socket-p Show ID and name of program using Socket-u Show UDP connection status-i

Display web interface information form-nUse IP address directly, not through domain name server

Reference Example

Display detailed network status:

[root@linuxcool ~]# netstat -a

Display current UDP connection status of household registration:

[root@linuxcool ~]# netstat -nu

Display UDP port number usage:

[root@linuxcool ~]# netstat -apu

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

udp 0 0 0.0.0.0:bootpc 0.0.0.0:* 4000/dhclient

udp 0 0 localhost:323 0.0.0.0:* 3725/chronyd

udp6 0 0 localhost:323 [::]:* 3725/chronyd

Display network card list:

[root@linuxcool ~]# 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 181864 0 0 0 141278 0 0 0 BMRU

lo 16436 0 3362 0 0 0 3362 0 0 0 LRU

Show multicast group relationships:

[root@linuxcool ~]# netstat -g

IPv6/IPv4 Group Memberships Interface

RefCnt Group

--------------- ------ ---------------------

lo 1 ALL-SYSTEMS.MCAST.NET

eth0 1 ALL-SYSTEMS.MCAST.NET lo 1 ff02::1

eth0 1 ff02::1:ff0a:b0c eth0 1 ff02::1 On the use of linux netstat command to display network status to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

Tags: Network command status situation status queue information parameters more being program article reference good practical two content slogan name address Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Docker OPPO Reno Xiaomi macOS