原 ping: connect: Resource temporarily unavailable
现象
1 2 3 4 5 6 7 8 9 10 11 12 13 | [root@sdw2 ~]# ping sdw1 ping: connect: Resource temporarily unavailable [root@sdw2 ~]# ping sdw1 ping: connect: Resource temporarily unavailable [root@sdw2 ~]# ping sdw1 ping: connect: Resource temporarily unavailable [root@sdw2 ~]# ping sdw1 ping: connect: Resource temporarily unavailable [root@sdw2 ~]# ping sdw1 PING sdw1 (192.17.13.53) 56(84) bytes of data. 64 bytes from sdw1 (192.17.13.53): icmp_seq=1 ttl=64 time=0.040 ms 64 bytes from sdw1 (192.17.13.53): icmp_seq=2 ttl=64 time=0.036 ms 64 bytes from sdw1 (192.17.13.53): icmp_seq=3 ttl=64 time=0.026 ms |
分析
strace下ping 从trace信息发现ping还要打开1025端口,看看是不是有程序把它占用了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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 +++ |
原因
1.网络连接队列的大小
2.系统级别的最大文件描述符数量
1 2 | echo 65530 > /proc/sys/net/core/somaxconn ulimit -n 102400 |