Article From:https://www.cnblogs.com/appleat/p/9967450.html

1、firewalldBasic use

Start: system CTL start firewalld
Close: system CTL stop firewalld
View status: system CTL status firewalld
Boot Disabled: System CTL disable firewalld
Boot-up: system CTL enable firewalld
 
 

2.systemctlIt is the main tool in the service management tools of CentOS 7. It integrates the functions of service and chkconfig before.

Start a service: system CTL start firewalld.service
Close a service: system CTL stop firewalld.service
Restart a service: system CTL restart firewalld.service
Display the status of a service: system CTL status firewalld.service
Enable a service at boot time: system CTL enable firewalld.service
Disable a service at boot time: system CTL disable firewalld.service
Check if the service is booted: system CTL IS-enabled firewalld.
View the list of started services: system CTL list-unit-files | grep enabled
View the list of services that failed to start: system CTL — failed

3.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 area where the specified interface belongs: firewall-cmd — get-zone-of-interface = eth0
Deny all packages: firewall-cmd–panic-on
Cancel rejection status: firewall-cmd–panic-off
Check whether to reject: firewall-cmd–query-panic
 

4 How to open a port?

Add to
firewall-cmd –zone=public –add-port=80/tcp –permanent    (–permanentPermanent validity. Failure after restart without this parameter)
reload
firewall-cmd –reload
See
firewall-cmd –zone= public –query-port=80/tcp
delete
firewall-cmd –zone= public –remove-port=80/tcp –permanent
Link of this Article: CentOS 7 Firewall Operation

Leave a Reply

Your email address will not be published. Required fields are marked *