* IP Tables and DNS
@ 2008-09-11 18:09 David Doster
2008-09-11 18:53 ` Andrew Schulman
0 siblings, 1 reply; 5+ messages in thread
From: David Doster @ 2008-09-11 18:09 UTC (permalink / raw)
To: netfilter
Hi folks,
I'm putting together a recursive DNS resolver for my internal clients. The resolver has both an internal and an external interface, so it doesn't have to send the outgoing DNS queries through the firewall. I'm working on the IPTables rules for the external interface, and had a question come up that I wasn't sure about.
Does netfilter/iptables keep up with "connections" in UDP, even though UDP is connectionless? ie - How does it assure that it only accepts responses from the IP that it sent the query to? I saw a posting from Jan back about 3 years ago that said that as long as the response came back within ~30 seconds then netfilter would allow the response in. Is that still the case? If so, do I need any rules on the external interface other than the rules to allow the outgoing query (tcp and udp) and an "established,related" rule?
Thanks for any help,
Dave Doster
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: IP Tables and DNS
2008-09-11 18:09 IP Tables and DNS David Doster
@ 2008-09-11 18:53 ` Andrew Schulman
2008-09-12 7:42 ` Vladislav Kurz
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Schulman @ 2008-09-11 18:53 UTC (permalink / raw)
To: netfilter-u79uwXL29TY76Z2rM5mHXA
> Does netfilter/iptables keep up with "connections" in UDP, even though UDP is connectionless?
Yes. ICMP, too.
> ie - How does it assure that it only accepts responses from the IP that it sent the query to? I saw a posting from Jan back about 3 years ago that said that as long as the response came back within ~30 seconds then netfilter would allow the response in. Is that still the case?
Can't remember now exactly how this works... but it's something like that.
> If so, do I need any rules on the external interface other than the rules to allow the outgoing query (tcp and udp) and an "established,related" rule?
Nope. "Established" covers direct replies to UDP packets (i.e. DNS requests)
that you've already sent out, so that's probably all you need in this case.
"Related" covers new connections related to the first one, such as FTP data
connections triggered by FTP control traffic. I don't think there are any
"related" criteria that apply to DNS.
A.
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: IP Tables and DNS
@ 2008-09-11 22:02 David Doster
0 siblings, 0 replies; 5+ messages in thread
From: David Doster @ 2008-09-11 22:02 UTC (permalink / raw)
To: netfilter
Cool. Thanks for the info, Andrew.
Dave
>>> Andrew Schulman <andrex@alumni.utexas.net> 9/11/2008 02:53 PM >>>
> Does netfilter/iptables keep up with "connections" in UDP, even though UDP is connectionless?
Yes. ICMP, too.
> ie - How does it assure that it only accepts responses from the IP that it sent the query to? I saw a posting from Jan back about 3 years ago that said that as long as the response came back within ~30 seconds then netfilter would allow the response in. Is that still the case?
Can't remember now exactly how this works... but it's something like that.
> If so, do I need any rules on the external interface other than the rules to allow the outgoing query (tcp and udp) and an "established,related" rule?
Nope. "Established" covers direct replies to UDP packets (i.e. DNS requests)
that you've already sent out, so that's probably all you need in this case.
"Related" covers new connections related to the first one, such as FTP data
connections triggered by FTP control traffic. I don't think there are any
"related" criteria that apply to DNS.
A.
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
--- Scanned by M+ Guardian Messaging Firewall ---
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: IP Tables and DNS
2008-09-11 18:53 ` Andrew Schulman
@ 2008-09-12 7:42 ` Vladislav Kurz
2008-09-12 14:13 ` Andrew Schulman
0 siblings, 1 reply; 5+ messages in thread
From: Vladislav Kurz @ 2008-09-12 7:42 UTC (permalink / raw)
To: netfilter
On Thursday 11 of September 2008, Andrew Schulman wrote:
> > If so, do I need any rules on the external interface other than the
> > rules to allow the outgoing query (tcp and udp) and an
> > "established,related" rule?
>
> Nope. "Established" covers direct replies to UDP packets (i.e. DNS
> requests) that you've already sent out, so that's probably all you need in
> this case. "Related" covers new connections related to the first one, such
> as FTP data connections triggered by FTP control traffic. I don't think
> there are any "related" criteria that apply to DNS.
What about some ICMP (port|host) unreachable packet when you try to query a
broken DNS server? Isn't that a RELATED packet?
--
Regards
Vladislav Kurz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: IP Tables and DNS
2008-09-12 7:42 ` Vladislav Kurz
@ 2008-09-12 14:13 ` Andrew Schulman
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Schulman @ 2008-09-12 14:13 UTC (permalink / raw)
To: netfilter-u79uwXL29TY76Z2rM5mHXA
> > Nope. "Established" covers direct replies to UDP packets (i.e. DNS
> > requests) that you've already sent out, so that's probably all you need in
> > this case. "Related" covers new connections related to the first one, such
> > as FTP data connections triggered by FTP control traffic. I don't think
> > there are any "related" criteria that apply to DNS.
>
> What about some ICMP (port|host) unreachable packet when you try to query a
> broken DNS server? Isn't that a RELATED packet?
Good point, and that could apply for any type of connection. I'm not sure if
those are matched by ESTABLISHED or RELATED. I guess there's no harm in
matching against both.
I just looked at my firewall. The incoming DNS rule matches only ESTABLISHED,
not RELATED. It's matched 12,000 times since boot. Later on there is a generic
RELATED match, but it's only matched 19 times. So FWIW, it seems to me that
ESTABLISHED covers essentially all you need for DNS replies.
Andrew.
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-09-12 14:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-11 18:09 IP Tables and DNS David Doster
2008-09-11 18:53 ` Andrew Schulman
2008-09-12 7:42 ` Vladislav Kurz
2008-09-12 14:13 ` Andrew Schulman
-- strict thread matches above, loose matches on Subject: below --
2008-09-11 22:02 David Doster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox