Use ss in CentOS to view network port status

Source: Internet
Author: User
[Scenario 1: View network connection statistics of the current server] $ ss-sTotal: 295 (kernel312) TCP: 48 (estab1, closed31, orphaned0, synrecv0, & nbs

[Scenario 1: view the network connection statistics of the current server]

$ ss -sTotal: 295 (kernel 312)TCP:   48 (estab 1, closed 31, orphaned 0, synrecv 0, timewait 0/0), ports 13Transport Total     IP        IPv6*         312       -         -RAW       0         0         0UDP       2         2         0TCP       17        12        5INET      19        14        5FRAG      0         0         0

When the server generates a large number of sockets connections, we will use this command for macro statistics.

 

Scenario 2: View all open network ports]

$ ss -lRecv-Q Send-Q           Local Address:Port               Peer Address:Port0      128                         :::webcache                      :::*0      128                         :::http                         :::*0      128                         :::snapenetio                      :::*0      128                          *:snapenetio                       *:*0      50                           *:8531                          *:*0      9                           :::ftp                          :::*0      9                            *:ftp                           *:*0      128                          *:ddi-tcp-1                       *:*0      100                        ::1:smtp                         :::*0      100                  127.0.0.1:smtp                          *:*0      128                          *:8541                          *:*0      128                  127.0.0.1:entextxid                       *:*0      50                           *:12421                         *:*0      10                           *:amqp                          *:*0      128                          *:12521                         *:*0      50                           *:mysql                         *:*

If the-pl parameter is used, the specific program name is listed. You will see something similar to this in the output:

("nginx",15786,6)

We can know that a socket connection belongs to the nginx program, and the PID of the nginx program is 15786.

 

[Scenario 3: View All socket connections on this server]

You can simply use the-a option to list all network connections.

#ss -a

If you only want to view TCP sockets, use the-ta option;
If you only want to view UDP sockets, use the-ua option;
If you only want to view RAW sockets, use the-wa option;
If you only want to view UNIX sockets, use the-xa option.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.