Linux Netfilter discussions
 help / color / mirror / Atom feed
* clear the ip_conntrack entry
@ 2003-06-25  2:46 杨华
  0 siblings, 0 replies; 4+ messages in thread
From: 杨华 @ 2003-06-25  2:46 UTC (permalink / raw)
  To: netfilter

Hi everyone :
	I have notice that many request about how to clear the
/proc/net/ip_conntrack entry , and someone suggest that it have no
resolution except restart the interface .
	I think the answer : send a fake ip packet (with RST set) to
firewall , to let it think the connection terminate .
	By this methode , I have the following script written , it work
well for me.
	To use this script , you must have hping2 installed , it can be
download from http://www.hping.org 
--------- clr_conns start  ------------------
echo
echo "############################"
echo "# Edit by Youngh 2003.06.24 v1.1 "
echo "# Usage : clr_conns IpAddress"
echo "#    	This will clear all connections from this IP_Address"
echo "# Example:/root/clr_conns  10.0.3.3 "
echo "############################"
echo



if [ -z $1 ] ; then 
	exit
fi


grep -E "^tcp .{10,25}ESTABLISHED src=$1 " /proc/net/ip_conntrack | while read line ; do 
	S_IP=`echo $line | awk '{print substr($5,5)}'`
	S_SOCK=`echo $line | awk '{print substr($7,7)}'`
	D_IP=`echo $line | awk '{print substr($6,5)}'`
	D_SOCK=`echo $line | awk '{print substr($8,7)}'`	
	echo "$S_IP:$S_SOCK $D_IP:$D_SOCK"

	hping2 $D_IP -R -s $S_SOCK -p $D_SOCK -a $S_IP -k -c 1 >/dev/null 2>/dev/null &

done	

----------------clr_conns end --------------------------------


^ permalink raw reply	[flat|nested] 4+ messages in thread

* clear the ip_conntrack entry
@ 2003-06-25  3:06 杨华
  2003-06-25  7:22 ` Jozsef Kadlecsik
  2003-06-26 18:21 ` Rocco Stanzione
  0 siblings, 2 replies; 4+ messages in thread
From: 杨华 @ 2003-06-25  3:06 UTC (permalink / raw)
  To: netfilter

Hi everyone :
	I have notice that many request about how to clear the
/proc/net/ip_conntrack entry , and someone suggest that it have no
resolution except restart the interface .
	I think the answer : send a fake ip packet (with RST set) to
firewall , to let it think the connection terminate .
	By this methode , I have the following script written , it work
well for me.
	To use this script , you must have hping2 installed , it can be
download from http://www.hping.org 
--------- clr_conns start  ------------------
echo
echo "############################"
echo "# Edit by Youngh 2003.06.24 v1.1 "
echo "# Usage : clr_conns IpAddress"
echo "#    	This will clear all connections from this IP_Address"
echo "# Example:/root/clr_conns  10.0.3.3 "
echo "############################"
echo



if [ -z $1 ] ; then 
	exit
fi


grep -E "^tcp .{10,25}ESTABLISHED src=$1 " /proc/net/ip_conntrack | while read line ; do 
	S_IP=`echo $line | awk '{print substr($5,5)}'`
	S_SOCK=`echo $line | awk '{print substr($7,7)}'`
	D_IP=`echo $line | awk '{print substr($6,5)}'`
	D_SOCK=`echo $line | awk '{print substr($8,7)}'`	
	echo "$S_IP:$S_SOCK $D_IP:$D_SOCK"

	hping2 $D_IP -R -s $S_SOCK -p $D_SOCK -a $S_IP -k -c 1 >/dev/null 2>/dev/null &

done	

----------------clr_conns end --------------------------------


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: clear the ip_conntrack entry
  2003-06-25  3:06 clear the ip_conntrack entry 杨华
@ 2003-06-25  7:22 ` Jozsef Kadlecsik
  2003-06-26 18:21 ` Rocco Stanzione
  1 sibling, 0 replies; 4+ messages in thread
From: Jozsef Kadlecsik @ 2003-06-25  7:22 UTC (permalink / raw)
  To: 杨华; +Cc: netfilter

On Wed, 25 Jun 2003, [GB2312] Ñ wrote:

> 	I have notice that many request about how to clear the
> /proc/net/ip_conntrack entry , and someone suggest that it have no
> resolution except restart the interface .
> 	I think the answer : send a fake ip packet (with RST set) to
> firewall , to let it think the connection terminate .
> 	By this methode , I have the following script written , it work
> well for me.

Nice solution and script!

But please note, it won't work with TCP window tracking patch applied.

Best regards,
Jozsef
-
E-mail  : kadlec@blackhole.kfki.hu, kadlec@sunserv.kfki.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
          H-1525 Budapest 114, POB. 49, Hungary




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: clear the ip_conntrack entry
  2003-06-25  3:06 clear the ip_conntrack entry 杨华
  2003-06-25  7:22 ` Jozsef Kadlecsik
@ 2003-06-26 18:21 ` Rocco Stanzione
  1 sibling, 0 replies; 4+ messages in thread
From: Rocco Stanzione @ 2003-06-26 18:21 UTC (permalink / raw)
  To: netfilter

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I recently reached the same conclusion when unsuccessfully testing cutter.  It 
didn't kill the connection but it did remove the conntrack entry, so I 
figured the RST packets might be doing the trick.

On Tuesday 24 June 2003 10:06 pm, Ñ spake thusly:
> Hi everyone :
> 	I have notice that many request about how to clear the
> /proc/net/ip_conntrack entry , and someone suggest that it have no
> resolution except restart the interface .
> 	I think the answer : send a fake ip packet (with RST set) to
> firewall , to let it think the connection terminate .
> 	By this methode , I have the following script written , it work
> well for me.
> 	To use this script , you must have hping2 installed , it can be
> download from http://www.hping.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE++znDSCmJfrlriowRAuc7AKDo0NRLi4sqXACU66x8l+T9cQeJjACfYk8F
ta8F/i4Ke4B3rYRNuiqc3gM=
=7GIt
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-06-26 18:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-25  3:06 clear the ip_conntrack entry 杨华
2003-06-25  7:22 ` Jozsef Kadlecsik
2003-06-26 18:21 ` Rocco Stanzione
  -- strict thread matches above, loose matches on Subject: below --
2003-06-25  2:46 杨华

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox