All of lore.kernel.org
 help / color / mirror / Atom feed
* delete NAT conntrack entry.
@ 2007-05-10  7:10 ???
  2007-05-10  9:52 ` Jan Engelhardt
  0 siblings, 1 reply; 5+ messages in thread
From: ??? @ 2007-05-10  7:10 UTC (permalink / raw)
  To: netfilter


Hello

We have some problems with nat.
We want to relay "udp packet" from a host to other host using SNAT, DNAT.

iptables -t nat -A PREROUTING -p udp -d PACKET.RELAY.HOST.IP --dport 10000
-j DNAT --to-destination TO.OTHER.HOST.IP:10000 
iptables -t nat -A POSTROUTING -p udp -d TO.OTHER.HOST.IP --dport 10000 -j
SNAT --to-source PACKET.RELAY.HOST.IP:10000

It works well. But after removing the rules, packet still transferred. I can
find the conntrack entry in /proc/net/stat/ip_conntrack.
We know libnfnetlink & libnetfilter_conntrack with kernel 2.6 can delete
conntrack entries from userspace. But we use Redhat linux 2.4.21-32.EL.
How can I delete specified conntrack entry in kernel 2.4 without kernel code
??

Cheers,
Seongwoo Park







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

* Re: delete NAT conntrack entry.
  2007-05-10  7:10 delete NAT conntrack entry ???
@ 2007-05-10  9:52 ` Jan Engelhardt
  2007-05-10 11:14   ` Wakko Warner
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2007-05-10  9:52 UTC (permalink / raw)
  To: ???; +Cc: netfilter


On May 10 2007 16:10, ??? wrote:
>We have some problems with nat.
>We want to relay "udp packet" from a host to other host using SNAT, DNAT.
>
>iptables -t nat -A PREROUTING -p udp -d PACKET.RELAY.HOST.IP --dport 10000
>-j DNAT --to-destination TO.OTHER.HOST.IP:10000 
>iptables -t nat -A POSTROUTING -p udp -d TO.OTHER.HOST.IP --dport 10000 -j
>SNAT --to-source PACKET.RELAY.HOST.IP:10000
>
>It works well. But after removing the rules, packet still transferred. I can
>find the conntrack entry in /proc/net/stat/ip_conntrack.
>We know libnfnetlink & libnetfilter_conntrack with kernel 2.6 can delete
>conntrack entries from userspace. But we use Redhat linux 2.4.21-32.EL.
>How can I delete specified conntrack entry in kernel 2.4 without kernel code
>??

I suppose that the reason that "conntrack" (the userspace tool to
monitor/delete conntrack entries) was written is because there was no
prior way to do it from userland. (In short: you are toast with 2.4)

Or wait for the UDP connection tracking timeout to happen.



	Jan
-- 


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

* Re: delete NAT conntrack entry.
  2007-05-10  9:52 ` Jan Engelhardt
@ 2007-05-10 11:14   ` Wakko Warner
  2007-05-10 12:48     ` Jan Engelhardt
  0 siblings, 1 reply; 5+ messages in thread
From: Wakko Warner @ 2007-05-10 11:14 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: netfilter

Jan Engelhardt wrote:
> 
> On May 10 2007 16:10, ??? wrote:
> >We have some problems with nat.
> >We want to relay "udp packet" from a host to other host using SNAT, DNAT.
> >
> >iptables -t nat -A PREROUTING -p udp -d PACKET.RELAY.HOST.IP --dport 10000
> >-j DNAT --to-destination TO.OTHER.HOST.IP:10000 
> >iptables -t nat -A POSTROUTING -p udp -d TO.OTHER.HOST.IP --dport 10000 -j
> >SNAT --to-source PACKET.RELAY.HOST.IP:10000
> >
> >It works well. But after removing the rules, packet still transferred. I can
> >find the conntrack entry in /proc/net/stat/ip_conntrack.
> >We know libnfnetlink & libnetfilter_conntrack with kernel 2.6 can delete
> >conntrack entries from userspace. But we use Redhat linux 2.4.21-32.EL.
> >How can I delete specified conntrack entry in kernel 2.4 without kernel code
> >??
> 
> I suppose that the reason that "conntrack" (the userspace tool to
> monitor/delete conntrack entries) was written is because there was no
> prior way to do it from userland. (In short: you are toast with 2.4)
> 
> Or wait for the UDP connection tracking timeout to happen.

Sometimes this may not be possible if the traffic doesn't stop long enough
for it to time out.  I wish I had known about conntrack when I had this
problem occur.  I just set the UDP timeout to 1 second (fortunately, that
worked).

If it were possible that when a rule like that is deleted, all active
conntrack entries that this rule causes would be removed.

-- 
 Lab tests show that use of micro$oft causes cancer in lab animals
 Got Gas???


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

* Re: delete NAT conntrack entry.
  2007-05-10 11:14   ` Wakko Warner
@ 2007-05-10 12:48     ` Jan Engelhardt
  2007-05-10 16:16       ` Wakko Warner
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2007-05-10 12:48 UTC (permalink / raw)
  To: Wakko Warner; +Cc: netfilter


On May 10 2007 07:14, Wakko Warner wrote:
>
>If it were possible that when a rule like that is deleted, all
>active conntrack entries that this rule causes would be removed.

Problem 1: We would have to record in a ct entry what rule caused
the ct to come alive. What if we have an empty ruleset? Conntracking
still runs even when no iptables rules are in position.

Problem 2: If I wanted to move a rule inside a chain,
deleting/reinserting it would kill the ct entry and - given some
ruleset* (there are many more that would apply) - stops all
connections immediately.

  -P INPUT DROP
  -A INPUT -m conntrack --ctstate ESTABLISHED -j ACCEPT
  -A INPUT -m conntrack --ctstate NEW -p tcp --syn -j ACCEPT



	Jan
-- 


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

* Re: delete NAT conntrack entry.
  2007-05-10 12:48     ` Jan Engelhardt
@ 2007-05-10 16:16       ` Wakko Warner
  0 siblings, 0 replies; 5+ messages in thread
From: Wakko Warner @ 2007-05-10 16:16 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: netfilter

Jan Engelhardt wrote:
> 
> On May 10 2007 07:14, Wakko Warner wrote:
> >
> >If it were possible that when a rule like that is deleted, all
> >active conntrack entries that this rule causes would be removed.
> 
> Problem 1: We would have to record in a ct entry what rule caused
> the ct to come alive. What if we have an empty ruleset? Conntracking
> still runs even when no iptables rules are in position.

I figured something like that would be required.  I do realize that
conntrack tracks connections regardless of iptable rules.

> Problem 2: If I wanted to move a rule inside a chain,
> deleting/reinserting it would kill the ct entry and - given some
> ruleset* (there are many more that would apply) - stops all
> connections immediately.
> 
>   -P INPUT DROP
>   -A INPUT -m conntrack --ctstate ESTABLISHED -j ACCEPT
>   -A INPUT -m conntrack --ctstate NEW -p tcp --syn -j ACCEPT

I understood this before I wrote it.  How often does one move things around
in their firewall (after their experiemental stage)?

-- 
 Lab tests show that use of micro$oft causes cancer in lab animals
 Got Gas???


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

end of thread, other threads:[~2007-05-10 16:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-10  7:10 delete NAT conntrack entry ???
2007-05-10  9:52 ` Jan Engelhardt
2007-05-10 11:14   ` Wakko Warner
2007-05-10 12:48     ` Jan Engelhardt
2007-05-10 16:16       ` Wakko Warner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.