R1配置
Router(config)#hostname r1
r1(config)#interface loopback 0
r1(config-if)#ip address 1.1.1.1 255.255.255.0
r1(config)#interface serial 2/1
r1(config-if)#ip address 12.0.0.1 255.255.255.0
r1(config-if)#no shutdown
R2配置
Router(config)#hostname r2
r2(config)#interface loopback 0
r2(config-if)#ip address 2.2.2.2 255.255.255.0
r2(config)#interface serial 2/1
r2(config-if)#ip address 12.0.0.2 255.255.255.0
r2(config-if)#no shutdown
r2(config)#interface serial 2/2
r2(config-if)#ip address 23.0.0.1 255.255.255.0
r2(config-if)#no shutdown
R3配置
Router(config)#hostname r3
r3(config)#interface loopback 0
r3(config-if)#ip address 3.3.3.3 255.255.255.0
r3(config)#interface serial 2/1
r3(config-if)#ip address 23.0.0.2 255.255.255.0
r3(config-if)#no shutdown
r3(config)#interface serial 2/2
r3(config-if)#ip address 34.0.0.1 255.255.255.0
r3(config-if)#no shutdown
R4配置
Router(config)#hostname r4
r4(config)#interface loopback 0
r4(config-if)#ip address 4.4.4.4 255.255.255.0
r4(config)#interface serial 2/1
r4(config-if)#ip address 34.0.0.2 255.255.255.0
r4(config-if)#no shutdown
r4(config)#interface serial 2/2
r4(config-if)#ip address 45.0.0.1 255.255.255.0
r4(config-if)#no shutdown
R5配置
Router(config)#hostname r5
r5(config)# interface loopback 0
r5(config-if)#ip address 5.5.5.5 255.255.255.0
r5(config)#interface serial 2/2
r5(config-if)#ip address 45.0.0.2 255.255.255.0
r5(config-if)#no shutdown
R1配置OSPF
r1(config)#router ospf 1
r1(config-router)#router-id 1.1.1.1
r1(config-router)#network 12.0.0.1 0.0.0.0 area 1
R2配置OSPF
r2(config)#router ospf 1
r2(config-router)#router-id 2.2.2.2
r2(config-router)#network 12.0.0.2 0.0.0.0 area 1
r2(config-router)#network 23.0.0.1 0.0.0.0 area 0
R3配置OSPF
r3(config)#router ospf 1
r3(config-router)#router-id 3.3.3.3
r3(config-router)#network 23.0.0.2 0.0.0.0 area 0
r3(config-router)#network 34.0.0.1 0.0.0.0 area 0
R4配置OSPF
r4(config)#router ospf 1
r4(config-router)#router-id 4.4.4.4
r4(config-router)#network 34.0.0.2 0.0.0.0 area 0
r4(config-router)#network 45.0.0.1 0.0.0.0 area 2
R5配置OSPF
r5(config)#router ospf 1
r5(config-router)#router-id 5.5.5.5
r5(config-router)#network 45.0.0.2 0.0.0.0 area 2
R4配置重分布
r4(config)#interface loopback 1
r4(config-if)#ip address 192.168.1.1 255.255.255.0
r4(config)#interface loopback 2
r4(config-if)#ip address 192.168.2.2 255.255.255.0
r4(config)#interface loopback 3
r4(config-if)#ip address 192.168.3.3 255.255.255.0
r4(config)#interface loopback 4
r4(config-if)#ip address 192.168.4.4 255.255.255.0
r4(config)#interface loopback 5
r4(config-if)#ip address 192.168.5.5 255.255.255.0
r4(config)#router ospf 1
r4(config-router)#redistribute connected subnets
r4(config-router)#end
r4#show ip ospf database
OSPF Router with ID (4.4.4.4) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 421 0x80000002 0x00D77F 2
3.3.3.3 3.3.3.3 380 0x80000003 0x0063FA 4
4.4.4.4 4.4.4.4 6 0x80000003 0x009C90 2
2.2.2.2 2.2.2.2 421 0x80000002 0x00D77F 2
3.3.3.3 3.3.3.3 380 0x80000003 0x0063FA 4
4.4.4.4 4.4.4.4 6 0x80000003 0x009C90 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
12.0.0.0 2.2.2.2 450 0x80000001 0x0033B5
45.0.0.0 4.4.4.4 360 0x80000001 0x004877
12.0.0.0 2.2.2.2 450 0x80000001 0x0033B5
45.0.0.0 4.4.4.4 360 0x80000001 0x004877
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
4.4.4.4 4.4.4.4 6 0x80000003 0x001EF1 2
5.5.5.5 5.5.5.5 344 0x80000001 0x00B857 2
4.4.4.4 4.4.4.4 6 0x80000003 0x001EF1 2
5.5.5.5 5.5.5.5 344 0x80000001 0x00B857 2
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
12.0.0.0 4.4.4.4 365 0x80000001 0x00FB64
23.0.0.0 4.4.4.4 366 0x80000001 0x00E9AB
34.0.0.0 4.4.4.4 366 0x80000001 0x00D7F2
Link ID ADV Router Age Seq# Checksum
12.0.0.0 4.4.4.4 365 0x80000001 0x00FB64
23.0.0.0 4.4.4.4 366 0x80000001 0x00E9AB
34.0.0.0 4.4.4.4 366 0x80000001 0x00D7F2
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
4.4.4.0 4.4.4.4 7 0x80000001 0x00DEA5 0
192.168.1.0 4.4.4.4 7 0x80000001 0x00B273 0
192.168.2.0 4.4.4.4 7 0x80000001 0x00A77D 0
192.168.3.0 4.4.4.4 7 0x80000001 0x009C87 0
192.168.4.0 4.4.4.4 7 0x80000001 0x009191 0
192.168.5.0 4.4.4.4 7 0x80000001 0x00869B 0
4.4.4.0 4.4.4.4 7 0x80000001 0x00DEA5 0
192.168.1.0 4.4.4.4 7 0x80000001 0x00B273 0
192.168.2.0 4.4.4.4 7 0x80000001 0x00A77D 0
192.168.3.0 4.4.4.4 7 0x80000001 0x009C87 0
192.168.4.0 4.4.4.4 7 0x80000001 0x009191 0
192.168.5.0 4.4.4.4 7 0x80000001 0x00869B 0
出现类型5的LSA
查看R2路由表
r2#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
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
34.0.0.0/24 is subnetted, 1 subnets
O 34.0.0.0 [110/128] via 23.0.0.2, 00:25:57, Serial2/2
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
4.0.0.0/24 is subnetted, 1 subnets
O E2 4.4.4.0 [110/20] via 23.0.0.2, 00:25:57, Serial2/2
23.0.0.0/24 is subnetted, 1 subnets
C 23.0.0.0 is directly connected, Serial2/2
O E2 192.168.4.0/24 [110/20] via 23.0.0.2, 00:25:58, Serial2/2
O E2 192.168.5.0/24 [110/20] via 23.0.0.2, 00:25:58, Serial2/2
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, Serial2/1
O E2 192.168.1.0/24 [110/20] via 23.0.0.2, 00:25:58, Serial2/2
O E2 192.168.2.0/24 [110/20] via 23.0.0.2, 00:26:50, Serial2/2
O E2 192.168.3.0/24 [110/20] via 23.0.0.2, 00:26:50, Serial2/2
45.0.0.0/24 is subnetted, 1 subnets
O IA 45.0.0.0 [110/192] via 23.0.0.2, 00:26:50, Serial2/2
O 34.0.0.0 [110/128] via 23.0.0.2, 00:25:57, Serial2/2
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
4.0.0.0/24 is subnetted, 1 subnets
O E2 4.4.4.0 [110/20] via 23.0.0.2, 00:25:57, Serial2/2
23.0.0.0/24 is subnetted, 1 subnets
C 23.0.0.0 is directly connected, Serial2/2
O E2 192.168.4.0/24 [110/20] via 23.0.0.2, 00:25:58, Serial2/2
O E2 192.168.5.0/24 [110/20] via 23.0.0.2, 00:25:58, Serial2/2
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, Serial2/1
O E2 192.168.1.0/24 [110/20] via 23.0.0.2, 00:25:58, Serial2/2
O E2 192.168.2.0/24 [110/20] via 23.0.0.2, 00:26:50, Serial2/2
O E2 192.168.3.0/24 [110/20] via 23.0.0.2, 00:26:50, Serial2/2
45.0.0.0/24 is subnetted, 1 subnets
O IA 45.0.0.0 [110/192] via 23.0.0.2, 00:26:50, Serial2/2
将区域1配置为stub区域
r1(config)#router ospf 1
r1(config-router)#area 1 stub
r2(config)#router ospf 1
r2(config-router)#area 1 stub
r2#show ip ospf
Routing Process "ospf 1" with ID 2.2.2.2
Start time: 00:09:46.160, Time elapsed: 00:42:49.992
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
It is an area border router
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 5000 msecs
Minimum hold time between two consecutive SPFs 10000 msecs
Maximum wait time between two consecutive SPFs 10000 msecs
Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 6. Checksum Sum 0x03E14E
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 2. 1 normal 1 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
Area BACKBONE(0)
Number of interfaces in this area is 1
Area has no authentication
SPF algorithm last executed 00:05:59.312 ago
SPF algorithm executed 8 times
Area ranges are
Number of LSA 5. Checksum Sum 0x024A3A
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
Area 1
Number of interfaces in this area is 1
It is a stub area
generates stub default route with cost 1
Area has no authentication
SPF algorithm last executed 00:05:44.312 ago
SPF algorithm executed 6 times
Area ranges are
Number of LSA 6. Checksum Sum 0x03C116
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
Start time: 00:09:46.160, Time elapsed: 00:42:49.992
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
It is an area border router
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 5000 msecs
Minimum hold time between two consecutive SPFs 10000 msecs
Maximum wait time between two consecutive SPFs 10000 msecs
Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 6. Checksum Sum 0x03E14E
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 2. 1 normal 1 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
Area BACKBONE(0)
Number of interfaces in this area is 1
Area has no authentication
SPF algorithm last executed 00:05:59.312 ago
SPF algorithm executed 8 times
Area ranges are
Number of LSA 5. Checksum Sum 0x024A3A
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
Area 1
Number of interfaces in this area is 1
It is a stub area
generates stub default route with cost 1
Area has no authentication
SPF algorithm last executed 00:05:44.312 ago
SPF algorithm executed 6 times
Area ranges are
Number of LSA 6. Checksum Sum 0x03C116
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
r1#show ip ospf databaseOSPF Router with ID (1.1.1.1) (Process ID 1)Router Link States (Area 1)Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 474 0x80000005 0x00CBAD 2
2.2.2.2 2.2.2.2 475 0x80000005 0x006E05 2Summary Net Link States (Area 1)Link ID ADV Router Age Seq# Checksum
0.0.0.0 2.2.2.2 483 0x80000001 0x0075C0
23.0.0.0 2.2.2.2 483 0x80000003 0x00BD20
34.0.0.0 2.2.2.2 483 0x80000003 0x00B0E1
45.0.0.0 2.2.2.2 483 0x80000003 0x00A3A3已经看不见类型5的LSA
转载于:https://blog.51cto.com/firefox1/252654