Contents
How to Create SSH Tunneling or Port Forwarding in Linux

SSH tunneling allow you to securely route traffic through your slot using an encrypted tunnel. SSH tunnels can be used to prevent network monitors on your local network from monitoring what sites you visit, or to bypass overly restrictive web filters. They are also useful for trackers that require users to log in from an IP before being able to seed from it.
1. My Setup Environment
For the purpose of this article, we are using the following setup:
- Local Host: 192.168.2.10
- Remote Host: CentOS 7 VPS Server with hostname server1.devops-team.net.
Usually, we can securely connect to a remote server using SSH (without password) as follows.
1 |
ssh myuser@server1.devops-team.net |
2. Local SSH Port Forwarding
This type of port forwarding will help you to connect from your local machine to a remote server using tunnel. Assuming you are behind a restrictive firewall, or blocked by an outgoing firewall from accessing an application running on port 8080 (tomcat page) in your remote server.
To forward a local port (8888) which we can then use to access the application locally as follows. The -L
flag defines the port forwarded to the remote host and remote port.
1 |
ssh myuser@server1.example.com -L 8888:server1.devops-team.net:8080 |
Adding the -N
flag means do not execute a remote command, in this case we will not get a shell.
1 |
ssh -N myuser@server1.example.com -L 8888:server1.devops-team.net:8080 |
The -f
switch instructs ssh to run in the background.
1 |
ssh -f -N myuser@server1.example.com -L 8888:server1.devops-team.net:8080 |
Now, on your local machine, open a browser, instead of accessing the remote application using the address http://server1.devops-team.net:8080 , you can simply use localhost:8888
or your_local_ip_address:8888
, as shown in the screenshot below.

3. Conclusion
In this post, i have explained How To Install and Secure phpMyAdmin on Ubuntu.
If you have any questions or feedback, feel free to leave a comment.
As always, if you found this post useful, then click like and share it 🙂