Check if ports are allowed in Firewall ubuntu
5,451
If you configure all your firewall setting with ufw, then ufw status
would show you the ports. But sometimes (in my experience) this doesn't show all configured firewall ports and options.
You would get a general output with:
iptables -L -v -n
-L = list all ports
-v = make the output verbose
-n = do print port numbers instead of servicenames (otherwise it would print "http" or "ssh" instead of "80" or "22".
The command is faster when using the -n option an also can be `grep`ped or `ack`ed (https://beyondgrep.com/) for the port number
Comments
-
Pablo over 1 year
Currently I'm trying to setup my ssl in docker instance. I'm trying to check if these ports are allowed in my firewall
Port: 443 and 4021
I've searched that allowing specific port for firewall using this terminal command
sudo ufw allow 4021
But how can I check and see all the ports allowed in my firewall?
-
Pablo over 4 yearssomething like
sudo ufw -L?
but this gives list of commands such asenable, disabled, default arg and so on
-
MacMartin over 4 yearswhat do you mean? like @itsahobby and I said:
ufw status
(use with sudo or with the root-account). Did you try it? it also "lists" the ports:sudo ufw status
-
MacMartin over 4 years@RaeIan is it still unclear or is your question resolved?