# start Systemctl start firewalld# View status Systemctl state firewalld# stop close systemctl disable firewalldsystemctl stop firewalld# put A source address is whitelisted to allow all connections from this source address # This uses the common # setting in the cluster after using Firewall-cmd--Reload Update firewall rules Firewall-cmd--add-rich-rule‘Rule family= "IPv4" source address= "192.168.1.215" accept‘ --Permanentfirewall-cmd--reload# users within a specific domain can connect via SSH, 24 identifies 255.255.255.0Firewall-cmd--remove-service=SSH--Permanentfirewall-cmd--add-rich-rule‘Rule Family=ipv4 Source Address=172.16.30.0/24 accept‘ --Permanentfirewall-cmd--Reloadfirewall-cmd--list-All # Add a user to whitelist Firewall-cmd--add-lockdown-whitelist-user=hadoop--Permanentfirewall-cmd--reload# remove the user ID from the whitelist firewall-cmd--remove-lockdown-whitelist-uid=uidfirewall-cmd--reload# View all open ports: firewall-cmd--list-ports# Open port Firewall-cmd--zone=public--add-port=8080/tcp-- permanent# close port firewall-cmd--remove-port=465/TCP # Open the service, see/etc/firewalld directory, You can configure Firewall-cmd--permanent--zone=public--add-service=sambafirewall-cmd-- Add-service=http--permanent firewall-cmd--reload# Close service Firewall-cmd--zone=public--remove-service=sambafirewall-cmd--reload
Official documents and common references:
Https://access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.html
Https://www.server-world.info/en/note?os=CentOS_7&p=firewalld
Some common configurations of firewalls in CentOS7