Linux Netfilter discussions
 help / color / mirror / Atom feed
From: /dev/rob0 <rob0@gmx.co.uk>
To: netfilter@lists.netfilter.org
Subject: DNAT --to-destination: why not hostname?
Date: Wed, 3 Mar 2004 13:33:33 -0600	[thread overview]
Message-ID: <200403031333.33554.rob0@gmx.co.uk> (raw)

The syntax from TFM, iptables(8):
    --to-destination ipaddr[-ipaddr][:port-port]
Obviously if you are going to use a range of destinations only IP 
addresses would suffice. But why can't this option accept a hostname 
for a single destination?

This would be convenient for scripting, in that you maintain control of 
the firewall through DNS. As it is, to use a hostname I have to use an 
intermediate step to get the IP, like this:
    DEST_IP=`dig +short ${DEST_HOST}.domain.tld.`
This is also less than ideal because if iptables resolved the name 
itself, it would use the "search domain.tld" out of resolv.conf. For 
dig I have to manually append it. And it's REALLY inconvenient in some 
of my firewall machines where there is no BIND installed. It gets even 
worse in sites which aren't running their own DNS ... AFAIK dig and 
host only use DNS, not /etc/hosts, for resolving.

iptables DOES resolve hostnames used in other parameters, so why not 
here? That should have been a question for the developer list, I guess, 
but I'm not on that one.

But a good question for this list might be: "How have you handled this 
need in iptables scripting?" I have used the dig trick where available 
and hard-coded IP's elsewhere.
-- 
    mail to this address is discarded unless "/dev/rob0"
    or "not-spam" is in Subject: header


             reply	other threads:[~2004-03-03 19:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-03 19:33 /dev/rob0 [this message]
2004-03-03 23:39 ` DNAT --to-destination: why not hostname? John A. Sullivan III

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=200403031333.33554.rob0@gmx.co.uk \
    --to=rob0@gmx.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox