-
Dynamic Port Forwarding: listening on ssh client, forwarding from ssh server, target host:port is determined by SOCKS4/SOCKS5
# -f is running in background, optinal
# -v is printing debugging messages
ssh -ND [bind_address:]port johnson@jserver
# example: set up a SOCKS5 proxy at localhost
ssh -vND 1080 johnson@jserver
-
Local Port Forwarding: listening on ssh client, forwarding from ssh server
# -f is running in background, optinal
# -v is printing debugging messages
ssh -NL [bind_address:]port:host:hostport] johnson@jserver
-
Remote Port Forwarding: listening on ssh server, forwarding from ssh client
# -f is running in background, optinal
# -v is printing debugging messages
ssh -NR [bind_address:]port:host:hostport] johnson@jserver
# example: remote SSH access local server which is inside a firewall
# 1. exec on the local server, port 10000 will listen on remote server, 22 is the local server ssh port
ssh -vNR 10000:localhost:22 remote_server_user@jserver
# 2. exec on the remove server
ssh -p10000 lan_server_user@localhost