当我们需要在不重启服务的情况下断开某一个TCP长连接时,tcpkill工具就非常有用。比如我们要测试某个长连接断开后程序自动重连的情况。
这个连接的作者改了一下tcpkill,使得更好用。
https://yq.aliyun.com/articles/59308
[email protected] ~/下载/tcpkill_v2 $ sudo ./tcpkill -s 192.168.36.83:46880 -d 121.14.103.153:19999
46880
19999
src port 46880 and dst port 19999 and src host 192.168.36.83 and dst host 121.14.103.153
tcpkill: listening on enp0s25 [src port 46880 and dst port 19999 and src host 192.168.36.83 and dst host 121.14.103.153]
46880 19999 192.168.36.83 121.14.103.153
send succ
8014 8375
192.168.36.83:46880 > 121.14.103.153:19999: R 2452388356:2452388356(0) win 0
8014 8375
192.168.36.83:46880 > 121.14.103.153:19999: R 2452388784:2452388784(0) win 0
8014 8375
192.168.36.83:46880 > 121.14.103.153:19999: R 2452389640:2452389640(0) win 0
46880 19999 192.168.36.83 121.14.103.153
send succ
46880 19999 192.168.36.83 121.14.103.153
send succ
46880 19999 192.168.36.83 121.14.103.153
send succ
就这样就断开了