0

I am trying to use iptables to reject packets as well as reset the TCP connection. My rule is:

iptables -I FORWARD -p tcp -s 10.0.0.10 -j REJECT --reject-with tcp-reset

If 10.0.0.10 is SSH'ing into 172.16.50.1 and we run the above rule then the session will drop. However, if say we do the above rule and then for whatever reason we delete it then the SSH session will keep working.

How do I tell iptables to kill the current session?

I tried using: http://www.digitage.co.uk/cutter but for some reason it keeps thinking the sessions I am trying to kill are local connections.

2

You likely have a rule to accept ESTABLISHED connections. To reset active connections, temporarily place a reject rule for SSH above that in the chain. Remove it once the connections have dropped.

If you are accessing the server remotely, open an alternate SSH port to connect while you are doing this. Otherwise you may kill your connection.

0

Install the conntrack tools then use the conntrack command with the -G and -D options to respectively search and drop an entry from the conntrack table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.