Setup static port forwarding on Linux no Router configuration required
July 12, 2020
Hello and welcome back to another quick blog. Today we are going to see the best alternative of port forwarding all time. I've been asked many times to make this tutorial as we require port forwarding to access over the internet.
You can port forward your small PHP server to a big node.js project the same way I'm going to show you today. So without wasting our time lets get our hands dirty on the terminal.
Requirements for static port forwarding on Linux are:-
Internet
Openvpn
Portmap
Let's dig the things step by step.
Step 1 Go to Portmap.io
Is a well-known port forwarding option after Ngrock. You will find it easy to install and it's static. This means you can access the same
Step 2 Loing or Register
(NOTE: no fake email id and carefully choose your user name as it will be visible in your forwarding link in my case user name is radhika001)
Step 3 Click onCreate New Configuration
to create the configuration file to make our work done by the port forwarding
Step 4 Do some required changes
Type name for your configuration, make sure your port forwarded link will contain a name for your new configuration profile. You can select a port from UDP or TCP. I'm going to select TCP. Do not change anything. Now click on generate will be at the left bottom of the screen.
Step 5 Click on mapping rule and create a new rule
Do the changes carefully
Step 6 Set up the port on your PC
Do not change anything just change the option port on your PC. Enter any random port and hit creat.
Your port forwarding details may look like the image shown below.
tcp://radhika001-25126.portmap.host:25126 => 4999
Let us break it down.
Your LHOST is radhika001-25126.portmap.host
Your LPORT for application 25126
Your LPORT for Listener 4999
Let us break it down.
Your LHOST is radhika001-25126.portmap.host
Your LPORT for application 25126
Your LPORT for Listener 4999
Step 7 Click user name
Click on your user name on the same page. I've highlighted it you can see the image below. On the next page go to the bottom left and hit the Download button. It will download a file like this radhika001.myvpn0001.ovpn
We are done with most of the parts. Now we have to configure our Linux system. I'm using Ubuntu for the demonstration you can perform
Now open the terminal and paste a command
sudo apt install openvpn
This command will install the Open VPN client in your Linux system. Once it gets installed. Move the downloaded file to a separate directory/folder. and run another command (open terminal in the same folder where configuration file exists)
openvpn --config radhika001.myvpn0001.ovpn
Details:
openvpn --config(is the command to run the file you have downloaded) radhika001.myvpn0001.ovpn
If everything goes well you will see some text like shown below.
It means you have successfully configured the Portmap.io using an open VPN. The best part of it is, you can use this configuration file any time anywhere just use the command to run the VPN file and use the persistence port forwarding on Linux.
openvpn --config(is the command to run the file you have downloaded) radhika001.myvpn0001.ovpn
If everything goes well you will see some text like shown below.
If you want to see the video version of this blog where I've shown an example of a bash file that can be port forwarded using this port map. I'm working on that project I'll provide the download files very soon. Must watch the video and subscribe to my youtube channel. Thank you for clicking the link.