* RE: redirection
@ 2003-04-09 8:40 dhiraj.2.bhuyan
2003-04-09 9:13 ` redirection xchris
0 siblings, 1 reply; 19+ messages in thread
From: dhiraj.2.bhuyan @ 2003-04-09 8:40 UTC (permalink / raw)
To: lyra, netfilter
You do infact need DNAT and not SNAT
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j DNAT
--to-destination x.y.z.2:80
this should work.
dhiraj
-----Original Message-----
From: xchris [mailto:lyra@fastwebnet.it]
Sent: 08 April 2003 23:17
To: netfilter@lists.netfilter.org
Subject: Re: redirection
----- Original Message -----
From: "Eric Joe" <sysop@tje1.com>
> I didnt catch the fact that you need the source address. Are you tracking
> this for a reason? You can probably have iptables log the source address.
> This does in fact work, been using it for about 6 months now. Let me post
> my exact rules (IPs are obsfucated)
i need it because i'm trying to do a simple load balancing between 2 local
servers running opennap.
(and opennap needs to know the IP address otherwise downloads dont start)
thnak you
xchris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: redirection
2003-04-09 8:40 redirection dhiraj.2.bhuyan
@ 2003-04-09 9:13 ` xchris
0 siblings, 0 replies; 19+ messages in thread
From: xchris @ 2003-04-09 9:13 UTC (permalink / raw)
To: dhiraj.2.bhuyan, netfilter
On Wednesday 09 April 2003 10:40 am, you wrote:
> You do infact need DNAT and not SNAT
>
> iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j DNAT
> --to-destination x.y.z.2:80
>
> this should work.
I tried but all connections go in timeout.
I first flushed every chain,set default policy everywhere,and then added DNAT
rule...
no result...
The strange thing is :
if i DNAT on another interface everything is ok.
if i DNAT through the incoming connection interface... it fails.
strange...
I think i miss something..
Thank you
Chris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Redirection
@ 2004-02-27 12:08 Sasa Stupar
2004-02-27 12:19 ` Redirection Antony Stone
[not found] ` <008b01c3fd2b$f8910320$2a245cc2@cea05>
0 siblings, 2 replies; 19+ messages in thread
From: Sasa Stupar @ 2004-02-27 12:08 UTC (permalink / raw)
To: Netfilter-List
Hi!
I have setup router with iptables. Now I have also setup a squid proxy
server on another internal machine. What I want is to all http requests
from internal LAN to send thru proxy.
Since I am new to iptables I am asking here for some help.
How can I do that?
Thanks,
Sasa
^ permalink raw reply [flat|nested] 19+ messages in thread* RE: redirection
@ 2003-04-09 13:10 dhiraj.2.bhuyan
2003-04-09 13:34 ` redirection Christian Cernuschi
0 siblings, 1 reply; 19+ messages in thread
From: dhiraj.2.bhuyan @ 2003-04-09 13:10 UTC (permalink / raw)
To: netfilter
note one thing -
when the client tries to connect to port 80 of x.y.z.1, the firewall in
x.y.z.1 redirects the traffic to x.y.z.2:80
so the client will be receiving packets from x.y.z.2:80 - which is not what
it is expecting. It is waiting for packets from x.y.z.1:80 - so it will no
doubt timeout. You should be able to see the packets coming from x.y.z.2:80
by running a sniffer on the client machine.
I think Eric Joe did infact give the right solution - that x.y.z.1 will be
working as a proxy between the client and x.y.z.2 - although you can
question if you are achieving your "loadbalancing" by this.
dhiraj
-----Original Message-----
From: xchris [mailto:lyra@fastwebnet.it]
Sent: 08 April 2003 23:17
To: netfilter@lists.netfilter.org
Subject: Re: redirection
----- Original Message -----
From: "Eric Joe" <sysop@tje1.com>
> I didnt catch the fact that you need the source address. Are you tracking
> this for a reason? You can probably have iptables log the source address.
> This does in fact work, been using it for about 6 months now. Let me post
> my exact rules (IPs are obsfucated)
i need it because i'm trying to do a simple load balancing between 2 local
servers running opennap.
(and opennap needs to know the IP address otherwise downloads dont start)
thnak you
xchris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: redirection
2003-04-09 13:10 redirection dhiraj.2.bhuyan
@ 2003-04-09 13:34 ` Christian Cernuschi
2003-04-09 13:38 ` redirection xchris
0 siblings, 1 reply; 19+ messages in thread
From: Christian Cernuschi @ 2003-04-09 13:34 UTC (permalink / raw)
To: dhiraj.2.bhuyan, netfilter
On Wednesday 09 April 2003 03:10 pm, dhiraj.2.bhuyan@bt.com wrote:
> note one thing -
>
> when the client tries to connect to port 80 of x.y.z.1, the firewall in
> x.y.z.1 redirects the traffic to x.y.z.2:80
>
> so the client will be receiving packets from x.y.z.2:80 - which is not what
> it is expecting. It is waiting for packets from x.y.z.1:80 - so it will no
> doubt timeout. You should be able to see the packets coming from x.y.z.2:80
> by running a sniffer on the client machine.
>
> I think Eric Joe did infact give the right solution - that x.y.z.1 will be
> working as a proxy between the client and x.y.z.2 - although you can
> question if you are achieving your "loadbalancing" by this.
>
exactly...
it's the same conclusion i arrived..
The solution (also for source adress keeping) is to masquerade the destination
machine under the first one!
The destination machine must not reside "under" the first.It can also be at
the same level (read attached to the same switch) but needs to have the first
machine as gateway. (so MASQ rules works)
Doing in this way should work everything!!
Thank you again (i liked to study this...)
xchris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: redirection
2003-04-09 13:34 ` redirection Christian Cernuschi
@ 2003-04-09 13:38 ` xchris
0 siblings, 0 replies; 19+ messages in thread
From: xchris @ 2003-04-09 13:38 UTC (permalink / raw)
To: dhiraj.2.bhuyan, netfilter
On Wednesday 09 April 2003 03:34 pm, Christian Cernuschi wrote:
> On Wednesday 09 April 2003 03:10 pm, dhiraj.2.bhuyan@bt.com wrote:
> > note one thing -
> >
> > when the client tries to connect to port 80 of x.y.z.1, the firewall in
> > x.y.z.1 redirects the traffic to x.y.z.2:80
> >
> > so the client will be receiving packets from x.y.z.2:80 - which is not
> > what it is expecting. It is waiting for packets from x.y.z.1:80 - so it
> > will no doubt timeout. You should be able to see the packets coming from
> > x.y.z.2:80 by running a sniffer on the client machine.
> >
> > I think Eric Joe did infact give the right solution - that x.y.z.1 will
> > be working as a proxy between the client and x.y.z.2 - although you can
> > question if you are achieving your "loadbalancing" by this.
>
exactly...
it's the same conclusion i arrived..
The solution (also for source adress keeping) is to masquerade the
destination machine under the first one!
The destination machine must not reside "under" the first.It can also be at
the same level (read attached to the same switch) but needs to have the
first machine as gateway. (so MASQ rules works)
Doing in this way should work everything!!
Thank you again (i liked to study this...)
xchris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Redirection
@ 2003-04-09 10:15 Simone Sestini
0 siblings, 0 replies; 19+ messages in thread
From: Simone Sestini @ 2003-04-09 10:15 UTC (permalink / raw)
To: netfilter
[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]
Hi all.. i have a situation where i need to use iptables..
I have a public www with some virtual hosts on a machine with public ip
2.2.2.2.
I have with another provider a second server with public ip 1.1.1.1
On dns server i wrote that intra.pippo.foo has address 1.1.1.1 so all the
internet request come to machine 1.1.1.1 port 80.
I want that the server 1.1.1.1 redirects all the call on port 80 and 443 to
the server 2.2.2.2 in transparent mode.. i don't want end user to know that
datas are over server 2.2.2.2.
Naturally the www server on 2.2.2.2 listen on port 80 for intra.pippo.foo
How can i menage the packets with iptables for do that ?
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Simone Sestini [ SS971-RIPE ]
Plug IT s.p.a. - Technical Office
Via Galileo Ferraris 216
52100 Arezzo
Titles:
System and Network Administrator
Data Transmission Manager
Fax +39-199-4400-88
E-mail simone.sestini@plugit.net
Web http://www.plugit.it
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
[-- Attachment #2: Type: text/html, Size: 1727 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: redirection
@ 2003-04-09 10:03 dhiraj.2.bhuyan
2003-04-09 10:25 ` redirection xchris
0 siblings, 1 reply; 19+ messages in thread
From: dhiraj.2.bhuyan @ 2003-04-09 10:03 UTC (permalink / raw)
To: lyra, netfilter
try one thing - flush all rules and add the rule
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j DNAT
--to-destination x.y.z.2:80
I have a feeling that you are doing something in the POSTROUTING chain which
is why you are not getting the right result. Or maybe you have a rule to
drop the packet defined?
dhiraj
-----Original Message-----
From: xchris [mailto:lyra@fastwebnet.it]
Sent: 09 April 2003 09:14
To: Bhuyan,D,Dhiraj,XVR3A C; netfilter@lists.netfilter.org
Subject: Re: redirection
On Wednesday 09 April 2003 10:40 am, you wrote:
> You do infact need DNAT and not SNAT
>
> iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j DNAT
> --to-destination x.y.z.2:80
>
> this should work.
I tried but all connections go in timeout.
I first flushed every chain,set default policy everywhere,and then added
DNAT
rule...
no result...
The strange thing is :
if i DNAT on another interface everything is ok.
if i DNAT through the incoming connection interface... it fails.
strange...
I think i miss something..
Thank you
Chris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: redirection
2003-04-09 10:03 redirection dhiraj.2.bhuyan
@ 2003-04-09 10:25 ` xchris
0 siblings, 0 replies; 19+ messages in thread
From: xchris @ 2003-04-09 10:25 UTC (permalink / raw)
To: dhiraj.2.bhuyan, netfilter
On Wednesday 09 April 2003 12:03 pm, dhiraj.2.bhuyan@bt.com wrote:
> try one thing - flush all rules and add the rule
> iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j DNAT
> --to-destination x.y.z.2:80
>
> I have a feeling that you are doing something in the POSTROUTING chain
> which is why you are not getting the right result. Or maybe you have a rule
> to drop the packet defined?
>
nope.
i flushed everithing!
all tables cleared.
i added only the DNAT line...
but it still doesn't work.
thank you
P.S.:I don't understand why if i use an ip of another interface it works. (a
classic DNAT to dmz)
^ permalink raw reply [flat|nested] 19+ messages in thread
* redirection
@ 2003-04-08 18:31 xchris
2003-04-08 18:44 ` redirection Eric Joe
0 siblings, 1 reply; 19+ messages in thread
From: xchris @ 2003-04-08 18:31 UTC (permalink / raw)
To: netfilter
i'd like to do this:
i have 2 pc
x.y.z.1
x.y.z.2
i would like to redirect connection on port 80 of x.y.z.1 to port 80 of
x.y.z.2
i tried with DNAT but when someone tries to connect it goes in timeout?
Is there a solution?
Thank you
Chris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: redirection
2003-04-08 18:31 redirection xchris
@ 2003-04-08 18:44 ` Eric Joe
2003-04-08 19:40 ` redirection xchris
0 siblings, 1 reply; 19+ messages in thread
From: Eric Joe @ 2003-04-08 18:44 UTC (permalink / raw)
To: xchris; +Cc: netfilter
On Tue, 8 Apr 2003, xchris wrote:
> i'd like to do this:
>
> i have 2 pc
> x.y.z.1
> x.y.z.2
>
> i would like to redirect connection on port 80 of x.y.z.1 to port 80 of
> x.y.z.2
>
> i tried with DNAT but when someone tries to connect it goes in timeout?
Do this
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -d x.y.z.1 -j DNAT
--to x.y.z.2:80
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to x.y.z.1
I use a line similar to this to reroute non-local traffic to a different
web server then our local users.
Eric
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: redirection
2003-04-08 18:44 ` redirection Eric Joe
@ 2003-04-08 19:40 ` xchris
2003-04-08 22:49 ` redirection Eric Joe
0 siblings, 1 reply; 19+ messages in thread
From: xchris @ 2003-04-08 19:40 UTC (permalink / raw)
To: netfilter; +Cc: Eric Joe
On Tuesday 08 April 2003 08:44 pm, Eric Joe wrote:
> Do this
>
>
> iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -d x.y.z.1 -j DNAT
> --to x.y.z.2:80
>
> iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to x.y.z.1
am i wrong or i loose the original connection source address?
if i check the log in x.y.z.2 i see connections from x.y.z.1.
I really need to preserve the source address.
Thank you very much
xchris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: redirection
2003-04-08 19:40 ` redirection xchris
@ 2003-04-08 22:49 ` Eric Joe
2003-04-08 23:17 ` redirection xchris
0 siblings, 1 reply; 19+ messages in thread
From: Eric Joe @ 2003-04-08 22:49 UTC (permalink / raw)
To: lyra; +Cc: netfilter
I didnt catch the fact that you need the source address. Are you tracking
this for a reason? You can probably have iptables log the source address.
This does in fact work, been using it for about 6 months now. Let me post
my exact rules (IPs are obsfucated)
iptables -t nat -A PREROUTING -i eth0 -s 192.168.1.0/24 -p tcp --dport 80
-d 192.168.1.7 -j DNAT --to 192.168.1.7
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -d 192.168.1.7 -j
DNAT --to 192.168.1.11:80
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 192.168.1.7
Regards
Eric
--
Eric Joe
Network Operations
Journey's End Internet/Computer Connection Inc
> On Tuesday 08 April 2003 08:44 pm, Eric Joe wrote:
>
>> Do this
>>
>>
>> iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -d x.y.z.1 -j
>> DNAT --to x.y.z.2:80
>>
>> iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to x.y.z.1
>
> am i wrong or i loose the original connection source address?
>
> if i check the log in x.y.z.2 i see connections from x.y.z.1.
> I really need to preserve the source address.
> Thank you very much
> xchris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: redirection
2003-04-08 22:49 ` redirection Eric Joe
@ 2003-04-08 23:17 ` xchris
0 siblings, 0 replies; 19+ messages in thread
From: xchris @ 2003-04-08 23:17 UTC (permalink / raw)
To: netfilter
----- Original Message -----
From: "Eric Joe" <sysop@tje1.com>
> I didnt catch the fact that you need the source address. Are you tracking
> this for a reason? You can probably have iptables log the source address.
> This does in fact work, been using it for about 6 months now. Let me post
> my exact rules (IPs are obsfucated)
i need it because i'm trying to do a simple load balancing between 2 local
servers running opennap.
(and opennap needs to know the IP address otherwise downloads dont start)
thnak you
xchris
^ permalink raw reply [flat|nested] 19+ messages in thread
* redirection
@ 2003-04-08 16:10 Christian Cernuschi
2003-04-10 17:45 ` redirection Eric Joe
0 siblings, 1 reply; 19+ messages in thread
From: Christian Cernuschi @ 2003-04-08 16:10 UTC (permalink / raw)
To: netfilter
i'd like to do this:
i have 2 pc
x.y.z.1
x.y.z.2
i would like to redirect connection on port 80 of x.y.z.1 to port 80 of
x.y.z.2
i tried with DNAT but when someone tries to connect it goes in timeout?
Is there a solution?
Thank you
Chris
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: redirection
2003-04-08 16:10 redirection Christian Cernuschi
@ 2003-04-10 17:45 ` Eric Joe
0 siblings, 0 replies; 19+ messages in thread
From: Eric Joe @ 2003-04-10 17:45 UTC (permalink / raw)
To: Christian Cernuschi; +Cc: netfilter
On Tue, 8 Apr 2003, Christian Cernuschi wrote:
> i'd like to do this:
>
> i have 2 pc
> x.y.z.1
> x.y.z.2
>
> i would like to redirect connection on port 80 of x.y.z.1 to port 80 of
> x.y.z.2
>
> i tried with DNAT but when someone tries to connect it goes in timeout?
>
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -d x.y.z.1 -j
DNAT --to x.y.z.2:80
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to x.y.z.1
We are doing the *exact* thing you want to do everyday with the above 2
lines.
Eric
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2004-02-27 12:46 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-09 8:40 redirection dhiraj.2.bhuyan
2003-04-09 9:13 ` redirection xchris
-- strict thread matches above, loose matches on Subject: below --
2004-02-27 12:08 Redirection Sasa Stupar
2004-02-27 12:19 ` Redirection Antony Stone
[not found] ` <008b01c3fd2b$f8910320$2a245cc2@cea05>
2004-02-27 12:41 ` Redirection Sasa Stupar
2004-02-27 12:46 ` Redirection Sasa Stupar
2003-04-09 13:10 redirection dhiraj.2.bhuyan
2003-04-09 13:34 ` redirection Christian Cernuschi
2003-04-09 13:38 ` redirection xchris
2003-04-09 10:15 Redirection Simone Sestini
2003-04-09 10:03 redirection dhiraj.2.bhuyan
2003-04-09 10:25 ` redirection xchris
2003-04-08 18:31 redirection xchris
2003-04-08 18:44 ` redirection Eric Joe
2003-04-08 19:40 ` redirection xchris
2003-04-08 22:49 ` redirection Eric Joe
2003-04-08 23:17 ` redirection xchris
2003-04-08 16:10 redirection Christian Cernuschi
2003-04-10 17:45 ` redirection Eric Joe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox