Linux TCP链接查看和调整

查看Linux的TCP连接数的方法如下:

统计80端口连接数

shell 复制代码
netstat -nat|grep -i "80"|wc -l

统计httpd协议连接数

shell 复制代码
ps -ef|grep httpd|wc -l

统计已连接上的,状态为"established"的TCP连接数

shell 复制代码
netstat -na|grep ESTABLISHED|wc -l

统计某个IP地址连接最多的TCP连接数

shell 复制代码
netstat -na|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r

调整方式

临时生效

shell 复制代码
sysctl -w net.core.somaxconn=10240

永久生效

shell 复制代码
echo "net.core.somaxconn = 10240" >>/etc/sysctl.conf
sysctl -p
相关推荐
Clarence Liu7 分钟前
虚拟机与容器的差异与取舍
linux·后端·容器
A132470531215 分钟前
防火墙配置入门:保护你的服务器
linux·运维·服务器·网络
摇滚侠28 分钟前
CentOS 7 Linux 离线安装 Docker:离线安装包、依赖文件、安装步骤
linux·docker·centos
小鸡脚来咯31 分钟前
怎么配置主机名映射?
linux·windows·macos
Zzqqads32 分钟前
vnc连接问题:Timed out waiting for a response from the computer
服务器
咖啡の猫37 分钟前
TypeScript基本类型
linux·ubuntu·typescript
玖疯子39 分钟前
JavaScript性能优化实战的技术文章大纲
服务器
DeeplyMind39 分钟前
第4章:DebugFS 安全性和并发控制
linux·驱动开发·debugfs
CS Beginner1 小时前
【Linux】快速配置wifi和SSH服务
linux·运维·ssh
become__better1 小时前
判断ceph osd 节点磁盘异常
linux·运维·ceph