1. 程式人生 > 實用技巧 >多區域OSPF綜合實驗

多區域OSPF綜合實驗

實驗拓撲圖:

實驗過程

1.R1的預配置

Router>en

Router#config t

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R1

R1(config)#interface s1/0

R1(config-if)#no shut

R1(config-if)#ip add 192.168.1.1 255.255.255.252

R1(config-if)#interface lo0

R1(config-if)#ip add 10.1.1.1 255.255.255.0

R1(config-if)#interface lo0

R1(config-if)#ip add 10.1.2.1 255.255.255.0

R1(config-if)#exit

2.R2的預配置

Router>en

Router#config t

Enter configuration commands, one per line.

End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R2

R2(config)#interface s1/0

R2(config-if)#no shut

R2(config-if)#ip add 192.168.1.2 255.255.255.0

R2(config-if)#interface s1/1

R2(config-if)#no shut

R2(config-if)#ip add 192.168.1.5 255.255.255.0

R2(config-if)#exit

3.R3的預配置

Router>en

Router#config t

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R3

R3(config)#interface s1/1

R3(config-if)#no shut

R3(config-if)#ip add 192.168.1.6 255.255.255.0

R3(config-if)#interface s1/2

R3(config-if)#no shut

R3(config-if)#ip add 192.168.1.9 255.255.255.0

R3(config-if)#exit

4.R4的預配置

Router>en

Router#config t

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R4

R4(config)#interface s1/2

R4(config-if)#no shut

R4(config-if)#ip add 192.168.1.10 255.255.255.0

R4(config-if)#interface lo0

R4(config-if)#ip add 172.16.1.1 255.255.255.0

R4(config-if)#interface lo1

R4(config-if)#ip add 172.16.2.1 255.255.255.0

R4(config-if)#exit

5.配置R1OSPF

R1(config)#router ospf 1 //啟動OSPF程序

R1(config-router)#network 10.1.1.1 0.0.0.0 area 1 //使用0.0.0.0精確宣告網路

R1(config-router)#network 10.1.2.1 0.0.0.0 area 1

R1(config-router)#network 192.168.1.1 0.0.0.0 area 1

R1(config-router)#end

6.配置R2OSPF

R2(config)#router ospf 1

R2(config-router)#network 192.168.1.2 0.0.0.0 area 1

R2(config-router)#network 192.168.1.5 0.0.0.0 area 0

R2(config-router)#end

7.配置R3OSPF

R3(config)#router ospf 1

R3(config-router)#network 192.168.1.6 0.0.0.0 area 0

R3(config-router)#network 192.168.1.9 0.0.0.0 area 2

R3(config-router)#end

8.配置R4OSPF

R4(config)#router ospf 1

R4(config-router)#network 192.168.1.10 0.0.0.0 area 2

R4(config-router)#network 172.16.1.1 0.0.0.0 area 2

R4(config-router)#network 172.16.2.1 0.0.0.0 area 2

R4(config-router)#end

9.R2上檢視OSPF鄰居

R2#show ip ospf nei

Neighbor ID Pri State Dead Time Address Interface

192.168.1.9 0 FULL/ - 00:00:34 192.168.1.6 Serial1/1

10.1.2.1 0 FULL/ - 00:00:37 192.168.1.1 Serial1/0

10.檢視R1路由表,檢視區域間路由

R1#show ip route ospf

172.16.0.0/32 is subnetted, 2 subnets

O IA 172.16.1.1 [110/193] via 192.168.1.2, 00:03:11, Serial1/0 //區域間路由用“O IA”表示

O IA 172.16.2.1 [110/193] via 192.168.1.2, 00:03:01, Serial1/0

192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks

O 192.168.1.0/24 [110/128] via 192.168.1.2, 00:05:37, Serial1/0

11.檢視R1OSPF鏈路狀態資料庫

R1#show ip ospf da

OSPF Router with ID (10.1.2.1) (Process ID 1)

Router Link States (Area 1) //型別1LSA

Link ID ADV Router Age Seq# Checksum Link count

10.1.2.1 10.1.2.1 409 0x80000006 0x00E33E 3

192.168.1.5 192.168.1.5 400 0x80000005 0x007566 2

Summary Net Link States (Area 1) //型別3LS—ABR產生

Link ID ADV Router Age Seq# Checksum

172.16.1.1 192.168.1.5 249 0x80000001 0x00CCC0

172.16.2.1 192.168.1.5 239 0x80000001 0x00C1CA

192.168.1.0 192.168.1.5 400 0x80000001 0x001E05

12.測試連通性

R1#ping 172.16.1.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 12/56/80 ms

13.配置R2的區域間路由彙總

R2#config t

Enter configuration commands, one per line. End with CNTL/Z.

R2(config)#router ospf 1

R2(config-router)#area 1 range 10.1.0.0 255.255.0.0

R2(config-router)#end

14.檢視R4的路由表

R4#show ip route

Codes: C - connected, S - static, 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

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

172.16.0.0/24 is subnetted, 2 subnets

C 172.16.1.0 is directly connected, Loopback0

C 172.16.2.0 is directly connected, Loopback1

10.0.0.0/16 is subnetted, 1 subnets

O IA 10.1.0.0 [110/193] via 192.168.1.9, 00:00:28, Serial1/2 //出現彙總以後的路由

192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks

O IA 192.168.1.0/30 [110/256] via 192.168.1.9, 00:09:25, Serial1/2

C 192.168.1.0/24 is directly connected, Serial1/2

轉載於:https://blog.51cto.com/mxn19871215/482837