All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Brian Ugie" <bugie@pzs.com>
To: ramin@cannon.eng.us.uu.net
Cc: netfilter@lists.samba.org
Subject: Re: iptables and DNS
Date: Tue, 04 Jun 2002 10:41:58 -0700	[thread overview]
Message-ID: <scfc997d.097@pzsj-office.pzs.com> (raw)

Below  is the hosts portion of nsswitch.conf.  The actual hosts file is
below that. I have also included the simple config that I am using for
iptables. I have seen the -n option but it is not relevant for
appending, inserting or replacing. It only applies to listing (output)

--Brian

#hosts:     db files nisplus nis dns
hosts:      files dns

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               testbox localhost.localdomain localhost
10.1.1.13               ns2.pzs.com 

# Generated by iptables-save v1.2.3 on Tue Jun  4 10:33:01 2002
*filter
:INPUT DROP [14:722]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [129912:18396846]
-A INPUT -d 10.1.1.13 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -d 10.1.1.13 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -d 10.1.1.13 -p tcp -m tcp --dport 21 -j ACCEPT
-A INPUT -d 10.1.1.13 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -i lo -j ACCEPT
COMMIT
# Completed on Tue Jun  4 10:33:01 2002



>>> Ramin Alidousti <ramin@cannon.eng.us.uu.net> 06/04/02 10:28AM >>>
On Tue, Jun 04, 2002 at 09:51:31AM -0700, Brian Ugie wrote:

> Hi,
> 
>   I am hoping that someone can explain the role that DNS has in
> relation to iptables and if there is a way to stop iptables from
> resolving. 
> 
>   I have a network where a netscreen firewall sits in front or our
> servers. We map public IPs to the servers and do initial port
filtering
> from the netscreen. We also want to have each machine filter just in
> case the windows box gets compromised ;). It has seemed to me that
> iptables will not first use /etc/hosts to resolve but will go
straight
> to the DNS server. Is this a valid statement?

No. gethostbyaddr would go through the preference list in
nsswitch.conf.
This is part of a library and iptables uses it. #include <netdb.h>

> nsswitch.conf lists file
> first. Since DNS will resolve the server to a public address but it
is
> actually on a private address, iptables get confused and the net
result
> is long delays on ssh and ftp logins and server time outs on DNS
> queries. 

Do you have "hosts:  files dns" in your nsswitch.conf and have the
correct setup in /etc/hosts?

> 
>   To test my theory I set the DNS record to the private ip and that
> worked like a champ. I feel that I am left with only the option to
> create views in bind.
> 
>   Has anyone else out there seen this or know of a better solution? 

You can also provide "-n" to the iptables command to avoid names:

man iptables:
...
       -n, --numeric
              Numeric output.  IP addresses and port numbers will
              be printed in numeric format.  By default, the pro¡
              gram  will  try to display them as host names, net¡
              work names, or services (whenever applicable).
...

Ramin

> 
> Thanks in advance,
> 
> Brian


             reply	other threads:[~2002-06-04 17:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-04 17:41 Brian Ugie [this message]
2002-06-04 17:52 ` iptables and DNS Nick Drage
2002-06-04 18:09   ` Ramin Alidousti
     [not found] <scfca615.000@pzsj-office.pzs.com>
2002-06-04 18:48 ` Ramin Alidousti
2002-06-04 19:34   ` Antony Stone
  -- strict thread matches above, loose matches on Subject: below --
2002-06-04 18:35 Brian Ugie
2002-06-04 16:51 Brian Ugie
2002-06-04 17:28 ` Ramin Alidousti

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=scfc997d.097@pzsj-office.pzs.com \
    --to=bugie@pzs.com \
    --cc=netfilter@lists.samba.org \
    --cc=ramin@cannon.eng.us.uu.net \
    /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.