Networking Forums

Networking Forums > Computer Networking > Linux Networking > iptables:redirect in an intranet?

Reply
Thread Tools Display Modes

iptables:redirect in an intranet?

 
 
M F
Guest
Posts: n/a

 
      11-15-2003, 10:29 AM
Hi all,

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 command:

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 plicies 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 the latter one doesn't see anything.

What am I missing?

Thanks for replying!

Micahel

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables redirect question. yozhang@gmail.com Linux Networking 1 12-09-2005 09:22 PM
iptables firewall between dsl router and intranet Thomas Olschewski Linux Networking 7 08-03-2005 07:45 PM
iptables? redirect? M3ntos Linux Networking 3 05-20-2005 08:16 AM
Iptables SSL redirect Fritz Bayer Linux Networking 6 07-20-2004 06:08 AM
iptables redirect = ! ipsec0 DaemonB Linux Networking 0 09-02-2003 07:23 AM



1 2 3 4 5 6 7 8 9 10 11