使用firewall-cmd添加富规则:
1.拒绝来自public区域中ip地址为192.168.0.11的所有流量
firewall-cmd --permanent --zone=public --add-rich-rule='rule family=ipv4 source address=192.168.0.11/32 reject'
2.允许来自127.16.0.0/16 网段的访问
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=172.16.0.0/16 accept'
3.拒绝192.168.0.100主机访问本地的Samba服务
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=192.168.0.100/24 service name=samba reject'
完了,之后重启防火墙
firewall-cmd --reload
查看规则:
firewall-cmd --list-all