netstat

Linux 使用ss命令代替 netstat

天大地大妈咪最大 提交于 2019-12-03 08:33:39
ss是Socket Statistics的缩写。 顾名思义,ss命令可以用来获取socket统计信息,它可以显示和netstat类似的内容。但ss的优势在于它能够显示更多更详细的有关TCP和连接状态的信息,而且比netstat更快速更高效。 【和netstat说再见的原因】 当服务器的socket连接数量变得非常大时,无论是使用netstat命令还是直接cat /proc/net/tcp,执行速度都会很慢。可能你不会有切身的感受,但请相信我,当服务器维持的连接达到上万个的时候,使用netstat等于浪费 生命,而用ss才是节省时间。 天下武功唯快不破。ss快的秘诀在于,它利用到了TCP协议栈中tcp_diag。tcp_diag是一个用于分析统计的模块,可以获得Linux 内核中第一手的信息,这就确保了ss的快捷高效。当然,如果你的系统中没有tcp_diag,ss也可以正常运行,只是效率会变得稍慢。(但仍然比 netstat要快。) 【用数据说话】 为了让你更坚决的和netstat说再见,列举一些测试数据,以便证明ss的确名不虚传。 当服务器维持3万个socket连接,Admin需要计算具体的连接数量时,不同情况的耗时如下: netstat -at | wc 耗时 15.60 秒 ss -atr | wc 耗时 5.40 秒(未利用tcp_diag) ss -atr | wc 耗时

Troubleshooting connections stuck in CLOSE_WAIT status

孤者浪人 提交于 2019-12-03 05:40:38
问题 I have a Java application running in WebLogic 11g on Windows, which after several days, becomes unresponsive. One suspicious symptom I've noticed is that a large number of connections (about 3000) show up in netstat with a CLOSE_WAIT status even when the server is idle. Since the application server is managing the client connections, I'm not sure what's causing this. We also make a number of web service calls that loopback to the same server, but I believe those connections get closed

Debugging IDE's port connection to XDebug: “Waiting to Connect”

独自空忆成欢 提交于 2019-12-03 03:06:39
问题 Preamble Like many, I've spent more hours debugging my IDE’s connection to XDebug than I have using XDebug to debug my programs. I’ve gotten it to work repeatedly , but every once and a while I get the common “Waiting to connect” problem. I haven’t been able to localize what causes XDebug to work or fail. I’ve been using ubuntu for two years; I’m neither a noob nor an strace guru. What am I doing wrong? How can I better debug my IDE’s connection to XDebug? Setup Ubuntu 10.10 Netbeans 6.9.1

ubuntu查看占用某端口的程序

安稳与你 提交于 2019-12-03 01:46:42
查看端口使用情况,使用netstat命令。 查看已经连接的服务端口(ESTABLISHED netstat -a 查看所有的服务端口(LISTEN,ESTABLISHED) netstat -ap 查看8080端口,则可以结合grep命令: netstat -ap | grep 8080 如查看8888端口,则在终端中输入: lsof -i:8888 若要停止使用这个端口的程序,使用kill +对应的pid即可 来源: https://www.cnblogs.com/smallleiit/p/11769942.html

Understanding the netstat output

匿名 (未验证) 提交于 2019-12-03 00:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: tcp 0 0 :::111 :::* LISTEN Above is the output of netstat -nl | grep 111 What is the meaning of :::111 segment? 回答1: technet.microsoft.com says that: Displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics (for the IP, ICMP, TCP, and UDP protocols), and IPv6 statistics (for the IPv6, ICMPv6, TCP over IPv6, and UDP over IPv6 protocols). Used without parameters, netstat displays active TCP connections. So you can find which addresses and ports are used and listening.

netstat命令使用

匿名 (未验证) 提交于 2019-12-03 00:14:01
Ŀ¼ Netstat 命令用于显示各种网络相关信息,如网络连接,路由表,接口状态 (Interface Statistics),masquerade 连接,多播成员 (Multicast Memberships) 等等。 CentOS7: yum install net - tools - y usage : netstat [- vWeenNcCF ] [< Af >] - r netstat {- V |-- version |- h |-- help } netstat [- vWnNcaeol ] [< Socket > ...] netstat { [- vWeenNac ] - I [< Iface >] | [- veenNac ] - i | [- cnNe ] - M | - s [- 6tuw ] } [ delay ] - r , -- route display routing table - I , -- interfaces =< Iface > display interface table for < Iface > - i , -- interfaces display interface table - g , -- groups display multicast group memberships - s , -- statistics

查看服务器是否被DDOS攻击

匿名 (未验证) 提交于 2019-12-02 23:38:02
以下内容均为工作中整理 找出活跃的SYNC_REC netstat -n -p|grep SYN_REC | wc -l 使用netstat命令来计算每个IP地址对服务器的连接数量 watch -n 2 "netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n" 显示并且列出连接到80端口IP地址和连接数.80被用来作为HTTP (443端口同理) netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1 统计80端口连接数(443端口同理) watch -n 2 "netstat -an | grep :80 | grep ESTABLISHED" 统计所有连接到本机端口 watch -n 2 "netstat -ant |grep ESTABLISHED|wc -l" 拒绝此IP的所有连接 iptables -A INPUT 1 -s $IPADRESS -j DROP/REJECT 文章来源: https://blog.csdn.net/weixin_44335190/article/details/91353729

Linux-T

大城市里の小女人 提交于 2019-12-02 22:59:15
vim编辑器 i输入 Esc切换 :wq w保存 q退出 保存 查看openssl版本号 openssl version 查看所有php扩展 php -m 查看指定端口占用 netstat -anp |grep xxxx 查看所有端口号占用 netstat -nultp 来源: https://www.cnblogs.com/xuanjiange/p/11766105.html

查看linux所有被占用的端口

匿名 (未验证) 提交于 2019-12-02 21:56:30
netstat -tulnp -t(tcp)只显示tcp相关的 -u(udp)只显示udp相关的 -l(listening)只显示监听服务的端口 -n(numeric)不解析名称,能用数字表示的就不用别名(例如:localhost会转成127.0.0.1) -p(programs)显示端口的PID和程序名称 可以通过netstat -tulnp | grep 端口号查看当前端口号是否被占用 例如: netstat -tulnp|grep 3306 可以看出来3306端口被mysql占用了。 来源:博客园 作者: 浅安时光i 链接:https://www.cnblogs.com/qiananshiguang/p/11459013.html

linux查看端口号占用

匿名 (未验证) 提交于 2019-12-02 21:56:30
1、lsof -i:端口号 2、netstat -tunlp|grep 端口号 都可以查看指定端口被哪个进程占用的情况 【步骤一】lsof -i lsof -i 用以显示符合条件的进程情况,lsof(list open files)是一个列出当前系统打开文件的工具。 以root用户来执行lsof -i命令 ,如下图 【步骤二】lsof -i:端口号 lsof -i:端口号,用于查看某一端口的占用情况,比如查看22号端口使用情况,lsof -i:22,如下图 【步骤三】netstat -tunlp netstat -tunlp用于显示tcp,udp的端口和进程等相关情况,如下图 【步骤四】netstat -tunlp|grep 端口号 netstat -tunlp|grep 端口号,用于查看指定端口号的进程情况,如查看22端口的情况,netstat -tunlp|grep 22,如下图 来源:博客园 作者: 梦----------凡 链接:https://www.cnblogs.com/accpguoliang/p/11421633.html