查看R2的路由表如下:

Gateway of last resort is not set

 

O E1 192.168.89.0/24 [110/212] via 192.168.12.1, 00:01:03, Serial0/0

O IA 192.168.46.0/24 [110/65] via 192.168.1.4, 00:29:57, FastEthernet1/0

C    192.168.12.0/24 is directly connected, Serial0/0

     1.0.0.0/32 is subnetted, 1 subnets

O       1.1.1.1 [110/65] via 192.168.12.1, 00:29:57, Serial0/0

O E1 192.168.47.0/24 [110/21] via 192.168.1.4, 00:01:03, FastEthernet1/0

     2.0.0.0/24 is subnetted, 1 subnets

C       2.2.2.0 is directly connected, Loopback0

     3.0.0.0/32 is subnetted, 1 subnets

O       3.3.3.3 [110/2] via 192.168.1.3, 00:29:57, FastEthernet1/0

O IA 192.168.15.0/24 [110/128] via 192.168.12.1, 00:29:57, Serial0/0

O E1 192.168.8.0/24 [110/212] via 192.168.12.1, 00:01:03, Serial0/0

     4.0.0.0/32 is subnetted, 1 subnets

O       4.4.4.4 [110/2] via 192.168.1.4, 00:29:58, FastEthernet1/0

O IA 192.168.58.0/24 [110/192] via 192.168.12.1, 00:29:58, Serial0/0

     5.0.0.0/32 is subnetted, 1 subnets

O IA    5.5.5.5 [110/129] via 192.168.12.1, 00:29:58, Serial0/0

     6.0.0.0/32 is subnetted, 1 subnets

O IA    6.6.6.6 [110/66] via 192.168.1.4, 00:29:58, FastEthernet1/0

     172.5.0.0/24 is subnetted, 3 subnets

O IA    172.5.1.0 [110/129] via 192.168.12.1, 00:00:05, Serial0/0

O IA    172.5.3.0 [110/129] via 192.168.12.1, 00:00:05, Serial0/0

O IA    172.5.2.0 [110/129] via 192.168.12.1, 00:00:05, Serial0/0

     172.16.0.0/24 is subnetted, 3 subnets

O E1    172.16.1.0 [110/212] via 192.168.12.1, 00:00:00, Serial0/0

O E1    172.16.2.0 [110/212] via 192.168.12.1, 00:00:00, Serial0/0

O E1    172.16.3.0 [110/212] via 192.168.12.1, 00:00:00, Serial0/0

     7.0.0.0/24 is subnetted, 1 subnets

O E1    7.7.7.0 [110/21] via 192.168.1.4, 00:00:00, FastEthernet1/0

     8.0.0.0/32 is subnetted, 1 subnets

O IA    8.8.8.8 [110/193] via 192.168.12.1, 00:29:58, Serial0/0

     9.0.0.0/24 is subnetted, 1 subnets

O E1    9.9.9.0 [110/212] via 192.168.12.1, 00:00:00, Serial0/0

C    192.168.1.0/24 is directly connected, FastEthernet1/0

 

查看R5的路由表如下:

Gateway of last resort is not set

 

O E1 192.168.89.0/24 [110/84] via 192.168.58.8, 00:22:06, Serial0/0

O IA 192.168.46.0/24 [110/193] via 192.168.15.1, 00:49:13, Serial0/1

O IA 192.168.12.0/24 [110/128] via 192.168.15.1, 00:49:13, Serial0/1

     1.0.0.0/32 is subnetted, 1 subnets

O IA    1.1.1.1 [110/65] via 192.168.15.1, 00:49:13, Serial0/1

O E1 192.168.47.0/24 [110/149] via 192.168.15.1, 00:22:06, Serial0/1

     2.0.0.0/32 is subnetted, 1 subnets

O IA    2.2.2.2 [110/129] via 192.168.15.1, 00:49:13, Serial0/1

     3.0.0.0/32 is subnetted, 1 subnets

O IA    3.3.3.3 [110/130] via 192.168.15.1, 00:22:11, Serial0/1

C    192.168.15.0/24 is directly connected, Serial0/1

O E1 192.168.8.0/24 [110/84] via 192.168.58.8, 00:22:06, Serial0/0

     4.0.0.0/32 is subnetted, 1 subnets

O IA    4.4.4.4 [110/130] via 192.168.15.1, 00:49:14, Serial0/1

C    192.168.58.0/24 is directly connected, Serial0/0

     5.0.0.0/24 is subnetted, 1 subnets

C       5.5.5.0 is directly connected, Loopback0

     6.0.0.0/32 is subnetted, 1 subnets

O IA    6.6.6.6 [110/194] via 192.168.15.1, 00:49:14, Serial0/1

     172.5.0.0/24 is subnetted, 3 subnets

C       172.5.1.0 is directly connected, Loopback1

C       172.5.3.0 is directly connected, Loopback3

C       172.5.2.0 is directly connected, Loopback2

     172.16.0.0/24 is subnetted, 3 subnets

O E1    172.16.1.0 [110/84] via 192.168.58.8, 00:22:06, Serial0/0

O E1    172.16.2.0 [110/84] via 192.168.58.8, 00:22:06, Serial0/0

O E1    172.16.3.0 [110/84] via 192.168.58.8, 00:22:06, Serial0/0

     7.0.0.0/24 is subnetted, 1 subnets

O E1    7.7.7.0 [110/149] via 192.168.15.1, 00:22:06, Serial0/1

     8.0.0.0/32 is subnetted, 1 subnets

O       8.8.8.8 [110/65] via 192.168.58.8, 00:49:14, Serial0/0

     9.0.0.0/24 is subnetted, 1 subnets

O E1    9.9.9.0 [110/84] via 192.168.58.8, 00:22:06, Serial0/0

O IA 192.168.1.0/24 [110/129] via 192.168.15.1, 00:49:14, Serial0/1

 

发现各路由器的LSDB和路由表都比较庞大,进行优化

1、在ABR路由器R1上做区域间路由汇总,配置如下:

router ospf 10

 log-adjacency-changes

 area 2 range 172.5.0.0 255.255.252.0

 

2、在ASBR路由器R8上做外部路由汇总,配置如下:

router ospf 10

 log-adjacency-changes

 summary-address 172.16.0.0 255.255.252.0

3、将OSPF area2更改为 total NSSA区域,配置如下:

  R5R8ospf进程下,配置如下命令:

    area 2 nssa

  R1ospf进程下,配置如下命令:

    area 2 nssa no-summary   //加入参数no-summary,将禁止外部(5类)LSA和汇总(3类和4类)LSA进入区域,而用一条默认路由代替。将自动生成一条3类的默认路由,并将其通告到NSSA中,no-summary参数仅需在ABR路由器上配置即可。

4、将OSPF area1更改为total stub区域,配置如下:

   R4OSPF进程下配置:area 1 stub no-summary

   R6OSPF进程下配置:area 1 stub

 

再次查看R5的路由表,如下:

Gateway of last resort is 192.168.15.1 to network 0.0.0.0

 

O N1 192.168.89.0/24 [110/85] via 192.168.58.8, 00:15:36, Serial0/0

C    192.168.15.0/24 is directly connected, Serial0/1

O N1 192.168.8.0/24 [110/85] via 192.168.58.8, 00:15:36, Serial0/0

C    192.168.58.0/24 is directly connected, Serial0/0

     5.0.0.0/24 is subnetted, 1 subnets

C       5.5.5.0 is directly connected, Loopback0

     172.5.0.0/24 is subnetted, 3 subnets

C       172.5.1.0 is directly connected, Loopback1

C       172.5.3.0 is directly connected, Loopback3

C       172.5.2.0 is directly connected, Loopback2

     172.16.0.0/22 is subnetted, 1 subnets

O N1    172.16.0.0 [110/85] via 192.168.58.8, 00:15:36, Serial0/0

     8.0.0.0/32 is subnetted, 1 subnets

O       8.8.8.8 [110/65] via 192.168.58.8, 00:15:37, Serial0/0

     9.0.0.0/24 is subnetted, 1 subnets

O N1    9.9.9.0 [110/85] via 192.168.58.8, 00:15:37, Serial0/0

O*IA 0.0.0.0/0 [110/65] via 192.168.15.1, 00:15:37, Serial0/1    //ABR路由器R1宣告进area2的默认路由

 

查看R5LSDB表,如下:

R5#sh ip ospf da

 

            OSPF Router with ID (5.5.5.5) (Process ID 10)

 

                Router Link States (Area 2)

 

Link ID         ADV Router      Age         Seq#       Checksum Link count

1.1.1.1         1.1.1.1         842         0x80000007 0x000186 2

5.5.5.5         5.5.5.5         1100        0x8000000D 0x00678A 8

8.8.8.8         8.8.8.8         1101        0x80000008 0x00516F 3

 

                Summary Net Link States (Area 2)

 

Link ID         ADV Router      Age         Seq#       Checksum

0.0.0.0         1.1.1.1         1138        0x80000001 0x001B17

 

                Type-7 AS External Link States (Area 2)

 

Link ID         ADV Router      Age         Seq#       Checksum Tag

9.9.9.0         8.8.8.8         1108        0x80000001 0x002B90 0

172.16.0.0      8.8.8.8         1108        0x80000001 0x00DB41 0

192.168.8.0     8.8.8.8         1108        0x80000001 0x0066FE 0

192.168.89.0    8.8.8.8         1108        0x80000001 0x00E72C 0

仅剩1类、3类的默认路由和7LSA

剩余部分请看(三)