四、根據資料包的大小來做政策路由走向:
1、我先把R4上的pbr1下再做一個match:
R4(config)#route-map pbr1 permit 1
R4(config-route-map)#match length 0 600 (比對一個最小為0 ,最大為600的資料包)
R4(config)#route-map pbr2 permit 2
R4(config-route-map)#match length 0 800 (比對一個最小為601,最大為800的資料包)
2、在R4上show route-map 看一下:
R4(config)#do sho route-map
route-map pbr1, permit, sequence 1
Match clauses:
Set clauses:
ip next-hop 192.168.34.3
Policy routing matches: 0 packets, 0 bytes
route-map pbr2, permit, sequence 2
ip address (access-lists): 2
length 601 800
3、我現在在R5上用擴充ping
R5#ping ip
Target IP address: 1.1.1.1
Repeat count [5]: 5
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 5.5.5.5
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 5.5.5.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 216/325/404
4、再到R4上看一下route-map
length 0 600
ip next-hop 192.168.24.2
Policy routing matches: 5 packets, 520 bytes (走這條鍊路了是520bytes)
Policy routing matches: 0 packets, 0 bytes
5、同樣在R6上用擴充ping 700看一下會走哪裡?
R6#ping ip
Datagram size [100]: 700
Source address or interface: 6.6.6.6
Sending 5, 700-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 6.6.6.6
Success rat
6、再次show route-map
R4# show route-map
Policy routing matches: 5 packets, 520 bytes (這裡還是520bytes)
Policy routing matches: 5 packets, 3520 bytes (這裡卻到了3520bytes)
7、我在R6上traceroute ,因為traceroute 過去的話也會小于700
R6#traceroute ip
Source address: 6.6.6.6
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Tracing the route to 1.1.1.1
1 192.168.46.4 84 msec 128 msec 92 msec
2 192.168.24.2 188 msec 220 msec 280 msec
3 192.168.12.1 216 msec * 260 msec (小于700,是以就走左邊鍊路了)
本文轉自wxs-163 51CTO部落格,原文連結:http://blog.51cto.com/supercisco/250068