I'm having trouble with getting local subnet traffic sent through a proxy. I've got some mobile testing devices on a subnet and a web server on that also. For dev purposes, I need to inject some code. I'm using a proxy to do this. However the traffic that is local to the subnet (i.e. from a device, say to the webserver is not passing through the proxy server. All other requests get the code injected correctly.

My current iptables is configured using the following command:

iptables -t nat -A PREROUTING -p tcp -m tcp -i eth1 --dport 80 -j DNAT --to-destination

Eventually I will limit this rule to source & destination network

I'm using an intermediary box ( with a dumb wifi access point as a router; running ubuntu 12.04.

The proxy is Apache configured as a forward proxy, listening on port 8080.

I know that the traffic is not being sent to the proxy because when I take down Apache proxy the local sites are still served. However any outbound sites are then unavailable.

I don't understand why this rule is not applying to completely local-to-the-subnet traffic.

I there something I am missing? Or is it likely that my WiFi access point, despite being configured NOT to route, is routing this traffic, and thus it never reaches my iptables?


After a while I decided that this wasn't possible, and I made sure that the devices and the web server were to be on different subnets, with the proxy server machine routing between the two.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.