本文主要描述通过策略路由PBRIP服务水平协议SLA来实现数据包的分流。
    假设:Outside上设置默认路由到192.168.1.0/24,下一条指向R6ip route 0.0.0.0 255.255.255.0 1.1.56.6
要求:但是从源IP:5.5.5.5/32出来的数据包必须走R4:并且保证链路的畅通性:
    R5基本配置:
    interface Loopback0
      ip address 5.5.5.5 255.255.255.255
 
    interface FastEthernet1/0
      ip address 1.1.56.5 255.255.255.0
 
    interface FastEthernet1/1
      ip address 1.1.45.5 255.255.255.0
      ip policy route-map AAA
 
    ip local policy route-map AAA
    ip route 0.0.0.0 0.0.0.0 1.1.56.6
    route-map AAA permit 10
      match interface Loopback0
      set ip next-hop 1.1.45.4
 
    R5#debug ip policy
    R5#ping 4.4.4.4 sou lo0
:这里注意:如果是本地产生的流量,route-map默认是不匹配的,需要启用:[ip local policy route-map AAA]:才能让本地流量匹配AAA
    *Dec  3 18:48:32.823: IP: s=5.5.5.5 (local), d=4.4.4.4, len 100, policy match
    *Dec  3 18:48:32.823: IP: route map AAA, item 10, permit
    *Dec  3 18:48:32.827: IP: s=5.5.5.5 (local), d=4.4.4.4 (FastEthernet1/1), len 100, policy routed
    *Dec  3 18:48:32.827: IP: local to FastEthernet1/1 1.1.45.4
    此时如果关闭R4F1/1接口:此时R5pingR4:链路是否正常?
  
【不通】:解释:route-map无法区分下一跳是否可达。但是可以结合SLA来实现:
    ip sla monitor 1
    type echo protocol ipIcmpEcho 1.1.45.4
    frequency 10
    ip sla monitor schedule 1 life forever start-time now
 
    track 2 rtr 1
    route-map AAA permit 10
    match interface Loopback0
    set ip next-hop verify-availability 1.1.45.4 1 track 2
    R5#ping 4.4.4.4 sou lo0 :这里注意:此时如果你关闭R4F1/1,即使流量匹配了route-map,但是策略还是不会被执行,走正常的路由表:详细见以下debug信息
    Wan30#debug ip policy
    *Dec  3 18:49:42.115: IP: s=5.5.5.5 (local), d=4.4.4.4, len 100, policy match
    *Dec  3 18:49:42.115: IP: route map AAA, item 10, permit
    *Dec  3 18:49:42.115: IP: s=5.5.5.5 (local), d=4.4.4.4, len 100, policy rejected -- normal forwarding
    通过以上配置实验,数据包分流实现。