示例:基于目标类配置速率限制过滤器
此示例说明如何配置速率限制的无状态防火墙过滤器。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
开始之前,请配置目标类 class1
。
概述
配置
下面的示例要求您在各个配置层级中进行导航。有关导航 CLI 的信息,请参见 在配置模式下使用 CLI 编辑器。
CLI 快速配置
要快速配置此示例,请将以下命令复制到文本文件中,删除所有换行符,然后将命令粘贴到层次结构级别的 CLI [edit]
中。
set firewall policer police_class1 if-exceeding bandwidth-limit 25m set firewall policer police_class1 if-exceeding burst-size-limit 25m set firewall policer police_class1 then discard set firewall filter rl_dclass1 term term1 from destination-class class1 set firewall filter rl_dclass1 term term1 then policer police_class1 set interfaces ge-0/0/1 unit 0 family inet address 10.1.2.1/30 set interfaces ge-0/0/1 unit 0 family inet filter input rl_dclass1
配置无状态防火墙过滤器
分步过程
要使用目标类class1
的监管器police_class1
配置无状态防火墙过滤器rl_dclass1
:
创建监管器模板
police_class1
。[edit] user@host# edit firewall policer police_class1
配置监管器模板
police_class1
。[edit firewall policer police_class1] user@host# set if-exceeding bandwidth-limit 25m user@host# set if-exceeding burst-size-limit 25m user@host# set then discard
创建无状态防火墙过滤器
rl_dclass1
。[edit] user@host# edit firewall filter rl_dclass1
配置一个过滤器术语,该术语使用监管器
police_class1
对目标类class1
的流量进行速率限制。[edit firewall filter rl_dclass1] user@host# set term term1 from destination-class class1 user@host# set term term1 then policer police_class1
将无状态防火墙过滤器应用于逻辑接口
分步过程
要将过滤器 rl_dclass1
应用于逻辑接口,请执行以下操作:
配置要应用无状态防火墙过滤器的逻辑接口。
[edit] user@host# edit interfaces ge-0/0/1 unit 0 family inet
配置逻辑接口的接口地址。
[edit interfaces ge-0/0/1 unit 0 family inet] user@host# set address 10.1.2.1/30
将无状态防火墙过滤器应用于逻辑接口。
[edit interfaces ge-0/0/1 unit 0 family inet] user@host# set filter input rl_dclass1
确认并提交候选配置
分步过程
要确认并提交候选配置,请执行以下操作:
通过输入
show firewall
配置模式命令确认无状态防火墙过滤器的配置。如果命令输出未显示预期的配置,请重复此示例中的说明以更正配置。[edit] user@host# show firewall policer police_class1 { if-exceeding { bandwidth-limit 25m; burst-size-limit 25m; } then discard; } filter rl_dclass1 { term term1 { from { destination-class class1; } then policer police_class1; } }
通过输入
show interfaces
配置模式命令确认接口的配置。如果命令输出未显示预期的配置,请重复此示例中的说明以更正配置。[edit] user@host# show interfaces ge-0/0/1 { unit 0 { family inet { filter { input rl_dclass1; } address 10.1.2.1/30; } } }
如果完成设备配置,请提交候选配置。
[edit] user@host# commit
验证
要确认配置工作正常,请输入 show class-of-service ge-0/0/1
操作模式命令。