实验拓扑图:

6台路由器和1台交换机和3台PC机

 思科OSPF辅助地址_DY

R1的配置

R1#

R1#conf t

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

R1(config)#int e0/0

R1(config-if)#ip address 192.168.2.1 255.255.255.0

R1(config-if)#no sh 

R1(config-if)#int e0/1

R1(config-if)#ip address 192.168.1.1 255.255.255.0

R1(config-if)#no sh 

R1(config-if)#exit

R1(config)#router ospf 1

R1(config-router)#network 192.168.1.0 0.0.0.255 area 1

R1(config-router)#network 192.168.2.0 0.0.0.255 area 1

R1(config-router)#area 1 stub 

R1(config-router)#exit

R1(config)#do sh 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 192.168.2.2 to network 0.0.0.0


C    192.168.1.0/24 is directly connected, Ethernet0/1

C    192.168.2.0/24 is directly connected, Ethernet0/0

O*IA 0.0.0.0/0 [110/11] via 192.168.2.2, 00:12:13, Ethernet0/0

R1(config)#do sh ip int br

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0/0                192.168.2.1      YES manual up                    up      

Ethernet0/1                192.168.1.1      YES manual up                    up      

Ethernet0/2                unassigned       YES unset  administratively down down    

Ethernet0/3                unassigned       YES unset  administratively down down    

R1(config)#do sh route ospf

route-map ospf not found

R1(config)#do sh ip route ospf

O*IA 0.0.0.0/0 [110/11] via 192.168.2.2, 00:24:05, Ethernet0/0

R1(config)#do sh ip ospf

 Routing Process "ospf 1" with ID 192.168.2.1

 Start time: 00:17:56.480, Time elapsed: 00:27:19.416

 Supports only single TOS(TOS0) routes

 Supports opaque LSA

 Supports Link-local Signaling (LLS)

 Supports area transit capability

 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 0. Checksum Sum 0x000000

 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 1. 0 normal 1 stub 0 nssa

 Number of areas transit capable is 0

 External flood list length 0

    Area 1

        Number of interfaces in this area is 2

        It is a stub area

        Area has no authentication

        SPF algorithm last executed 00:24:27.172 ago

        SPF algorithm executed 4 times

        Area ranges are

        Number of LSA 4. Checksum Sum 0x02F8C7

        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(config)#


R2的配置

R2#

R2#conf t

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

R2(config)#int e0/0

R2(config-if)#ip address 192.168.2.2 255.255.255.0

R2(config-if)#no sh 

R2(config-if)#int e0/1

R2(config-if)#ip address 192.168.3.1 255.255.255.0

R2(config-if)#no sh 

R2(config-if)#exit

R2(config)#router ospf 1

R2(config-router)#network 192.168.2.0 0.0.0.255 area 1

R2(config-router)#network 192.168.3.0 0.0.0.255 area 0

R2(config-router)#area 1 stub no-summary 

R2(config-router)#exit

R2(config)#do sh 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


O E2 192.168.8.0/24 [110/20] via 192.168.3.2, 00:16:30, Ethernet0/1

O IA 192.168.4.0/24 [110/20] via 192.168.3.2, 00:25:41, Ethernet0/1

O IA 192.168.5.0/24 [110/30] via 192.168.3.2, 00:23:03, Ethernet0/1

O IA 192.168.6.0/24 [110/40] via 192.168.3.2, 00:17:20, Ethernet0/1

O E2 192.168.7.0/24 [110/20] via 192.168.3.2, 00:17:15, Ethernet0/1

O    192.168.1.0/24 [110/20] via 192.168.2.1, 00:27:48, Ethernet0/0

C    192.168.2.0/24 is directly connected, Ethernet0/0

C    192.168.3.0/24 is directly connected, Ethernet0/1

R2(config)#do sh ip int br

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0/0                192.168.2.2       YES manual up                    up      

Ethernet0/1                192.168.3.1       YES manual up                    up      

Ethernet0/2                unassigned        YES unset  administratively down down    

Ethernet0/3                unassigned        YES unset  administratively down down    

R2(config)#do sh route os

route-map os not found

R2(config)#do sh route ospf

route-map ospf not found

R2(config)#do sh ip ospf

 Routing Process "ospf 1" with ID 192.168.3.1

 Start time: 00:19:34.552, Time elapsed: 00:52:54.572

 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 2. Checksum Sum 0x00653C

 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:49:34.768 ago

        SPF algorithm executed 7 times

        Area ranges are

        Number of LSA 8. Checksum Sum 0x050BD9

        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, no summary LSA in this area

          generates stub default route with cost 1

        Area has no authentication

        SPF algorithm last executed 00:51:41.580 ago

        SPF algorithm executed 5 times

        Area ranges are

        Number of LSA 4. Checksum Sum 0x02F0CB

        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


R2(config)#


R3的配置

R3#

R3#conf t

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

R3(config)#int e0/0

R3(config-if)#ip address 192.168.3.2 255.255.255.0

R3(config-if)#no sh 

R3(config-if)#int e0/1

R3(config-if)#ip address 192.168.4.1 255.255.255.0

R3(config-if)#no sh 

R3(config-if)#exit

R3(config)#router ospf 1

R3(config-router)#network 192.168.3.0 0.0.0.255 area 0

R3(config-router)#network 192.168.4.0 0.0.0.255 area 2

R3(config-router)#area 2 nssa 

R3(config-router)#exit

R3(config)#do sh ip int br

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0/0                192.168.3.2       YES manual up                    up      

Ethernet0/1                192.168.4.1       YES manual up                    up      

Ethernet0/2                unassigned        YES unset  administratively down down    

Ethernet0/3                unassigned        YES unset  administratively down down    

R3(config)#do sh 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


O N2 192.168.8.0/24 [110/20] via 192.168.4.2, 00:43:11, Ethernet0/1

C    192.168.4.0/24 is directly connected, Ethernet0/1

O    192.168.5.0/24 [110/20] via 192.168.4.2, 00:44:02, Ethernet0/1

O    192.168.6.0/24 [110/30] via 192.168.4.2, 00:44:02, Ethernet0/1

O N2 192.168.7.0/24 [110/20] via 192.168.4.2, 00:44:02, Ethernet0/1

O IA 192.168.1.0/24 [110/30] via 192.168.3.1, 00:44:02, Ethernet0/0

O IA 192.168.2.0/24 [110/20] via 192.168.3.1, 00:44:02, Ethernet0/0

C    192.168.3.0/24 is directly connected, Ethernet0/0

R3(config)#exit

R3#sh ip ospf

 Routing Process "ospf 1" with ID 192.168.4.1

 Start time: 00:21:31.032, Time elapsed: 00:54:21.640

 Supports only single TOS(TOS0) routes

 Supports opaque LSA

 Supports Link-local Signaling (LLS)

 Supports area transit capability

 It is an area border and autonomous system boundary router

 Redistributing External Routes from,

 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 2. Checksum Sum 0x00653C

 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 0 stub 1 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:52:58.224 ago

        SPF algorithm executed 6 times

        Area ranges are

        Number of LSA 8. Checksum Sum 0x050BD9

        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 2

        Number of interfaces in this area is 1

        It is a NSSA area

        Perform type-7/type-5 LSA translation

        Area has no authentication

        SPF algorithm last executed 00:44:38.796 ago

        SPF algorithm executed 8 times

        Area ranges are

        Number of LSA 10. Checksum Sum 0x04C12C

        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


R3#sh ip route ospf

O N2  192.168.8.0/24 [110/20] via 192.168.4.2, 00:45:04, Ethernet0/1

O    192.168.5.0/24 [110/20] via 192.168.4.2, 00:45:54, Ethernet0/1

O    192.168.6.0/24 [110/30] via 192.168.4.2, 00:45:54, Ethernet0/1

O N2  192.168.7.0/24 [110/20] via 192.168.4.2, 00:45:54, Ethernet0/1

O IA  192.168.1.0/24 [110/30] via 192.168.3.1, 00:45:54, Ethernet0/0

O IA  192.168.2.0/24 [110/20] via 192.168.3.1, 00:45:54, Ethernet0/0

R3#


R4的配置

R4#

R4#conf t

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

R4(config)#int e0/0

R4(config-if)#ip address 192.168.4.2 255.255.255.0

R4(config-if)#no sh 

R4(config-if)#int e0/1 

R4(config-if)#ip address 192.168.5.1 255.255.255.0

R4(config-if)#no sh 

R4(config-if)#exit

R4(config)#router ospf 1

R4(config-router)#network 192.168.4.0 0.0.0.255 area 2

R4(config-router)#network 192.168.5.0 0.0.0.255 area 2

R4(config-router)#area 2 nssa

R4(config-router)#exit

R4(config)#int e0/1

R4(config-if)#ip address 192.168.7.1 255.255.255.0 secondary 

R4(config-if)#exit

R4(config)#router rip

R4(config-router)#network 192.168.7.0

R4(config-router)#version 2

R4(config-router)#no auto-summary 

R4(config-router)#exit

R4(config)#router ospf 1

R4(config-router)#redistribute rip subnets 

R4(config-router)#router rip

R4(config-router)#redistribute ospf 1 metric 1

R4(config-router)#exit

R4#sh 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


R    192.168.8.0/24 [120/1] via 192.168.7.2, 00:00:12, Ethernet0/1

C    192.168.4.0/24 is directly connected, Ethernet0/0

C    192.168.5.0/24 is directly connected, Ethernet0/1

O    192.168.6.0/24 [110/20] via 192.168.5.2, 00:50:59, Ethernet0/1

C    192.168.7.0/24 is directly connected, Ethernet0/1

O IA  192.168.1.0/24 [110/40] via 192.168.4.1, 00:50:59, Ethernet0/0

O IA  192.168.2.0/24 [110/30] via 192.168.4.1, 00:50:59, Ethernet0/0

O IA  192.168.3.0/24 [110/20] via 192.168.4.1, 00:50:59, Ethernet0/0

R4#sh ip int br

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0/0                192.168.4.2      YES manual up                    up      

Ethernet0/1                192.168.5.1      YES manual up                    up      

Ethernet0/2                unassigned       YES unset  administratively down down    

Ethernet0/3                unassigned       YES unset  administratively down down    

R4#sh ip ospf 

 Routing Process "ospf 1" with ID 192.168.5.1

 Start time: 00:24:13.648, Time elapsed: 00:58:09.592

 Supports only single TOS(TOS0) routes

 Supports opaque LSA

 Supports Link-local Signaling (LLS)

 Supports area transit capability

 It is an autonomous system boundary router

 Redistributing External Routes from,

    rip, includes subnets in redistribution

 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 0. Checksum Sum 0x000000

 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 1. 0 normal 0 stub 1 nssa

 Number of areas transit capable is 0

 External flood list length 0

    Area 2

        Number of interfaces in this area is 2

        It is a NSSA area

        Area has no authentication

        SPF algorithm last executed 00:51:20.440 ago

        SPF algorithm executed 6 times

        Area ranges are

        Number of LSA 10. Checksum Sum 0x04C12C

        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


R4#sh ip route ospf

O    192.168.6.0/24 [110/20] via 192.168.5.2, 00:51:27, Ethernet0/1

O IA 192.168.1.0/24 [110/40] via 192.168.4.1, 00:51:27, Ethernet0/0

O IA 192.168.2.0/24 [110/30] via 192.168.4.1, 00:51:27, Ethernet0/0

O IA 192.168.3.0/24 [110/20] via 192.168.4.1, 00:51:27, Ethernet0/0

R4#


R5的配置

R5#

R5#conf t

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

R5(config)#int e0/0

R5(config-if)#ip address 192.168.5.2 255.255.255.0

R5(config-if)#no sh 

R5(config-if)#int e0/1

R5(config-if)#ip address 192.168.6.1 255.255.255.0

R5(config-if)#no sh 

R5(config-if)#exit 

R5(config)#router ospf 1

R5(config-router)#network 192.168.5.0 0.0.0.255 area 2

R5(config-router)#network 192.168.6.0 0.0.0.255 area 2

R5(config-router)#area 2 nssa 

R5(config-router)#exit

R5#sh ip int br

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0/0                192.168.5.2       YES manual up                    up      

Ethernet0/1                192.168.6.1       YES manual up                    up      

Ethernet0/2                unassigned        YES unset  administratively down down    

Ethernet0/3                unassigned        YES unset  administratively down down    

R5#sh 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


O N2 192.168.8.0/24 [110/20] via 192.168.5.1, 00:54:20, Ethernet0/0

O    192.168.4.0/24 [110/20] via 192.168.5.1, 00:55:20, Ethernet0/0

C    192.168.5.0/24 is directly connected, Ethernet0/0

C    192.168.6.0/24 is directly connected, Ethernet0/1

O N2 192.168.7.0/24 [110/20] via 192.168.5.1, 00:55:20, Ethernet0/0

O IA 192.168.1.0/24 [110/50] via 192.168.5.1, 00:55:20, Ethernet0/0

O IA 192.168.2.0/24 [110/40] via 192.168.5.1, 00:55:20, Ethernet0/0

O IA 192.168.3.0/24 [110/30] via 192.168.5.1, 00:55:20, Ethernet0/0

R5#sh ip route ospf

O N2  192.168.8.0/24 [110/20] via 192.168.5.1, 00:54:27, Ethernet0/0

O    192.168.4.0/24 [110/20] via 192.168.5.1, 00:55:27, Ethernet0/0

O N2  192.168.7.0/24 [110/20] via 192.168.5.1, 00:55:27, Ethernet0/0

O IA  192.168.1.0/24 [110/50] via 192.168.5.1, 00:55:27, Ethernet0/0

O IA  192.168.2.0/24 [110/40] via 192.168.5.1, 00:55:27, Ethernet0/0

O IA  192.168.3.0/24 [110/30] via 192.168.5.1, 00:55:27, Ethernet0/0

R5#


R6的配置

R6#

R6#conf t

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

R6(config)#int e0/0

R6(config-if)#ip address 192.168.7.2 255.255.255.0

R6(config-if)#no sh 

R6(config-if)#int e0/1

R6(config-if)#ip address 192.168.8.1 255.255.255.0

R6(config-if)#no sh 

R6(config-if)#exit

R6(config)#router rip 

R6(config-router)#network 192.168.7.0 

R6(config-router)#network 192.168.8.0 

R6(config-router)#version 2

R6(config-router)#no auto-summary 

R6(config-router)#redistribute ospf 1 metric 1

R6(config-router)#exit

R6#sh 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


C    192.168.8.0/24 is directly connected, Ethernet0/1

R    192.168.4.0/24 [120/1] via 192.168.7.1, 00:00:01, Ethernet0/0

R    192.168.5.0/24 [120/1] via 192.168.7.1, 00:00:01, Ethernet0/0

R    192.168.6.0/24 [120/1] via 192.168.7.1, 00:00:01, Ethernet0/0

C    192.168.7.0/24 is directly connected, Ethernet0/0

R    192.168.1.0/24 [120/1] via 192.168.7.1, 00:00:01, Ethernet0/0

R    192.168.2.0/24 [120/1] via 192.168.7.1, 00:00:01, Ethernet0/0

R    192.168.3.0/24 [120/1] via 192.168.7.1, 00:00:01, Ethernet0/0

R6#sh ip int br 

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0/0                192.168.7.2       YES manual up                    up      

Ethernet0/1                192.168.8.1       YES manual up                    up      

Ethernet0/2                unassigned        YES unset  administratively down down    

Ethernet0/3                unassigned        YES unset  administratively down down   

R6#


SW1的配置

SW1#conf t

SW1(config)#int range f1/0 -2

SW1(config-if)#switchport mode trunk

SW1(config-if)#no sh

SW1#