awk Statistics Connection Status

Source: Internet
Author: User

1. Identify the maximum number of IP connections with a connection status of establish and seal it off.

# netstat-antlp|grep ' estab ' |awk ' {print $ {} ' |awk-f: ' {print '} ' |sort |uniq-c|sort-rn-k 1

2. Count the number of IP connections with establish connection status

# netstat-antlp|grep ' estab ' |awk ' {print $ {} ' |awk-f: ' {print '} ' |sort |uniq-c|sort-rn

3. Identify the IP with the most Syn_rec connection status and seal it off.

# netstat-antlp|grep ' Syn_rec ' |awk ' {print $ {} ' |awk-f: ' {print '} ' |sort |uniq-c|sort-rn-k 1

4. Count the number of IP connections with Syn_rec connection status

# netstat-antlp|grep ' Syn_rec ' |awk ' {print $ {} ' |awk-f: ' {print '} ' |sort |uniq-c|sort-rn

Normally this value is small, preferably less than 5

5. Count connections for TCP connection status

# NETSTAT-ANTLP |awk '/^tcp/{s[$NF]++}end{for (A in S) print A,s[a]} '


This article is from the "Hanyun.fang" blog, make sure to keep this source http://hanyun.blog.51cto.com/1060170/1600839

awk Statistics Connection Status

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.