2. set ip next-hop verify-availability [ next-hop-address sequence track object ] 检测下一跳的可达性,默认是关闭的
Sequence of next hops. The acceptable range is from 1 to 65535.
此条命令可以下列方式使用:
3. set ip next-hop 与set ip default next-hop的区别比较简单,这里就不解析了
二 实验验证
2.1 set ip next-hop
GW的配置如下: access-list 1 permit any
route-map PBR permit 10
match ip address 1
set ip next-hop 10.1.1.2 10.2.2.2
interface fast 1/0
ip policy route-map PBR
!! GW并无其他关于路由的配置
补充: Set ip next-hop ip1 ip2 ip3,这个知识点已经没问题了吧?match住相关条件后,数据包首先被送到第一个next-hop ip address,如果这个ip地址所关联的直连接口DOWN了,则切换至下一个next-hop ip address,如此反复,可以配置多个next-hop。但是,如果直连的next-hop(对端路由器或其接口)自己挂了,而本地直连接口没感知到(如中间串了台switch),则无法自动切换,路由器仍然会一股脑的把数据丢给这个next-hop。
另外,如果配置的时候命令这么写的话:
Set ip next-hop ip1
Set ip next-hop ip2
……
则IOS会自动将命令变成Set ip next-hop ip1 ip2 ……
2.2 set ip next-hop verify-availability
GW的配置如下: access-list 1 permit any
route-map PBR permit 10
match ip address 1
set ip next-hop 10.1.1.2 10.2.2.2
set ip next-hop verify-availability
interface fast 1/0
ip policy route-map PBR
!! GW并无其他关于路由的配置
!! ISP1、ISP2及GW都需开启CDP
2.3 set ip next-hop verify-availability基于object tracking
GW的配置如下: ip sla monitor responder
ip sla monitor 1
type echo protocol ipIcmpEcho 10.1.1.2 source-ipaddr 10.1.1.1
frequency 10
exit
ip sla monitor schedule 1 life forever start-time now
track 1 rtr 1 reachability
ip sla monitor 2
type echo protocol ipIcmpEcho 10.2.2.2 source-ipaddr 10.2.2.1
frequency 10
exit
ip sla monitor schedule 2 life forever start-time now
track 2 rtr 2 reachability
access-list 1 permit any
route-map PBR permit 10
match ip address 1
set ip next-hop verify-availability 10.1.1.2 10 track 1
set ip next-hop verify-availability 10.2.2.2 20 track 2