ssh tunneling

For some reason at some time you need tunnel to your home, work, server etc..
and the easiest way to build it – is ssh. There are a lot of manuals in internet how to do it, but here I will keep my useful examples with description

  • local port forwarding:
    ssh -2 -f -N -L local_port:127.0.0.1:remote_port user@host

    • 2 – Forces ssh to try protocol version 2 only
    • f – Requests ssh to go to background just before command execution
    • N – Requests ssh to go to background just before command execution
    • L – Specifies that the given port on the local (client) host is to be forwarded 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 – Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side.
    • \* – specify remote server listen on all interface
    • 4 – Forces ssh to use IPv4 addresses only
  • ssh vpn tunnel
    very good manual written on ubuntu help page: ssh_vpn tunnel
No comment yet
Leave a Reply

Your email address will not be published. Required fields are marked *