All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Taylor, Grant" <gtaylor@riverviewtech.net>
To: netfilter@lists.netfilter.org
Subject: Re: captive web system using DNAT and SNAT
Date: Wed, 11 May 2005 13:36:45 -0500	[thread overview]
Message-ID: <428250BD.3020304@riverviewtech.net> (raw)
In-Reply-To: <200505110139.50503.dcinege-mlists@psychosis.com>

> NOTE to Grant: The below might explain some of my issues
>   Re: Linux forwarding Win XP hosts VERY slowly
> Please comment on your thoughts...
> 
> Matt,
> 
> Take a look at: /proc/net/ip_conntrack
> 
> I'm dealing with a lot of weird issues with an appliance I've made that does 
> captive portaling and completely dynamic multiple gateway authorzation. 
> 
> I'm starting to think some of my issues, that I thought were locking, are now 
> actually connecting that are locked up.
> 
> Where I know this was a problem was in my captive portal redirecting. I have 2 
> dnsmasq's running. One on port 53 and one on 5353.  The 5353 one replies with 
> a dummy IP to DNS responses to allow the browser to attempt a connection...my 
> firewall rules then REDIRECT to the appliance, and ultimatly the login page.
> 
> The problem is once that 53->5353 redirection conneciton is established, it's 
> kept alive, even when a new rule is added that should exclude it. 
> 
> Example: 
> #Default rule
> iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 5353
> 
> #Host then logins in and authorizes. (Notice these are inserted before
> #the above.)
> iptables -t nat -I PREROUTING -d %(hostip)s -j ACCEPT
> iptables -t nat -I PREROUTING -s %(hostip)s -j ACCEPT
> 
> Should be ok, right? No. That host will continue to get REDIRECTed to port 
> 5353.
> 
> How I solved this was:
> echo 1 > /proc/sys/net/ipv4/netfilter/ip_conntrack_udp_timeout_stream
> 
> Which forces the connection to time out in a 1 second. 
> 
> I figured this would only be an issue with UDP connections like DNS. But after 
> reviewing  /proc/net/ip_conntrack 2 days ago when it seemed a host could no 
> longer connect to the appliance's web server, I'm thinking this might be a 
> similar issue of TCP connections going stale and no longer jibing with the 
> rule set. (This may be caused by or compounded by buggy Windows traffic.)
> 
> So if things seem to get 'out of sync' again, you might try lowering some of 
> the timeout values in /proc/sys/net/ipv4/netfilter/. I'm going to try this 
> myself and see if it helps.

Very interesting.  This makes me think that there is a kernel routing caching type issue.  I expect that if this is indeed the case there could (or should) easily be a way to flush said cache or adjust a garbage collection interval.  This might need to be (summarized and) cross posted to a kernel developers mailing list to get their thoughts on it.



Grant. . . .


  reply	other threads:[~2005-05-11 18:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-11  5:39 captive web system using DNAT and SNAT Dave Cinege
2005-05-11 18:36 ` Taylor, Grant [this message]
2005-05-11 18:49   ` Jason Opperisano
  -- strict thread matches above, loose matches on Subject: below --
2005-05-11 21:25 Dave Cinege
2005-05-05 20:11 Matt Zagrabelny
2005-05-06  2:27 ` Taylor, Grant
2005-05-06 13:21   ` Matt Zagrabelny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=428250BD.3020304@riverviewtech.net \
    --to=gtaylor@riverviewtech.net \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.