The linux centos7 firewall basically uses detailed explanation
- 2020-12-22 17:53:18
- OfStack
1. Basic use of firewalld
Activation:
systemctl start firewalld
Check status:
systemctl status firewalld
Stop:
systemctl disable firewalld
Disable:
systemctl stop firewalld
2.systemctl is the main tool in CentOS7's service management tool, which combines the functions of service and chkconfig in one body.
Start the firewall:
systemctl start firewalld.service
Close the firewall:
systemctl stop firewalld.service
Restart the firewall:
systemctl restart firewalld.service
Display firewall status:
systemctl status firewalld.service
Firewall at startup:
systemctl enable firewalld.service
Disable firewall when starting up:
systemctl disable firewalld.service
Check whether the firewall is started:
systemctl status firewalld
0
View a list of started services:
systemctl list-unit-files|grep enabled
View the list of services that failed to start:
systemctl --failed
3. The configuration firewalld - cmd
View Version:
systemctl status firewalld
3
View Help:
systemctl status firewalld
4
Display status:
systemctl status firewalld
5
View all open ports:
systemctl status firewalld
6
Update firewall rules:
firewall-cmd --reload
View area information:
firewall-cmd --get-active-zones
View the region of the specified interface:
systemctl status firewalld
9
Reject all packages:
firewall-cmd --panic-on
Cancel the rejected status:
firewall-cmd --panic-off
Check whether to reject:
firewall-cmd --query-panic
4: Open port
add
firewall-cmd --zone=public --add-port=80/tcp --permanent ( --permanent Permanent effect, no this parameter is rebooted after invalidity) # open 80 port
Reload the
firewall-cmd --reload
To view
firewall-cmd --zone=public --query-port=80/tcp # To view 80 Whether the port is open
delete
firewall-cmd --zone= public --remove-port=80/tcp --permanent # delete 80 Port configuration