OSPF多区域

一,实验要点:

(1),LSA1:路由器LSA(由区域内的路由器发出的,泛洪在内部区域)

(2),LSA2:网络LSA(由区域内的DR始发的,泛洪在内部区域)

(3),LSA3:网络汇总LSA(由ABR路由器始发的,通告该区域外部的目的地址)

(4),LSA4:ASBR汇总LSA(由ABR路由器始发的,用于通告ASBR信息,指出谁是ASBR)

(5),LSA5:自治系统外部LSA(由ASBR路由器始发的,用来通告到达OSPF自治系统外部的目的地或者是到OSPF自治系统外部的默认路由的LSA。外部LSA通告将在整个自治系统中进行泛洪)

OSPF多区域_第1张图片

OSPF 多区域的拓扑结构有如下的优势:
1. 降低SPF 计算频率
2. 减小路由表
3. 降低了通告LSA 的开销
4. 将不稳定限制在特定的区

二,实验拓扑图

OSPF多区域_第2张图片

R1loopback0):1.1.1.1/32        R2loopback0):2.2.2.2/32

R3loopback0):3.3.3.3/32        R4loopback0):4.4.4.4/32

R5loopback0):5.5.5.5/32        R6loopback0):6.6.6.6/32

R1配置:

R1#conf t

R1(config)#int f0/0

R1(config-if)#ip add 192.168.1.2 255.255.255.252

R1(config-if)#no shut

R1(config-if)#int f0/1

R1(config-if)#ip add 10.1.1.1 255.255.255.252

R1(config-if)#no shut

R1(config-if)#int loo 0

R1(config-if)#ip add 1.1.1.1 255.255.255.255

R1(config-if)#no shut

R1(config-if)#ex

R1(config)#router ospf 110

R1(config-router)#router-id 1.1.1.1

R1(config-router)#network 1.1.1.1 0.0.0.0 a 1

R1(config-router)#network 10.1.1.0 0.0.0.3 a 1

R2配置:

R2#conf t

R2(config)#int f0/0

R2(config-if)#ip add 10.1.1.2 255.255.255.252

R2(config-if)#no shut

R2(config-if)#int f0/1

R2(config-if)#ip add 20.2.2.1 255.255.255.252

R2(config-if)#no shut

R2(config-if)#int loo 0

R2(config-if)#ip add 2.2.2.2 255.255.255.255

R2(config-if)#no shut

R2(config-if)#ex

R2(config)#router ospf 110

R2(config-router)#router-id 2.2.2.2

R2(config-router)#network 2.2.2.2 0.0.0.0 a 1

R2(config-router)#network 10.1.1.0 0.0.0.3 a 1

R2(config-router)#network 20.2.2.0 0.0.0.3 a 1

R3配置:

R3#conf t

R3(config)#int f0/0

R3(config-if)#ip add 20.2.2.2 255.255.255.252

R3(config-if)#no shut

R3(config-if)#int f0/1

R3(config-if)#ip add 30.3.3.1 255.255.255.252

R3(config-if)#no shut

R3(config-if)#int loo 0

R3(config-if)#ip add 3.3.3.3 255.255.255.255

R3(config-if)#no shut

R3(config-if)#ex

R3(config)#router ospf 110

R3(config-router)#router-id 3.3.3.3

R3(config-router)#network 3.3.3.3 0.0.0.0 a 0

R3(config-router)#network 20.2.2.0 0.0.0.3 a 1

R3(config-router)#network 30.3.3.0 0.0.0.3 a 0

R4配置:

R4#conf t

R4(config)#int f0/0

R4(config-if)#ip add 30.3.3.2 255.255.255.252

R4(config-if)#no shut

R4(config-if)#int f0/1

R4(config-if)#ip add 40.4.4.1 255.255.255.252

R4(config-if)#no shut

R4(config-if)#int loo 0

R4(config-if)#ip add 4.4.4.4 255.255.255.255

R4(config-if)#no shut

R4(config-if)#ex

R4(config)#router ospf 110

R4(config-router)#router-id 4.4.4.4

R4(config-router)#network 4.4.4.4 0.0.0.0 a 2

R4(config-router)#network 30.3.3.0 0.0.0.3 a 0

R4(config-router)#network 40.4.4.0 0.0.0.3 a 2

R5配置:

R5#conf t

R5(config)#int f0/0

R5(config-if)#ip add 40.4.4.2 255.255.255.252

R5(config-if)#no shut

R5(config-if)#int loo 0

R5(config-if)#ip add 5.5.5.5 255.255.255.255

R5(config-if)#no shut

R5(config-if)#ex

R5(config)#router ospf 110

R5(config-router)#router-id 5.5.5.5

R5(config-router)#network 5.5.5.5 0.0.0.0 a 2

R5(config-router)#network 40.4.4.0 0.0.0.3 a 2

R6配置:

R6#conf t

R6(config)#int f0/0

R6(config-if)#ip add 192.168.1.1 255.255.255.252

R6(config-if)#no shut

R6(config-if)#int loo 0

R6(config-if)#ip add 6.6.6.6 255.255.255.255

R6(config-if)#no shut

R6(config-if)#ex

R6(config)#router rip

R6(config-router)#version 2

R6(config-router)#no auto-summary

R6(config-router)#network 6.6.6.6

R6(config-router)#network 192.168.1.0

R1配置:

R1(config)#router rip

R1(config-router)#version 2

R1(config-router)#no auto-summary

R1(config-router)#network 192.168.1.0

R1(config-router)#network 1.1.1.1

R1(config-router)#network 10.1.1.0

R1(config)#router ospf 110

R1(config-router)#redistribute rip subnets

R1(config)#router rip

R1(config-router)#redistribute ospf 110 metric 2

R6#ping 5.5.5.5

Type escape sequence to abort.

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

!!!!!

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

R5#ping 6.6.6.6

Type escape sequence to abort.

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

!!!!!

(至此全网互通)

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

R1#show ip ospf database router //查看内部数据库中列出的所有路由器LSA通告

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

          Router Link States (Area 1)

 LS age: 759

 Options: (No TOS-capability, DC)

 LS Type: Router Links

 Link State ID: 1.1.1.1

 Advertising Router: 1.1.1.1

 LS Seq Number: 80000005

 Checksum: 0x17D5

 Length: 48

 AS Boundary Router

 Number of Links: 2

   Link connected to: a Transit Network

    (Link ID) Designated Router address: 10.1.1.1

    (Link Data) Router Interface address: 10.1.1.1

     Number of TOS metrics: 0

      TOS 0 Metrics: 10

   Link connected to: a Stub Network

    (Link ID) Network/subnet number: 1.1.1.1

    (Link Data) Network Mask: 255.255.255.255

     Number of TOS metrics: 0

      TOS 0 Metrics: 1

 LS age: 1413

 Options: (No TOS-capability, DC)

 LS Type: Router Links

 Link State ID: 2.2.2.2

 Advertising Router: 2.2.2.2

 LS Seq Number: 80000006

 Checksum: 0x5045

 Length: 60

 Number of Links: 3

   Link connected to: a Transit Network

    (Link ID) Designated Router address: 20.2.2.1

    (Link Data) Router Interface address: 20.2.2.1

     Number of TOS metrics: 0

      TOS 0 Metrics: 10

   Link connected to: a Transit Network

    (Link ID) Designated Router address: 10.1.1.1

    (Link Data) Router Interface address: 10.1.1.2

     Number of TOS metrics: 0

      TOS 0 Metrics: 10

   Link connected to: a Stub Network

    (Link ID) Network/subnet number: 2.2.2.2

    (Link Data) Network Mask: 255.255.255.255

     Number of TOS metrics: 0

      TOS 0 Metrics: 1

 Routing Bit Set on this LSA

 LS age: 1521

 Options: (No TOS-capability, DC)

 LS Type: Router Links

 Link State ID: 3.3.3.3

 Advertising Router: 3.3.3.3

 LS Seq Number: 80000003

 Checksum: 0x8C4F

 Length: 36

 Area Border Router

 Number of Links: 1

   Link connected to: a Transit Network

    (Link ID) Designated Router address: 20.2.2.1

    (Link Data) Router Interface address: 20.2.2.2

     Number of TOS metrics: 0

      TOS 0 Metrics: 10

(泛洪在内部区域,由区域内的路由器发出的:LSA1)

R1#show ip ospf database network //查看内部网络LSA通告的信息

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

       Net Link States (Area 1)

 Routing Bit Set on this LSA

 LS age: 125

 Options: (No TOS-capability, DC)

 LS Type: Network Links

 Link State ID: 10.1.1.1 (address of Designated Router)

 Advertising Router: 1.1.1.1

 LS Seq Number: 80000003

 Checksum: 0x4ECF

 Length: 32

 Network Mask: /30

       Attached Router: 1.1.1.1

       Attached Router: 2.2.2.2

 Routing Bit Set on this LSA

 LS age: 1791

 Options: (No TOS-capability, DC)

 LS Type: Network Links

 Link State ID: 20.2.2.1 (address of Designated Router)

 Advertising Router: 2.2.2.2

 LS Seq Number: 80000002

 Checksum: 0xEC1A

 Length: 32

 Network Mask: /30

       Attached Router: 2.2.2.2

       Attached Router: 3.3.3.3

(每一个多址网络中的指定路由器DR都将产生网络LSA通告,即由区域内的DR发出的)

R1#show ip ospf database summary //显示链接状态数据库中的网络汇总LSA信息

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

        Summary Net Link States (Area 1)

 Routing Bit Set on this LSA

 LS age: 59

 Options: (No TOS-capability, DC, Upward)

 LS Type: Summary Links(Network)

 Link State ID: 3.3.3.3 (summary Network Number)

 Advertising Router: 3.3.3.3

 LS Seq Number: 80000003

 Checksum: 0xAA77

 Length: 28

 Network Mask: /32

       TOS: 0  Metric: 1

 Routing Bit Set on this LSA

 LS age: 59

 Options: (No TOS-capability, DC, Upward)

 LS Type: Summary Links(Network)

 Link State ID: 4.4.4.4 (summary Network Number)

 Advertising Router: 3.3.3.3

 LS Seq Number: 80000003

 Checksum: 0xE033

 Length: 28

 Network Mask: /32

       TOS: 0  Metric: 11

 Routing Bit Set on this LSA

 LS age: 1839

 Options: (No TOS-capability, DC, Upward)

 LS Type: Summary Links(Network)

 Link State ID: 5.5.5.5 (summary Network Number)

 Advertising Router: 3.3.3.3

 LS Seq Number: 80000002

 Checksum: 0x19ED

 Length: 28

 Network Mask: /32

       TOS: 0  Metric: 21

 Routing Bit Set on this LSA

 LS age: 63

 Options: (No TOS-capability, DC, Upward)

 LS Type: Summary Links(Network)

 Link State ID: 30.3.3.0 (summary Network Number)

 Advertising Router: 3.3.3.3

 LS Seq Number: 80000003

 Checksum: 0xB053

 Length: 28

 Network Mask: /30

       TOS: 0  Metric: 10

 Routing Bit Set on this LSA

 LS age: 64

 Options: (No TOS-capability, DC, Upward)

 LS Type: Summary Links(Network)

 Link State ID: 40.4.4.0 (summary Network Number)

 Advertising Router: 3.3.3.3

 LS Seq Number: 80000003

 Checksum: 0x7B72

 Length: 28

 Network Mask: /30

       TOS: 0  Metric: 20

(由ABR路由器始发的,ABR将发送网络汇总LSA到一个区域,用来通告外部的目的地址。一台ABR也可以通过网络汇总LSAarea 0通告与它相连的区域内部的目的地址。在一个区域外部,且仍然在一个OSPF自治系统内部的默认路由,可以通过这种LSA来通告。)

R4#show ip ospf database asbr-summary //查看ASBR汇总LSA的信息

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

        Summary ASB Link States (Area 0)

 Routing Bit Set on this LSA

 LS age: 152

 Options: (No TOS-capability, DC, Upward)

 LS Type: Summary Links(AS Boundary Router)

 Link State ID: 1.1.1.1 (AS Boundary Router address)

 Advertising Router: 3.3.3.3

 LS Seq Number: 80000003

 Checksum: 0xB75E

 Length: 28

 Network Mask: /0

       TOS: 0  Metric: 20

               Summary ASB Link States (Area 2)

 LS age: 8

 Options: (No TOS-capability, DC, Upward)

 LS Type: Summary Links(AS Boundary Router)

 Link State ID: 1.1.1.1 (AS Boundary Router address)

 Advertising Router: 4.4.4.4

 LS Seq Number: 80000003

 Checksum: 0xFD0A

 Length: 28

 Network Mask: /0

       TOS: 0  Metric: 30

(由ABR路由器始发的,用于通告ASBR信息,指出谁是ASBRASBR汇总LSA除了所通告的目的地是一个ASBR路由器而不是一个网络外,其他的网络汇总LSA都是一样)

R1#show ip ospf database external //查看AS外部LSA的信息

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

      Type-5 AS External Link States

 LS age: 576

 Options: (No TOS-capability, DC)

 LS Type: AS External Link

 Link State ID: 6.6.6.6 (External Network Number )

 Advertising Router: 1.1.1.1

 LS Seq Number: 80000003

 Checksum: 0xB0D1

 Length: 36

 Network Mask: /32

       Metric Type: 2 (Larger than any link state path)

       TOS: 0

       Metric: 20

       Forward Address: 0.0.0.0

       External Route Tag: 0

 LS age: 576

 Options: (No TOS-capability, DC)

 LS Type: AS External Link

 Link State ID: 192.168.1.0 (External Network Number )

 Advertising Router: 1.1.1.1

 LS Seq Number: 80000003

 Checksum: 0xF63C

 Length: 36

 Network Mask: /30

       Metric Type: 2 (Larger than any link state path)

       TOS: 0

       Metric: 20

       Forward Address: 0.0.0.0

       External Route Tag: 0

(由ASBR始发的,用来通告到达OSPF自治系统外部的目的地或者是到OSPF自治系统外部的默认路由的LSA。外部LSA通告将在整个自治系统中进行泛洪)