科技行者

行者学院 转型私董会 科技行者专题报道 网红大战科技行者

知识库

知识库 安全导航

至顶网网络频道路由交换路由交换:OSPF NSSA区域配置例子

路由交换:OSPF NSSA区域配置例子

  • 扫一扫
    分享文章到微信

  • 扫一扫
    关注官方公众号
    至顶头条

路由交换:OSPF NSSA区域配置例子

来源:chinaitlab 2010年3月27日

关键字: OSPF 路由协议

  • 评论
  • 分享微博
  • 分享邮件

  

  实验预备知识:

  NSSA,Not-so-stubby Area,非完全末梢区域

  LSA的类型:

  1型:路由器LSA(Router LSA)

  2型:网络LSA(Network LSA)

  3型:网络汇总LSA(Network Summary LSA)

  4型:ASBR汇总LSA(ASBR Summary LSA)

  5型:自治系统外部LSA(AS External LSA)

  7型:NSSA外部LSA(NSSA External LSA)

  实验预配置:

  第一步 R1的预配置

  R1(config)#int lo0

  R1(config-if)#ip add 1.1.1.1 255.255.255.0

  R1(config-if)#int s2/1

  R1(config-if)#ip add 12.0.0.1 255.255.255.0

  R1(config-if)#no sh

  R1(config-if)#int s2/2

  R1(config-if)#ip add 15.0.0.1 255.255.255.0

  R1(config-if)#no sh

  R1(config-if)#exit

  第二步 R2的预配置

  R2(config)#int lo0

  R2(config-if)#ip add 2.2.2.2 255.255.255.0

  R2(config-if)#int s2/1

  R2(config-if)#ip add 12.0.0.2 255.255.255.0

  R2(config-if)#no sh

  R2(config-if)#int s2/2

  R2(config-if)#ip add 23.0.0.2 255.255.255.0

  R2(config-if)#no sh

  R2(config-if)#exit

  第三步 R3的预配置

  R3(config)#int lo0

  R3(config-if)#ip add 3.3.3.3 255.255.255.0

  R3(config-if)#int s2/1

  R3(config-if)#ip add 23.0.0.3 255.255.255.0

  R3(config-if)#no sh

  R3(config-if)#exit

  第四步 R4的预配置

  R4(config)#int lo0

  R4(config-if)#ip add 4.4.4.4 255.255.255.0

  R4(config-if)#int s2/2

  R4(config-if)#ip add 45.0.0.4 255.255.255.0

  R4(config-if)#no sh

  R4(config-if)#exit

  第五步 R5的预配置

  R5(config)#int lo0

  R5(config-if)#ip add 5.5.5.5 255.255.255.0

  R5(config-if)#int s2/1

  R5(config-if)#ip add 15.0.0.5 255.255.255.0

  R5(config-if)#no sh

  R5(config-if)#int s2/2

  R5(config-if)#ip add 45.0.0.5 255.255.255.0

  R5(config-if)#no sh

  实验配置过程:

  第一步 配置R1、R2、R3、R4、R5的OSPF协议

  R1(config)#router ospf 100

  R1(config-router)#router-id 1.1.1.1

  R1(config-router)#network 1.1.1.1 0.0.0.0 area 0

  R1(config-router)#network 12.0.0.1 0.0.0.0 area 0

  R1(config-router)#network 15.0.0.1 0.0.0.0 area 0

  R1(config-router)#exit

  R2(config)#router ospf 100

  R2(config-router)#router-id 2.2.2.2

  R2(config-router)#network 2.2.2.2 0.0.0.0 area 0

  R2(config-router)#network 12.0.0.2 0.0.0.0 area 0

  R2(config-router)#network 23.0.0.2 0.0.0.0 area 32

  R2(config-router)#exit

  R3(config)#router ospf 100

  R3(config-router)#router-id 3.3.3.3

  R3(config-router)#network 3.3.3.3 0.0.0.0 area 32

  R3(config-router)#network 23.0.0.3 0.0.0.0 area 32

  R3(config-router)#exit

  R4(config)#router ospf 100

  R4(config-router)#router-id 4.4.4.4

  R4(config-router)#network 4.4.4.4 0.0.0.0 area 54

  R4(config-router)#network 45.0.0.4 0.0.0.0 area 54

  R4(config-router)#exit

  R5(config)#router ospf 100

  R5(config-router)#network 5.5.5.5 0.0.0.0 area 0

  R5(config-router)#network 15.0.0.5 0.0.0.0 area 0

  R5(config-router)#network 45.0.0.5 0.0.0.0 area 54

  R5(config-router)#exit

  第二步 配置Area 32为NSSA区域

  R2(config)#router ospf 100

  R2(config-router)#area 32 nssa

  R2(config-router)#exit

  R3(config)#router ospf 100

  R3(config-router)#area 32 nssa

  R3(config-router)#exit

  第三步 到R3上配置重分布

  R3(config)#int lo11

  R3(config-if)#ip ad 199.172.1.1 255.255.255.0

  R3(config-if)#int lo12

  R3(config-if)#ip ad 199.172.2.2 255.255.255.0

  R3(config-if)#int lo13

  R3(config-if)#ip ad 199.172.3.3 255.255.255.0

  R3(config-if)#int lo14

  R3(config-if)#ip ad 199.172.4.4 255.255.255.0

  R3(config-if)#int lo15

  R3(config-if)#ip ad 199.172.5.5 255.255.255.0

  R3(config-if)#int lo16

  R3(config-if)#ip ad 199.172.6.6 255.255.255.0

  R3(config-if)#int lo17

  R3(config-if)#ip ad 199.172.7.7 255.255.255.0

  R3(config-if)#int lo18

  R3(config-if)#ip ad 199.172.8.8 255.255.255.0

  R3(config-if)#int lo19

  R3(config-if)#ip ad 199.172.9.9 255.255.255.0

  R3(config-if)#int lo20

  R3(config-if)#ip ad 199.172.10.10 255.255.255.0

  R3(config-if)#int lo21

  R3(config-if)#ip ad 199.172.11.11 255.255.255.0

  R3(config-if)#int lo22

  R3(config-if)#ip ad 199.172.12.12 255.255.255.0

  R3(config-if)#int lo23

  R3(config-if)#ip ad 199.172.13.13 255.255.255.0

  R3(config-if)#int lo24

  R3(config-if)#ip ad 199.172.14.14 255.255.255.0

  R3(config-if)#int lo25

  R3(config-if)#ip ad 199.172.15.15 255.255.255.0

  R3(config-if)#exit

  R3(config)#router ospf 100

  R3(config-router)#redistribute connected subnets

  R3(config-router)#^Z

  第四步 查看R3的OSPF数据库

  R3#show ip ospf database

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

  Router Link States (Area 32)

  Link ID ADV Router Age Seq# Checksum Link count

  2.2.2.2 2.2.2.2 146 0x80000006 0x0089C0 2

  3.3.3.3 3.3.3.3 31 0x80000004 0x006FBB 3

  Summary Net Link States (Area 32)

  Link ID ADV Router Age Seq# Checksum

  1.1.1.1 2.2.2.2 162 0x80000002 0x004F99

  2.2.2.2 2.2.2.2 162 0x80000002 0x009E86

  4.4.4.4 2.2.2.2 162 0x80000002 0x00C992

  5.5.5.5 2.2.2.2 162 0x80000002 0x00197F

  12.0.0.0 2.2.2.2 162 0x80000002 0x00D60B

  15.0.0.0 2.2.2.2 162 0x80000002 0x00326C

  45.0.0.0 2.2.2.2 162 0x80000002 0x002D13

  Type-7 AS External Link States (Area 32)

  //可以看到,R3上重发布的路由成了LSA-7型

  Link ID ADV Router Age Seq# Checksum Tag

  199.172.1.0 3.3.3.3 30 0x80000001 0x0047C1 0

  199.172.2.0 3.3.3.3 31 0x80000001 0x003CCB 0

  199.172.3.0 3.3.3.3 31 0x80000001 0x0031D5 0

  199.172.4.0 3.3.3.3 31 0x80000001 0x0026DF 0

  199.172.5.0 3.3.3.3 31 0x80000001 0x001BE9 0

  199.172.6.0 3.3.3.3 32 0x80000001 0x0010F3 0

  199.172.7.0 3.3.3.3 32 0x80000001 0x0005FD 0

  199.172.8.0 3.3.3.3 32 0x80000001 0x00F908 0

  199.172.9.0 3.3.3.3 32 0x80000001 0x00EE12 0

  199.172.10.0 3.3.3.3 32 0x80000001 0x00E31C 0

  199.172.11.0 3.3.3.3 32 0x80000001 0x00D826 0

  199.172.12.0 3.3.3.3 32 0x80000001 0x00CD30 0

  199.172.13.0 3.3.3.3 32 0x80000001 0x00C23A 0

  199.172.14.0 3.3.3.3 32 0x80000001 0x00B744 0

  199.172.15.0 3.3.3.3 32 0x80000001 0x00AC4E 0

  第五步 查看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

  Gateway of last resort is not set

  O N2 199.172.11.0/24 [110/20] via 23.0.0.3, 00:02:15, Serial2/2

  1.0.0.0/32 is subnetted, 1 subnets

  O 1.1.1.1 [110/65] via 12.0.0.1, 00:04:26, Serial2/1

  O N2 199.172.10.0/24 [110/20] via 23.0.0.3, 00:02:15, Serial2/2

  2.0.0.0/24 is subnetted, 1 subnets

  C 2.2.2.0 is directly connected, Loopback0

  O N2 199.172.9.0/24 [110/20] via 23.0.0.3, 00:02:15, Serial2/2

  3.0.0.0/32 is subnetted, 1 subnets

  O 3.3.3.3 [110/65] via 23.0.0.3, 00:02:15, Serial2/2

  O N2 199.172.8.0/24 [110/20] via 23.0.0.3, 00:02:15, Serial2/2

  O N2 199.172.15.0/24 [110/20] via 23.0.0.3, 00:02:15, Serial2/2

  4.0.0.0/32 is subnetted, 1 subnets

  O IA 4.4.4.4 [110/193] via 12.0.0.1, 00:02:15, Serial2/1

  O N2 199.172.14.0/24 [110/20] via 23.0.0.3, 00:02:15, Serial2/2

  5.0.0.0/32 is subnetted, 1 subnets

  O 5.5.5.5 [110/129] via 12.0.0.1, 00:04:27, Serial2/1

  O N2 199.172.13.0/24 [110/20] via 23.0.0.3, 00:02:16, Serial2/2

  23.0.0.0/24 is subnetted, 1 subnets

  C 23.0.0.0 is directly connected, Serial2/2

  O N2 199.172.12.0/24 [110/20] via 23.0.0.3, 00:02:16, Serial2/2

  O N2 199.172.3.0/24 [110/20] via 23.0.0.3, 00:02:16, Serial2/2

  O N2 199.172.2.0/24 [110/20] via 23.0.0.3, 00:02:16, Serial2/2

  O N2 199.172.1.0/24 [110/20] via 23.0.0.3, 00:02:16, Serial2/2

  O N2 199.172.7.0/24 [110/20] via 23.0.0.3, 00:02:16, Serial2/2

  12.0.0.0/24 is subnetted, 1 subnets

  C 12.0.0.0 is directly connected, Serial2/1

  O N2 199.172.6.0/24 [110/20] via 23.0.0.3, 00:02:17, Serial2/2

  O N2 199.172.5.0/24 [110/20] via 23.0.0.3, 00:02:17, Serial2/2

  O N2 199.172.4.0/24 [110/20] via 23.0.0.3, 00:02:17, Serial2/2

  45.0.0.0/24 is subnetted, 1 subnets

  O IA 45.0.0.0 [110/192] via 12.0.0.1, 00:02:17, Serial2/1

  15.0.0.0/24 is subnetted, 1 subnets

  O 15.0.0.0 [110/128] via 12.0.0.1, 00:04:28, Serial2/1

  R2#

  R2#show ip ospf database

  OSPF Router with ID (2.2.2.2) (Process ID 100)

  Router Link States (Area 0)

  Link ID ADV Router Age Seq# Checksum Link count

  1.1.1.1 1.1.1.1 372 0x80000005 0x005B35 5

  2.2.2.2 2.2.2.2 305 0x80000004 0x001B3C 3

  5.5.5.5 5.5.5.5 368 0x80000002 0x0040ED 3

  Summary Net Link States (Area 0)

    • 评论
    • 分享微博
    • 分享邮件
    邮件订阅

    如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。

    重磅专题
    往期文章
    最新文章