Last active
May 31, 2021 12:17
-
-
Save nyrahul/767681eefc28a43e9d587bf61a7a9898 to your computer and use it in GitHub Desktop.
ssh port forwarding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh -L 6060:127.0.0.1:6060 [email protected] | |
golang pprof tool by default starts the pprof web server on localhost:6060. My pprof was running inside a VM and I needed to access the web server from the host. I could ssh to the VM. Thus I needed to enable port-forwarding on the host to the VM (remote). | |
ssh -L 6060:127.0.0.1:6060 [email protected] | |
| | | |-------v------------| | |
| | | \--------------- remote ssh user@hostname | |
| | | | |
| | \--------- remote port to forward | |
| | | |
| \----------------- remote IP to forward ... in my case it was localhost | |
| | |
\------------------------ Local port to use for forwarding | |
After this I could use the web-browser on localhost:6060 __on the host__ to access the localhost:6060 on the VM. | |
[Update] | |
This even works with vagrant ssh. | |
vagrant ssh -- -L 6060:127.0.0.1:6060 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment