Home / Community / Blog / SSH as kind of VPN on OpenVZ machnie

SSH as kind of VPN on OpenVZ machnie

I had a case:

  • Have a service in home local network.
  • I would like to access this service from outside.
  • I don't have routed IP in home.
  • I have VPS with public IP, but I can't run OpenVPN on it.

As workaround you can use SSH tunnel with remote port forwarding.

In my example service is running on machine 192.168.3.28:8080 and I want to have access on port 8090.

First of all you have to add to your /etc/ssh/sshd_config file:

GatewayPorts yes

On my router (it doesn't matter, but it has address 192.168.3.3) I've run command:

ssh -R 8090:192.168.3.28:8080 me@jaqb.gda.pl

This command create a tunnel between server (jaqb.gda.pl) on port 8090 through my router (192.168.3.3) to port 8080 on host 192.168.3.28 in home network.

Now I can access it from anywhere.

In fact, my (great!) VPS provider allow me to run OpenVPN in less than 10 minutes so it wasn't necessary.

Comments

Log in or create a user account to comment.

Just my blog...

Mon Tue Wed Thu Fri Sat Sun
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31