0

I'm trying to redirect all port 80 requests on a single LAN IP to an external squid proxy server outside of my network. For debugging purposes, I'm attempting this from the router level as the application does not have proxy support but does send its requests through port 80.

So far, I've tried plugging this in at the 'run command' box on DDWRT:

YourIP=192.168.1.128
YourPort=80
TargetIP=x.x.x.x
TargetPort=23128

iptables -t nat -A PREROUTING --dst $YourIP -p tcp --dport $YourPort -j DNAT --to-destination $TargetIP:$TargetPort
iptables -t nat -A POSTROUTING -p tcp --dst $TargetIP --dport $TargetPort -j SNAT --to-source $YourIP
iptables -t nat -A OUTPUT --dst $YourIP -p tcp --dport $YourPort -j DNAT --to-destination $TargetIP:$TargetPort

It doesn't seem to do anything, though. Requests are still served through my home internet connection from the specified device. Am I going about this the wrong way? Any help is appreciated. When I run "iptables -t nat -L" I see the following:

DNAT       tcp  --  anywhere             192.168.1.128       tcp dpt:www to:x.x.x.x:23128 
2
  • What is YourIP=192.168.1.128 in your context? Is that the IP address assigned to the client you are testing from? It is the dd-wrt box going to be making http requests? If not you can drop the -A OUTPUT rule. You also, probably don't need the SNAT.
    – Zoredache
    Feb 17, 2012 at 0:47
  • "requests are still served through my home internet connection"... home networking questions are not appropriate for ServerFault. Please read our FAQ.
    – user74416
    Feb 29, 2012 at 1:41

0

You must log in to answer this question.

Browse other questions tagged .