0

Assume two CentOS instances are connected to the internet‌ (Say server A: 5.200.200.5 and B: 46.30.7.20).

I want to create a setup on servers in which all network traffic of server A passes through server B. So that when server A sends a request to a third server, for example, Google, the IP of server B is transmitted. I have SSH access to both servers.

For this purpose, I prefer not to use OpenVPN. I read many articles on Google and StackExchange about SSH Tunneling or Port Forwarding in Linux. But none of them explain a step by step solution or are written for highly expert users.

Iman
  • 113
  • 9
  • Of these articles you read, please provide some links, what exactly you attempted, and why it did not solve your problem. And what problem you are trying to solve. – John Mahowald Oct 01 '22 at 23:19

1 Answers1

0

Depending on your use-case you might have some luck with ssh's -Doption (dynamic tunnelling)?

If so, this:

serverA:~$ ssh -D 1234 serverB

would allow serverA to use its localhost:1234-port as a dynamic (SOCKS) proxy, and this traffic would swoop through the tunnel and appear outside serverB as if it originated on serverB.

If you're looking for something more VPN-like you'll probably need some kind of real VPN - maybe the lighter-weight wireguard or tinc perhaps?

Stygge
  • 71
  • 6