Firewalld Rich Language
格式
firewall-cmd [--zone=zone] --add-rich-rule='rule' [--timeout 9=seconds]firewall-cmd [--zone=zone] --remove-rich-rule='rule'firewall-cmd [--zone=zone] --query-rich-rule='rule'rule [family="<rule family>"] [ source address="<address>" [invert="True"] ] [ destination address="<address>" [invert="True"] ] [ <element> ] [ log [prefix="<prefix text>"] [level="<log level>"] [limit value="rate/duration"] ] [ audit ] [ accept|reject|drop ]# service # 服务名称是 firewalld 提供的其中一种服务。要获得被支持的服务的列表,输入以下命令:firewall-cmd --get-services service name=service_name # port # 端口既可以是一个独立端口数字,又或者端口范围,例如,5060-5062。协议可以指定为 tcp 或 udp port port=number_or_range protocol=protocol # protocol # 协议值可以是一个协议 ID 数字,或者一个协议名。预知可用协议,请查阅 /etc/protocols protocol value=protocol_name_or_ID # icmp-block # 用这个命令阻绝一个或多个 ICMP 类型。 ICMP 类型是 firewalld 支持的 ICMP 类型之一。要获得被支持的 ICMP 类型列表,输入一下命令:firewall-cmd --get-icmptypes icmp-block name=icmptype_name # masquerade # 打开规则里的 IP 伪装。用源地址而不是目的地址来把伪装限制在这个区域内。在此,指定一个动作是不被允许的 # forward-port # 从一个带有指定为 tcp 或 udp 协议的本地端口转发数据包到另一个本地端口,或另一台机器,或另一台机器上的另一个端口。 port 和 to-port 可以是一个单独的端口数字,或一个端口范围。而目的地址是一个简单的 IP 地址。在此,指定一个动作是不被允许的。 forward-port 命令使用内部动作 accept forward-port port=number_or_range protocol=protocol / to-port=number_or_range to-addr=addresslog [prefix=prefix text] [level=log level] limit value=rate/duration # 等级用正的自然数 [1, ..] 表达,持续时间的单位为 s 、 m 、 h 、 d 。 s 表示秒, m 表示分钟, h 表示小时, d 表示天。最大限定值是 1/d ,意为每天最多有一条日志进入accept | reject [type=reject type] | drop
示例
最后更新于