So what I'm trying to do is have tcp/udp incoming traffic from source IP 192.168.1.100 be routed to localhost:12345. localhost:12345 is used in an ssh socks proxy to my server with Internet access.
So I've done the following:
# iptables -t nat -A PREROUTING -s 192.168.1.100 -p tcp -j DNAT --to 127.0.0.1:12345 # iptables -t nat -A PREROUTING -s 192.168.1.100 -p udp -j DNAT --to 127.0.0.1:12345 # ssh -f -N -d 12345 <serverWithInternectAccess>
I've tested the socks proxy directly by configuring the browser to use it and it works fine. However, without configuring the proxy on the client the requests never make it to the 127.0.0.1:12345 interface and port. I can run tcpdump on the server where the above commands were run (eth0) and I see the incoming traffic from 192.168.1.100 but it doesn't appear to make it to 127.0.0.1:12345 (when I snoop that interface and port I don't see any traffic). I'm thinking the two tcpdumps should be identical when packets come from the source IP.
I'm wondering if the socks proxy doesn't pick it up because the packets aren't directly sent to it (since the client isn't configured to use a proxy). The goal here is to be able to leverage the socks proxy ssh tunnel without configuring anything on the client side.