How to SSH from server A to B with port forwarding and transparent proxy – Ubuntu 20.04
I have two servers, A
and B
. These are pros and cons of both:
Server A pros:
if I use A to get access the internet, my cost is reduce by half it is near my local internet provider and it has high speed
Server A cons:
limited access to internet, it can ping and sees some specific IPs, like server B and very limited IPs
Server B pros:
Full internet access
Server B cons:
if I user server B as proxy, my internet costs double
What I have tried so far
I started OpenVPN server on server A, and now my mobile (as client) can connect to server A with OpenVPN and when I check my IP it’s fine.
I started a screen
in server A
with this command:
ssh [email protected]_ip -p1994 -D 1994
Now when I check my mobile to see if it works and I can ping website like twitter.com
, it returns me IP 10.10.10.10
that it shows I have not yet got full internet access unfortunately.
Someone told me this way is correct, but I should use something like transparent proxy
and adding some rules to iptables
, and I searched for it a little but they did not work. The websites I searched and checked resulted my server A not being accessible anymore so I did reinstall the OS.
What I want to reach
I want to connect server A to server B, so that server A can have full internet access. And as server A is an OpenVPN server, my mobile can full internet access with half cost too.