问题
主机ping自己或者其他的设备报错如下 ping: connect: Resource temporarily unavailable
看了下网络上的其他说法,大多说是下面的两个限制
1.网络连接队列的大小
2.系统级别的最大文件描述符数量
根因分析
调整连接队列和最大文件描述符数,问题仍未解决
echo 65530 > /proc/sys/net/core/somaxconn
ulimit -n 102400
strace下ping 从trace信息发现ping还要打开1025端口,看看是不是有程序把它占用了
strace ping 10.8.73.53
execve("/usr/sbin/ping", ["ping", "10.8.73.53"], 0x7ffd2af3ce58 /* 21 vars */) = 0
brk(NULL) = 0x561a62ee0000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
.....
openat(AT_FDCWD, "/usr/lib64/charset.alias", O_RDONLY|O_NOFOLLOW) = -1 ENOENT (No such file or directory)
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 5
connect(5, {sa_family=AF_INET, sin_port=htons(1025), sin_addr=inet_addr("10.8.73.53")}, 16) = -1 EAGAIN (Resource temporarily unavailable)
write(2, "ping: ", 6ping: ) = 6
write(2, "connect", 7connect) = 7
write(2, ": Resource temporarily unavailab"..., 34: Resource temporarily unavailable) = 34
write(2, "\n", 1
) = 1
close(1) = 0
close(2) = 0
exit_group(2) = ?
+++ exited with 2 +++
果然是端口真的被占用了
解决方案
杀掉占用端口的进程,ping正常了
参考
https://access.redhat.com/solutions/2039103