firewall防火墙配置

时间:2021-09-10 18:37:43
防火墙列表
firewall-cmd --list-all
添加防火墙策略
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.10.5" port protocol="tcp" port="10050" accept'
删除防火墙策略
firewall-cmd --permanent --remove-rich-rule=' rule family="ipv4" source address="192.168.10.5" port protocol="tcp" port="10050" accept '
丢弃来自192.168.10.1的任何连接
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.10.1" drop'
添加端口策略
firewall-cmd --permanent --add-port=${port}/tcpfirewall-cmd --permanent --remove-port=${port}/tcp
重启防火墙
firewall-cmd --reload
参数
--permanent 永久