天天看點

思科同時比對源和目标位址進行政策路由配置測試

1.測試拓撲:

2.基本配置:

R1:

interface FastEthernet0/0

 ip address 12.1.1.1 255.255.255.0

 no shutdown

interface Loopback0

 ip address 1.1.1.1 255.255.255.0

R2:

interface Ethernet0/0

 ip address 12.1.1.2 255.255.255.0

!

interface Ethernet0/1

 ip address 23.1.1.2 255.255.255.0

interface Ethernet0/2

 ip address 24.1.1.2 255.255.255.0

R3:

 ip address 23.1.1.3 255.255.255.0

interface FastEthernet0/1

 ip address 50.1.1.3 255.255.255.0

R4:

 ip address 24.1.1.4 255.255.255.0

 ip address 50.1.1.4 255.255.255.0

R5:

 ip address 5.5.5.5 255.255.255.0

 ip address 50.1.1.5 255.255.255.0

3.靜态路由配置:

ip route 0.0.0.0 0.0.0.0 12.1.1.2

R2:

ip route 0.0.0.0 0.0.0.0 23.1.1.3

ip route 1.1.1.0 255.255.255.0 12.1.1.1

ip route 5.5.5.0 255.255.255.0 50.1.1.5

ip route 12.1.1.0 255.255.255.0 23.1.1.2

ip route 1.1.1.0 255.255.255.0 24.1.1.2

ip route 0.0.0.0 0.0.0.0 50.1.1.3

ip route 1.1.1.0 255.255.255.0 50.1.1.4

4.R2政策路由配置:

A.配置通路控制清單,比對流量:

access-list 110 permit ip 1.1.1.0 0.0.0.255 5.5.5.0 0.0.0.255

B.配置route-map,比對流量後,設定下一跳

route-map net5 permit 10

 match ip address 110

 set ip next-hop 24.1.1.4

route-map net5 permit 20

C.在通路控制清單對應流量的進入接口應用route-map

 ip policy route-map net5

5.效果測試:

A.R1直接traceroute 5.5.5.5 ,這時的源位址為12.1.1.1

R1#traceroute 5.5.5.5                      

Type escape sequence to abort.

Tracing the route to 5.5.5.5

  1 12.1.1.2 36 msec 80 msec 44 msec

  2 23.1.1.3 92 msec 96 msec 60 msec

  3 50.1.1.5 160 msec *  184 msec

R1#

-----可以看到R2根據預設路由配置,将去往5.5.5.5的資料包下一跳扔給了R3。

B.R1指定源位址為1.1.1.1來traceroute 5.5.5.5

R1#traceroute 5.5.5.5 source 1.1.1.1

  1 12.1.1.2 44 msec 100 msec 56 msec

  2 24.1.1.4 68 msec 64 msec 96 msec

  3 50.1.1.5 124 msec *  140 msec

----可以看到,R2根據政策路由配置,将源位址為1.1.1.1目标位址為5.5.5.5的下一跳扔給了R4。

本文轉自 碧雲天 51CTO部落格,原文連結:http://blog.51cto.com/333234/1066640,如需轉載請自行聯系原作者

繼續閱讀