Local Tunneling with SSH: A Basic Overview

ice-wzl
2 min readJan 31, 2023

SSH (Secure Shell) is a popular protocol for secure remote access to a server or network. One of its most powerful features is the ability to create a local tunnel between a remote host and the local machine. This allows the user to access services running on the remote machine as if they were running locally.

In this article, we’ll cover some different techniques for setting up local tunnels with SSH. We’ll cover specific examples with IP addresses, as well as how to access services running only on localhost.

Example 1: Forwarding a Remote Port to the Local Machine

Suppose you have a web server running on a remote machine with IP address 10.0.0.10. This server is only accessible from the local network, and you want to be able to access it from your local machine. To do this, you can use the following command:

$ ssh -L 8080:10.0.0.10:80 user@10.0.0.10

This command creates a local tunnel between port 8080 on the local machine and port 80 on the remote machine. Once the tunnel is established, you can access the web server by visiting http://localhost:8080 in your web browser.

Example 2: Forwarding a Local Port to the Remote Machine

--

--