On Ubuntu 20.04 how do you open a port in the firewall
Finally found the answer here: https://www.cyberciti.biz/faq/how-to-configure-firewall-with-ufw-on-ubuntu-20-04-lts/
The answer appears to be that ufw is disabled by default and there is a default policy in place that doesn't use that. So I ran:
sudo ufw enable
And then ran
sudo ufw allow 4200
now sudo ufw status verbose
returns me the information I wanted to see.
Additionally, https://stackoverflow.com/questions/43492354/how-to-allow-access-outside-localhost taught me to run ng serve --host 0.0.0.0
to serve my angular app outside of localhost.
Thom
Updated on September 18, 2022Comments
-
Thom over 1 year
Googled and found nothing recent. I did find docs on ufw and I ran:
thomas@Westeros:~/git/heavyweight-software$ sudo ufw status verbose [sudo] password for thomas: Status: inactive
So I'm thinking it isn't running ufw anymore. I can ping my computer, but I can't connect to it on my development web server port 4200. Can't find any docs on ubuntu site either.
-
Thom almost 4 yearsLet me try again. When I run ufw status verbose it says status: inactive, which tells me that ufw is not my firewall. Running the allow 4200 command accomplished nothing and the status still says inactive.
-
KilianAlias almost 4 yearsAh I see. Are you connecting through LAN or the internet, as you will need to portforward if you are connecting over the internet.
-
Thom almost 4 yearsI am connecting over a LAN.
-
KilianAlias almost 4 yearsUFW is the default firewall application. You could try enabling it and adding a rule, but other than that I am not sure.