hping send SYN: how not to send RST after receiving SYN/ACK?

我的未来我决定 提交于 2020-01-01 03:46:07

问题


using hping, I send SYN packet, second peer is listening and replies with SYN/ACK, but hping (or linux kernel does it I guess) sends RST after receiving SYN/ACK.

Is there anyway I can stop my machine sending RST after receiving SYN/ACK?

thanks.


回答1:


This command should drop any TCP packet with the RST flag set your machine would send to the specific destination:

iptables -I OUTPUT 1 -d <destination> -p tcp --tcp-flags RST RST -j DROP

to revert it, use:

iptables -D OUTPUT -d <destination> -p tcp --tcp-flags RST RST -j DROP

An alternative is to block all incoming TCP packets with SYN+ACK flags set from the specific source (i.e. the packets that cause the RST):

iptables -I INPUT 1 -s <source> -p tcp --tcp-flags SYN,ACK SYN,ACK -j DROP

to revert it, use:

iptables -D INPUT -s <source> -p tcp --tcp-flags SYN,ACK SYN,ACK -j DROP

Works for me with hping3 -S -p 22 <destination>



来源:https://stackoverflow.com/questions/33741002/hping-send-syn-how-not-to-send-rst-after-receiving-syn-ack

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!