All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: netfilter@lists.netfilter.org
Subject: Re: how to redirect certain IPs to specific url
Date: Wed, 30 Jun 2004 10:34:44 +0100	[thread overview]
Message-ID: <200406301034.44072.Antony@Soft-Solutions.co.uk> (raw)
In-Reply-To: <a0f69e5040630021311b0555d@mail.gmail.com>

On Wednesday 30 June 2004 10:13 am, Askar Ali Khan wrote:

> > iptables -A PREROUTING -t nat -p tcp --dport 80 -s a.b.c.d -j DNAT --to
> > w.x.y.z
>
> may i have to replace w.x.y.z with the IP of domain or simply
> www.abc.com will work?

You can use www.abc.com, but you must remember that www.abc.com will be 
resolved to an IP address *at the time you enter the rule*, and the rule will 
then exist on your firewall with that IP address while the firewall is 
running.

Therefore if www.abc.com always resolves to one IP address, it makes no 
difference whether you enter the rule by IP or name.

If www.abc.com resolves to one IP address, but that address changes, your 
firewall wil continue to use the old IP address until you change it.

If www.abc.com resolves to more than one IP address, only one will get entered 
into the rule if you specify the name (and you would need to use multiple 
rules if you specify by IP), and therefore only some of the packets sent to 
ww.abc.com would match the rule.

> > If this is not what you want, and you do indeed need to do stuff at OSI
> > layer 7, working on HTTP rather than TCP and IP, you should probably look
> > into http://www.squid-cache.org
>
> we have firewall it redirect traffic to cache server running "squid"
>
> :) may i put this rule on firewall machine or the cache server ?

If you want to use netfilter rules, put them on the firewall.   If you want to 
do URL redirection and perhaps regular expression matching, or you want to 
make sure that www.abc.com always works in a rule, then use Squid (because 
that will do a DNS lookup of www.abc.com every time it sees it in a URL).

Regards,

Antony.

-- 
There are only 10 types of people in the world:
those who understand binary notation,
and those who don't.

                                                     Please reply to the list;
                                                           please don't CC me.



  reply	other threads:[~2004-06-30  9:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-30  7:44 how to redirect certain IPs to specific url Askar Ali Khan
2004-06-30  8:31 ` Antony Stone
2004-06-30  9:13   ` Askar Ali Khan
2004-06-30  9:34     ` Antony Stone [this message]
2004-06-30 15:14       ` James A. Pattie
2004-07-01  1:11 ` Ian Holsman

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=200406301034.44072.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 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.