netstat查看系统连接数及当前连接IP

2019-04-03 · 1 阅读
1.查看当前连接IP地址:
[root@centos69 ~]# netstat -nat
Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address    Foreign Address       State tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN tcp        0      0 192.168.1.200:22   192.168.1.162:52265   ESTABLISHED tcp        0      0 :::22                       :::*                        LISTEN tcp        0      0 ::1:25                      :::*                        LISTEN 2.查看80端口连接数
netstat -nat|grep -i '80'|wc -l
3.查看当前连接状态数量如LISTEN /ESTABLISHED /tcp
netstat -na|grep LISTEN|wc -l
4.查看连接IP
netstat -na|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'
5.netstat --help使用方法