netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: forum@users.pc9.org
To: netfilter@lists.netfilter.org
Subject: Does redirect in PREROUTING require open port in INPUT?
Date: Sat, 27 Mar 2004 14:31:44 -0600	[thread overview]
Message-ID: <jbm.20040327143144.8905e4c3@alkaid.pc9> (raw)

My situation is, I run two different nameservers (one on udp 53 and another 
one on udp 5300). The one on the higher port is meant to be private and 
used only by permitted IPs.

Currently, I am using the following with success:
-----------------------
iptables -P INPUT DROP
iptables -A INPUT -i $EXTIF -p udp --dport 53 -j ACCEPT
iptables -A INPUT -i $EXTIF -p udp --dport 5300 -j ACCEPT

iptables -t nat -A PREROUTING -i $EXTIF -p udp --dport 53 -s 1.2.3.4 \
	-j REDIRECT --to-ports 5300
-----------------------

Works fine; only the IP 1.2.3.4 can access the private nameserver while all 
other public requests go to the default server on port 53. However I found 
that I needed to explicitly open up port 5300 on INPUT for this to work. 
While I could throw in an additional -s check in the INPUT rules, it seems 
like an ugly duplication if I have a large number of IPs.

Is there a more elegant way to do this port redirection without opening up 
the private port to the world? i.e. somehow see that a REDIRECT happened, 
rather than a packet actually coming in with destination port 5300?

-- 
forum@users.pc9.org




             reply	other threads:[~2004-03-27 20:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-27 20:31 forum [this message]
2004-03-27 20:50 ` Does redirect in PREROUTING require open port in INPUT? Antony Stone

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=jbm.20040327143144.8905e4c3@alkaid.pc9 \
    --to=forum@users.pc9.org \
    --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;
as well as URLs for NNTP newsgroup(s).