一、拓撲圖:
二、配置及說明:
1、圖中我用R0模拟幀中繼,我隻想讓它們都參與到幀中繼網中,R3我沒有用子接口來做,因為我隻要能學到全網内的路由。我并不要他們各自ping 通自己接口位址。我用路由器模拟幀中繼,有利于我們更好的了解其原理。(為節省篇幅,幀中繼的配置我就不寫了。)其它的在幀中繼網中的路由器都指map。好了。下面來看一下R0的frame-relay route:
FRSW#sh frame-relay route
Input Intf Input Dlci Output Intf Output Dlci Status
Serial1/0 343 Serial1/1 434 active
Serial1/0 363 Serial1/2 636 active
Serial1/1 434 Serial1/0 343 active
Serial1/2 636 Serial1/0 363 active
2、我用R1和R2模拟成主機并指預設路由到下一跳192.168.1.1網關。
3、在R3,R4,R5,R6各路由器中都運作動态路由協定RIP V2 ,保證全網的互聯性。
4、配置完成之後,再來看一下R3的路由表:
R3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 2 subnets
R 172.16.1.0 [120/1] via 10.1.1.2, 00:00:07, Serial1/2
R 172.16.2.0 [120/1] via 10.1.1.3, 00:00:12, Serial1/2
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial1/2
130.130.0.0/24 is subnetted, 1 subnets
R 130.130.1.0 [120/2] via 10.1.1.3, 00:00:12, Serial1/2
[120/2] via 10.1.1.2, 00:00:07, Serial1/2 (發現有兩條負載鍊路)
C 192.168.1.0/24 is directly connected, FastEthernet0/0
R3#
4、把R3上的cef (Cisco Express Forwarding,Cisco快速交換)和route-cache 關掉,我們來traceroute 130.130.1.1看一下它的路徑走向:
R3(config)#int s1/2
R3(config-if)#no ip cef
R3(config-if)#no ip route-cache
R3#traceroute 130.130.1.1
Type escape sequence to abort.
Tracing the route to 130.130.1.1
1 10.1.1.2 64 msec
10.1.1.3 80 msec
10.1.1.2 12 msec
2 172.16.2.1 16 msec
172.16.1.2 28 msec * (發現通過R4和R6兩條鍊路走)
5、我再到R3上的F0/0接口上去關閉一下cef 和route-cache ,我再到R1和R2主機上去traceroute 看一下負載均衡路徑的明細走向:
R3(config)#int f0/0
R1#traceroute 130.130.1.1
1 192.168.1.1 60 msec 44 msec 12 msec
2 10.1.1.2 44 msec
10.1.1.3 68 msec
10.1.1.2 24 msec
3 172.16.2.1 48 msec
172.16.1.2 48 msec * (都是通過兩條鍊路來走的)
R2#traceroute 130.130.1.1
1 192.168.1.1 56 msec 24 msec 12 msec
2 10.1.1.2 80 msec
10.1.1.3 20 msec
10.1.1.2 72 msec
3 172.16.2.1 80 msec
172.16.1.2 4 msec * (都是通過兩條鍊路來走的)
R2#
三、那麼我要在R3上做政策路由實作:
1、R1主機àR3àR4àR5à130.130.1.1/24
2、R2主機àR3àR6àR5à130.130.1.1/24
四、在R3上做政策路由的配置:
R3(config)#access-list 10 per host 192.168.1.10
R3(config)#access-list 20 per host 192.168.1.20(先建兩個ACL)
R3(config)#route-map pbr permit 10 (建立route-map pbr 序号為10)
R3(config-route-map)#match ip add 10 (比對acl 10)
R3(config-route-map)#set ip next-hop 10.1.1.2(設定下一點為R4)
R3(config)#route-map pbr permit 20(再建一個route-map pbr 序号為20)
R3(config-route-map)#match ip add 20(比對acl 20)
R3(config-route-map)#set ip next-hop 10.1.1.3(設定下一跳為R6)
R3(config-if)#ip policy route-map pbr (把政策路由往接口上挂,這樣它就不從路由表走,而是從設定的下一跳走)
五、我們再來跟蹤一下R1和R2的路由走向:
1 192.168.1.1 40 msec 68 msec 28 msec
2 10.1.1.2 48 msec 28 msec 24 msec (從R4走了)
3 172.16.1.2 52 msec * 104 msec
1 192.168.1.1 68 msec 20 msec 16 msec
2 10.1.1.3 64 msec 40 msec 48 msec (從R6走了)
3 172.16.2.1 36 msec * 100 msec
六、通過上面的操作我們可以對某些路由不從自己的路由表走,而是從設定的下一跳走。這就是政策路由。需要記住跟蹤路徑的時候要關閉cef和ip route-cache。以便能夠跟蹤到詳細的路徑。配置FR的時候map注意一點就行了。
http://blog.51cto.com/supercisco/260124
本文轉自wxs-163 51CTO部落格,原文連結:http://blog.51cto.com/supercisco/260124