基於報文大小的策略路由

實驗目的
通過本實驗可以掌握策略路由配置以及相應的應用
實驗要求
1):知道什麼是策略路由和相應的知識
2):知道配置策略路由的作用
3): 知道如何配置策略路由
 
實驗內容
1):設置大小爲64~100B的報文出棧接口爲s1/0
2):設置大小爲101~1000B的報文出棧接口爲s1/1。
3):其他的報文正常轉發,整個網絡運行RIPV2
 
實驗拓撲
實驗步聚
1).配置R1
R1(config)#int s1/0
R1(config-if)#ip add 192.168.2.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shut
R1(config)#int s1/1
R1(config-if)#ip add 192.168.3.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shut
R1(config)#int fa0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config)#router rip
R1(config-router)#ver 2
R1(config-router)#no auto-summary
R1(config-router)#net 192.168.2.0
R1(config-router)#net 192.168.3.0
R1(config-router)#net 192.168.1.0
 
2).配置R2
R2(config)#int s1/0
R2(config-if)#ip add 192.168.2.2 255.255.255.0
R2(config-if)#no sh
R2(config)#int s1/1
R2(config-if)#ip add 192.168.3.2 255.255.255.0
R2(config-if)#no sh
R2(config)#int s1/1
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config)#router rip
R2(config-router)#ver 2
R2(config-router)#no auto-summary
R2(config-router)#net 192.168.2.0
R2(config-router)#net 192.168.3.0
R2(config-router)#net 2.2.2.0
 
3).配置SW1
SW1(config)#int fa0/0
SW1(config-if)#no sh
SW1(config)#int fa0/1
SW1(config-if)#no sh
SW1(config)#int fa0/2
SW1(config-if)#no sh
 
4).配置PC的IP地址
PC1:192.168.1.2/24
PC2: 192.168.1.3/24
 
5).在R1上配置基於IP地址的策略路由
R1(config)#route-map ahxh permit 10
R1(config-route-map)#match length 64 100
R1(config-route-map)#set ip next-hop 192.168.2.2 或set int s1/0
R1(config)#route-map ahxh permit 20
R1(config-route-map)#match length 101 1000
R1(config-route-map)#set ip next-hop 192.168.3.2 或set int s1/1
R1(config)#int fa0/0
R1(config-if)#ip policy route-map ahxh
R1(config)#ip local policy router-map ahxh
 
6).打開路由R1的debug
R1#debug ip policy
 
7).顯示策略
R1#sh ip policy
Interface      Route map
Fa0/0          ahxh
以上輸出信息表明在F0/0上應用了路由策略AHXH
 
8).認證(用擴展ping測試)
在路由器R1打開debug ip policy,然後在路由器R1上執行擴展ping命令,數據包的長度分別爲80和200。
A:當數據包的長度分別爲80時
*Mar 1 00:08:40.155: IP: s=192.168.1.1 (local), d=2.2.2.2, len 80, policy match
*Mar 1 00:08:40.155: IP: route map ahxh, item 10, permit
*Mar 1 00:08:40.155: IP: s=192.168.1.1 (local), d=2.2.2.2 (Serial1/0), len 80, policy routed
*Mar 1 00:08:40.159: IP: local to Serial1/0 192.168.2.2

policy routed

 
以上輸出信息表明長度爲80B的數據包區配route-map ahxh的序列號10所定義的策略,執行本地策略路由,設置數包的下一跳爲192.168.2.2
 
B:當數據包的長度分別爲200時
*Mar 1 00:17:39.411: IP: s=192.168.1.1 (local), d=2.2.2.2, len 200, policy match
*Mar 1 00:17:39.411: IP: route map ahxh, item 20, permit
*Mar 1 00:17:39.411: IP: s=192.168.1.1 (local), d=2.2.2.2 (Serial1/1), len 200, policy routed
*Mar 1 00:17:39.411: IP: local to Serial1/1 192.168.3.2
 
以上輸出信息表明長度爲200B的數據包區配route-map ahxh的序列號10所定義的策略,執行本地策略路由,設置數包的下一跳爲192.168.3.2
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章