Port Forwarding for ‘truely’ remote access

Port Forwarding for ‘truely’ remote access

Port Forwarding is an awesome and versatile tool for accessing a computer or a device from anywhere in the world. It requires a few setups in your router and then you are ready to go.

Uses

I have used it for several purposes:

  • Local websites now become accesible remotely.
  • It enables me to access a server with SSH from any part in the world with an Internet connection.
  • I can access a security camera from my cellphone.
  • You can play videogames with LAN-only capabilities across the internet.

And many more uses are possible!

Find it out first!

Ask.

Your Internet Service Provider (ISP) has to grant you access to a certain port(s) which are the key to this process. Call or write them to (gently) ask at least 5 ports for “Port Forwarding” to be assigned to your router, just in case if you want to expand it later for another uses. If you are familiarized with Computer Networking, this means allowing TCP and UDP packages from Transport Layer to come to your router.

If your ISP has granted you with a port for accesing your router from any part of the world, great! Because that was the hardest from all steps. Suppose that they gave you the port 22221. Remember this number.

Public IP

Now, you need to find out the public IP address to access your router. Go to any of the following links:

Let's suppose that the IP displayed in 100.145.10.89. This is a randomly generated IPv4 number and yours will be definitely different. This means that you can access your router with the address:

100.145.10.89:22221

Yay!

But hold on because the setup isn't over; it just have started.

Into the router

Which is the IP address of your router?

Go to the network properties from your computer; it will be different on every operating system. Click on the interface by which you are connected to your network and search for the IP address of your router, as shown in the image. It usually ends with ‘.1' .

How do you access your router?

Now enter the IP address in your web browser (Google Chrome, Safari, Firefox, Edge, etc). In my case:

http://192.168.100.1

Do you know the credentials to enter the configuration of your router? If not, check below your router if there is handwritten note with the username and password. The most spreadout combo is:

  • username: admin
  • password: admin

Try it.

Port Forwarding New Rule

Once you have entered, go to the Port Forwarding option. The user interface will certainly vary from one router to another, but there are always a big label that says “PORT FORWARDING”. I will show you step by step with screenshots from mine. I'm using the Synology RT2600AC for this example.

Click on Network Center -> Port Forwarding -> Port Forwarding. Create a new rule.

  • Name: Give a name to the new rule (i.e. “PC Remote access”).
  • Private IP address: What's the IP address of the device or computer in your local area network that you want to have access to?
  • Public port: The port that the ISP gave you. The port from this example is 22221.
  • Private port: Which port will the intended application will use? For example, if you want to access a webpage, then it's the port 80.
  • Protocol: If you are not sure, leave both TCP and UDP enabled.
Port Forwarding inside the router's configurations.

Common port numbers

There are some reserved port that you shouldn't use because it may enter in conflict with your application. This isn't likely to happen if you use the ports above 1024.

AssignmentPort
FTP Data Transfer20
FTP Command Control21
SSH22
Telnet23
HTTP (for Websites)80
POP3110
IMAP143

Check a more complete list following this link

Testing

I'm going to check if a sample website located in my Raspberry Pi can be accessed from anywhere is the world with the public IP 100.145.10.89 and the designed port 22222. So the access route would be:

  • From: 100.145.10.89, port 22222.
  • To: 192.168.100.32, port 80.

In order to access it remotely, I typed in my web browser:

http://100.145.10.89:22222

Notice that to do this test, you need to be outside your local network. You can this this conformtably by disconnecting your cellphone from your Wi-Fi (as long as you have cellular data and a few megabytes to spare) and use your cellphone web browser instead.

This was the result:

It works! The Apache default website shows up and I have now access remotely to check or interact with it from anywhere with an internet conection.

By the way, if you want to know how to create a web server for your Raspberry Pi, follow this link to learn it in a simple way, step-by-step.

Advanced Configuration

If you use an application specific port, then you will need to specify the port that you are going to use. This means, you will have to open a Firewall port in the operating system that you are using. You should use any port from 10000 to 63999.

The following video explains how to open a port in Windows 10 firewall. Check it out.

You have reached this far!

Thank you for reading the blog post. Your comments and suggestions are welcomed. At the bottom of this page, leave a message or just say hi! The whole team of techZorro will appreciate it. Don't forget to share it on social media as well.

techZorro’s Index of Content

Click on the following link to browse likewise content in the blog in techZorro. This index will help you see what you are looking for in a bird’s eye view.

techZorro's Newsletter!

If you enjoyed this blog post, please subscribe to techZorro’s newsletter so you don’t miss any future blog posts!

One Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.