Last active
December 29, 2020 15:48
-
-
Save AviKKi/7b967ad822bdaaa693d47e3aa7bcc645 to your computer and use it in GitHub Desktop.
Practical aspects of using SSH tunneling are demostrated here, which can potentially replace services like ngrok, localtunnel, DDNS etc.
This file contains 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
by default ssh daemon's config are stored in `/etc/ssh/sshd_config` and does not allow port forwarding, to enable it set `AllowTcpForwarding yes` and also `GatewayPorts yes` |
This file contains 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
using local and dynamic port forwarding. | |
TODO | |
include suitable description and examples. |
This file contains 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 local_port:remote_addr:remote_port username@remote` | |
Assume an example where we I have a development server running on my local machine on port 8080, (i.e. http://localhost:8080/), and I have ssh access to a remote server(IP 3.182.212.9) that is exposed to the internet. | |
To tunnel it | |
1. run below command on your computer. | |
`$ssh -R 8080:localhost:8080 [email protected]` | |
2. in a browser open 3.182.212.9:8080 | |
________________ ________________ | |
| | | | | |
| Local server | <-----> | Public server | <-------> [ Internet ] | |
|________________| |________________| | |
This capability of ssh makes it pretty useful and competitive to services like ngrok,serveo, localtunnel etc. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment