环境:R3 Loop test ip1:3.3.3.3, test ip2:33.33.33.33服务器
R4 (PC): Client ip:40.1.1.4ide
WJC-LAY3:三层交换机,学到去3.3.3.3/33.33.33.33的路由以下oop
优选E0/0出去debug
为了避免影响R1(RA)& R2(RB)的配置,咱们尽可能把policy作在WJC三层交换上blog
扩展1:基于某一网段实现分流,能够是语音网段ip
基于40.1.1.X网段作policy路由
WJC-SWL3(config)#access-list 10 permit 40.1.1.0 0.0.0.255get
WJC-SWL3(config)#route-map policy1it
WJC-SWL3(config-route-map)#match ip add 10io
WJC-SWL3(config-route-map)#set ip next-hop 20.1.1.2
WJC-SWL3(config-route-map)#exit
WJC-SWL3(config)#int e0/1 \\入方向作policy
WJC-SWL3(config-if)#ip policy route-map policy1
看先后两次对结果:
WJC-SWL3#debug ip policy
Policy routing debugging is on
WJC-SWL3#
*Apr 30 11:02:27.865: IP: s=40.1.1.4 (Ethernet0/1), d=3.3.3.3, len 28, policy match
*Apr 30 11:02:27.865: IP: route map policy1, item 10, permit
*Apr 30 11:02:27.865: IP: s=40.1.1.4 (Ethernet0/1), d=3.3.3.3 (Serial2/0), len 28, policy routed
*Apr 30 11:02:27.865: IP: Ethernet0/1 to Serial2/0 20.1.1.2
扩展2:实现打印分流 咱们能够扩展ACL,好比说咱们去打印服务器3.3.3.3,让流量强制走备线S2/0出去而去其余网段好比:33.33.33.33,依旧走E0/0
WJC-SWL3(config)#do sh access-list
Extended IP access list 100
10 permit ip any 3.3.3.0 0.0.0.255
WJC-SWL3(config)#route-map policy2
WJC-SWL3(config-route-map)#match ip address 100
WJC-SWL3(config-route-map)#set ip next-hop 20.1.1.2
WJC-SWL3(config-route-map)#exit
WJC-SWL3(config)#int e0/1
WJC-SWL3(config-if)#ip policy route-map policy2
成功实现结果以下:
扩展3:另外route map后面能够跟序号,能够匹配多条ACL 作不一样的分流
WJC-SWL3(config)#route-map policy2 ?
<0-65535> Sequence to insert to/delete from existing route-map entry