示例:使用每秒数据包数限制过滤器保护路由引擎
此示例演示如何配置基于每秒数据包的速率限制过滤器以提高安全性。它将应用于回传接口,以帮助保护路由引擎免遭拒绝服务攻击。
这种类型的过滤器和监管器组合只是多层方法中的一个元素,可用于帮助保护路由引擎。需要其他保护层才能完全保护路由引擎。请参阅第一天:有关详细信息,请保护 M、MX 和 T Series 上的路由引擎。
要求
配置此示例之前,不需要在设备初始化之外进行特殊配置。
概述
配置
下面的示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅Cli 用户指南中的使用配置模式中的 CLI 编辑器。
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除任何换行符,更改与网络配置匹配的必要详细信息,然后将命令复制并粘贴到[edit]
层次结构级别的 CLI 中。
set firewall policer police_pps if-exceeding-pps pps-limit 1k set firewall policer police_pps if-exceeding-pps packet-burst 150 set firewall policer police_pps then discard set firewall family inet filter my_pps_filter term term1 then policer police_pps set interfaces lo0 unit 0 family inet filter input my_pps_filter set interfaces lo0 unit 0 family inet address 127.0.0.1/32
配置监管器和无状态防火墙过滤器
分步过程
要配置监管器police_pps
和无状态防火墙过滤器my_pps_filter
:
配置监管器模板
police_pps
。[edit firewall] user@host# set policer police_pps if-exceeding-pps pps-limit 1k user@host# set policer police_pps if-exceeding-pps packet-burst 150 user@host# set policer police_pps then discard
创建无状态防火墙过滤器
my_pps_filter
。[edit] user@host# edit firewall family inet filter my_pps_filter
配置一个使用监管器
police_pps
的过滤器术语,按协议系列评定流量限制。[edit firewall family inet filter my_pps_filter] user@host# set term term1 then policer police_pps
将无状态防火墙过滤器应用于回传逻辑接口
分步过程
要将过滤器my_pps_filter
应用于回传接口:
配置将应用无状态防火墙过滤器的逻辑回传接口。
[edit] user@host# edit interfaces lo0 unit 0
将无状态防火墙过滤器应用于回传接口。
[edit interfaces lo0 unit 0] user@host# set family inet filter input my_pps_filter
配置环回接口的接口地址。
[edit interfaces lo0 unit 0] user@host# set family inet address 127.0.0.1/32
成果
进入show firewall
配置模式命令,确认无状态防火墙过滤器的配置。如果命令输出未显示预期的配置,请重复此示例中的说明以更正配置。
user@host# show firewall family inet{ filter my_pps_filter { term term1 { then policer police_pps; } } } policer police_pps { if-exceeding-pps { pps-limit 1k; packet-burst 150; } then discard; }
进入show interfaces lo0
配置模式命令,确认接口配置。如果命令输出未显示预期的配置,请重复此示例中的说明以更正配置。
user@host# show interfaces lo0 unit 0 { family inet { filter { input my_pps_filter; } address 127.0.0.1/32; } }
如果您完成了设备配置,请从配置模式进入提交。
user@host# commit
针对
验证过滤器的操作
用途
要确认配置是否正常工作,请输入show firewall filter my_pps_filter
操作模式命令。
以下输出结果从另一台主机到受测路由器的快速 ping 运行。为了在输出中显示结果,ping 测试期间使用了 的设置 和 pps-limit
50packet-burst
10 。
行动
user@host> show firewall filter my_pps_filter Filter: my_pps_filter Policers: Name Bytes Packets police_pps-term1 8704 17