- Basic use of firewalld
Start: systemctl start firewalld
Close: systemctl stop firewalld
View status: systemctl status firewalld
Startup disabling: systemctl disable firewalld
Startup enabling: systemctl enable firewalld
- Systemctl is the main tool in the service management tool of CentOS7. It integrates the functions of service and chkconfig before.
Start a service: systemctl start firewalld.service
Close a service: systemctl stop firewalld.service
Restart a service: systemctl restart firewalld.service
Display the status of a service: systemctl status firewalld.service
Enable a service at startup: systemctl enable firewalld.service
Disable a service at startup: systemctl disable firewalld.service
Check whether the service is started: systemctl is enabled firewalld.service
View the list of started services: systemctl list unit files | green enabled
View the list of services that failed to start: systemctl -- failed
- Configure firewalld cmd
View version: firewall cmd -- version
View help: firewall cmd -- help
Display status: firewall cmd -- state
View all open ports: firewall cmd -- zone=public -- list ports
Update firewall rules: firewall cmd -- reload
View area information: firewall cmd -- get active zones
View the region of the specified interface: firewall cmd -- get zone of interface=eth0
Reject all packages: firewall cmd -- panic on
Cancel Rejection Status: firewall cmd -- panic off
Check whether to reject: firewall cmd -- query panel
- How to open a port
add to
Firewall cmd -- zone=public -- add port=80/tcp -- permanent
Reload
firewall-cmd --reload
firewall-cmd --zone=public --query-port=80/tcp
firewall-cmd --zone=public --remove-port=80/tcp --permanent