L
L
loderunner842015-12-08 05:43:38
openvpn
loderunner84, 2015-12-08 05:43:38

How to use iptables to redirect individual requests to a proxy server?

The scheme is as follows: there is a router that has a gateway to the Internet (let's say internal 192.168.0.1 external 2.3.4.5). There is a server on the local network running squid+openvpn in a docker container. Server address, let's say 192.168.0.2. All traffic inside this container is directed through vpn (default gateway). The squid port is mapped and visible on the server. Tell me, please, how can I send requests from LAN clients, for example, to svoboda.ru through this VPN tunnel? (the question is getting more and more relevant :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vdvpie22, 2015-12-11
@vdvpie22

iptables -t nat -A PREROUTING -s 192.168.xx -p tcp -m multiport --dport 80,81,82,83,88, 8080 -j DNAT --to 192.168.xx:3128
before --dort specify -d IP_address_where_to_go_through_proxy
_ sites have several IP addresses, then the rules must be written for each, because if you write a name through dns, then iptables will answer at startup and take a random address from the available ones.
There are scripts that resolve and make changes to iptables on the fly, but I could not find a 100% working one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question