四、根据数据包的大小来做策略路由走向:
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
Match clauses:
ip address (access-lists): 2
length 601 800
Set clauses:
ip next-hop 192.168.34.3
Policy routing matches: 0 packets, 0 bytes
|
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
route-map pbr1, permit, sequence 1
Match clauses:
length 0 600
Set clauses:
ip next-hop 192.168.24.2
Policy routing matches: 5 packets, 520 bytes
(走这条链路了是
520bytes
)
route-map pbr2, permit, sequence 2
Match clauses:
ip address (access-lists): 2
length 601 800
Set clauses:
ip next-hop 192.168.34.3
Policy routing matches: 0 packets, 0 bytes
|
5、同样在R6上用扩展ping 700看一下会走哪里?
R6#ping ip
Target IP address: 1.1.1.1
Repeat count [5]: 5
Datagram size [100]: 700
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 6.6.6.6
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, 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
route-map pbr1, permit, sequence 1
Match clauses:
length 0 600
Set clauses:
ip next-hop 192.168.24.2
Policy routing matches: 5 packets, 520 bytes
(这里还是
520bytes
)
route-map pbr2, permit, sequence 2
Match clauses:
ip address (access-lists): 2
length 601 800
Set clauses:
ip next-hop 192.168.34.3
Policy routing matches: 5 packets, 3520 bytes
(这里却到了
3520bytes
)
|
7、我在R6上traceroute ,因为traceroute 过去的话也会小于700
R6#traceroute ip
Target IP address: 1.1.1.1
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]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
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
,所以就走左边链路了)
|