Search code examples
linuxproxysshsquidportforwarding

Proxy setup question


I want to be able to access a website that is IP restricted outside the UK from my cable DSL in Germany.

A friend of mine set up a proxy server in the UK that whitelists my dedicated Debian server at a German hosting company. Since my cable DSL IP changes everyday this was the simplest setup for him.

Now, on my side I would like to set up a proxy frowarder on my dedicated Debian server to his UK proxy, in order to be able to whitelist my cable DSL IP when I need to access the particular website. I have no access to the proxy itself, apart from my Germand dedicated server's IP being whitelisted for it.

A graphic illustrates the setup:

DSL at home <------> German dedicated server <--[permitted to access]--> UK proxy <-----> UK restricted website

What tools would you recommend to set up a proxy forwarding of the UK proxy at my German dedicated server, so that my German dedicated server becomes a transparent proxy that forwards to the UK proxy? As said it is a full blown Debian system. I tried netcat port forwarding, but that didn't work.


Solution

  • I agree, this should go to serverfault. But I think you can manage to do this using a simple iptables rule to redirect incoming traffic from a given port, to you friends web proxy.

    iptables -t nat -A PREROUTING -j DNAT -i eth0 -p TCP --dport 3128 --to-destination a.b.c.d
    

    Where a.b.c.d is your friend's IP.

    You can also use a.b.c.d:port syntax for a different listening port at your friend's host.

    Edit: I have tested it on my own network using masquerading and ip forwarding.