NQA 实验
实验拓扑
注:如无特别说明,描述中的 R1 或 SW1 对应拓扑中设备名称末尾数字为 1 的设备,R2 或 SW2 对应拓扑中设备名称末尾数字为 2 的设备,以此类推
实验需求
- 按照图示配置 IP 地址
- 配置 OSPF,使 R1、R2、R3 和 R4 的互联接口可以互通,Loopback 口不要宣告
- 在 R1 上配置到达 192.168.1.0/24 网段的静态路由,Active 路由经过 R2 到达,Inactive 路由经过 R3 到达
- 在 R1 上配置 NQA,当 R3 和 R4 之间的链路故障后,R1 能够把到达 192.168.1.0/24 网段的路由切换至经过 R3
实验解法
按照图示配置 IP 地址,命令略
配置 OSPF,使 R1、R2、R3 和 R4 的互联接口可以互通,Loopback 口不要宣告。命令略
在 R1 上配置静态路由,并联动 NQA 实现远端故障监测
步骤 1:在 R1 上配置到达 192.168.1.0/24 网段的静态路由,下一跳指向 R2 的路由调用 Track 项监测,另一条路由下一跳指向 R3 把优先级设置为 80
[R1]ip route-static 192.168.1.0 24 10.1.1.2 track 1 [R1]ip route-static 192.168.1.0 24 10.2.2.3 preference 80
步骤 2:在 R1 上创建 NQA,测试类型为 ICMP-Echo,报文探测目的地址为 10.3.3.4,下一跳地址为 10.1.1.2,测试频率 100ms,5 次探测失败则判断为故障
[R1]nqa entry admin s1 \\admin 为管理员账户,s1 为 NQA 测试组名称 [R1-nqa-admin-s1]type icmp-echo [R1-nqa-admin-s1-icmp-echo]destination ip 10.3.3.4 [R1-nqa-admin-s1-icmp-echo]frequency 100 [R1-nqa-admin-s1-icmp-echo]next-hop ip 10.1.1.2 [R1-nqa-admin-s1-icmp-echo]reaction 1 checked-element probe-fail threshold-type consecutive 5 action-type trigger-only
步骤 3:在 R1 上启动 NQA 探测
[R1]nqa schedule admin s1 start-time now lifetime forever
步骤 4:在 R1 上创建 Track 项,关联 NQA
[R1]track 1 nqa entry admin s1 reaction 1
效果测试
步骤 1:在 R1 上查看路由表,正常情况下,到达 192.168.1.0/24 网段的路由是经过 R2 的。查看 Track 项状态为正常
[R1]display ip routing-table Destination/Mask Proto Pre Cost NextHop Interface …… 192.168.1.0/24 Static 60 0 10.1.1.2 GE0/0 ……
[R1]display track 1 Track ID: 1 State: Positive Duration: 0 days 0 hours 16 minutes 3 seconds Tracked object type: NQA Notification delay: Positive 0, Negative 0 (in seconds) Tracked object: NQA entry: admin s1 Reaction: 1 Remote IP/URL: 10.3.3.4 Local IP: -- Interface: --
步骤 2:在 R4 上手段关闭 G0/1 口后,R1 上到达 192.168.1.0/24 网段的路由会自动切换至经过 R3,且 Track 项的状态变为失败
[R1]display ip routing-table Destination/Mask Proto Pre Cost NextHop Interface …… 192.168.1.0/24 Static 80 0 10.2.2.3 GE0/1 ……
[R1]display track 1 Track ID: 1 State: Negative Duration: 0 days 0 hours 0 minutes 37 seconds Tracked object type: NQA Notification delay: Positive 0, Negative 0 (in seconds) Tracked object: NQA entry: admin s1 Reaction: 1 Remote IP/URL: 10.3.3.4 Local IP: -- Interface: --