🔗
Networking concepts
  • Introduction
  • DNS
    • Introduction
    • DNS query
  • SSH
    • Introduction
    • Basics
    • SSH tunneling
      • Direct SSH tunnel
      • Reverse SSH tunnel
      • Dynamic SSH tunnel
    • SSH public key authentication
    • Port forwarding with virtual interface
    • sshd
    • scp/sftp
  • 🔫Networking tools
    • configuration & information
      • ip
      • netstat/netsh
      • ifconfig/ipconfig/iwconfig
      • arp
      • route
      • ps
      • ss
      • lsof
      • pgrep
      • nmcli
      • Information about services/processes & PID
    • monitoring & troubleshooting
      • ping
      • tracert/traceroute
      • mtr
      • iperf3
    • domain information
      • dig/nslookup
      • whois
      • host
    • capture & analysis
      • tcpdump
      • ngrep
      • wireshark
    • firewall & security
      • iptables
      • nft
    • services
      • dnsmasq
      • hostapd
      • RDP/VNC
      • ngrok
      • networking.service
      • NetworkManager.service
      • nginx
      • apache
      • nfs
    • miscellaneous
      • cURL
      • wget
      • netwox
      • netcat
      • openssl
      • socat
      • ftp
      • smbclient
    • proxy & tunneling
      • proxychains
    • Programming/scripting
      • Python
      • C
  • 🤩Interesting concepts
    • Simple tips & tricks
    • Network hole punching
    • SSH Over HTTPS
  • Network ports & services cheat sheet
    • 20/21/tcp ~ ftp
    • 22/tcp ~ ssh
    • 23/tcp ~ telnet
    • ...
  • For-fun projects
    • Raspberry pi + Windows machine experiments
Powered by GitBook
On this page
  1. SSH
  2. SSH tunneling

Direct SSH tunnel

A direct SSH tunnel, also known as local port forwarding, allows the creation of a tunnel that redirects traffic from a local address and port, to a specified port on a remote server, via an SSH connection

Direct tunneling is enabled with the -L flag, with the supplied values: [local_address:]local_port:destination_address:destination_port.

$ ssh user@server -L [local_address:]local_port:destination_address:destination_port

Eg. Direct tunneling from the local machine's localhost at port 8000 to the localhost on the remote server side at port 8888.

$ ssh user@13.10.10.10 -L 127.0.0.1:8000:127.0.0.1:8888
$ ssh user@13.10.10.10 -L 8000:127.0.0.1:8888

Notice that the only 3 values are provided, as the first value would default to bind on all interfaces (0.0.0.0) if omitted.

PreviousSSH tunnelingNextReverse SSH tunnel

Last updated 28 days ago