认证培训,h3c认证体系,网络工程师
丰沃创新

关于OSPF特殊区域的配置

  • 发布时间: 2018-3-16 13:53:44

学习OSPF的过程中我们遇到过比较难的知识点如OSPF的几种LSA的类型和OSPF特殊区域。其中LSA的类型的判别是OSPF特殊区域的基础,今天技术帖我们就给大家介绍OSPF的特殊区域中的LSA

首先OSPF的特殊区域划分的目的主要是在OSPF划分区域的基础上,进一步减少LSA的交互量,换而言之就是让LSA的数量更少。其中特殊区域中最主要的是stub区域、totally stub区域和NSSA区域。

Stub区域的特点:不允许有4类和5LSA,取而代之的是一条携带0.0.0.03LSA

Totally stub区域的特点:不允许有4类和5LSA,区域之间交互的明细的3LSA也不存在,取而代之的是一条携带0.0.0.0 3LSA

NSSA区域的特点:不允许有4类和5LSA,取而代之的是7类的明细LSA


配置和显示信息如下:

//RTA配置

RTA(config)#interface ethernet 0/0

RTA(config-if)# ip address 192.168.1.1 255.255.255.0

RTA(config-if)#exit

RTA(config)#interface Loopback0

RTA(config-if)# ip address 100.1.1.1 255.255.255.0

RTA(config)#router ospf 110

RTA(config-router)# router-id 1.1.1.1

RTA(config-router)# redistribute connected subnets

RTA(config-router)# network 192.168.1.0 0.0.0.255 area 0

//RTB配置

RTB(config)#interface Ethernet0/0

RTB(config-if)# ip address 192.168.1.2 255.255.255.0

RTB(config-if)#exit

RTB(config)#interface Ethernet0/1

RTB(config-if)# ip address 192.168.2.1 255.255.255.0

RTB(config-if)#exit

RTB(config)#router ospf 110

RTB(config-router)# router-id 2.2.2.2

RTB(config-router)# network 192.168.1.0 0.0.0.255 area 0

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

//RTC配置

RTC(config)#interface Ethernet0/1

RTC(config-if)# ip address 192.168.2.2 255.255.255.0

RTC(config-if)#exit

RTC(config)#router ospf 110

RTC(config-router)# router-id 3.3.3.3

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

步骤一:查看LSDB

RTC#show ip ospf database

            OSPF Router with ID (3.3.3.3) (Process ID 110)

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count

2.2.2.2         2.2.2.2         44          0x8000002C 0x00AB68 1

3.3.3.3         3.3.3.3         10          0x80000029 0x00709E 1

                Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.2.2     3.3.3.3         45          0x8000001A 0x000291

                Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.1.0     2.2.2.2         50          0x80000009 0x00E4D3

                Summary ASB Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

1.1.1.1         2.2.2.2         50          0x80000001 0x0075B0

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag

100.1.1.0       1.1.1.1         1347        0x80000012 0x0077AD 0

步骤二:STUB区域配置

配置和显示信息如下:

RTB(config-router)#area 1 stub //OSPF的区域1配置成STUB区域

RTC(config-router)#area 1 stub

步骤三:查看LSDB和路由表

RTC#show ip ospf database 

            OSPF Router with ID (3.3.3.3) (Process ID 110)

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count

2.2.2.2         2.2.2.2          4           0x8000002E 0x00C54E 1

3.3.3.3         3.3.3.3          4           0x8000002B 0x008A84 1

                Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.2.2     3.3.3.3         4           0x8000001C 0x001C77

                Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

0.0.0.0         2.2.2.2          9           0x80000001 0x0075C0

192.168.1.0    2.2.2.2          9           0x8000000A 0x0001B8

从上述现象发现,STUB区域中R2过滤了4/5LSA,并自动下发30.0.0.0/0LSA

RTC#show ip route 

Codes: L - local, 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, H - NHRP, l - LISP

       a - application route

       + - replicated route, % - next hop override

Gateway of last resort is 192.168.2.1 to network 0.0.0.0

O*IA  0.0.0.0/0 [110/11] via 192.168.2.1, 00:01:49, Ethernet0/1

      100.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        100.3.3.0/24 is directly connected, Loopback0

L        100.3.3.3/32 is directly connected, Loopback0

O IA  192.168.1.0/24 [110/20] via 192.168.2.1, 00:01:49, Ethernet0/1

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

C        192.168.2.0/24 is directly connected, Ethernet0/1

L        192.168.2.2/32 is directly connected, Ethernet0/1

RTC#ping 100.1.1.1

Type escape sequence to abort.

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

!!!!!

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

从上述现象发现,STUB区域内设备能访问外部网段。

步骤四:配置Totally STUB区域

配置和显示信息如下:

RTB(config-router)#area 1 stub no-summary//OSPF的区域1配置成完全STUB区域

步骤五:查看LSDB和路由表

RTC#show ip ospf database 

            OSPF Router with ID (3.3.3.3) (Process ID 110)

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count

2.2.2.2         2.2.2.2         378         0x8000002E 0x00C54E 1

3.3.3.3         3.3.3.3         379         0x8000002B 0x008A84 1

                Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.2.2    3.3.3.3         379         0x8000001C 0x001C77

                Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

0.0.0.0         2.2.2.2         15          0x80000003 0x0071C2

从上述现象发现,完全STUB区域中R2过滤了3/4/5LSA,并自动下发30.0.0.0/0LSA

RTC#show ip route

Codes: L - local, 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, H - NHRP, l - LISP

       a - application route

       + - replicated route, % - next hop override

Gateway of last resort is 192.168.2.1 to network 0.0.0.0

O*IA  0.0.0.0/0 [110/11] via 192.168.2.1, 00:01:44, Ethernet0/1

      100.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        100.3.3.0/24 is directly connected, Loopback0

L        100.3.3.3/32 is directly connected, Loopback0

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

C        192.168.2.0/24 is directly connected, Ethernet0/1

L        192.168.2.2/32 is directly connected, Ethernet0/1

RTC#ping 100.1.1.1

Type escape sequence to abort.

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

!!!!!

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

从上述现象发现,完全STUB区域内设备能访问外部网段。

步骤六:配置NSSA区域

配置和显示信息如下:

RTB(config-router)#no area 1 stub

RTB(config-router)#area 1 nssa //area1配置成NSSA区域

RTC(config-router)#no area 1 stub

RTC(config-router)#area 1 nssa

步骤七:查看LSDB和路由表

RTC#show ip ospf database 

            OSPF Router with ID (3.3.3.3) (Process ID 110)

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count

2.2.2.2         2.2.2.2         61          0x80000031 0x004DB9 1

3.3.3.3         3.3.3.3         60          0x8000002D 0x000EF6 1

                Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.2.2     3.3.3.3         60          0x8000001E 0x009FE9

                Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.1.0     2.2.2.2         86          0x80000002 0x009821

从上述现象发现,NSSA区域中R2过滤了4/5LSA,但未自动下发0.0.0.0/0LSA

RTB(config-router)#area 1 nssa default-information-originate //手工下发默认路由

RTC#show ip ospf database 

            OSPF Router with ID (3.3.3.3) (Process ID 110)

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count

2.2.2.2         2.2.2.2         208         0x80000031 0x004DB9 1

3.3.3.3         3.3.3.3         207         0x8000002D 0x000EF6 1

                Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.2.2     3.3.3.3         207         0x8000001E 0x009FE9

                Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.1.0     2.2.2.2         234         0x80000002 0x009821

                Type-7 AS External Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Tag

0.0.0.0         2.2.2.2         43          0x80000001 0x00D0D8 0

从上述现象发现,NSSA区域中R2手工下发70.0.0.0/0LSA

RTC#show ip route

Codes: L - local, 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, H - NHRP, l - LISP

       a - application route

       + - replicated route, % - next hop override

Gateway of last resort is 192.168.2.1 to network 0.0.0.0

O*N2  0.0.0.0/0 [110/1] via 192.168.2.1, 00:01:45, Ethernet0/1

      100.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        100.3.3.0/24 is directly connected, Loopback0

L        100.3.3.3/32 is directly connected, Loopback0

O IA  192.168.1.0/24 [110/20] via 192.168.2.1, 00:04:28, Ethernet0/1

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

C        192.168.2.0/24 is directly connected, Ethernet0/1

L        192.168.2.2/32 is directly connected, Ethernet0/1

RTC#ping 100.1.1.1

Type escape sequence to abort.

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

!!!!!

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

从上述现象发现,NSSA区域内设备能访问外部网段。

步骤八:Totally NSSA区域

配置和显示信息如下:

RTB(config-router)#area 1 nssa no-summary //配置成完全NSSA区域

步骤九:查看LSDB和路由表

RTC#show ip ospf database

            OSPF Router with ID (3.3.3.3) (Process ID 110)

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count

2.2.2.2         2.2.2.2         159         0x80000034 0x0047BC 1

3.3.3.3         3.3.3.3         561         0x8000002D 0x000EF6 1

                Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.2.2     3.3.3.3         561         0x8000001E 0x009FE9

                Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

0.0.0.0         2.2.2.2         66          0x80000001 0x00FC31

从上述现象发现,完全NSSA区域中R2过滤了3/4/5LSA,并自动下发30.0.0.0/0LSA

RTC#show ip route 

Codes: L - local, 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, H - NHRP, l - LISP

       a - application route

       + - replicated route, % - next hop override

Gateway of last resort is 192.168.2.1 to network 0.0.0.0

O*IA  0.0.0.0/0 [110/11] via 192.168.2.1, 00:02:30, Ethernet0/1

      100.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        100.3.3.0/24 is directly connected, Loopback0

L        100.3.3.3/32 is directly connected, Loopback0

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

C        192.168.2.0/24 is directly connected, Ethernet0/1

L        192.168.2.2/32 is directly connected, Ethernet0/1

RTC#ping 100.1.1.1

Type escape sequence to abort.

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

!!!!!

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

从上述现象发现,完全NSSA区域内设备能访问外部网段。

相关阅读: