一個OSPF綜合實驗,包括9臺路由器(其中一臺模擬幀中繼交換機),涉及OSPF多區域、OSPF虛鏈路、Stub區域、NSSA區域、OSPF手動匯總、OSPF接口認證、OSPF區域認證等技術。
GNS3拓撲與實驗拓撲圖完全一致,我把預配置文件也一起打包了(包括所有的接口配置以及幀中繼交換機的配置,在下邊),需要的可以直接下載專注于練習OSPF。
點擊下載:GNS3實驗拓撲及預配置文件
實驗拓撲圖
實驗過程:
1、幀中繼交換機的配置,我簡單寫一下(預配置已經做好,跟OSPF關系不大)。
en
conf t
ho R9
frame-relay switching
int s1/0
encapsulation frame-relay
clock rate 64000
frame-relay intf-type dce
frame-relay route 203 interface s1/1 302
frame-relay route 204 interface s1/2 402
no sh
int s1/1
encapsulation frame-relay
clock rate 64000
frame-relay intf-type dce
frame-relay route 302 interface s1/0 203
no sh
int s1/2
encapsulation frame-relay
clock rate 64000
frame-relay intf-type dce
frame-relay route 402 interface s1/0 204
no sh
end
2、配置Area 0區域,不需要采用子接口,物理接口網絡類型設置為broadcast即可。
R2(config)#router ospf 10
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 172.17.1.1 0.0.0.0 area 0
// 修改OSPF接口網絡類型為廣播
R2(config-router)#int s1/2
R2(config-if)#ip ospf network broadcast
R3(config)#router ospf 10
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 172.17.1.2 0.0.0.0 area 0
// 修改OSPF接口網絡類型為廣播
R3(config-router)#int s1/2
R3(config-if)#ip ospf network broadcast
// 設置ospf接口優先級為0,禁止R3成為DR/BDR
R3(config-if)#ip ospf priority 0
R4(config)#router ospf 10
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 172.17.1.3 0.0.0.0 area 0
// 修改OSPF接口網絡類型為廣播
R4(config-router)#int s1/2
R4(config-if)#ip ospf network broadcast
//設置ospf接口優先級為0,禁止R4成為DR/BDR
R4(config-if)#ip ospf priority 0
3、在R2上檢查鄰居關系,R3和R4均為DROTHER
R2#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 0 FULL/DROTHER 00:00:34 172.17.1.2 Serial1/2
4.4.4.4 0 FULL/DROTHER 00:00:33 172.17.1.3 Serial1/2
4、配置Area 1區域
R2(config)#router ospf 10
R2(config-router)#net 10.1.1.2 0.0.0.0 area 1
R1(config)#router ospf 10
R1(config-router)#router-id 1.1.1.1
R1(config-router)#net 172.16.0.0 0.0.3.255 area 1
R1(config-router)#net 10.1.1.1 0.0.0.0 area 1
5、配置Area 2區域
R4(config)#router ospf 10
R4(config-router)#net 10.1.3.1 0.0.0.0 area 2
R7(config)#router ospf 10
R7(config-router)#router-id 7.7.7.7
R7(config-router)#net 172.18.1.0 0.0.1.255 area 2
R7(config-router)#net 10.1.3.2 0.0.0.0 area 2
6、配置Area 3區域
R7(config)#router ospf 10
R7(config-router)#net 10.1.4.1 0.0.0.0 area 3
R8(config)#router ospf 10
R8(config-router)#router-id 8.8.8.8
R8(config-router)#net 172.20.0.0 0.0.3.255 area 3
R8(config-router)#net 10.1.4.2 0.0.0.0 area 3
7、配置Area 4區域
R3(config)#router ospf 10
R3(config-router)#net 10.1.2.1 0.0.0.0 area 4
R5(config)#router ospf 10
R5(config-router)#router-id 5.5.5.5
R5(config-router)#net 172.19.0.0 0.0.1.255 area 4
R5(config-router)#net 10.1.2.2 0.0.0.0 area 4
8、由于Area 3沒有跟Area 0直接相連,因此需要在R4和R7上創建虛鏈路
//虛鏈路參數為對端路由器Router ID
R4(config)#router ospf 10
R4(config-router)#area 2 virtual-link 7.7.7.7
R7(config)#router ospf 10
R7(config-router)#area 2 virtual-link 4.4.4.4
9、配置ripv2路由協議,由于rip不支持掩碼表示法,因此需要依次宣告每個C類網段
R5(config)#router rip
R5(config-router)#version 2
R5(config-router)#no auto-summary
R5(config-router)#net 192.168.255.0
R6(config)#router rip
R6(config-router)#version 2
R6(config-router)#no auto-summary
R6(config-router)#net 192.168.0.0
R6(config-router)#net 192.168.1.0
R6(config-router)#net 192.168.2.0
R6(config-router)#net 192.168.3.0
R6(config-router)#net 192.168.4.0
R6(config-router)#net 192.168.5.0
R6(config-router)#net 192.168.6.0
R6(config-router)#net 192.168.7.0
R6(config-router)#net 192.168.8.0
R6(config-router)#net 192.168.9.0
R6(config-router)#net 192.168.10.0
R6(config-router)#net 192.168.11.0
R6(config-router)#net 192.168.255.0
10、在R5上將rip重分布進ospf,開銷使用E1類型,此時R5為ASBR
R5(config)#router ospf 10
R5(config-router)#redistribute rip subnets metric-type 1
11、檢查R2的路由表,應可以學到192.168.0.0/24網段
R2#sh ip ro
O E1 192.168.8.0/24 [110/148] via 172.17.1.2, 00:00:58, Serial1/2
O E1 192.168.9.0/24 [110/148] via 172.17.1.2, 00:00:58, Serial1/2
O E1 192.168.10.0/24 [110/148] via 172.17.1.2, 00:00:58, Serial1/2
172.17.0.0/24 is subnetted, 1 subnets
C 172.17.1.0 is directly connected, Serial1/2
172.16.0.0/24 is subnetted, 4 subnets
O 172.16.0.0 [110/65] via 10.1.1.1, 00:10:09, Serial1/0
O 172.16.1.0 [110/65] via 10.1.1.1, 00:10:09, Serial1/0
O 172.16.2.0 [110/65] via 10.1.1.1, 00:10:12, Serial1/0
O 172.16.3.0 [110/65] via 10.1.1.1, 00:10:12, Serial1/0
172.19.0.0/24 is subnetted, 2 subnets
O IA 172.19.1.0 [110/129] via 172.17.1.2, 00:06:38, Serial1/2
O IA 172.19.0.0 [110/129] via 172.17.1.2, 00:06:38, Serial1/2
172.18.0.0/24 is subnetted, 2 subnets
O IA 172.18.0.0 [110/129] via 172.17.1.3, 00:06:41, Serial1/2
O IA 172.18.1.0 [110/129] via 172.17.1.3, 00:06:41, Serial1/2
172.20.0.0/24 is subnetted, 4 subnets
O IA 172.20.0.0 [110/193] via 172.17.1.3, 00:06:41, Serial1/2
O IA 172.20.1.0 [110/193] via 172.17.1.3, 00:06:41, Serial1/2
O IA 172.20.2.0 [110/193] via 172.17.1.3, 00:06:41, Serial1/2
O IA 172.20.3.0 [110/193] via 172.17.1.3, 00:06:41, Serial1/2
O E1 192.168.11.0/24 [110/148] via 172.17.1.2, 00:01:04, Serial1/2
O E1 192.168.4.0/24 [110/148] via 172.17.1.2, 00:01:04, Serial1/2
O E1 192.168.5.0/24 [110/148] via 172.17.1.2, 00:01:04, Serial1/2
10.0.0.0/24 is subnetted, 4 subnets
O IA 10.1.3.0 [110/128] via 172.17.1.3, 00:06:41, Serial1/2
O IA 10.1.2.0 [110/128] via 172.17.1.2, 00:06:41, Serial1/2
C 10.1.1.0 is directly connected, Serial1/0
O IA 10.1.4.0 [110/192] via 172.17.1.3, 00:06:41, Serial1/2
O E1 192.168.6.0/24 [110/148] via 172.17.1.2, 00:01:04, Serial1/2
O E1 192.168.7.0/24 [110/148] via 172.17.1.2, 00:01:07, Serial1/2
O E1 192.168.255.0/24 [110/148] via 172.17.1.2, 00:01:07, Serial1/2
O E1 192.168.0.0/24 [110/148] via 172.17.1.2, 00:01:07, Serial1/2
O E1 192.168.1.0/24 [110/148] via 172.17.1.2, 00:01:07, Serial1/2
O E1 192.168.2.0/24 [110/148] via 172.17.1.2, 00:01:07, Serial1/2
O E1 192.168.3.0/24 [110/148] via 172.17.1.2, 00:01:07, Serial1/2
精彩內容,請點擊下一頁!
下一篇 如何正確選擇網站建設優化服務公司