firewall-cmd命令的富语言(richlanguage)示例

一、为协议“ah”启用新的IPv4和IPv6连接

  firewall-cmd --permanent --add-rich-rule 'rule protocol value="ah" accept'

二、允许新的IPv4和IPv6连接服务ftp和log 1每分钟使用审计

  firewall-cmd --permanent --add-rich-rule 'rule service name="ftp" log limit value="1/m" audit accept'

三、允许使用syslog从地址192.168.0.0/24为服务tftp和每分钟日志1提供新的IPv4连接

  firewall-cmd --permanent --add-rich-rule 'rule family="ipv4" source address="192.168.0.0/24" service name="tftp" log prefix="tftp" level="info" limit value="1/m" accept'

四、新的IPv6连接从1:2:3:4:6::到服务半径都被拒绝,并以每分钟3次的速度记录。接受来自其他源的新的IPv6连接。

  firewall-cmd --permanent --add-rich-rule 'rule family="ipv6" source address="1:2:3:4:6::" service name="radius" log prefix="dns" level="info" limit value="3/m" reject'

  firewall-cmd --permanent --add-rich-rule 'rule family="ipv6" service name="radius" accept'

五、用tcp协议将IPv6端口/数据包从端口4011上的1:2:3:4::转发到端口4012上的1:2:3:4:7

  firewall-cmd --permanent --add-rich-rule 'rule family="ipv6" source address="1:2:3:4:6::" forward-port to-addr="1::2:3:4:7" to-port="4012" protocol="tcp" port="4011"'

六、白名单源地址允许所有连接从192.168.2.2

  firewall-cmd --permanent --add-rich-rule 'rule family="ipv4" source address="192.168.2.3" reject type="icmp-admin-prohibited"'

七、黑名单源地址以拒绝来自192.168.2.3的所有连接

  firewall-cmd --permanent --add-rich-rule 'rule family="ipv4" source address="192.168.2.3" reject type="icmp-admin-prohibited"'

八、从192.168.2.4删除所有连接的黑名单源地址

  firewall-cmd --permanent --add-rich-rule 'rule family="ipv4" source address="192.168.2.4" drop'

原文地址:https://www.cnblogs.com/gchen-frank/p/11417094.html