All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: bind 9 and iptables
@ 2004-08-27 20:16 Jason Opperisano
  2004-08-27 21:10 ` it clown
  0 siblings, 1 reply; 19+ messages in thread
From: Jason Opperisano @ 2004-08-27 20:16 UTC (permalink / raw)
  To: netfilter

> Hi All
>
> I have a dns with a forwarder to my isp on the iptables
> box. I am having trouble on getting dns to work properly.
>
> When i comment:
>
> iptables -P INPUT DROP
> iptables -p OUTPUT DROP
>
> DNS will work fine and all the pc's can browse the net.
>
> I have tried the following with out any luck:
>
> iptables -A OUTPUT -p tcp --dport 53 -j ACCEPT
> iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
> iptables -A INPUT -m state --state ESTABLISHED,RELATED -j
> ACCEPT
>
> what rule do i need to add to make things more secure to
> get my dns working properly, thanks?

# allow internal machines to contact the DNS server
iptables -A INPUT -p udp -i $INSIDE_IF -s $INSIDE_NET -d $INSIDE_IP --dport 53 -j ACCEPT

# allow established an related packets out
iptables -I OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

normally the "established" rule appears first in your chains, if you are using connection tracking.

-j


^ permalink raw reply	[flat|nested] 19+ messages in thread
* RE: bind 9 and iptables
@ 2004-08-30 19:08 Jason Opperisano
  0 siblings, 0 replies; 19+ messages in thread
From: Jason Opperisano @ 2004-08-30 19:08 UTC (permalink / raw)
  To: netfilter

> El sáb, 28 de 08 de 2004 a las 02:47, Nick Drage escribió:
> > On Fri, Aug 27, 2004 at 05:19:07PM -0400, Jason Opperisano wrote:
> >
> > > long answer:  it has been discussed on this list previously that
> > > connection tracking DNS queries/responses on or for a busy DNS server
> > > (i think the number was ~ 200 queries/second) will slow the name
> > > resolution process down.  the reason being that the state creation
> > > adds noticeable, unnecessary latency, as most (all?) queries are one
> > > packet request--one packet response.
> >
> > I've a vague recollection of being able to specify that a rule won't
> > create an entry in the state table, so for situations like this
> > netfilter can act faster, as long as you specify the correct rules for
> > connections both ways.  However I can't find anything in the
> > documentation about this... after a cursory look... can anyone refresh
> > my memory?
>
> I think that even if you don't use the conntrack feature for the DNS
> port you will have state table entries anyway, because the state
> machine will check every connection you made. The only solution would
> be to unload the conntrack module and not using conntrack at all, but
> that it's probably a mess, because you would have to change all the
> rules to specify both directions of traffic, like in the old ipchains
> days.

or use the raw table NOTRACK patch like someone else suggested (and i should have included in my initial rambling).

-j

^ permalink raw reply	[flat|nested] 19+ messages in thread
* RE: bind 9 and iptables
@ 2004-08-27 23:40 Daniel Chemko
  0 siblings, 0 replies; 19+ messages in thread
From: Daniel Chemko @ 2004-08-27 23:40 UTC (permalink / raw)
  To: Jason Opperisano, netfilter

> somewhere along the line, you lost:
> 
>   iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

And if that doesn't work, add the following to the end of your rules:

iptables -A INPUT -j LOG
iptables -A OUTPUT -j LOG


^ permalink raw reply	[flat|nested] 19+ messages in thread
* RE: bind 9 and iptables
@ 2004-08-27 23:34 Jason Opperisano
  2004-08-28  0:00 ` it clown
  0 siblings, 1 reply; 19+ messages in thread
From: Jason Opperisano @ 2004-08-27 23:34 UTC (permalink / raw)
  To: netfilter

> Hi Again,
>
> Damn it still not working why i said it was working was was
> because of cached ip's as soon as i tried to access a site
> that hasn't been cached it would give me a unknown host
> error.
>
> iptables -P INPUT DROP
> iptables -P OUTPUT DROP
> iptables -P FORWARD DROP
>
> iptables -A INPUT -p udp -i eth0 -s 192.168.0/24 -d
> 192.168.0.1 --dport 53 -j ACCEPT
> iptables -A INPUT -p tcp -i eth0 -s 192.168.0/24 -d
> 192.168.0.1 --dport 53 -j ACCEPT
> iptables -I OUTPUT -m state --state ESTABLISHED,RELATED -j
> ACCEPT
>
> iptables -I INPUT -i lo -j ACCEPT
> iptables -I OUTPUT -o lo -j ACCEPT
>
> iptables -A FORWARD -i eth0 -o ppp0 -p tcp -j ACCEPT
> iptables -A FORWARD -i eth0 -o ppp0 -p udp -j ACCEPT
> iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j
> ACCEPT
>
> iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
>
> Thats my rules im trying to get dns to work atm.
>
> When i comment these out everything works fine:
>
> #iptables -P INPUT DROP
> #iptables -P OUTPUT DROP

somewhere along the line, you lost:

  iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

-j

ps - in the future, it's easier to help if you provide the output of:
     iptables -vnL && iptables -t nat -vnL && iptables -t mangle -vnL

^ permalink raw reply	[flat|nested] 19+ messages in thread
[parent not found: <D5C9032B2B09C64EA2409D6214E91AC90512F9@asimail2.alphanumeric.co m>]
* RE: bind 9 and iptables
@ 2004-08-27 21:19 Jason Opperisano
  0 siblings, 0 replies; 19+ messages in thread
From: Jason Opperisano @ 2004-08-27 21:19 UTC (permalink / raw)
  To: netfilter

> Hi
>
> Thanks this seemed to have done the trick.I had to add
> another rule for tcp aswell. Is it possible for these rules
> to slow my browsing abit? Because it seems asif my browsing
> is abit slower now since i used the rules?

quick answer:  no.

long answer:  it has been discussed on this list previously that connection tracking DNS queries/responses on or for a busy DNS server (i think the number was ~ 200 queries/second) will slow the name resolution process down.  the reason being that the state creation adds noticeable, unnecessary latency, as most (all?) queries are one packet request--one packet response.

somehow i don't think this applies here.

oh--and i'll chime in with the obligatory:  don't run a DNS (or any other) server on your firewall.

-j


^ permalink raw reply	[flat|nested] 19+ messages in thread
* RE: bind 9 and iptables
@ 2004-08-27 21:00 Jason Opperisano
  0 siblings, 0 replies; 19+ messages in thread
From: Jason Opperisano @ 2004-08-27 21:00 UTC (permalink / raw)
  To: netfilter

> OK i will try again.
>
> I have a internal dns server with a forwarder to my isp.The
> internal dns server is on the iptables box.The clients use
> the internal dns server to resolve names on the local
> network.When the internal dns cannot resolve a name it
> forwards to my isp's dns.
>
> So my problem is with the forwarding.To get that to work i
> have to uncomment:

from an iptables persepctive--you're problem is with the INPUT, not the FORWARD-ing

> iptables -P INPUT DROP and iptables -P OUTPUT DROP.
>
> When i uncomment those two rules the clients can browse the
> internet.
>
> what rules can i use instead of uncommenting those two
> rules because thats not secure?

you need to allow your internal hosts to contact the dns server/firewall on UDP port 53.

see previous post by me, and a much more thorough one by Aleksandar Milivojevic.

-j


^ permalink raw reply	[flat|nested] 19+ messages in thread
* bind 9 and iptables
@ 2004-08-27 20:06 it clown
  2004-08-27 20:19 ` Nick Taylor
  2004-08-27 20:37 ` Aleksandar Milivojevic
  0 siblings, 2 replies; 19+ messages in thread
From: it clown @ 2004-08-27 20:06 UTC (permalink / raw)
  To: netfilter

Hi All

I have a dns with a forwarder to my isp on the iptables
box. I am having trouble on getting dns to work properly.

When i comment:

iptables -P INPUT DROP
iptables -p OUTPUT DROP

DNS will work fine and all the pc's can browse the net.

I have tried the following with out any luck:

iptables -A OUTPUT -p tcp --dport 53 -j ACCEPT
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j
ACCEPT

what rule do i need to add to make things more secure to
get my dns working properly, thanks?

Regards


_____________________________________________________________________
For super low premiums ,click here http://www.dialdirect.co.za/quote


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

end of thread, other threads:[~2004-08-30 19:08 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-27 20:16 bind 9 and iptables Jason Opperisano
2004-08-27 21:10 ` it clown
  -- strict thread matches above, loose matches on Subject: below --
2004-08-30 19:08 Jason Opperisano
2004-08-27 23:40 Daniel Chemko
2004-08-27 23:34 Jason Opperisano
2004-08-28  0:00 ` it clown
     [not found] <D5C9032B2B09C64EA2409D6214E91AC90512F9@asimail2.alphanumeric.co m>
2004-08-27 23:32 ` it clown
     [not found] ` <D5C9032B2B09C64EA2409D6214E91AC90512F9@asimail2.alphanumeric.com>
2004-08-28  0:47   ` Nick Drage
2004-08-28  1:58     ` Jose Maria Lopez
2004-08-28  4:40     ` dchemko
2004-08-27 21:19 Jason Opperisano
2004-08-27 21:00 Jason Opperisano
2004-08-27 20:06 it clown
2004-08-27 20:19 ` Nick Taylor
2004-08-27 20:53   ` it clown
2004-08-27 21:02     ` Nick Taylor
2004-08-27 20:37 ` Aleksandar Milivojevic
2004-08-28  0:44   ` Nick Drage
2004-08-28  5:02     ` Aleksandar Milivojevic

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.