资讯详情

ospf特殊区域stub配置详解

实验目的:1、掌握类型1、2、3、4、5LSA的作用。

2、掌握OSPF末节(Stub)区域特点。

3、掌握OSPF Stub区域配置方法。

4、掌握OSPF Stub区域配置要求: Stub区域没有ASBR,至少有一个ABR。

实验拓扑:

步骤1:接口配置

R1(config)#interface f0/0 R1(config-if)#ip address 12.12.12.1 255.255.255.0 R1(config-if)#no shutdown   R1(config)#interface loopback 0 R1(config-if)#ip address 1.1.1.1 255.255.255.0  R2(config)#interface f0/0 R2(config-if)#ip address 12.12.12.2 255.255.255.0 R2(config-if)#no shutdown     R2(config)#interface f0/1 R2(config-if)#ip address 23.23.23.2 255.255.255.0 R2(config-if)#no shutdown  R3(config)#interface f0/1 R3(config-if)#ip address 23.23.23.3 255.255.255.0 R3(config-if)#no shutdown  R3(config)#interface f0/0 R3(config-if)#ip address 34.34.34.3 255.255.255.0 R3(config-if)#no shutdown  R3(config)#interface f0/2 R3(config-if)#ip address 35.35.35.3 255.255.255.0 R3(config-if)#no shutdown    R4(config)#interface f0/0 R4(config-if)#ip address 34.34.34.4 255.255.255.0  R4(config-if)#no shutdown  R4(config)#interface loopback 0 R4(config-if)#ip address 4.1.1.1 255.255.255.0 R4(config)#interface loopback 1 R4(config-if)#ip address 4.1.2.1 255.255.255.0 R4(config)#interface loopback 2 R4(config-if)#ip address 4.1.3.1 255.255.255.0 R4(config)#interface loopback 3 R4(config-if)#ip address 4.1.4.1 255.255.255.0 R4(config)#interface loopback 4 R4(config-if)#ip address 4.1.5.1 255.255.255.0  R5(config)#interface f0/2 R5(config-if)#ip address 35.35.35.5 255.255.255.0 R5(config-if)#no shutdown

步骤2:路由协议配置

R1(config)#router ospf 1 R1(config-router)#network 1.1.1.1 0.0.0.0 area 1 R1(config-router)#network 12.12.12.0 0.0.0.255 area 1  R2(config)#router ospf 1 R2(config-router)#network 12.12.12.0 0.0.0.255 area 1 R2(config-router)#network 23.23.23.0 0.0.0.255 area 0  R3(config)#router ospf 1 R3(config-router)#network 23.23.23.0 0.0.0.255 area 0 R3(config-router)#network 34.34.34.0 0.0.0.255 area 0 R3(config)#router rip R3(config-router)#no auto-summary  R3(config-router)#version 2 R3(config-router)#net 35.35.35.0  R4(config)#router ospf 1 R4(config-router)#network 34.34.34.0 0.0.0.255 area 0 R4(config-router)#network 4.1.1.1 0.0.0.0 area 0 R4(config-router)#network 4.1.2.1 0.0.0.0 area 0 R4(config-router)#network 4.1.3.1 0.0.0.0 area 0 R4(config-router)#network 4.1.4.1 0.0.0.0 area 0 R4(config-router)#network 4.1.5.1 0.0.0.0 area 0  R5(config)#router rip R5(config-router)#no auto-summary  R5(config-router)#version 2 R5(config-router)#network 35.35.35.0

重分发:

R3(config)#router ospf 1 R3(config-router)#redistribute rip subnets metric 200 R3(config-router)#router rip R3(config-router)#redistribute ospf 1 metric 10

查看R1路由表:

R1#show ip route   Gateway of last resort is not set       34.0.0.0/24 is subnetted, 1 subnets O IA    34.34.34.0 [110/3] via 12.12.12.2, 00:22:37, FastEthernet0/0 //IA类型路由是由LSA3通知区域间路由      1.0.0.0/24 is subnetted, 1 subnets C       1.1.1.0 is directly connected, Loopback0      35.0.0.0/24 is subnetted, 1 subnets O E2    35.35.35.0 [110/200] via 12.12.12.2, 00:00:03, FastEthernet0/0 // E2类型路由是由LSA5通知的外部区域路由      4.0.0.0/32 is subnetted, 5 subnets O IA    4.1.4.1 [110/4] via 12.12.12.2, 00:00:57, FastEthernet0/0 O IA    4.1.5.1 [110/4] via 12.12.12.2, 00:00:08, FastEthernet0/0 O IA    4.1.1.1 [110/4] via 12.12.12.2, 00:21:07, FastEthernet0/0 O IA    4.1.2.1 [110/4] via 12.12.12.2, 00:01:08, FastEthernet0/0 O IA    4.1.3.1 [110/4] via 12.12.12.2, 00:00:58, FastEthernet0/0      23.0.0.0/24 is subnetted, 1 subnets O IA    23.23.23.0 [110/2] via 12.12.12.2, 00:33:30, FastEthernet0/0      12.0.0.0/24 is subnetted, 1 subnets C       12.12.12.0 is directly connected, FastEthernet0/0

测试网络连通性

R1#ping 35.35.35.5  Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 35.35.35.5, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 20/60/104 ms

查看R1路由器链路状态数据库:

R1#show ip ospf database               OSPF Router with ID (1.1.1.1) (Process ID 1)    Router Link States (Area 1) //类型1的lsa用于宣布具体网络  Link ID         ADV Router      Age         Seq#       Checksum Link count 1.1.1.1         1.1.1.1         707         0x80000004 0x006464 2 23.23.23.2      23.23.3.2      659         0x80000004 0x0058FC 1

		Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
12.12.12.1      1.1.1.1         707         0x80000002 0x004183

		Summary Net Link States (Area 1)
//类型3的lsa用于宣告区域间路由

Link ID         ADV Router      Age         Seq#       Checksum
4.1.1.1         23.23.23.2      1902        0x80000001 0x001CCF
4.1.2.1         23.23.23.2      703         0x80000001 0x0011D9
4.1.3.1         23.23.23.2      693         0x80000001 0x0006E3
4.1.4.1         23.23.23.2      693         0x80000001 0x00FAED
4.1.5.1         23.23.23.2      644         0x80000001 0x00EFF7
23.23.23.0      23.23.23.2      659         0x80000002 0x001C92
34.34.34.0      23.23.23.2      155         0x80000002 0x0098F3

		Summary ASB Link States (Area 1)
//类型4的lsa用于指出自制系统边界路由器(ASBR)的位置

Link ID         ADV Router      Age         Seq#       Checksum
35.35.35.3      23.23.23.2      797         0x80000001 0x004047

		Type-5 AS External Link States
//类型5的lsa用于宣告外部路由

Link ID         ADV Router      Age         Seq#       Checksum Tag
35.35.35.0      35.35.35.3      802         0x80000001 0x00A86D 0

我们注意到R1路由学习到的本次实验拓扑中所有的路由,在实际网络应用中,R1路由并不需要学习到整个网络路由。过多的路由条目会导致路由器变大,不利用路由查询,同时也不利于网络的收敛。OSPF网络路由是通过LSA来进行通告。可以

步骤3:在R1和R2上配置area 1区域为stub区域:

R1(config)#router ospf 1
R1(config-router)#area 1 stub

R2(config)#router ospf 1
R2(config-router)#area 1 stub

再次查看R1的链路状态数据库,通过查看R1的数据库,可以发现类型4和5的LSA被拒绝了,从而限制了LSA的泛洪范围。如下所示:

R1#show IP ospf database 

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

		Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         45          0x80000006 0x00883F 2
23.23.23.2      23.23.23.2      46          0x80000006 0x007CD7 1

		Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
12.12.12.2      23.23.23.2      46          0x80000001 0x003251

		Summary Net Link States (Area 1)
//由于在R2上配置area 1为末节区域。因此R2必须发送一条默认路由。以确保area 1区域的路由器通过访问非OSPF的网络。


Link ID         ADV Router      Age         Seq#       Checksum
0.0.0.0         23.23.23.2      51          0x80000001 0x007B7B
4.1.1.1         23.23.23.2      51          0x80000003 0x0036B5
4.1.2.1         23.23.23.2      51          0x80000002 0x002DBE
4.1.3.1         23.23.23.2      51          0x80000002 0x0022C8
4.1.4.1         23.23.23.2      51          0x80000002 0x0017D2
4.1.5.1         23.23.23.2      51          0x80000002 0x000CDC
23.23.23.0      23.23.23.2      51          0x80000003 0x003877
34.34.34.0      23.23.23.2      53          0x80000003 0x00B4D8

查看R1的路由表,确认路由表变化。因为有R2发送的默认路由,因此R1也不需要接收类型4的LSA,即无需要知晓ASBR的位置:

R1#show ip route 

Gateway of last resort is 12.12.12.2 to network 0.0.0.0

     34.0.0.0/24 is subnetted, 1 subnets
O IA    34.34.34.0 [110/3] via 12.12.12.2, 00:01:40, FastEthernet0/0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     4.0.0.0/32 is subnetted, 5 subnets
O IA    4.1.4.1 [110/4] via 12.12.12.2, 00:01:40, FastEthernet0/0
O IA    4.1.5.1 [110/4] via 12.12.12.2, 00:01:40, FastEthernet0/0
O IA    4.1.1.1 [110/4] via 12.12.12.2, 00:01:40, FastEthernet0/0
O IA    4.1.2.1 [110/4] via 12.12.12.2, 00:01:41, FastEthernet0/0
O IA    4.1.3.1 [110/4] via 12.12.12.2, 00:01:41, FastEthernet0/0
     23.0.0.0/24 is subnetted, 1 subnets
O IA    23.23.23.0 [110/2] via 12.12.12.2, 00:01:41, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.12.12.0 is directly connected, FastEthernet0/0
O*IA 0.0.0.0/0 [110/2] via 12.12.12.2, 00:01:42, FastEthernet0/0

检测网络联通性

R1#ping 35.35.35.5

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 35.35.35.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/54/88 ms

标签: 007b2ln传感器

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台