Tcpkill 强制杀死 ESTABLISHED 连接

tcpkill   ESTABLISHED  

安装

  • Centos Yum Install
yum -y install dsniff --enablerepo=epel  

* 查找连接对应被动端口号

netstat -an|grep 3600  
tcp        0      0 0.0.0.0:3600                0.0.0.0:*                   LISTEN  
tcp        0    378 22.61.189.76:3600          13.66.110.215:59986        ESTABLISHED  
  • 踢掉59986连接
tcpkill -i eth0 -9 port 50185  
tcpkill: listening on em1 [port 59986]  
22.61.189.76:59986 > 13.66.110.215:3600: R 2505431948:2505431948(0) win 0  
22.61.189.76:59986 > 13.66.110.215:3600: R 2505448364:2505448364(0) win 0  
22.61.189.76:59986 > 13.66.110.215:3600: R 2505481196:2505481196(0) win 0  
22.61.189.76:59986 > 13.66.110.215:3600: R 2505530444:2505530444(0) win 0  
22.61.189.76:59986 > 13.66.110.215:3600: R 2505596108:2505596108(0) win 0  
22.61.189.76:59986 > 13.66.110.215:3600: R 2505678188:2505678188(0) win 0  
22.61.189.76:59986 > 13.66.110.215:3600: R 2505776684:2505776684(0) win 0  
22.61.189.76:59986 > 13.66.110.215:3600: R 2505891596:2505891596(0) win 0  
22.61.189.76:59986 > 13.66.110.215:3600: R 2506022924:2506022924(0) win 0  
13.66.110.215:3600 > 22.61.189.76:59986: R 4114443072:4114443072(0) win 0  
13.66.110.215:3600 > 22.61.189.76:59986: R 4114443247:4114443247(0) win 0  
13.66.110.215:3600 > 22.61.189.76:59986: R 4114443597:4114443597(0) win 0  
13.66.110.215:3600 > 22.61.189.76:59986: R 4114444122:4114444122(0) win 0  
13.66.110.215:3600 > 22.61.189.76:59986: R 4114444822:4114444822(0) win 0  
13.66.110.215:3600 > 22.61.189.76:59986: R 4114445697:4114445697(0) win 0  
13.66.110.215:3600 > 22.61.189.76:59986: R 4114446747:4114446747(0) win 0  
13.66.110.215:3600 > 22.61.189.76:59986: R 4114447972:4114447972(0) win 0  
13.66.110.215:3600 > 22.61.189.76:59986: R 4114449372:4114449372(0) win 0  
  • ctrl +c 结束,后再次查看连接,发现连接已经被断开了
netstat -an|grep 3600  
tcp        0      0 0.0.0.0:3600                0.0.0.0:*                   LISTEN