CentOS firewall commonly used commands

1. Check the firewall status:
firewall-cmd --state 
2. Start the firewall
systemctl start firewalld
3. Turn off the firewall
systemctl stop firewalld
4. Check the firewall open ports
firewall-cmd --permanent --zone=public --list-ports
5. Open a new port
firewall-cmd --zone=public --add-port=8080/tcp --permanent
6. Restart the firewall
firewall-cmd --reload
7. Verify that the new port is in effect increase
firewall-cmd --zone=public --query-port=8080/tcp
8. Firewall boot from the start
systemctl enable firewalld.service
9. cancel a firewall ports open
firewall-cmd --zone=public --remove-port=9200/tcp --permanent

Guess you like

Origin www.cnblogs.com/xiaobaixie/p/11210614.html