環境: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