![]() ![]() ssh -R 5000:localhost:80 all the magic! You can now simply reach your local webserver via. Let’s start with the general syntax of remote port forwarding: ssh -R :: let’s simply forward our local web-server to our remote machine on port 5000. ![]() In this example we are going to make our local web-server (Port 80) available on a remote server on Port 5000. This is the full example: ssh -L 127.0.0.1:5000:localhost:3306 port forwarding So you can also only bind it locally to your 127.0.0.1 (on your local machine). If you do not specify it, the remote port will be bound locally to all interfaces ( 0.0.0.0). Yes, you are right! The complete syntax is: ssh -L ::: local address is an optional parameter. ![]() ssh -L 5000:localhost:3306 all the magic! You can now simply reach the remote database from your local machine with mysql -host=127.0.0.1 -port=5000 or any other client.īut wait… which local address does it listen on? Let’s start with the general syntax of local port forwarding: ssh -L :: let’s simply forward our remote MySQL server to our local machine on port 5000. In this example we are going to make a remote MySQL Server (Port 3306) available on our local computer on port 5000. Remote MySQL server (remote port 3306) to local machine on local port 5000: ssh -L 5000:localhost:3306 web-server (local port 80) to remote server on remote port 5000: ssh -R 5000:localhost:80 port forwarding The SSH command syntax uses the same easy to remember abbreviations: -L (forward to my local machine) and -R (forward to my remote machine). It should now be pretty easy to remember: Local and remote port forwarding always refers to where to relay the port to. Remote port forwarding might come in handy if you for example want to make your local web-server available on a port of a public server, so that someone can quickly check what your local web-server provides without having to deploy it somewhere publicly. The second option is to make your local port available on a remote server ( ssh -R). A very basic use-case is if your remote server has a MySQL database daemon listening on port 3306 and you want to access this daemon from your local computer. You can relay a port from a remote server to your local machine with ssh -L, hence called local port forwarding. When it comes to the art of SSH tunnelling, there are basically two options where to relay a port to. Original source: Local vs Remote SSH port forwarding We will be prompoted to reauthenticate Port forwarding Basic ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |