Skip to contentSkip to conversation

How to drop existing connections

DISCUSSION Vitaly 4 participants 7 messages Apr 7, 2008 1 message not in the archive

lore
Share & tools
lore

Vitaly

author
#0 lore raw

I'd like to kill all existing connections to the
specific IP/port. What is the simpliest way to do
this?

Thanks,
Vitaly

      ____________________________________________________________________________________

You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

#1 lore raw

Using iptables?
just add a drop rule having src/dest ip addressess and ports and protocol on top of other rules.

----- Original Message ----- From: "Vitaly" <[email protected]>
To: <[email protected]>
Sent: Monday, April 07, 2008 11:30 AM
Subject: How to drop existing connections

Quoted 16 lines

I'd like to kill all existing connections to the
specific IP/port. What is the simpliest way to do
this?

Thanks,
Vitaly

____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#2 lore raw
Quoted 4 lines · --- Karim Asif

Using iptables?
just add a drop rule having src/dest ip addressess and ports and protocol on
top of other rules.

Probably I wasn't clear - I want to kill existing, already opened connection.
Now, after reading some articles/threads, it seems that only utils like tcpkill, cutter can do this...

Quoted 19 lines

----- Original Message -----
From: "Vitaly" <[email protected]>
To: <[email protected]>
Sent: Monday, April 07, 2008 11:30 AM
Subject: How to drop existing connections

Quoted 10 lines

I'd like to kill all existing connections to the
specific IP/port. What is the simpliest way to do
this?

Thanks,
Vitaly

____________________________________________________________________________________

Quoted 12 lines
Quoted 1 line

You rock. That's why Blockbuster's offering you

one month of Blockbuster

Quoted 4 lines

Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
--
To unsubscribe from this list: send the line

"unsubscribe netfilter" in

Quoted 2 lines

the body of a message to [email protected] More majordomo info at

http://vger.kernel.org/majordomo-info.html

      ____________________________________________________________________________________

You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

#3 lore raw

В Пнд, 07/04/2008 в 02:05 -0700, Vitaly пишет:

Quoted 11 lines
Quoted 4 lines · --- Karim Asif

Using iptables?
just add a drop rule having src/dest ip addressess and ports and protocol on
top of other rules.

Probably I wasn't clear - I want to kill existing, already opened connection.
Now, after reading some articles/threads, it seems that only utils like tcpkill, cutter can do this...

You can use conntrack utility to remove conntrack entry, if you also drop INVALID packets with iptables this will let you kill connection.

Quoted 42 lines
Quoted 19 lines

----- Original Message -----
From: "Vitaly" <[email protected]>
To: <[email protected]>
Sent: Monday, April 07, 2008 11:30 AM
Subject: How to drop existing connections

Quoted 10 lines

I'd like to kill all existing connections to the
specific IP/port. What is the simpliest way to do
this?

Thanks,
Vitaly

____________________________________________________________________________________

Quoted 12 lines
Quoted 1 line

You rock. That's why Blockbuster's offering you

one month of Blockbuster

Quoted 4 lines

Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
--
To unsubscribe from this list: send the line

"unsubscribe netfilter" in

Quoted 2 lines

the body of a message to [email protected] More majordomo info at

http://vger.kernel.org/majordomo-info.html

      ____________________________________________________________________________________

You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Покотиленко Костик <[email protected]>
#4 lore raw
Quoted 11 lines · Покотиленко Костик
Quoted 9 lines
Quoted 4 lines

Using iptables?
just add a drop rule having src/dest ip addressess and ports and protocol on
top of other rules.

Probably I wasn't clear - I want to kill existing, already opened connection.
Now, after reading some articles/threads, it seems that only utils like tcpkill, cutter can do this...

You can use conntrack utility to remove conntrack entry,

This only removes the conntrack entry of course, and does not induce a TCP reset.

Quoted 2 lines

if you also
drop INVALID packets with iptables this will let you kill connection.

When more packets come in, the 'connection' will go NEW, not INVALID.

#6 lore raw
In reply to a message not in the archive
Quoted 7 lines · Покотиленко Костик

В Пнд, 07/04/2008 в 11:39 +0200, Jan Engelhardt пишет:

Quoted 6 lines
Quoted 2 lines

You can use conntrack utility to remove conntrack entry,

This only removes the conntrack entry of course, and does not induce a TCP reset.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

if you also
drop INVALID packets with iptables this will let you kill connection.

When more packets come in, the 'connection' will go NEW, not INVALID.

Maybe, I remember reading this solution somewhere.

This solution requires that you only accept NEW connections that have SYN set. Something like

  -m conntrack --ctstate ESTABLISHED -j ACCEPT
  -p tcp --syn -m conntrack --ctstatus NEW -j ACCEPT
  -p udp -m conntrack --ctstatus NEW -j ACCEPT
  -p tcp -j REJECT --reject-with tcp-reset
  -j REJECT

yes, that is indeed a good idea to do a tcpkill on connections using conntrack :-)

#7 lore raw

В Пнд, 07/04/2008 в 13:11 +0200, Jan Engelhardt пишет:

Quoted 19 lines · Покотиленко Костик
Quoted 8 lines

В Пнд, 07/04/2008 в 11:39 +0200, Jan Engelhardt пишет:

Quoted 6 lines
Quoted 2 lines

You can use conntrack utility to remove conntrack entry,

This only removes the conntrack entry of course, and does not induce a TCP reset.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

if you also
drop INVALID packets with iptables this will let you kill connection.

When more packets come in, the 'connection' will go NEW, not INVALID.

Maybe, I remember reading this solution somewhere.

This solution requires that you only accept NEW connections that have SYN set. Something like

Quoted 8 lines
  -m conntrack --ctstate ESTABLISHED -j ACCEPT
  -p tcp --syn -m conntrack --ctstatus NEW -j ACCEPT
  -p udp -m conntrack --ctstatus NEW -j ACCEPT
  -p tcp -j REJECT --reject-with tcp-reset
  -j REJECT

yes, that is indeed a good idea to do a tcpkill on connections using conntrack :-)

That is it.

Signature · 1 line
Покотиленко Костик <[email protected]>