Local Tunneling
Understand local tunneling.
More Information
Local tunneling to a server
Traffic between the localhost and remote host can be tunneled via SSH connections. To establish a local tunnel on your remote server, use -L
parameter when connecting and must provide
- Local port for accessing the tunneled connection
- Remote host IP/name
- Remote host port
For general usage, connect to 10.0.0.12
on port 80 on your remote host, then your local machine is able to ping or make the connection to the remote host through port 8080.
Now if you go to your browser/curl to localhost:8080
, you are able to see the content that hosted at 10.0.0.12:80
.
Parameters | Description |
---|---|
-f | let SSH go into the background before executing |
-N | does not open a shell or execute a program on the remote side |
-L | establish a local tunnel to your remote server |
If you want to terminate the background connection, you have to find the PID and kill it.
Local tunneling local network
You can tunnel remote host local network to your local. Here is the animation diagram of the local network web server and common SSH server.
Local tunneling private network
You can tunnnel remote host private network to your local. Here is the animation diagram of the private network web server and common SSH server.