實驗二策略的使用

在這裏插入圖片描述
需求:1、R3到192.168.1.1 192.168.3.1的路由走R3-R2-R1,並留有備份
2、R3到192.168.2.1 192.168.4.1的路由走R3-R4-R1,並留有備份
3、10.0.12.0、10.0.14.0的路由不引進ospf中
在左側起rip,右邊起ospf在R2,R4的兩邊分別起RIP和ospf
將rip發不到ospf中
在這裏插入圖片描述
在這裏插入圖片描述

1、匹配192.168.1.0 192.168.3.0的路由將走R2的cost改爲20,走R4的cost改爲30在這裏插入圖片描述在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述
2、匹配192.168.2.0 192.168.4.0的路由將走R2的cost改爲30,走R4的cost改爲20

在這裏插入圖片描述

在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述
3、10.0.12.0、10.0.14.0的路由不引進ospf中
使用前綴列表匹配這兩個網段
在這裏插入圖片描述在這裏插入圖片描述在這裏插入圖片描述在這裏插入圖片描述
R1配置

#
interface GigabitEthernet0/0/0
 ip address 10.0.12.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 10.0.14.1 255.255.255.0 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 10.0.1.1 255.255.255.255 
#
interface LoopBack1
 ip address 192.168.1.1 255.255.255.0 
#
interface LoopBack2
 ip address 192.168.2.1 255.255.255.0 
#
interface LoopBack3
 ip address 192.168.3.1 255.255.255.0 
#
interface LoopBack4
 ip address 192.168.4.1 255.255.255.0 
#
rip 1
	 undo summary
	 version 2
	 network 10.0.0.0
	 network 192.168.1.0
	 network 192.168.2.0
	 network 192.168.3.0
	 network 192.168.4.0
#

R2配置

acl number 2000  
 rule 5 permit source 192.168.1.0 0.0.254.255 
acl number 2001  
 rule 5 permit source 192.168.0.0 0.0.254.255 
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 10.0.23.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 10.0.12.2 255.255.255.0 
#
interface GigabitEthernet0/0/2
#
ospf 1 router-id 2.2.2.2 
 import-route rip 1 route-policy 1
 area 0.0.0.0 
  network 10.0.23.1 0.0.0.0 
#
rip 1
 undo summary
 version 2
 network 10.0.0.0
#
route-policy 1 permit node 5 
 if-match acl 2000 
 apply cost 20 
 apply cost-type type-1 
#
route-policy 1 permit node 10 
 if-match acl 2001 
 apply cost 30 
 apply cost-type type-2 
#
route-policy 1 deny node 15 
 if-match ip-prefix 2 
#
route-policy 1 permit node 100 
#
ip ip-prefix 2 index 10 permit 10.0.12.0 24
ip ip-prefix 2 index 20 permit 10.0.14.0 24
#

R3配置:

#
interface GigabitEthernet0/0/0
 ip address 10.0.23.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 10.0.34.2 255.255.255.0 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 10.0.23.2 0.0.0.0 
  network 10.0.34.2 0.0.0.0 
#

R4配置:

#
interface GigabitEthernet0/0/0
 ip address 10.0.34.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 10.0.14.2 255.255.255.0 
#
interface GigabitEthernet0/0/2
#
ospf 1 router-id 4.4.4.4 
 import-route rip 1 route-policy 1
 area 0.0.0.0 
  network 10.0.34.1 0.0.0.0 
#
rip 1
 undo summary
 network 10.0.0.0
#
route-policy 1 permit node 5 
 if-match acl 2000 
 apply cost 30 
 apply cost-type type-1 
#
route-policy 1 permit node 10 
 if-match acl 2001 
 apply cost 20 
 apply cost-type type-2 
#
route-policy 1 deny node 15 
 if-match ip-prefix 2 
#
route-policy 1 permit node 100 
#
ip ip-prefix 2 index 10 permit 10.0.12.0 24
ip ip-prefix 2 index 20 permit 10.0.14.0 24
#
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章