SSH tunneling
SSH tunneling
Sooner or later you need a tunnel to your home, work or server, and the easiest way to build one is SSH. There are plenty of manuals online; here I keep my own examples with descriptions.
- Local port forwarding:
ssh -2 -f -N -L local_port:127.0.0.1:remote_port user@host-2– force SSH protocol version 2 only-f– go to background just before command execution-N– do not execute a remote command (just forward ports)-L– forward the given port on the local (client) host to the given host and port on the remote side
- Remote port forwarding:
ssh -4 -N -f -R '*:remote_port:127.0.0.1:local_port' user@server-R– forward the given port on the remote (server) host to the given host and port on the local side*– the remote server listens on all interfaces (requiresGatewayPorts yesin itssshd_config)-4– use IPv4 addresses only
- SSH VPN tunnel: there is a very good manual on the Ubuntu help pages: SSH_VPN
Last updated on