# SSH Reverse Tunnels

### Introduction

Reverse SSH port forwarding specifies that the given port on the remote server host is to be forwarded to the given host and port on the local side.

***

### Local Tunnel vs Remote Tunnel

#### Local Tunnel

-L is a local tunnel **(YOU <-- CLIENT)**.

If a site was blocked, you can forward the traffic to a server you own and view it.

For example, if a remote machine port say 10000 is blocked via a firewall rule from the outside but accessible internally. However, Using an SSH Tunnel we can expose the port to us (locally)!

```bash
ssh -L 10000:localhost:1000 <username>@<ip>
```

And then we can access `http://localhost:1000` to view the content.

#### Remote Tunnel

-R is a remote tunnel (YOU --> CLIENT). You forward your traffic to the other server for others to view.

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.nomanaziz.me/cybersecurity/penetration-testing/tryhackme/networking-concepts/ssh-reverse-tunnels.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
