示例:配置动态路由策略
此示例说明如何在不受标准配置数据库中所需验证的动态数据库中配置路由策略对象。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
概述
提交配置更改所需的验证过程可能需要大量的开销和时间。
将更改提交到动态数据库所需的时间比标准配置数据库短得多。您可以在标准数据库中配置的路由策略中引用这些策略和策略对象。BGP 是唯一可以应用引用动态数据库中配置的策略和策略对象的路由策略的协议。根据动态数据库中配置的对象配置并提交路由策略后,可以通过更改动态数据库配置来快速更新任何现有路由策略。
由于 Junos OS 不会验证对动态数据库的配置更改,因此在使用此功能时,应在提交所有配置更改之前测试并验证这些更改。
图 1 显示了示例网络。
该示例包括三个已建立外部 BGP (EBGP) 会话的路由器。只有设备 R1 使用动态数据库。
在设备 R0 的 fe-1/2/1 接口上,配置了多个 IPv4 接口,路由策略将这些前缀注入 BGP, 使用策略条件作为指定设备 R0 的 fe-1/2/1 接口上配置的所有 IP 地址的简写方法。from interface fe-1/2/1.0
同样,在设备 R2 的 fe-1/2/3 接口上,配置了多个 IPv4 地址,路由策略将这些前缀注入 BGP。设备 R2 的配置与设备 R0 的配置略有不同,因为设备 R2 的配置演示了前缀列表的使用。
在设备 R1 上的动态数据库中,定义了两个前缀列表,一个用于从设备 R0 获知的接口地址,另一个用于从设备 R2 获知的接口地址。设备 R1 的标准数据库包含路由策略,其前缀列表类似于动态数据库中定义的前缀列表。
在与设备 R0 的对等会话中,设备 R1 应用了静态数据库策略。相反,在与设备 R2 的对等会话中,设备 R1 的配置引用动态数据库。
本节 分析了这些不同配置的结果。验证
本节介绍设备 R1 动态数据库上的步骤。#configuration776__policy-dynamic-st
本节介绍设备 R1 标准数据库上的步骤。#configuration776__policy-standard-st
配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,然后将命令复制并粘贴到层次结构级别的 CLI 中。[edit]
设备 R0
set interfaces fe-1/2/0 unit 0 family inet address 10.0.0.1/30 set interfaces fe-1/2/1 unit 0 family inet address 172.16.4.1/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.3.1/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.2.1/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.1.1/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.5.1/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.6.1/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.7.1/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.8.1/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.9.1/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.10.1/24 set interfaces lo0 unit 0 family inet address 10.255.14.151/32 set protocols bgp group ext type external set protocols bgp group ext neighbor 10.0.0.2 export t2 set protocols bgp group ext neighbor 10.0.0.2 peer-as 200 set policy-options policy-statement t2 from interface fe-1/2/0.0 set policy-options policy-statement t2 from interface fe-1/2/1.0 set policy-options policy-statement t2 then accept set routing-options router-id 10.255.14.151 set routing-options autonomous-system 100
设备 R1 动态数据库
[edit dynamic] set policy-options prefix-list dyn_prfx1 172.16.1.0/24 set policy-options prefix-list dyn_prfx1 172.16.2.0/24 set policy-options prefix-list dyn_prfx1 172.16.3.0/24 set policy-options prefix-list dyn_prfx1 172.16.4.0/24 set policy-options prefix-list dyn_prfx1 172.16.5.0/24 set policy-options prefix-list dyn_prfx1 172.16.6.0/24 set policy-options prefix-list dyn_prfx1 172.16.7.0/24 set policy-options prefix-list dyn_prfx1 172.16.8.0/24 set policy-options prefix-list dyn_prfx2 172.16.2.0/24 set policy-options prefix-list dyn_prfx2 172.16.3.0/24 set policy-options prefix-list dyn_prfx2 172.16.4.0/24 set policy-options prefix-list dyn_prfx2 172.16.5.0/24 set policy-options prefix-list dyn_prfx2 172.16.6.0/24 set policy-options policy-statement dyn_policy1 term t1 from prefix-list dyn_prfx1 set policy-options policy-statement dyn_policy1 term t1 then accept set policy-options policy-statement dyn_policy1 term t2 then reject set policy-options policy-statement dyn_policy2 term t1 from prefix-list dyn_prfx2 set policy-options policy-statement dyn_policy2 term t1 then accept set policy-options policy-statement dyn_policy2 term t2 then reject
设备 R1 标准数据库
set interfaces fe-1/2/0 unit 0 family inet address 10.0.0.2/30 set interfaces fe-1/2/2 unit 0 family inet address 10.1.0.1/30 set interfaces fe-1/2/1 unit 0 family inet address 172.16.4.2/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.3.2/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.2.2/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.1.2/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.5.2/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.6.2/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.7.2/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.8.2/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.9.2/24 set interfaces fe-1/2/1 unit 0 family inet address 172.16.10.2/24 set interfaces fe-1/2/3 unit 0 family inet address 172.16.22.2/24 set interfaces fe-1/2/3 unit 0 family inet address 172.16.23.2/24 set interfaces fe-1/2/3 unit 0 family inet address 172.16.24.2/24 set interfaces fe-1/2/3 unit 0 family inet address 172.16.25.2/24 set interfaces fe-1/2/3 unit 0 family inet address 172.16.26.2/24 set interfaces lo0 unit 0 family inet address 192.168.0.2/32 set protocols bgp group to_r0 idle-after-switch-over 300 set protocols bgp group to_r0 neighbor 10.0.0.1 import dyn_policy1 set protocols bgp group to_r0 neighbor 10.0.0.1 export dyn_policy2 set protocols bgp group to_r0 neighbor 10.0.0.1 peer-as 100 set protocols bgp group to_R2 import static_policy1 set protocols bgp group to_R2 export static_policy2 set protocols bgp group to_R2 idle-after-switch-over 300 set protocols bgp group to_R2 neighbor 10.1.0.2 peer-as 300 set policy-options prefix-list static_prfx1 172.16.22.0/24 set policy-options prefix-list static_prfx1 172.16.23.0/24 set policy-options prefix-list static_prfx1 172.16.24.0/24 set policy-options prefix-list static_prfx1 172.16.25.0/24 set policy-options prefix-list static_prfx2 172.16.1.0/24 set policy-options prefix-list static_prfx2 172.16.2.0/24 set policy-options prefix-list static_prfx2 172.16.3.0/24 set policy-options prefix-list static_prfx2 172.16.4.0/24 set policy-options policy-statement dyn_policy1 dynamic-db set policy-options policy-statement dyn_policy2 dynamic-db set policy-options policy-statement static_policy1 term t1 from prefix-list static_prfx1 set policy-options policy-statement static_policy1 term t1 then accept set policy-options policy-statement static_policy1 term t2 then reject set policy-options policy-statement static_policy2 term t1 from prefix-list static_prfx2 set policy-options policy-statement static_policy2 term t1 then accept set policy-options policy-statement static_policy2 term t2 then reject set routing-options autonomous-system 200
设备 R2
set interfaces fe-1/2/2 unit 0 family inet address 10.1.0.2/30 set interfaces fe-1/2/3 unit 0 family inet address 172.16.22.1/24 set interfaces fe-1/2/3 unit 0 family inet address 172.16.23.1/24 set interfaces fe-1/2/3 unit 0 family inet address 172.16.24.1/24 set interfaces fe-1/2/3 unit 0 family inet address 172.16.25.1/24 set interfaces fe-1/2/3 unit 0 family inet address 172.16.26.1/24 set interfaces lo0 unit 0 family inet address 192.168.0.3/32 set protocols bgp group to_vin neighbor 10.1.0.1 export p1 set protocols bgp group to_vin neighbor 10.1.0.1 peer-as 200 set policy-options prefix-list ppx1 172.16.22.0/24 set policy-options prefix-list ppx1 172.16.23.0/24 set policy-options prefix-list ppx1 172.16.24.0/24 set policy-options prefix-list ppx1 172.16.25.0/24 set policy-options prefix-list ppx1 172.16.26.0/24 set policy-options policy-statement p1 term t1 from family inet set policy-options policy-statement p1 term t1 from prefix-list ppx1 set policy-options policy-statement p1 term t1 then accept set routing-options autonomous-system 300
分步过程
下面的示例要求您在各个配置层级中进行导航。有关如何执行此操作的说明,请参阅 Junos OS CLI 用户指南。在配置模式下使用 CLI 编辑器https://www.juniper.net/documentation/en_US/junos/information-products/pathway-pages/junos-cli/junos-cli.html
要配置设备 R1 的动态数据库:
进入动态数据库的配置模式。
user@R1> configure dynamic Entering configuration mode [edit dynamic]
为从设备 R0 获知的接口地址创建前缀列表。
[edit dynamic policy-options prefix-list dyn_prfx1] user@R1# set 172.16.1.0/24 user@R1# set 172.16.2.0/24 user@R1# set 172.16.3.0/24 user@R1# set 172.16.4.0/24 user@R1# set 172.16.5.0/24 user@R1# set 172.16.6.0/24 user@R1# set 172.16.7.0/24 user@R1# set 172.16.8.0/24
为从设备 R2 获知的接口地址创建前缀列表。
[edit dynamic policy-options prefix-list dyn_prfx2] user@R1# set 172.16.2.0/24 user@R1# set 172.16.3.0/24 user@R1# set 172.16.4.0/24 user@R1# set 172.16.5.0/24 user@R1# set 172.16.6.0/24
配置路由策略。
[edit dynamic policy-options policy-statement dyn_policy1] user@R1# set term t1 from prefix-list dyn_prfx1 user@R1# set term t1 then accept user@R1# set term t2 then reject user@R1# set term t1 from prefix-list dyn_prfx2 user@R1# set term t1 then accept user@R1# set term t2 then reject
分步过程
下面的示例要求您在各个配置层级中进行导航。有关如何执行此操作的说明,请参阅 Junos OS CLI 用户指南。在配置模式下使用 CLI 编辑器https://www.juniper.net/documentation/en_US/junos/information-products/pathway-pages/junos-cli/junos-cli.html
要配置设备 R1 的标准数据库,请执行以下操作:
创建路由器接口。
[edit interfaces] user@R1# set fe-1/2/0 unit 0 family inet address 10.0.0.2/30 user@R1# set fe-1/2/2 unit 0 family inet address 10.1.0.1/30 user@R1# set fe-1/2/1 unit 0 family inet address 172.16.4.2/24 user@R1# set fe-1/2/1 unit 0 family inet address 172.16.3.2/24 user@R1# set fe-1/2/1 unit 0 family inet address 172.16.2.2/24 user@R1# set fe-1/2/1 unit 0 family inet address 172.16.1.2/24 user@R1# set fe-1/2/1 unit 0 family inet address 172.16.5.2/24 user@R1# set fe-1/2/1 unit 0 family inet address 172.16.6.2/24 user@R1# set fe-1/2/1 unit 0 family inet address 172.16.7.2/24 user@R1# set fe-1/2/1 unit 0 family inet address 172.16.8.2/24 user@R1# set fe-1/2/1 unit 0 family inet address 172.16.9.2/24 user@R1# set fe-1/2/1 unit 0 family inet address 172.16.10.2/24 user@R1# set fe-1/2/3 unit 0 family inet address 172.16.2.2/24 user@R1# set fe-1/2/3 unit 0 family inet address 172.16.3.2/24 user@R1# set fe-1/2/3 unit 0 family inet address 172.16.4.2/24 user@R1# set fe-1/2/3 unit 0 family inet address 172.16.5.2/24 user@R1# set fe-1/2/3 unit 0 family inet address 172.16.6.2/24 user@R1# set lo0 unit 0 family inet address 192.168.0.2/32
创建引用动态数据库中的策略的路由策略。
[edit policy-options] user@R1# set policy-statement dyn_policy1 dynamic-db user@R1# set policy-statement dyn_policy2 dynamic-db
配置与设备 R0 的 BGP 对等互连。
[edit protocols bgp group to_r0] user@R1# set neighbor 10.0.0.1 peer-as 100
将动态数据库策略应用于与设备 R0 的 BGP 对等互连。
[edit protocols bgp group to_r0] user@R1# set neighbor 10.0.0.1 import dyn_policy1 user@R1# set neighbor 10.0.0.1 export dyn_policy2
为从设备 R0 获知的前缀配置前缀列表。
[edit policy-options prefix-list static_prfx2] user@R1# set 172.16.1.0/24 user@R1# set 172.16.2.0/24 user@R1# set 172.16.3.0/24 user@R1# set 172.16.4.0/24
为从设备 R2 获知的前缀配置前缀列表。
[edit policy-options prefix-list static_prfx1] user@R1# set 172.16.2.0/24 user@R1# set 172.16.3.0/24 user@R1# set 172.16.4.0/24 user@R1# set 172.16.5.0/24
配置静态数据库策略。
[edit policy-options policy-statement static_policy1] user@R1# set term t1 from prefix-list static_prfx1 user@R1# set term t1 then accept user@R1# set term t2 then reject [edit policy-options policy-statement static_policy2] user@R1# set term t1 from prefix-list static_prfx2 user@R1# set term t1 then accept user@R1# set term t2 then reject
配置与设备 R2 的 BGP 对等互连。
[edit protocols bgp group to_R2] user@R1# set neighbor 10.1.0.2 peer-as 300
将静态数据库策略应用于与设备 R2 的 BGP 对等互连。
[edit protocols bgp group to_R2] user@R1# set import static_policy1 user@R1# set export static_policy2
(可选)将路由器配置为在活动不间断路由切换后在指定时间段内或手动重新建立会话之前不重新建立 BGP 对等会话。
此语句对于动态路由策略特别有用,因为启用不间断活动路由 (NSR) 时,动态数据库不会与备份路由引擎同步。因此,如果切换到备份路由引擎,则切换时在主路由引擎上运行的导入和导出策略可能不再可用。因此,您可能希望防止在切换发生后立即自动重新建立 BGP 对等会话。
[edit protocols bgp] user@R1# set group to_r0 idle-after-switch-over 300 user@R1# set group to_R2 idle-after-switch-over 300
配置自治系统 (AS) 编号。
[edit routing-options] user@R1# set routing-options autonomous-system 200
成果
通过在动态数据库中输入配置模式命令,在标准数据库中输入配置模式中的 、 和命令来确认配置。show
show interfaces
show protocols
show policy-options
show routing-options
如果输出未显示预期的配置,请重复此示例中的说明,以便进行更正。
设备 R1 动态
[edit dynamic] user@R1# show policy-options { prefix-list dyn_prfx1 { 172.16.1.0/24; 172.16.2.0/24; 172.16.3.0/24; 172.16.4.0/24; 172.16.5.0/24; 172.16.6.0/24; 172.16.7.0/24; 172.16.8.0/24; } prefix-list dyn_prfx2 { 172.16.2.0/24; 172.16.3.0/24; 172.16.4.0/24; 172.16.5.0/24; 172.16.6.0/24; } policy-statement dyn_policy1 { term t1 { from { prefix-list dyn_prfx1; } then accept; } term t2 { then reject; } } policy-statement dyn_policy2 { term t1 { from { prefix-list dyn_prfx2; } then accept; } term t2 { then reject; } } }
设备 R1 标准
[edit] user@R1# show interfaces fe-1/2/0 { unit 0 { family inet { address 10.0.0.2/30; } } } fe-1/2/1 { unit 0 { family inet { address 172.16.4.2/24; address 172.16.3.2/24; address 172.16.2.2/24; address 172.16.1.2/24; address 172.16.5.2/24; address 172.16.6.2/24; address 172.16.7.2/24; address 172.16.8.2/24; address 172.16.9.2/24; address 172.16.10.2/24; } } } fe-1/2/2 { unit 0 { family inet { address 10.1.0.1/30; } } } fe-1/2/3 { unit 0 { family inet { address 172.16.2.2/24; address 172.16.3.2/24; address 172.16.4.2/24; address 172.16.5.2/24; address 172.16.6.2/24; } } } lo0 { unit 0 { family inet { address 192.168.0.2/32; } } }
user@R1# show protocols bgp { group to_r0 { idle-after-switch-over 300; neighbor 10.0.0.1 { import dyn_policy1; export dyn_policy2; peer-as 100; } } group to_R2 { import static_policy1; export static_policy2; idle-after-switch-over 300; neighbor 10.1.0.2 { peer-as 300; } } }
user@R1# show policy-options prefix-list static_prfx1 { 172.16.2.0/24; 172.16.3.0/24; 172.16.4.0/24; 172.16.5.0/24; } prefix-list static_prfx2 { 172.16.1.0/24; 172.16.2.0/24; 172.16.3.0/24; 172.16.4.0/24; } policy-statement dyn_policy1 { dynamic-db; } policy-statement dyn_policy2 { dynamic-db; } policy-statement static_policy1 { term t1 { from { prefix-list static_prfx1; } then accept; } term t2 { then reject; } } policy-statement static_policy2 { term t1 { from { prefix-list static_prfx2; } then accept; } term t2 { then reject; } }
user@R1# show routing-options autonomous-system 200;
如果完成设备配置,请从配置模式输入 commit
。
验证
确认配置工作正常。
- 检查设备 R1 上配置的策略
- 检查从设备 R0 播发到设备 R1 的路由
- 检查设备 R1 从设备 R0 接收的路由
- 检查从设备 R2 播发到设备 R1 的路由
- 检查设备 R1 从设备 R2 接收的路由
- 检查设备 R1 向设备 R0 播发的路由
- 检查设备 R1 向设备 R2 播发的路由
检查设备 R1 上配置的策略
目的
验证设备 R1 的动态和静态策略是否有效。
操作
从设备 R1 中,输入 命令。show policy
user@R1> show policy Configured policies: dyn_policy1 dyn_policy2 static_policy1 static_policy2 dyn_policy1 dyn_policy2
意义
动态策略被列出两次,因为它们配置了两次,即动态数据库中的第一次配置和集中配置。辅助配置位于引用动态数据库的静态数据库中,如下所示:
在动态数据库中配置
policy-statement dyn_policy1 { term t1 { from { prefix-list dyn_prfx1; } then accept; } term t2 { then reject; } } policy-statement dyn_policy2 { term t1 { from { prefix-list dyn_prfx2; } then accept; } term t2 { then reject; } }
从静态数据库引用
policy-statement dyn_policy1 { dynamic-db; } policy-statement dyn_policy2 { dynamic-db; }
检查从设备 R0 播发到设备 R1 的路由
目的
验证设备 R0 的路由策略是否正常工作。
操作
从设备 R0 中,输入命令,并使用 设备 R1 的邻居地址。show route advertising-protocol bgp
user@R0> show route advertising-protocol bgp 10.0.0.2 inet.0: 28 destinations, 28 routes (28 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 172.16.1.0/24 Self I * 172.16.2.0/24 Self I * 172.16.3.0/24 Self I * 172.16.4.0/24 Self I * 172.16.5.0/24 Self I * 172.16.6.0/24 Self I * 172.16.7.0/24 Self I * 172.16.8.0/24 Self I * 172.16.9.0/24 Self I * 172.16.10.0/24 Self I * 10.0.0.0/30 Self I
意义
设备 R0 正在向设备 R1 发送预期的路由。
检查设备 R1 从设备 R0 接收的路由
目的
验证设备 R1 的导入路由策略是否正常工作。
操作
在设备 R1 中,输入命令,并使用 设备 R0 的邻居地址。show route receive-protocol bgp
user@R1> show route receive-protocol bgp 10.0.0.1 inet.0: 35 destinations, 51 routes (35 active, 0 holddown, 4 hidden) Prefix Nexthop MED Lclpref AS path 172.16.1.0/24 10.0.0.1 100 I 172.16.2.0/24 10.0.0.1 100 I 172.16.3.0/24 10.0.0.1 100 I 172.16.4.0/24 10.0.0.1 100 I 172.16.5.0/24 10.0.0.1 100 I 172.16.6.0/24 10.0.0.1 100 I 172.16.7.0/24 10.0.0.1 100 I 172.16.8.0/24 10.0.0.1 100 I
意义
设备 R0 发送的某些路由未被设备 R1 接收。缺少路由 172.16.9.0/24、172.16.10.0/24 和 10.0.0.0/30。这是因为设备 R1 的导入策略(使用该语句应用于 与设备 R0 的 BGP 对等会话)专门定义了仅限于以下路由的前缀列表:import dyn_policy1
prefix-list dyn_prfx1 { 172.16.1.0/24; 172.16.2.0/24; 172.16.3.0/24; 172.16.4.0/24; 172.16.5.0/24; 172.16.6.0/24; 172.16.7.0/24; 172.16.8.0/24; }
检查从设备 R2 播发到设备 R1 的路由
目的
验证设备 R2 的路由策略是否正常工作。
操作
在设备 R2 中,输入命令,并使用 设备 R1 的邻居地址。show route advertising-protocol bgp
user@R2> show route advertising-protocol bgp 10.1.0.1 inet.0: 17 destinations, 17 routes (17 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 172.16.2.0/24 Self I * 172.16.3.0/24 Self I * 172.16.4.0/24 Self I * 172.16.5.0/24 Self I * 172.16.6.0/24 Self I
意义
设备 R2 正在向设备 R1 发送预期的路由。
检查设备 R1 从设备 R2 接收的路由
目的
验证设备 R1 的导入路由策略是否正常工作。
操作
在设备 R1 中,输入命令,并使用 设备 R0 的邻居地址。show route receive-protocol bgp
user@R1> show route receive-protocol bgp 10.1.0.2 inet.0: 35 destinations, 51 routes (35 active, 0 holddown, 4 hidden) Prefix Nexthop MED Lclpref AS path 172.16.2.0/24 10.1.0.2 300 I 172.16.3.0/24 10.1.0.2 300 I 172.16.4.0/24 10.1.0.2 300 I 172.16.5.0/24 10.1.0.2 300 I
意义
设备 R2 发送的路由之一未被设备 R1 接收。缺少路由 172.16.6.0/24。这是因为设备 R1 的导入策略(使用该语句应用于 与设备 R2 的 BGP 对等会话)专门定义了仅限于以下路由的前缀列表:import static_policy1
prefix-list static_prfx1 { 172.16.2.0/24; 172.16.3.0/24; 172.16.4.0/24; 172.16.5.0/24; }
检查设备 R1 向设备 R0 播发的路由
目的
验证设备 R1 的导出路由策略是否正常工作。
操作
在设备 R1 中,输入命令,并使用 设备 R0 的邻居地址。show route advertising-protocol bgp
user@R1> show route advertising-protocol bgp 10.0.0.1 inet.0: 35 destinations, 51 routes (35 active, 0 holddown, 4 hidden) Prefix Nexthop MED Lclpref AS path * 172.16.2.0/24 Self I * 172.16.3.0/24 Self I * 172.16.4.0/24 Self I * 172.16.5.0/24 Self I * 172.16.6.0/24 Self I
意义
也许出乎意料的是,设备 R1 未通过 BGP 从设备 R2 (172.16.6.0/24) 接收的路由仍然由设备 R1 通过 BGP 播发到设备 R0。发生这种情况有两个原因。第一个原因是路由 172.16.6.0/24 位于设备 R1 的路由表中,尽管是直接路由,如下所示:
user@R1> show route 172.16.6.0/24 protocol direct inet.0: 35 destinations, 51 routes (35 active, 0 holddown, 4 hidden) + = Active Route, - = Last Active, * = Both 172.16.6.0/24 *[Direct/0] 2d 22:51:41 > via fe-1/2/3.0
第二个原因是设备 R1 的导出策略(使用该语句应用于 与设备 R0 的 BGP 对等会话)专门定义了仅限于以下路由的前缀列表:export dyn_policy2
prefix-list dyn_prfx2 { 172.16.2.0/24; 172.16.3.0/24; 172.16.4.0/24; 172.16.5.0/24; 172.16.6.0/24; }
请注意包含 172.16.6.0/24。
检查设备 R1 向设备 R2 播发的路由
目的
验证设备 R1 的导出路由策略是否正常工作。
操作
在设备 R1 中,输入命令,使用 设备 R2 的邻居地址。show route advertising-protocol bgp
user@R1> show route advertising-protocol bgp 10.1.0.2 inet.0: 35 destinations, 51 routes (35 active, 0 holddown, 4 hidden) Prefix Nexthop MED Lclpref AS path * 172.16.1.0/24 Self I * 172.16.2.0/24 Self I * 172.16.3.0/24 Self I * 172.16.4.0/24 Self I
意义
设备 R1 正在向设备 R2 发送预期的路由。设备 R1 的导出策略(使用该语句应用于 与设备 R2 的 BGP 对等会话)专门定义了仅限于以下路由的前缀列表:export static_policy2
prefix-list static_prfx2 { 172.16.1.0/24; 172.16.2.0/24; 172.16.3.0/24; 172.16.4.0/24; }