December 2018
Beginner
826 pages
22h 54m
English
When you use the -L flag with SSH, you're specifying that any connection attempts made to the local machine, on the first port listed, are to be forwarded to the remote host and port.
Let's break down the command:
[vagrant@centos1 ~]$ ssh -f -L 9999:127.0.0.1:8888 192.168.33.11 sleep 120
First, the -f and sleep 120 at the end of the command are a quick way to create a session and background it while we perform our test:
-f ... sleep 120
The second part is the interesting bit:
-L 9999:127.0.0.1:8888
Here, we're saying that local port 9999 should have ...