CentOS 7.5 firewall firewall

1. Check firewalld service status

a. Details: systemctl status firewalld
b. Newsletter:firewall-cmd --state

2. Turn on, restart, and turn off the firewalld service

a. There is return information:

On: service firewalld start
Restart: service firewalld restart
Off:service firewalld stop

b. No return information:

On: systemctl start firewalld
Restart: systemctl restart firewalld
Off:systemctl stop firewalld

3. View firewall rules (all)

firewall-cmd --list-all

4. Query, open, and remove ports

4-1 Query the open port: firewall-cmd --list-port
4-2 Query whether the port is open: firewall-cmd --query-port=8080/tcp
4-3 Open port 80: firewall-cmd --permanent --add-port=80/tcp
4-4 Remove port 80: firewall-cmd --permanent --remove-port=80/tcp
4-5 Restart to take effect (restart after modifying the configuration port): firewall-cmd --reload
#Parameter explanation
1) firwall-cmd: is a tool for operating firewall provided by Linux;
2) –permanent: indicates that the setting is persistent;
3) –add-port: identifies the added port;
4) –remove-port: identifies the removed port;

5. Set self-start after power-on

systemctl disable firewalld

6. Prohibit self-starting after booting

systemctl disable firewalld

Guess you like

Origin blog.csdn.net/rao991207823/article/details/109431627