Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Shell counts the current network connection

2025-03-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

When the number of TCP connections is very large, the current internal IP and external IP connections are counted.

[root@lvs02 account_tcp] # cat account_tcp.sh #! / bin/bash# Statistics the current network connection netstat-na | awk'/ ^ tcp/ {s [$6] + +} END {for (key in s) print key S [key]}'> / root/account_tcp/state.txt# statistics on the number of TCP connections in Local Address netstat-na | awk'/ ^ tcp/' | awk-v FS= "[:] +'{print $4}'| sort | uniq-c | sort-n > / root/account_tcp/Local_Address.txt# statistics on TCP connections of Foreign Address with IP 51 netstat-na | awk'/ ^ tcp/' | grep 192.168.10.51 | awk-v FS=" [ :] +'{print $6}'| sort | uniq-c | sort-n > / root/account_tcp/51_tcp.txt# counts the TCP connection of Foreign Address with IP 80 netstat-na | awk'/ ^ tcp/' | grep 192.168.10.80 | awk-v FS= "[:] +'{print $6}'| sort | uniq-c | sort-n > / root/account_tcp/80_tcp.txt# counts Foreign Address with IP of 86 TCP connection netstat-na | awk'/ ^ tcp/' | grep 192.168.10.86 | awk-v FS= "[:] +'{print $6}'| sort | uniq-c | sort-n > / root/account_tcp/86_tcp.txt# statistics netstat-na of Foreign Address whose IP is 87 | awk'/ ^ tcp/' | grep 192.168.10.87 | awk-v FS=" [:] + "{print $6}' | | sort | uniq-c | sort-n > / root/account_tcp/87_tcp.txt |

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report