From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: netfilter@lists.netfilter.org
Subject: Re: custom redirector
Date: Fri, 13 Aug 2004 02:02:02 +0100 [thread overview]
Message-ID: <200408130202.02247.Antony@Soft-Solutions.co.uk> (raw)
In-Reply-To: <200408121158.17197.spidyno@yahoo.es>
On Thursday 12 August 2004 5:58 pm, Nicolás Velásquez O. wrote:
> Hello there,
>
> I want to do some custom redirection rules, I've searched the web with
> no success.
>
> What I want to do is to set the forward policy a redirect.
You can only set the default policy of a chain to ACCEPT or DROP.
> Here is what I was trying without success:
> $IPTABLES -t nat -N MY_REDIRECTOR_POLICY
> $IPTABLES -t nat -A PREROUTING -i $LAN_IFACE -p TCP --dport 80 -j
> MY_REDIRECTOR_POLICY --to-port 81
> $IPTABLES -A MY_REDIRECTOR_POLICY -j REDIRECT --to-port 81
> $IPTABLES -A FORWARD -j MY_REDIRECTOR_POLICY
>
> That snip would go at the end of the rules. so it will work like a
> policy.
Yes, that would work in the same way as a default policy, agreed.
However, the REDIRECT target is only valid in the net table, therefore your
third rule above needs a "-t nat" in it.
The first rule doesn't need "-t nat" because you are creating a chain, and
user-defined chains contain all tables as standard.
I don't understand why you don't simply write the second rule as "iptables -t
nat -A PREROUTING -i $LAN_IFACE -p TCP --dport 80 -j REDIRECT --to 81"
If you keep in mind that REDIRECT has to happen in the PREROUTING chain, which
is before the FORWARD chain, you should be able to sort things out.
Regards,
Antony.
--
"Note: Windows 98, Windows 98SE and Windows 95 are not affected by [MS
Blaster]. However, these products are no longer supported. Users of these
products are strongly encouraged to upgrade to later versions."
(which *are* affected by MS Blaster...)
http://www.microsoft.com/security/security_bulletins/ms03-026.asp
Please reply to the list;
please don't CC me.
next prev parent reply other threads:[~2004-08-13 1:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-12 16:58 custom redirector Nicolás Velásquez O.
2004-08-13 1:02 ` Antony Stone [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-08-12 4:04 Nicolás Velásquez O.
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=200408130202.02247.Antony@Soft-Solutions.co.uk \
--to=antony@soft-solutions.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