1. Turn on the firewall
Systemctl Start Firewalld
2. Add
Firewall-cmd--zone=public--add-port=80/tcp--permanent
3. Re-loading
Firewall-cmd --zone= public --query-port=80/tcp
4. Delete
Firewall-cmd--zone= public --remove-port=80/tcp--permanent
Command meaning:
--zone #作用域
--add-port=80/tcp #添加端口 in the format: Port/Communication protocol
--permanent #永久生效, fail after reboot without this parameter
3.firewall-cmd--reload
Attach the basic use of the firewall
1, the basic use of Firewalld start: Systemctl start firewalld off: Systemctl stop firewalld View status: Systemctl status firewalld boot disabled: SYSTEMCT L Disable FIREWALLD Power on: Systemctl enable FIREWALLD 2.systemctl is the main tool in the CentOS7 Service Management tool, which integrates the functionality of the previous service and Chkconfig.
Start a service: Systemctl start Firewalld.service
Close a service: Systemctl stop Firewalld.service
Restart a service: Systemctl restart Firewalld.service
Displays the status of a service: Systemctl status Firewalld.service
Enable a service at boot: Systemctl enable Firewalld.service
Disable a service at boot: systemctl disable Firewalld.service
Check if the service is booting: Systemctl is-enabled firewalld.service
To view a list of services that have been started: Systemctl List-unit-files|grep enabled
To view a list of services that failed to start: Systemctl--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 specified interface zone: Firewall-cmd-- Get-zone-of-interface=eth0 reject All packages: Firewall-cmd--panic-on de-deny status: Firewall-cmd--panic-off View reject: Firewall-cmd-- Query-panic 4. See which ports are open Firewall-cmd--zone=public--list-ports
CentOS 7 Open Firewall port