In this tutorial you will learn about SSH local and remote tunneling on Ubuntu.
Code used during this tutorial:
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 |
# Configuring local tunneling to a server # -f Requests ssh to go to background just before command execution # -N Do not execute a remote command. This is useful for just forwarding ports # -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 # In order to use -f option do not use "multiplexing SSH" # CLI: client side ssh -f -N -L 8888:192.168.56.101:80 liviu@ubuntu-vm ps aux | grep 8888 kill 3026 # Browser http://127.0.0.1:8888/ # Configuring remote tunneling to a 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 # CLI: client side ssh -N -R 8888:192.168.56.101:80 liviu@ubuntu-vm # Remote server http://127.0.0.1:8888/ Useful links: https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys#setting-up-ssh-tunnels |