Set Up SSH Tunneling on a Linux / Unix / BSD Server To Bypass NAT
Here’s how you can set up SSH tunneling on a Linux/Unix/BSD server to bypass NAT (Network Address Translation):
- Connect to the remote server with ssh:
ssh @ -L : :For example, if you want to connect to a remote MySQL server running on remote_server_IP on port 3306, you would use the following command:
ssh @ -L 3306:localhost:3306- Start the tunnel: After you have connected to the remote server, the tunnel will be established, and you can use
localhost:to connect to the remote service on:. In the example above, you would connect tolocalhost:3306to access the remote MySQL server.
Note: The -L option tells ssh to bind the specified to : on the remote server. The connection to the remote service will be made through the encrypted ssh tunnel, bypassing NAT.
