elosys:ssh_tunneling

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
elosys:ssh_tunneling [2024/03/30 15:47] – created nadirelosys:ssh_tunneling [2024/03/30 21:32] (current) nadir
Line 1: Line 1:
 ====== SSH Port Forwarding (Tunneling) ====== ====== SSH Port Forwarding (Tunneling) ======
  
 +
 +{{ :elosys:screenshot_from_2024-03-30_22-16-17.png?nolink&600 |}}
  
 **SSH** (Secure Shell) is a widely used protocol for system administration and file transfer. It provides secure encrypted communication between two hosts over an insecure network. One of the key features of **SSH** is **port forwarding**, also known as **SSH tunneling**, which allows users to create encrypted connections and forward network traffic through SSH sessions. This guide will provide a comprehensive overview of SSH port forwarding, including its types and practical examples. **SSH** (Secure Shell) is a widely used protocol for system administration and file transfer. It provides secure encrypted communication between two hosts over an insecure network. One of the key features of **SSH** is **port forwarding**, also known as **SSH tunneling**, which allows users to create encrypted connections and forward network traffic through SSH sessions. This guide will provide a comprehensive overview of SSH port forwarding, including its types and practical examples.
Line 94: Line 96:
 ===== Remote Port Forwarding ===== ===== Remote Port Forwarding =====
  
 +  
 ==== Definition and Usage ==== ==== Definition and Usage ====
 +
 +  * Remote port forwarding forwards traffic from a port on the SSH server to the local machine.
 +
  
 ==== Examples ==== ==== Examples ====
 +
  
 === Sharing Local Web Application === === Sharing Local Web Application ===
 +
 +<cli>
 +ssh -R 7000:127.0.0.1:8000 user@example.com
 +</cli>
 +
 +  * This command forwards traffic from port 7000 on the remote server to port 8000 (web application) on the local machine.
 +
 +
 +  * Users can access the web application hosted on the local machine by visiting **http://example.com:7000**.
 +
  
 === Configuring Remote Access to Local Resources === === Configuring Remote Access to Local Resources ===
 +
 +
 +<cli>
 +ssh -R 8080:192.168.100.1:8000 user@example.com
 +
 +</cli>
 +
 +
 +  * This command forwards traffic from port 8080 on the remote server to port 8000 (web application) on the local machine at IP **192.168.100.1**.
 +
 +
 +  * Allows remote access to a locally hosted web application.
 +
  
 ===== Dynamic Port Forwarding ===== ===== Dynamic Port Forwarding =====
Line 107: Line 136:
  
 ==== Definition and Usage ==== ==== Definition and Usage ====
 +
 +
 +
 +  * Dynamic port forwarding creates a SOCKS proxy on the local machine, allowing traffic to be forwarded through the SSH server dynamically.
 +
  
 ==== Configuring Dynamic Port Forwarding ==== ==== Configuring Dynamic Port Forwarding ====
 +
 +
 +<cli>
 +ssh -D 4000 user@example.com
 +</cli>
 +
 +  * This command creates a SOCKS proxy on port 4000 on the local machine, using the **SSH** server as a gateway.
 +
 +
 +  * Applications can be configured to use this proxy for secure communication.
 +
  
 ==== Applications and Settings ==== ==== Applications and Settings ====
  
-===== Additional Tips and Best Practices ===== 
  
 +  * Configure application settings to use **SOCKS** proxy.
  
  
 +  * Consider using browser extensions for easy proxy setup.
 +
 +
 +===== Additional Tips and Best Practices =====
 +
 +  
  
 ==== Disabling Shell and Running in Background ==== ==== Disabling Shell and Running in Background ====
 +
 +  * Use **-N** flag to disable shell when not needed.
 +
 +
 +  * Use **-f** flag to run SSH in the background.
  
  
 ==== Considerations for Proxy Usage ==== ==== Considerations for Proxy Usage ====
 +
 +  * Avoid running **HTTP** servers on remote machines when using SSH as a **proxy**.
 +
 +
  
  
 +----
  
-==== Security Considerations ==== 
  
 + --- //[[nadirhabib96@gmail.com|Nadir Habib]] 2024/03/30 21:17//
  • elosys/ssh_tunneling.1711813635.txt.gz
  • Last modified: 2024/03/30 15:47
  • by nadir