Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 
share|improve this question

migrated from serverfault.com Feb 29 '12 at 1:41

This question came from our site for professional system and network administrators.

    
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 '12 at 0:47
    
"requests are still served through my home internet connection"... home networking questions are not appropriate for ServerFault. Please read our FAQ. –  kce Feb 29 '12 at 1:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.