linux:ssh-tunnel
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| linux:ssh-tunnel [2016/07/13 13:11] – created Wuff | linux:ssh-tunnel [2023/05/29 11:55] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== SSH Tunnel ====== | ====== SSH Tunnel ====== | ||
| - | In this example, the remote port 3306 on the remote server will be forwarded to local port 3307 using login@server | + | ===== Forwarding ===== |
| + | |||
| + | In this example, the remote port 3306 on the remote server will be forwarded to local port 3307 using login@remoteserver | ||
| < | < | ||
| - | ssh login@server -L 3307: | + | ssh login@remote-server -L 3307: |
| </ | </ | ||
| + | |||
| + | Multiple ports can be forwarded by simply repeating the -L command: | ||
| + | < | ||
| + | ssh remote-host -L 8822: | ||
| + | </ | ||
| + | |||
| + | ===== Full Tunnel ===== | ||
| + | |||
| + | SSH has a “-w” option which will set up “tun” devices on either end and transport the traffic between them. If you say “ssh -w 0:0 hostname”, | ||
| + | |||
| + | < | ||
| + | ssh -o PermitLocalCommand=yes \ | ||
| + | -o LocalCommand=" | ||
| + | -w 0:0 $HOSTNAME \ | ||
| + | ' | ||
| + | </ | ||
| + | Note that on the server you will need to set “PermitTunnel yes” in / | ||
| + | |||
linux/ssh-tunnel.1468411862.txt.gz · Last modified: (external edit)