配置ospf驗證,彙總,虛鏈路

配置ospf驗證,彙總,虛鏈路
環境:三臺路由器串口相連,其它接口配置如圖
要求:1.在area 1配置ospf虛鏈路,router-id如圖配置
2.將R1的LOOP口配置ospf手工路由彙總
3. 配置ospf接口驗證(R1 和R2)
4.使用show命令查看結果
 

步驟一: 配置三個路由器接口使其連通。
R1的配置
R1(config)# interface Loopback0
R1(config-if)# ip address 30.1.1.1 255.255.255.0
R1(config)# interface Loopback1
R1(config-if)# ip address 30.1.2.1 255.255.255.0
R1(config)# interface Loopback2
R1(config-if)# ip address 30.1.3.1 255.255.255.0
R1(config)# interface s0
R1(config-if)# ip address 10.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R2的配置
R2(config)# interface Loopback0
R2(config-if)# ip address 50.1.1.1 255.255.255.0
R2(config)# interface s0
R2(config-if)# ip address 10.1.1.2 255.255.255.0
R2(config-if)#clockrate 64000
R2(config-if)#no shutdown
R2(config)# interface s1
R2(config-if)# ip address 20.1.1.1 255.255.255.0
R2(config-if)#no shutdown
R3的配置
R3(config)# interface Loopback0
R3(config-if)# ip address 40.1.1.1 255.255.255.0
R3(config)# interface s1
R3(config-if)# ip address 20.1.1.2 255.255.255.0
R3(config-if)#clockrate 64000
R3(config)#no shutdown

步驟二: 配置ospf
R1的配置
R1(config)#router ospf 1  à啓用ospf協議,進程號爲1
R1(config-router)#router-id 1.1.1.1  à配置router-id
R1(config-router)#network 10.1.1.0 0.0.0.255 area 1  à將接口參與到區域1內
R1(config-router)#network 30.1.1.0 0.0.0.255 area 0  à將接口參與到區域0內
R1(config-router)#network 30.1.2.0 0.0.0.255 area 0
R1(config-router)#network 30.1.3.0 0.0.0.255 area 0
R2的配置
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 10.1.1.0 0.0.0.255 area 1
R2(config-router)#network 20.1.1.0 0.0.0.255 area 2  à將接口參與到區域2內
R2(config-router)#network 50.1.1.0 0.0.0.255 area 1
R3的配置
R3(config)#router ospf 2
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 20.1.1.0 0.0.0.255 area 2
R3(config-router)#network 40.1.1.0 0.0.0.255 area 2

步驟三:配置ospf虛鏈路
R1的配置
R1(config)#router ospf 1
R1(config-router)# area 1 virtual-link 2.2.2.2 à配置虛電路,指對端的router-id
R2的配置
R2(config)#router ospf 1
R2(config-router)# area 1 virtual-link 1.1.1.1

步驟四:配置ospf手工路由彙總
R1的配置
R1(config)#router ospf 1
R1(config-router)# area 0 range 30.1.0.0 255.255.252.0  à手工彙總路由
R2的配置
R2(config)#router ospf 1
R2(config-router)# area 0 range 30.1.0.0 255.255.252.0  à因你的區域0已經延伸到此

步驟五:配置ospf接口驗證(R1 和R2)
R1的配置
R1(config)# interface Serial0
R1(config-if)# ip ospf authentication message-digest  à啓用驗證
R1(config-if)# ip ospf message-digest-key 1 md5 cisco à定義密鑰
R2的配置
R2(config)# interface Serial0
R2(config-if)# ip ospf authentication message-digest
R2(config-if)# ip ospf message-digest-key 1 md5 cisco  à兩端必須一致

步驟六:查看路由表
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
     50.0.0.0/32 is subnetted, 1 subnets
O       50.1.1.1 [110/65] via 10.1.1.2, 00:09:41, Serial0  àOSPF域內學來的路由條目
     20.0.0.0/24 is subnetted, 1 subnets
O IA    20.1.1.0 [110/128] via 10.1.1.2, 00:09:31, Serial0  àOSPF域間學來的路由條目
     40.0.0.0/32 is subnetted, 1 subnets
O IA    40.1.1.1 [110/129] via 10.1.1.2, 00:09:31, Serial0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Serial0
     30.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C       30.1.3.0/24 is directly connected, Loopback2
C       30.1.2.0/24 is directly connected, Loopback1
C       30.1.1.0/24 is directly connected, Loopback0
O       30.1.0.0/22 is a summary, 00:09:32, Null0  à手工彙總的條目
R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
     50.0.0.0/24 is subnetted, 1 subnets
C       50.1.1.0 is directly connected, Loopback0
     20.0.0.0/24 is subnetted, 1 subnets
C       20.1.1.0 is directly connected, Serial1
     40.0.0.0/32 is subnetted, 1 subnets
O       40.1.1.1 [110/65] via 20.1.1.2, 00:04:48, Serial1
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Serial0
     30.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O       30.1.2.1/32 [110/65] via 10.1.1.1, 00:04:38, Serial0
O       30.1.3.1/32 [110/65] via 10.1.1.1, 00:04:39, Serial0
O       30.1.0.0/22 is a summary, 00:04:39, Null0
O       30.1.1.1/32 [110/65] via 10.1.1.1, 00:04:39, Serial0
R3#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
     50.0.0.0/32 is subnetted, 1 subnets
O IA    50.1.1.1 [110/65] via 20.1.1.1, 00:02:02, Serial1
     20.0.0.0/24 is subnetted, 1 subnets
C       20.1.1.0 is directly connected, Serial1
     40.0.0.0/24 is subnetted, 1 subnets
C       40.1.1.0 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 1 subnets
O IA    10.1.1.0 [110/128] via 20.1.1.1, 00:02:02, Serial1
     30.0.0.0/22 is subnetted, 1 subnets
O IA    30.1.0.0 [110/129] via 20.1.1.1, 00:01:47, Serial1

步驟七:查看鄰居表
R1#show ip ospf neighbor  à鄰居已建立,點對點無DR之說
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/  -        00:00:33    10.1.1.2        Serial0
R2#show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/  -        00:00:33    10.1.1.1        Serial0
3.3.3.3           1   FULL/  -        00:00:34    20.1.1.2        Serial1
R3#show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/  -        00:00:37    20.1.1.1        Serial1

步驟八:用ping命令測試
R1#ping 40.1.1.1 à測試連通性
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 56/60/68 ms
R1#ping 50.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/36 ms
R2#ping 30.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 ms
 
步驟九:顯示當前配置信息
R1的配置信息
R1#sh run
hostname R1
!
interface Loopback0
 ip address 30.1.1.1 255.255.255.0
!
interface Loopback1
 ip address 30.1.2.1 255.255.255.0
!
interface Loopback2
 ip address 30.1.3.1 255.255.255.0
!
interface Serial0
 ip address 10.1.1.1 255.255.255.0
 ip ospf authentication message-digest
 ip ospf message-digest-key 1 md5 cisco
!
router ospf 1
 router-id 1.1.1.1
area 0 range 30.1.0.0 255.255.252.0
 area 1 virtual-link 2.2.2.2
 network 10.1.1.0 0.0.0.255 area 1
 network 30.1.1.0 0.0.0.255 area 0
 network 30.1.2.0 0.0.0.255 area 0
 network 30.1.3.0 0.0.0.255 area 0
end
R2#sh run
hostname R2
interface Loopback0
 ip address 50.1.1.1 255.255.255.0
!
interface Serial0
 ip address 10.1.1.2 255.255.255.0
 ip ospf authentication message-digest
 ip ospf message-digest-key 1 md5 cisco
 clockrate 64000
!
interface Serial1
 ip address 20.1.1.1 255.255.255.0
!
router ospf 1
 router-id 2.2.2.2
 area 0 range 30.1.0.0 255.255.252.0
 area 1 virtual-link 1.1.1.1
 network 10.1.1.0 0.0.0.255 area 1
 network 20.1.1.0 0.0.0.255 area 2
 network 50.1.1.0 0.0.0.255 area 1
end
R3#sh run
Hostname R3
!
interface Loopback0
 ip address 40.1.1.1 255.255.255.0
!
interface Serial1
 ip address 20.1.1.2 255.255.255.0
 clockrate 64000
!
router ospf 2
 router-id 3.3.3.3
 network 20.1.1.0 0.0.0.255 area 2
 network 40.1.1.0 0.0.0.255 area 2
end
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章