Open Firewall Rules on CentOS 7 When Apache Tomcat Access with IP Address


Default port is 8080


To view open ports, use the following command.

$ firewall-cmd --list-ports


We use the following to see services whose ports are open.

$ firewall-cmd --list-services


We use the following to see services whose ports are open and see open ports

$ firewall-cmd --list-all


To add a service to the firewall, we use the following command, in which case the service will use any port to open in the firewall.

$ firewall-cmd --add-services=http


For this service to be permanently open we use the following command.

$ firewall-cmd --permanent --zone=public --add-service=http


To add a port, use the following command

$ firewall-cmd --permanent --zone=public --add-port=8080/tcp


To run the firewall must be reloaded using the following command.

$ firewall-cmd --reload


Using semanage

$ semanage port -a -t ssh_port_t -p tcp new_port_number


Source :

https://stackoverflow.com/questions/24729024/open-firewall-port-on-centos-7

https://superuser.com/questions/1590367/unable-to-bind-to-nonstandard-ports-in-centos-7

Comments