Z
Z
zvonok13372018-12-23 20:27:46
linux
zvonok1337, 2018-12-23 20:27:46

How to redirect traffic to a proxy server and receive responses from it?

Greetings, the question is:
There is a server with mobile Internet far in the country, there is a second server (DigitalOcean) with a dedicated ip, so I connected them together via VPN
How do I send an http request to the digitalocean server, do -> to the server with mobile Internet -> mobile internet there performs an http/https request and returns a response back to me?
It is necessary to put squid on DO, DO throws on the squid of the mobile Internet, the mobile Internet makes a request - and returns everything in the reverse order. So right? Or I'm wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael Galyuk, 2018-12-23
@zvonok1337

And what for "a proxy server" to do?
After all, you can forward the port: configure routing with a masquerade through iptables.
If squid is already installed on the country server and the VPN is working, then it is enough to set the routing to DO, for example:

modprobe iptable_nat
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -d eth0 -p tcp --dport 3128 -j DNAT --to-destination 10.10.10.10:3128
iptables -A FORWARD -d 10.10.10.10 -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

Well, check all the current routes and rules:
route -n
iptables -L -n
iptables -t nat -L -n

Google, try it. More questions will be - ask.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question