Note: If you have SELinux enabled you’ll need to allow the port in semanage.
Basic syntax
firewall-cmd --zone=public --add-port=(port number)/(protocal)
So the command to allow port 80 through the firewall would be
firewall-cmd --zone=public --add-port=http/tcp or firewall-cmd --zone=public --add-port=80/tcp
The above command only works for the running instance of firewalld. If you want to add the port permanetely you need to run the above command and then run it again with “–permanent” added to the end of the command.
example:
firewall-cmd --zone=public --add-port=http/tcp firewall-cmd --zone=public --add-port=http/tcp --permanent