Hi. I currently SSH into my server, and access certain things with tunnels.
Is there any straightforward way to create a backwards tunnel, that is, from the server back to me (the client)? I run various services (database, source code repository) on my workstation, and I'd like to be able to access it directly, via an SSH tunnel, from my server.
Tunneling with SSH - backwards!
Re: Tunneling with SSH - backwards!
Run the following as root. You will need to have your public key setup on the remote host so that you can login via ssh without typing a password:
[code]
/usr/sbin/pppd updetach noauth passive pty "/usr/bin/ssh -P REMOTE_HOST -lroot -o Batchmode=yes sudo /usr/sbin/pppd nodetach notty noauth" ipparam vpn NEW_LOCAL_IP:NEW_REMOTE_LOCAL_IP
[/code]
change REMOTE_HOST to the ip / domain name of the remote host
change NEW_LOCAL_IP to a RFC1918 address, such as 192.168.50.1 ( make sure it's an IP you don't use on your network )
change NEW_REMOTE_LOCAL_IP to something similar, such as 192.168.50.2
This creates a peer to peer protocol link between the two systems, just like a VPN.
From local, you can ssh to remote via the IP 192.168.50.2
From the remote host, you can ssh back to local via the IP 192.168.50.1
Hope this helps.
[code]
/usr/sbin/pppd updetach noauth passive pty "/usr/bin/ssh -P REMOTE_HOST -lroot -o Batchmode=yes sudo /usr/sbin/pppd nodetach notty noauth" ipparam vpn NEW_LOCAL_IP:NEW_REMOTE_LOCAL_IP
[/code]
change REMOTE_HOST to the ip / domain name of the remote host
change NEW_LOCAL_IP to a RFC1918 address, such as 192.168.50.1 ( make sure it's an IP you don't use on your network )
change NEW_REMOTE_LOCAL_IP to something similar, such as 192.168.50.2
This creates a peer to peer protocol link between the two systems, just like a VPN.
From local, you can ssh to remote via the IP 192.168.50.2
From the remote host, you can ssh back to local via the IP 192.168.50.1
Hope this helps.