Monday, February 26, 2024
 Popular · Latest · Hot · Upcoming
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1029  / 2 Years ago, wed, march 2, 2022, 12:57:46

Good day everyone. I'm running an Ubuntu desktop 22.04. I'm new to linux world for about a month or so.

I already configure my router for port forwarding.

When I was developing this web app in windows, I got no problem with accessing it via public IP with just configuring my router. I run the web server using nodejs and it's on port 3000.

I could access the web page in my localhost or any computer in my local network just by typing localhost:3000 or but not - an example public IP.

When I run the server. ready - started server on, url: http://localhost:3000

This is my ufw configuration.

I dont know if this would help but I'll post this anyway.

What I would want to achieve is to show the develop web app to my client. Is there any way to do this? Thanks in advance!


Steps I did so far to achieve this and after following @user68186 answer:

  • start my web server at port 80 with sudo

  • forward my external and internal IP port to 80 in my router since setting my external IP to port 80 and running my web server at 3000
    and setting internal PORT to 3000 will not do the trick.

Follow up question:

Is there some configuration needed to achieve forwarding external IP routes from port 80 to port 3000 with iptables?

Say external IP forwarded to internal IP. Thanks much!

More From » networking


Allow port 3000 in firewall

You are not using the default web server ports 80 or 443. As you put it in the question: "I run the web server using nodejs and it's on port 3000." So, you have to open the port 3000.

Open a terminal by pressing Ctrl+Alt+T and enter:

sudo ufw allow proto tcp from any to any port 3000

Forward port 3000 in the router

Make sure port 3000 is forwarded to the Ubuntu server's internal IP address in the home router. This will allow anyone from outside the home LAN access the web server.

The instructions are router specific and beyond the scope of this answer as it has nothing to do with Ubuntu.

enter image description here

Port 80 is the default port for the http protocol. If you want to make it easier for external users to access the web server, you may want to map the router's port 80 to the internal port 3000. This way, external users won't have to add the port number at the end of the external IP address.

enter image description here

The pictures above is just an example. The settings in your router may look different.


Test whether you can access the web server from outside your home network.


Now you may delete the unwanted ufw rules. Use the command:

sudo ufw status numbered

to find the rule number(s) you want to delete, followed by :

    sudo ufw delete N

where N is the number of the rule you want to delete.

Note, the rule numbers may change once you delete a rule. So use the sudo ufw status numbered command again before you delete another rule.

Finally delete the port forwarding rules from your router you do not need.

Hope this helps

[#38] Wednesday, March 2, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 20
Total Questions: 102
Total Answers: 120

Location: Maldives
Member since Mon, Jun 21, 2021
3 Years ago