December 2018
Beginner
826 pages
22h 54m
English
It's not just SSH that this can be used with. In the same way, we can forward ports from the remote session to our local machine – we have a wealth of options available to us.
Let's start and background a simple web server on centos1:
[vagrant@centos1 ~]$ python -m SimpleHTTPServer 8888 &[1] 6010
Now, let's SSH to centos2, while stating that any requests made on the remote machine to 127.0.0.1:7777 are passed back along the established SSH session to centos1:
[vagrant@centos1 ~]$ ssh -R 7777:127.0.0.1:8888 192.168.33.11
On centos2, we should now be able to curl 127.0.0.1:7777 and see the contents of Vagrant's home directory on centos1:
[vagrant@centos2 ~]$ curl 127.0.0.1:7777127.0.0.1 - - [09/Aug/2018 12:56:43] "GET / HTTP/1.1" ...
Read now
Unlock full access