- play_arrow 配置防火墙过滤器
- play_arrow 了解防火墙过滤器如何保护您的网络
- play_arrow 防火墙过滤器匹配条件和操作
- 防火墙过滤器概述(OCX 系列)
- ACX 系列路由器上的防火墙过滤器配置文件概述(Junos OS 演化版)
- 了解防火墙过滤器匹配条件
- 了解防火墙过滤器规划
- 了解如何评估防火墙过滤器
- 了解防火墙过滤器匹配条件
- 防火墙过滤器灵活匹配条件
- 防火墙过滤器非终止操作
- 防火墙过滤器终止操作
- 防火墙过滤器匹配条件和操作(ACX 系列路由器)
- ACX 系列路由器中的防火墙过滤器匹配条件和操作 (Junos OS 演化版)
- 与协议无关的流量的防火墙过滤器匹配条件
- IPv4 流量的防火墙过滤器匹配条件
- IPv6 流量的防火墙过滤器匹配条件
- 基于数字或文本别名的防火墙过滤器匹配条件
- 基于位字段值的防火墙过滤器匹配条件
- 基于地址字段的防火墙过滤器匹配条件
- 基于地址类的防火墙过滤器匹配条件
- 了解 MPLS 流量的基于 IP 的过滤和选择性端口镜像
- MPLS 流量的防火墙过滤器匹配条件
- MPLS 标记的 IPv4 或 IPv6 流量的防火墙过滤器匹配条件
- VPLS 流量的防火墙过滤器匹配条件
- 第 2 层 CCC 流量的防火墙过滤器匹配条件
- 第 2 层桥接流量的防火墙过滤器匹配条件
- 环路接口上的防火墙过滤器支持
- play_arrow 将防火墙过滤器应用于路由引擎流量
- 在第 3 层 VPN 中的路由实例的环路接口上配置逻辑单元
- 示例:配置过滤器以根据前缀列表限制对端口的 TCP 访问
- 示例:配置无状态防火墙过滤器以接受来自可信源的流量
- 示例:配置过滤器以阻止 Telnet 和 SSH 访问
- 示例:配置过滤器以阻止 TFTP 访问
- 示例:配置过滤器以接受基于 IPv6 TCP 标志的数据包
- 示例:配置过滤器以阻止对端口的 TCP 访问(来自指定 BGP 对等方除外)
- 示例:配置无状态防火墙过滤器以防止 TCP 和 ICMP 泛滥
- 示例:使用每秒数据包数速率限制过滤器保护路由引擎
- 示例:配置过滤器以排除 LAC 订阅者的 DHCPv6 和 ICMPv6 控制流量
- DHCP 防火墙过滤器的端口号要求
- 示例:配置 DHCP 防火墙过滤器以保护路由引擎
- play_arrow 将防火墙过滤器应用于传输流量
- 示例:配置过滤器以用作入口队列过滤器
- 示例:配置过滤器以匹配 IPv6 标志
- 示例:配置过滤器以匹配端口和协议字段
- 示例:配置过滤器以计算接受和拒绝的数据包
- 示例:配置过滤器以计数和丢弃 IP 选项数据包
- 示例:配置过滤器以对 IP 选项数据包进行计数
- 示例:配置过滤器以对接受的数据包进行计数和采样
- 示例:配置过滤器以将 DSCP 位设置为零
- 示例:配置过滤器以将 DSCP 位设置为零
- 示例:将筛选器配置为匹配两个不相关的条件
- 示例:将过滤器配置为基于地址接受 DHCP 数据包
- 示例:配置过滤器以接受来自前缀的 OSPF 数据包
- 示例:配置无状态防火墙过滤器以处理片段
- 配置防火墙过滤器以防止或允许 IPv4 数据包分段
- 配置防火墙过滤器以丢弃带有移动扩展标头的入口 IPv6 数据包
- 示例:基于 IPv6 源或目标 IP 地址配置出口过滤器
- 示例:基于目标类配置速率限制过滤器
- play_arrow 在逻辑系统中配置防火墙过滤器
- play_arrow 配置防火墙过滤器记帐和日志记录
- play_arrow 将多个防火墙过滤器连接到单个接口
- play_arrow 将单个防火墙过滤器连接到多个接口
- play_arrow 配置跨 IP 网络的基于过滤器的隧道
- play_arrow 配置服务过滤器
- play_arrow 配置简单筛选器
- play_arrow 配置第 2 层防火墙过滤器
- play_arrow 为转发、分段和监管配置防火墙过滤器
- play_arrow 配置防火墙过滤器(EX 系列交换机)
- EX 系列交换机的防火墙过滤器概述
- 了解防火墙过滤器的规划
- 了解防火墙过滤器匹配条件
- 了解防火墙过滤器如何控制数据包流
- 了解如何评估防火墙过滤器
- 了解 EX 系列交换机上桥接数据包和路由数据包的防火墙过滤器处理点
- EX 系列交换机的防火墙过滤器匹配条件、操作和操作修改符
- EX 系列交换机上防火墙过滤器匹配条件、操作和操作修饰符的平台支持
- 支持交换机上环路防火墙过滤器的匹配条件和操作
- 配置防火墙过滤器(CLI 过程)
- 了解防火墙过滤器如何测试数据包的协议
- 了解 EX 系列交换机基于过滤器的转发
- 示例:为 EX 系列交换机上的端口、VLAN 和路由器流量配置防火墙过滤器
- 示例:在 EX 系列交换机的管理接口上配置防火墙过滤器
- 示例:使用基于过滤器的转发将应用程序流量路由到安全设备
- 示例:将防火墙过滤器应用于启用了 802.1X 或 MAC RADIUS 身份验证的接口上的多个请求方
- 验证监管器是否正常运行
- 防火墙过滤器故障排除
- play_arrow 配置防火墙过滤器(QFX 系列交换机、EX4600 交换机、PTX 系列路由器)
- 防火墙过滤器概述(QFX 系列)
- 了解防火墙过滤器规划
- 规划要创建的防火墙过滤器数量
- 防火墙过滤器匹配条件和操作(QFX 和 EX 系列交换机)
- 防火墙过滤器匹配条件和操作(QFX10000交换机)
- 防火墙过滤器匹配条件和操作(PTX 系列路由器)
- PTX 系列数据包传输路由器和 T 系列矩阵路由器之间的防火墙和监管差异
- 配置防火墙过滤器
- 将防火墙过滤器应用于接口
- 环路接口上的 MPLS 防火墙过滤器概述
- 在交换机上配置 MPLS 防火墙过滤器和监管器
- 在路由器上配置 MPLS 防火墙过滤器和监管器
- 配置 MPLS 防火墙过滤器和监管器
- 了解防火墙过滤器如何测试协议
- 了解桥接和路由数据包的防火墙过滤器处理点
- 了解基于过滤器的转发
- 示例:使用基于过滤器的转发将应用程序流量路由到安全设备
- 配置防火墙过滤器以解封装 GRE 或 IPIP 流量
- 验证防火墙过滤器是否正常运行
- 监控防火墙过滤器流量
- 防火墙过滤器配置疑难解答
- play_arrow 配置防火墙过滤器计费和日志记录(EX9200 交换机)
-
- play_arrow 配置流量监管器
- play_arrow 了解流量监管器
- 监管器实施概述
- ARP 监管器概述
- 示例:配置 ARP 监管器
- 了解监管器和令牌桶算法的优势
- 确定流量监管器的适当突发大小
- 使用流量监管控制网络访问概述
- 流量监管器类型
- 监管器和防火墙过滤器操作的顺序
- 了解监管数据包的帧长度
- 支持的监管标准
- 分层监管器配置概述
- 了解增强型分层监管器
- 基于每秒数据包数 (pps) 的监管器概述
- 应用流量监管器的准则
- 聚合以太网接口的监管器支持概述
- 示例:为物理接口上的聚合流量配置物理接口监管器
- PTX 系列数据包传输路由器和 T 系列矩阵路由器之间的防火墙和监管差异
- ACX 系列路由器上的分层监管器概述
- 在 ACX 系列路由器上配置分层监管器的准则
- ACX 系列路由器上的分层监管器模式
- 处理 ACX 系列路由器上的分层监管器
- 对 ACX 系列路由器上的分层监管器执行的操作
- 在 ACX 系列路由器上配置聚合父监管器和子监管器
- play_arrow 配置监管器速率限制和操作
- play_arrow 配置第 2 层监管器
- play_arrow 在第 3 层配置双色和三色流量监管器
- play_arrow 在第 3 层配置逻辑和物理接口流量监管器
- play_arrow 在交换机上配置监管器
-
- play_arrow 配置语句和操作命令
- play_arrow 故障排除
- play_arrow 知识库
-
示例:在路由策略中配置社区
社区是 BGP 用于对具有类似属性的路由进行管理分组的路由属性。
概述
社区属性的一个主要作用是作为用于将路由关联在一起的管理标记值。通常,这些路由共享一些通用属性,但这不是必需的。社区是 BGP 中的一个灵活工具。可以将单个社区值分配给单个路径或多个路径。可以为路由分配单个社区值或多个值。网络使用社区属性来帮助实施管理路由策略。路由的分配值允许将其接受到网络中,或拒绝从网络中拒绝,或者允许其修改属性。
图 1 将设备 R1、设备 R2 和设备 R3 显示为自治系统 (AS) 64510 中的内部 BGP (IBGP) 对等方。设备 R4 正在播发来自 AS 64511 的 172.16.0.0/21 地址空间。
拓扑学

设备 R1 从设备 R4 接收的具体路由如下:
user@R1> show route receive-protocol bgp 10.0.0.13
inet.0: 24 destinations, 28 routes (24 active, 0 holddown, 0 hidden)
Prefix Nexthop MED Lclpref AS path
* 172.16.0.0/24 10.0.0.13 64511 I
* 172.16.1.0/24 10.0.0.13 64511 I
* 172.16.2.0/24 10.0.0.13 64511 I
* 172.16.3.0/24 10.0.0.13 64511 I
172.16.4.0/24 10.0.0.13 64511 I
172.16.5.0/24 10.0.0.13 64511 I
172.16.6.0/24 10.0.0.13 64511 I
172.16.7.0/24 10.0.0.13 64511 I
AS 64511 的管理员希望接收来自设备 R1 的某些用户流量,以及来自设备 R3 的其他用户流量。为了实现此管理目标,设备 R4 将社区值 64511:1 附加到它发送的某些路由,并将社区值 64511:3 附加到它发送的其他路由。AS 64510 中的路由策略使用社区匹配标准进行配置,以将收到的路由的本地优先级更改为更改 BGP 路由选择算法的新值。首选具有最高本地优先级值的路由。
在设备 R1 上,为具有 64511:1 社区值的路由分配的本地优先级为 200,为具有 64511:3 社区值的路由分配的本地优先级为 50。在设备 R3 上,将执行相反的操作,以便为具有 64511:3 社区值的路由分配本地优先级 200,为具有 64511:1 社区值的路由分配本地优先级 50。然后,此信息通过 IBGP 由设备 R1 和设备 R3 传送到设备 R2。
分步配置部分介绍了设备 R1 和 R4 上的配置步骤。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,然后将命令复制并粘贴到层次结构级别的 CLI [edit]
中。
设备 R1
set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.1/30 set interfaces ge-0/0/1 unit 0 family inet address 10.1.0.5/30 set interfaces ge-0/0/2 unit 0 family inet address 10.0.0.14/30 set interfaces lo0 unit 0 family inet address 192.168.0.1/32 set policy-options policy-statement change-local-preference term find-R1-routes from community R1_PREFERRED set policy-options policy-statement change-local-preference term find-R1-routes then local-preference 200 set policy-options policy-statement change-local-preference term find-R3-routes from community R3_PREFERRED set policy-options policy-statement change-local-preference term find-R3-routes then local-preference 50 set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 from route-filter 10.0.0.12/30 exact set policy-options policy-statement send-direct term 1 then accept set policy-options community R3_PREFERRED members 64511:3 set policy-options community R1_PREFERRED members 64511:1 set protocols bgp group int type internal set protocols bgp group int local-address 192.168.0.1 set protocols bgp group int export send-direct set protocols bgp group int neighbor 192.168.0.2 set protocols bgp group int neighbor 192.168.0.3 set protocols bgp group ext type external set protocols bgp group ext import change-local-preference set protocols bgp group ext peer-as 64511 set protocols bgp group ext neighbor 10.0.0.13 set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive set routing-options router-id 192.168.0.1 set routing-options autonomous-system 64510
设备 R2
set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.2/30 set interfaces ge-0/0/1 unit 0 family inet address 10.1.0.1/30 set interfaces lo0 unit 0 family inet address 192.168.0.2/32 set protocols bgp group int type internal set protocols bgp group int local-address 192.168.0.2 set protocols bgp group int neighbor 192.168.0.1 set protocols bgp group int neighbor 192.168.0.3 set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive set routing-options router-id 192.168.0.2 set routing-options autonomous-system 64510
设备 R3
set interfaces ge-0/0/0 unit 0 family inet address 10.1.0.6/30 set interfaces ge-0/0/1 unit 0 family inet address 10.1.0.2/30 set interfaces ge-0/0/2 unit 0 family inet address 10.0.0.10/30 set interfaces lo0 unit 0 family inet address 192.168.0.3/32 set policy-options policy-statement change-local-preference term find-R3-routes from community R3_PREFERRED set policy-options policy-statement change-local-preference term find-R3-routes then local-preference 200 set policy-options policy-statement change-local-preference term find-R1-routes from community R1_PREFERRED set policy-options policy-statement change-local-preference term find-R1-routes then local-preference 50 set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 from route-filter 10.0.0.8/30 exact set policy-options policy-statement send-direct term 1 then accept set policy-options community R1_PREFERRED members 64511:1 set policy-options community R3_PREFERRED members 64511:3 set protocols bgp group int type internal set protocols bgp group int local-address 192.168.0.3 set protocols bgp group int export send-direct set protocols bgp group int neighbor 192.168.0.1 set protocols bgp group int neighbor 192.168.0.2 set protocols bgp group ext type external set protocols bgp group ext import change-local-preference set protocols bgp group ext peer-as 64511 set protocols bgp group ext neighbor 10.0.0.9 set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive set routing-options router-id 192.168.0.3 set routing-options autonomous-system 64510
设备 R4
set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.13/30 set interfaces ge-0/0/1 unit 0 family inet address 10.0.0.9/30 set interfaces lo0 unit 0 family inet address 192.168.0.4/32 set policy-options policy-statement send-static term 1 from protocol static set policy-options policy-statement send-static term 1 from route-filter 172.16.0.0/24 exact set policy-options policy-statement send-static term 1 from route-filter 172.16.1.0/24 exact set policy-options policy-statement send-static term 1 from route-filter 172.16.2.0/24 exact set policy-options policy-statement send-static term 1 from route-filter 172.16.3.0/24 exact set policy-options policy-statement send-static term 1 then community add R1_PREFERRED set policy-options policy-statement send-static term 1 then accept set policy-options policy-statement send-static term 2 from protocol static set policy-options policy-statement send-static term 2 from route-filter 172.16.4.0/24 exact set policy-options policy-statement send-static term 2 from route-filter 172.16.5.0/24 exact set policy-options policy-statement send-static term 2 from route-filter 172.16.6.0/24 exact set policy-options policy-statement send-static term 2 from route-filter 172.16.7.0/24 exact set policy-options policy-statement send-static term 2 then community add R3_PREFERRED set policy-options policy-statement send-static term 2 then accept set policy-options policy-statement send-static term 3 then reject set policy-options community R3_PREFERRED members 64511:3 set policy-options community R1_PREFERRED members 64511:1 set protocols bgp group to-R1 type external set protocols bgp group to-R1 export send-static set protocols bgp group to-R1 peer-as 64510 set protocols bgp group to-R1 neighbor 10.0.0.14 set protocols bgp group to-R3 type external set protocols bgp group to-R3 export send-static set protocols bgp group to-R3 peer-as 64510 set protocols bgp group to-R3 neighbor 10.0.0.10 set routing-options router-id 192.168.0.4 set routing-options autonomous-system 64511 set routing-options static route 172.16.0.0/24 reject set routing-options static route 172.16.1.0/24 reject set routing-options static route 172.16.2.0/24 reject set routing-options static route 172.16.3.0/24 reject set routing-options static route 172.16.4.0/24 reject set routing-options static route 172.16.5.0/24 reject set routing-options static route 172.16.6.0/24 reject set routing-options static route 172.16.7.0/24 reject
分步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅 在配置模式下使用 CLI 编辑器Junos OS CLI 用户指南。
要配置设备 R1:
配置接口。
content_copy zoom_out_map[edit interfaces] user@R1# set ge-0/0/0 unit 0 family inet address 10.0.0.1/30 user@R1# set ge-0/0/1 unit 0 family inet address 10.1.0.5/30 user@R1# set ge-0/0/2 unit 0 family inet address 10.0.0.14/30 user@R1# set lo0 unit 0 family inet address 192.168.0.1/32
配置与设备 R2 和 R3 的内部网关协议 (IGP) 连接。
content_copy zoom_out_map[edit protocols ospf area 0.0.0.0] user@R1# set interface ge-0/0/0.0 user@R1# set interface ge-0/0/1.0 user@R1# set interface lo0.0 passive
配置与设备 R2 和 R3 的 IBGP 连接。
content_copy zoom_out_map[edit protocols bgp group int] user@R1# set type internal user@R1# set local-address 192.168.0.1 user@R1# set export send-direct user@R1# set neighbor 192.168.0.2 user@R1# set neighbor 192.168.0.3
配置与设备 R4 的 EBGP 连接。
content_copy zoom_out_map[edit protocols bgp group ext] user@R1# set type external user@R1# set import change-local-preference user@R1# set peer-as 64511 user@R1# set neighbor 10.0.0.13
配置策略
send-direct
。此策略在 IBGP 配置中引用,并使设备 R2 具有外部可访问性。另一种方法是在设备 R1 和设备 R3 上配置
next-hop self
策略。content_copy zoom_out_map[edit policy-options policy-statement send-direct term 1] user@R1# set from protocol direct user@R1# set from route-filter 10.0.0.12/30 exact user@R1# set then accept
配置用于更改具有指定社区标记的路由的本地首选项的策略。
content_copy zoom_out_map[edit policy-options ] user@R1# set policy-statement change-local-preference term find-R1-routes from community R1_PREFERRED user@R1# set policy-statement change-local-preference term find-R1-routes then local-preference 200 user@R1# set policy-statement change-local-preference term find-R3-routes from community R3_PREFERRED user@R1# set policy-statement change-local-preference term find-R3-routes then local-preference 50 user@R1# set community R3_PREFERRED members 64511:3 user@R1# set community R1_PREFERRED members 64511:1
配置自治系统 (AS) 编号和路由器 ID。
content_copy zoom_out_map[edit routing-options] user@R1# set router-id 192.168.0.1 user@R1# set autonomous-system 64510
要配置设备 R4:
配置接口。
content_copy zoom_out_map[edit interfaces] user@R4# set ge-0/0/0 unit 0 family inet address 10.0.0.13/30 user@R4# set ge-0/0/1 unit 0 family inet address 10.0.0.9/30 user@R4# set lo0 unit 0 family inet address 192.168.0.4/32
配置与设备 R1 和设备 R3 的 EBGP 连接。
content_copy zoom_out_map[edit protocols bgp] user@R4# set group to-R1 type external user@R4# set group to-R1 export send-static user@R4# set group to-R1 peer-as 64510 user@R4# set group to-R1 neighbor 10.0.0.14 user@R4# set group to-R3 type external user@R4# set group to-R3 export send-static user@R4# set group to-R3 peer-as 64510 user@R4# set group to-R3 neighbor 10.0.0.10
配置社区标记。
content_copy zoom_out_map[edit policy-options ] user@R4# set community R3_PREFERRED members 64511:3 user@R4# set community R1_PREFERRED members 64511:1
配置策略
send-static
。与设备 R1 和设备 R3 的 EBGP 连接中引用此策略。该策略将 64511:1 (首选) 社区附加到某些路由,将 64511:3 (NOT_PREFERRED) 社区附加到其他路由。
content_copy zoom_out_map[edit policy-options] user@R4# set policy-statement send-static term 1 from protocol static user@R4# set policy-statement send-static term 1 from route-filter 172.16.0.0/24 exact user@R4# set policy-statement send-static term 1 from route-filter 172.16.1.0/24 exact user@R4# set policy-statement send-static term 1 from route-filter 172.16.2.0/24 exact user@R4# set policy-statement send-static term 1 from route-filter 172.16.3.0/24 exact user@R4# set policy-statement send-static term 1 then community add R1_PREFERRED user@R4# set policy-statement send-static term 1 then accept user@R4# set policy-statement send-static term 2 from protocol static user@R4# set policy-statement send-static term 2 from route-filter 172.16.4.0/24 exact user@R4# set policy-statement send-static term 2 from route-filter 172.16.5.0/24 exact user@R4# set policy-statement send-static term 2 from route-filter 172.16.6.0/24 exact user@R4# set policy-statement send-static term 2 from route-filter 172.16.7.0/24 exact user@R4# set policy-statement send-static term 2 then community add R3_PREFERRED user@R4# set policy-statement send-static term 2 then accept user@R4# set policy-statement send-static term 3 then reject
配置静态路由。
content_copy zoom_out_map[edit routing-options static] user@R4# set route 172.16.0.0/24 reject user@R4# set route 172.16.1.0/24 reject user@R4# set route 172.16.2.0/24 reject user@R4# set route 172.16.3.0/24 reject user@R4# set route 172.16.4.0/24 reject user@R4# set route 172.16.5.0/24 reject user@R4# set route 172.16.6.0/24 reject user@R4# set route 172.16.7.0/24 reject
配置自治系统 (AS) 编号和路由器 ID。
content_copy zoom_out_map[edit routing-options] user@R4# set router-id 192.168.0.4 user@R4# set autonomous-system 64511
结果
在配置模式下,输入 show interfaces
、show protocols
、show policy-options
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以便进行更正。
设备 R1
user@R1# show interfaces ge-0/0/0 { unit 0 { family inet { address 10.0.0.1/30; } } } ge-0/0/1 { unit 0 { family inet { address 10.1.0.5/30; } } } ge-0/0/2 { unit 0 { family inet { address 10.0.0.14/30; } } } lo0 { unit 0 { family inet { address 192.168.0.1/32; } } }
user@R1# show protocols bgp { group int { type internal; local-address 192.168.0.1; export send-direct; neighbor 192.168.0.2; neighbor 192.168.0.3; } group ext { type external; import change-local-preference; peer-as 64511; neighbor 10.0.0.13; } } ospf { area 0.0.0.0 { interface ge-0/0/0.0; interface ge-0/0/1.0; interface lo0.0 { passive; } } }
user@R1# show policy-options policy-statement change-local-preference { term find-R1-routes { from community R1_PREFERRED; then { local-preference 200; } } term find-R3-routes { from community R3_PREFERRED; then { local-preference 50; } } } policy-statement send-direct { term 1 { from { protocol direct; route-filter 10.0.0.12/30 exact; } then accept; } } community R3_PREFERRED members 64511:3; community R1_PREFERRED members 64511:1;
user@R1# show routing-options router-id 192.168.0.1; autonomous-system 64510;
设备 R4
user@R4# show interfaces ge-0/0/0 { unit 0 { family inet { address 10.0.0.13/30; } } } ge-0/0/1 { unit 0 { family inet { address 10.0.0.9/30; } } } lo0 { unit 0 { family inet { address 192.168.0.4/32; } } }
user@R4# show protocols bgp { group to-R1 { type external; export send-static; peer-as 64510; neighbor 10.0.0.14; } group to-R3 { type external; export send-static; peer-as 64510; neighbor 10.0.0.10; } }
user@R4# show policy-options policy-statement send-static { term 1 { from { protocol static; route-filter 172.16.0.0/24 exact; route-filter 172.16.1.0/24 exact; route-filter 172.16.2.0/24 exact; route-filter 172.16.3.0/24 exact; } then { community add R1_PREFERRED; accept; } } term 2 { from { protocol static; route-filter 172.16.4.0/24 exact; route-filter 172.16.5.0/24 exact; route-filter 172.16.6.0/24 exact; route-filter 172.16.7.0/24 exact; } then { community add R3_PREFERRED; accept; } } term 3 { then reject; } } community R3_PREFERRED members 64511:3; community R1_PREFERRED members 64511:1;
user@R4# show routing-options router-id 192.168.0.4; autonomous-system 64511; static { route 172.16.0.0/24 reject; route 172.16.1.0/24 reject; route 172.16.2.0/24 reject; route 172.16.3.0/24 reject; route 172.16.4.0/24 reject; route 172.16.5.0/24 reject; route 172.16.6.0/24 reject; route 172.16.7.0/24 reject; }
如果完成设备配置,请从配置模式输入 commit
。
验证
确认配置工作正常。
验证设备 R4 上发送的路由
目的
在设备 R4 上,检查发送到设备 R1 和设备 R3 的路由。
操作
user@R4> show route advertising-protocol bgp 10.0.0.14 extensive inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden) * 172.16.0.0/24 (1 entry, 1 announced) BGP group to-R1 type External Nexthop: Self AS path: [64511] I Communities: 64511:1 * 172.16.1.0/24 (1 entry, 1 announced) BGP group to-R1 type External Nexthop: Self AS path: [64511] I Communities: 64511:1 * 172.16.2.0/24 (1 entry, 1 announced) BGP group to-R1 type External Nexthop: Self AS path: [64511] I Communities: 64511:1 * 172.16.3.0/24 (1 entry, 1 announced) BGP group to-R1 type External Nexthop: Self AS path: [64511] I Communities: 64511:1 * 172.16.4.0/24 (1 entry, 1 announced) BGP group to-R1 type External Nexthop: Self AS path: [64511] I Communities: 64511:3 * 172.16.5.0/24 (1 entry, 1 announced) BGP group to-R1 type External Nexthop: Self AS path: [64511] I Communities: 64511:3 * 172.16.6.0/24 (1 entry, 1 announced) BGP group to-R1 type External Nexthop: Self AS path: [64511] I Communities: 64511:3 * 172.16.7.0/24 (1 entry, 1 announced) BGP group to-R1 type External Nexthop: Self AS path: [64511] I Communities: 64511:3
user@R4> show route advertising-protocol bgp 10.0.0.10 extensive inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden) * 172.16.0.0/24 (1 entry, 1 announced) BGP group to-R3 type External Nexthop: Self AS path: [64511] I Communities: 64511:1 * 172.16.1.0/24 (1 entry, 1 announced) BGP group to-R3 type External Nexthop: Self AS path: [64511] I Communities: 64511:1 * 172.16.2.0/24 (1 entry, 1 announced) BGP group to-R3 type External Nexthop: Self AS path: [64511] I Communities: 64511:1 * 172.16.3.0/24 (1 entry, 1 announced) BGP group to-R3 type External Nexthop: Self AS path: [64511] I Communities: 64511:1 * 172.16.4.0/24 (1 entry, 1 announced) BGP group to-R3 type External Nexthop: Self AS path: [64511] I Communities: 64511:3 * 172.16.5.0/24 (1 entry, 1 announced) BGP group to-R3 type External Nexthop: Self AS path: [64511] I Communities: 64511:3 * 172.16.6.0/24 (1 entry, 1 announced) BGP group to-R3 type External Nexthop: Self AS path: [64511] I Communities: 64511:3 * 172.16.7.0/24 (1 entry, 1 announced) BGP group to-R3 type External Nexthop: Self AS path: [64511] I Communities: 64511:3
意义
设备 R4 已使用社区 64511:1 和 64511:3 标记路由,并将其发送到设备 R1 和 R3。
验证设备 R2 上收到的路由
目的
在设备 R2 上,检查从设备 R1 和设备 R3 收到的路由。
操作
user@R2> show route receive-protocol bgp 192.168.0.1 inet.0: 25 destinations, 25 routes (25 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.12/30 192.168.0.1 100 I * 172.16.0.0/24 10.0.0.13 200 64511 I * 172.16.1.0/24 10.0.0.13 200 64511 I * 172.16.2.0/24 10.0.0.13 200 64511 I * 172.16.3.0/24 10.0.0.13 200 64511 I
user@R2> show route receive-protocol bgp 192.168.0.3 inet.0: 25 destinations, 25 routes (25 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.8/30 192.168.0.3 100 I * 172.16.4.0/24 10.0.0.9 200 64511 I * 172.16.5.0/24 10.0.0.9 200 64511 I * 172.16.6.0/24 10.0.0.9 200 64511 I * 172.16.7.0/24 10.0.0.9 200 64511 I
user@R2> show route match-prefix 172.16.* inet.0: 25 destinations, 25 routes (25 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 172.16.0.0/24 *[BGP/170] 1w3d 00:02:11, localpref 200, from 192.168.0.1 AS path: 64511 I, validation-state: unverified > to 10.0.0.1 via ge-0/0/0.0 172.16.1.0/24 *[BGP/170] 1w3d 00:02:11, localpref 200, from 192.168.0.1 AS path: 64511 I, validation-state: unverified > to 10.0.0.1 via ge-0/0/0.0 172.16.2.0/24 *[BGP/170] 1w3d 00:02:11, localpref 200, from 192.168.0.1 AS path: 64511 I, validation-state: unverified > to 10.0.0.1 via ge-0/0/0.0 172.16.3.0/24 *[BGP/170] 1w3d 00:02:11, localpref 200, from 192.168.0.1 AS path: 64511 I, validation-state: unverified > to 10.0.0.1 via ge-0/0/0.0 172.16.4.0/24 *[BGP/170] 1w3d 00:01:50, localpref 200, from 192.168.0.3 AS path: 64511 I, validation-state: unverified > to 10.1.0.2 via ge-0/0/1.0 172.16.5.0/24 *[BGP/170] 1w3d 00:01:50, localpref 200, from 192.168.0.3 AS path: 64511 I, validation-state: unverified > to 10.1.0.2 via ge-0/0/1.0 172.16.6.0/24 *[BGP/170] 1w3d 00:01:50, localpref 200, from 192.168.0.3 AS path: 64511 I, validation-state: unverified > to 10.1.0.2 via ge-0/0/1.0 172.16.7.0/24 *[BGP/170] 1w3d 00:01:50, localpref 200, from 192.168.0.3 AS path: 64511 I, validation-state: unverified > to 10.1.0.2 via ge-0/0/1.0
意义
设备 R2 具有具有预期本地首选项的路由和由星号 (*) 指定的预期活动路由。