All of lore.kernel.org
 help / color / mirror / Atom feed
* Redirect in intranet using DNAT?
@ 2003-11-16 10:43 Michael Feldmann
  2003-11-16 11:22 ` Antony Stone
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Feldmann @ 2003-11-16 10:43 UTC (permalink / raw)
  To: netfilter

Hi all, 


How can I redirect traffic from one internal IP to another? My situation is as 
follows:

I have two webservers in an Intranet, one on 192.168.0.1, port 80, the
other on on 192.168.0.5 port 80. Each machine has only one ethernet
card, attached to the same switch.Now I want to take away the first
webserver In order to do this transparently, I thought of using a
redirect rule.

Thus, on 192.168.0.1 I tried the following commands:

iptables -t nat -A PREROUTING -p tcp -d 192.168.0.1 --dport 80 -j DNAT
--to 192.168.0.5:80
iptables -t nat -A PREROUTING -p udp -d 192.168.0.1 --dport 80 -j DNAT
--to 192.168.0.5:80


For testing reasons, all the policies on both machines are set to ACCEPT.
iptables -t nat -L -n yields:


Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
DNAT       udp  --  0.0.0.0/0            192.168.0.1        udp dpt:80
to:192.168.0.5:80
DNAT       tcp  --  0.0.0.0/0            192.168.0.1        tcp dpt:80
to:192.168.0.5:80

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination


With these rules, I thought an attempt to reach 192.168.0.1:80 would
lead me to 192.168.0.5:80. But it seems there are no packets arriving at 
192.168.0.5:80 .
Obviously, i seem to overlook something. But what?

Thanks in advance
Michael


P.S. Sorry if this question has been posted twice. I am note sure if 
yesterday's posting has really reched the list.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-11-16 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-16 10:43 Redirect in intranet using DNAT? Michael Feldmann
2003-11-16 11:22 ` Antony Stone
     [not found]   ` <200311161301.40525.m_feldmann@t-online.de>
2003-11-16 12:14     ` : " Antony Stone

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.