防火墙基础操作
shell
#开启防火墙
systemctl start firewalld
shell
#关闭防火墙
systemctl stop firewalld
重新加载防火墙规则(改了规则后均需执行)
shell
firewall-cmd --reload
防火墙开放某端口
shell
firewall-cmd --permanent --add-port=8080/tcp
防火墙禁用某ip访问
shell
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.0.9" drop'
防火墙查看当前规则
shell
firewall-cmd --list-all
防火墙移除某条规则
shell
firewall-cmd --permanent --remove-rich-rule='rule family="ipv4" source address="192.168.0.9" drop'