实验目的:
1、掌握类型1、2、3、4和5的LSA,及类型7的LSA在完全次末节区域的作用。
2、掌握次未节区域(NSSA)和完全次末节区域(NSSA Totally Stub Area)特点。
3、掌握两种区域配置方法。
4、注意:完全次末节区域(Totally NSSA)为CISCO私有的。
实验拓扑:
步骤1:接口IP配置
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
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 f0/1
R4(config-if)#ip address 45.45.45.4 255.255.255.0
R4(config-if)#no shutdown
R4(config)#interface loopback 0
R4(config-if)#ip address 4.4.0.1 255.255.255.0
R4(config-if)#interface loopback 1
R4(config-if)#ip address 4.4.1.1 255.255.255.0
R4(config-if)#interface loopback 2
R4(config-if)#ip address 4.4.2.1 255.255.255.0
R4(config-if)#interface loopback 3
R4(config-if)#ip address 4.4.3.1 255.255.255.0
R4(config-if)#interface loopback 4
R4(config-if)#ip address 4.4.4.1 255.255.255.0
R5(config)#interface f0/1
R5(config-if)#ip address 45.45.45.5 255.255.255.0
R5(config-if)#no shutdown
R5(config)#interface f0/0
R5(config-if)#ip address 56.56.56.5 255.255.255.0
R5(config-if)#no shutdown
R6(config)#interface f0/0
R6(config-if)#ip address 56.56.56.6 255.255.255.0
R6(config-if)#no shutdown
R6(config)#interface loopback 0
R6(config-if)#ip address 6.6.0.1 255.255.255.0
R6(config-if)#interface loopback 1
R6(config-if)#ip address 6.6.1.1 255.255.255.0
R6(config-if)#interface loopback 2
R6(config-if)#ip address 6.6.2.1 255.255.255.0
R6(config-if)#interface loopback 3
R6(config-if)#ip address 6.6.3.1 255.255.255.0
R6(config-if)#interface loopback 4
R6(config-if)#ip address 6.6.4.1 255.255.255.0
步骤2:路由协议基础配置
R1(config)#router rip
R1(config-router)#no auto-summary
R1(config-router)#version 2
R1(config-router)#network 1.1.1.0
R1(config-router)#network 12.12.12.0
R2(config)#router rip
R2(config-router)#no auto-summary
R2(config-router)#version 2
R2(config-router)#network 12.12.12.0
R2(config)#router ospf 1
R2(config-router)#network 23.23.23.0 0.0.0.255 area 1
R3(config)#router ospf 1
R3(config-router)#network 34.34.34.0 0.0.0.255 area 1
R3(config-router)#network 23.23.23.0 0.0.0.255 area 1
R4(config)#router ospf 1
R4(config-router)#network 34.34.34.0 0.0.0.255 area 1
R4(config-router)#network 45.45.45.0 0.0.0.255 area 0
R4(config-router)#network 4.4.0.1 0.0.0.0 area 0
R4(config-router)#network 4.4.1.1 0.0.0.0 area 0
R4(config-router)#network 4.4.2.1 0.0.0.0 area 0
R4(config-router)#network 4.4.3.1 0.0.0.0 area 0
R4(config-router)#network 4.4.4.1 0.0.0.0 area 0
R5(config)#router ospf 1
R5(config-router)#network 45.45.45.0 0.0.0.255 area 0
R5(config)#router rip
R5(config-router)#no auto-summary
R5(config-router)#version 2
R5(config-router)#network 56.56.56.0
R6(config)#router rip
R6(config-router)#no auto-summary
R6(config-router)#version 2
R6(config-router)#network 56.56.56.0
R6(config-router)#network 6.6.0.0
R6(config-router)#network 6.6.1.0
R6(config-router)#network 6.6.2.0
R6(config-router)#network 6.6.3.0
R6(config-router)#network 6.6.4.0
步骤3:重分发
R2(config)#router ospf 1
R2(config-router)#redistribute rip metric 200 subnets
R2(config-router)#router rip
R2(config-router)#redistribute ospf 1 metric 10
R5(config)#router ospf 1
R5(config-router)#redistribute rip metric 200 subnets
R5(config-router)#router rip
R5(config-router)#redistribute ospf 1 metric 10
查看R3路由表和链路状态数据库
R3#show ip route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets
C 34.34.34.0 is directly connected, FastEthernet0/0
1.0.0.0/24 is subnetted, 1 subnets
//R3路由学习到多个区域和多个非ospf的网络路由
O E2 1.1.1.0 [110/200] via 23.23.23.2, 00:03:06, FastEthernet0/1
4.0.0.0/32 is subnetted, 5 subnets
O IA 4.4.1.1 [110/2] via 34.34.34.4, 00:03:52, FastEthernet0/0
O IA 4.4.0.1 [110/2] via 34.34.34.4, 00:03:52, FastEthernet0/0
O IA 4.4.3.1 [110/2] via 34.34.34.4, 00:03:52, FastEthernet0/0
O IA 4.4.2.1 [110/2] via 34.34.34.4, 00:03:52, FastEthernet0/0
O IA 4.4.4.1 [110/2] via 34.34.34.4, 00:03:54, FastEthernet0/0
6.0.0.0/24 is subnetted, 5 subnets
O E2 6.6.0.0 [110/200] via 34.34.34.4, 00:03:07, FastEthernet0/0
O E2 6.6.1.0 [110/200] via 34.34.34.4, 00:03:07, FastEthernet0/0
O E2 6.6.2.0 [110/200] via 34.34.34.4, 00:03:08, FastEthernet0/0
O E2 6.6.3.0 [110/200] via 34.34.34.4, 00:03:08, FastEthernet0/0
O E2 6.6.4.0 [110/200] via 34.34.34.4, 00:03:08, FastEthernet0/0
23.0.0.0/24 is subnetted, 1 subnets
C 23.23.23.0 is directly connected, FastEthernet0/1
56.0.0.0/24 is subnetted, 1 subnets
O E2 56.56.56.0 [110/200] via 34.34.34.4, 00:03:08, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
O E2 12.12.12.0 [110/200] via 23.23.23.2, 00:03:08, FastEthernet0/1
45.0.0.0/24 is subnetted, 1 subnets
O IA 45.45.45.0 [110/2] via 34.34.34.4, 00:03:55, FastEthernet0/0
R3#show IP ospf database
OSPF Router with ID (34.34.34.3) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
4.4.4.1 4.4.4.1 437 0x80000003 0x004002 1
23.23.23.2 23.23.23.2 174 0x80000003 0x00FD14 1
34.34.34.3 34.34.34.3 446 0x80000005 0x00F7F1 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
23.23.23.2 23.23.23.2 497 0x80000001 0x004BAF
34.34.34.3 34.34.34.3 446 0x80000001 0x005F91
Summary Net Link States (Area 1)
//用于描述其他ospf区域的lsa 3
Link ID ADV Router Age Seq# Checksum
4.4.0.1 4.4.4.1 414 0x80000001 0x00BE67
4.4.1.1 4.4.4.1 404 0x80000001 0x00B371
4.4.2.1 4.4.4.1 394 0x80000001 0x00A87B
4.4.3.1 4.4.4.1 384 0x80000001 0x009D85
4.4.4.1 4.4.4.1 374 0x80000001 0x00928F
45.45.45.0 4.4.4.1 439 0x80000001 0x00D2D4
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
56.56.56.5 4.4.4.1 130 0x80000001 0x00057B
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
1.1.1.0 23.23.23.2 175 0x80000001 0x009C05 0
//由R2通告的用于描述外部网络路由的lsa 5
6.6.0.0 56.56.56.5 135 0x80000001 0x00FC35 0
6.6.1.0 56.56.56.5 135 0x80000001 0x00F13F 0
6.6.2.0 56.56.56.5 135 0x80000001 0x00E649 0
6.6.3.0 56.56.56.5 135 0x80000001 0x00DB53 0
6.6.4.0 56.56.56.5 135 0x80000001 0x00D05D 0
//从R5通告的用于描述外部网络路由的lsa 5
12.12.12.0 23.23.23.2 175 0x80000001 0x000F71 0
56.56.56.0 56.56.56.5 135 0x80000001 0x00ABE9 0
由于area 1路由违背了stub区域要求,即stub区域不能够有ASBR路由器的特性,不能配置未节或者完全未节。因此本实验采用NSSA的配置方法来减少R3路由器的路由表大小
步骤4:在R4上将area 1区域配置为nssa区域
R4(config)#router ospf 1
R4(config-router)#area 1 nssa default-information-originate
//Default-information-originate的参数目的是向area 1区域注入一条默认路由
R3(config)#router ospf 1
R3(config-router)#area 1 nssa
R2(config)#router ospf 1
R2(config-router)#area 1 nssa
再次查看R3路由表和链路状态数据库
R3#show ip route
Gateway of last resort is 34.34.34.4 to network 0.0.0.0
34.0.0.0/24 is subnetted, 1 subnets
C 34.34.34.0 is directly connected, FastEthernet0/0
1.0.0.0/24 is subnetted, 1 subnets
O N2 1.1.1.0 [110/200] via 23.23.23.2, 00:00:14, FastEthernet0/1
4.0.0.0/32 is subnetted, 5 subnets
//从R2获得的外部路由
O IA 4.4.1.1 [110/2] via 34.34.34.4, 00:00:14, FastEthernet0/0
O IA 4.4.0.1 [110/2] via 34.34.34.4, 00:00:14, FastEthernet0/0
O IA 4.4.3.1 [110/2] via 34.34.34.4, 00:00:14, FastEthernet0/0
O IA 4.4.2.1 [110/2] via 34.34.34.4, 00:00:15, FastEthernet0/0
O IA 4.4.4.1 [110/2] via 34.34.34.4, 00:00:15, FastEthernet0/0
23.0.0.0/24 is subnetted, 1 subnets
C 23.23.23.0 is directly connected, FastEthernet0/1
12.0.0.0/24 is subnetted, 1 subnets
O N2 12.12.12.0 [110/200] via 23.23.23.2, 00:00:16, FastEthernet0/1
45.0.0.0/24 is subnetted, 1 subnets
O IA 45.45.45.0 [110/2] via 34.34.34.4, 00:00:16, FastEthernet0/0
O*N2 0.0.0.0/0 [110/1] via 34.34.34.4, 00:00:16, FastEthernet0/0
//本条默认路由用于指出如何到达R5所连接外网,如果R5所连外部网络路由较多时,这样的好处是不言而喻的
R3#show ip ospf database
OSPF Router with ID (34.34.34.3) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
4.4.4.1 4.4.4.1 187 0x80000005 0x00E750 1
23.23.23.2 23.23.23.2 156 0x80000005 0x00A95F 1
34.34.34.3 34.34.34.3 156 0x80000009 0x009F3F 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
23.23.23.3 34.34.34.3 156 0x80000001 0x004F82
34.34.34.3 34.34.34.3 181 0x80000003 0x0001E7
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
4.4.0.1 4.4.4.1 242 0x80000002 0x0062BC
4.4.1.1 4.4.4.1 242 0x80000002 0x0057C6
4.4.2.1 4.4.4.1 242 0x80000002 0x004CD0
4.4.3.1 4.4.4.1 242 0x80000002 0x0041DA
4.4.4.1 4.4.4.1 242 0x80000002 0x0036E4
45.45.45.0 4.4.4.1 245 0x80000002 0x00762A
Type-7 AS External Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Tag
0.0.0.0 4.4.4.1 245 0x80000001 0x00AB8E 0
//到达R5所连接网络,由默认路由替代
1.1.1.0 23.23.23.2 162 0x80000001 0x0063EC 0
12.12.12.0 23.23.23.2 162 0x80000001 0x00D559 0
R1路由表:
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
R 34.34.34.0 [120/10] via 12.12.12.2, 00:00:06, 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
R 4.4.1.1 [120/10] via 12.12.12.2, 00:00:07, FastEthernet0/0
R 4.4.0.1 [120/10] via 12.12.12.2, 00:00:07, FastEthernet0/0
R 4.4.3.1 [120/10] via 12.12.12.2, 00:00:07, FastEthernet0/0
R 4.4.2.1 [120/10] via 12.12.12.2, 00:00:09, FastEthernet0/0
R 4.4.4.1 [120/10] via 12.12.12.2, 00:00:09, FastEthernet0/0
23.0.0.0/24 is subnetted, 1 subnets
R 23.23.23.0 [120/10] via 12.12.12.2, 00:00:09, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.12.12.0 is directly connected, FastEthernet0/0
45.0.0.0/24 is subnetted, 1 subnets
R 45.45.45.0 [120/10] via 12.12.12.2, 00:00:10, FastEthernet0/0
R* 0.0.0.0/0 [120/10] via 12.12.12.2, 00:00:10, FastEthernet0/0
//R1通过R2的重分发,正确学习到默认路由
检测网络联通性
R1#ping 6.6.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 108/128/176 ms
为了进一步简化area 1区域的路由器的路由表,我们采用完全次末节区域(Totally NSSA)特性来配置area 1。
步骤5:在NSSA的基础上配置Totally NSSA区域特性,只需要在R4的路由器上作如下配置:
R4(config)#router ospf 1
R4(config-router)#area 1 nssa no-summary
再次查看R3的路由表和链路状态数据库:
R3#show ip ospf database
OSPF Router with ID (34.34.34.3) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
4.4.4.1 4.4.4.1 526 0x80000005 0x00E750 1
23.23.23.2 23.23.23.2 495 0x80000005 0x00A95F 1
34.34.34.3 34.34.34.3 495 0x80000009 0x009F3F 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
23.23.23.3 34.34.34.3 495 0x80000001 0x004F82
34.34.34.3 34.34.34.3 521 0x80000003 0x0001E7
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 4.4.4.1 126 0x80000001 0x00D256
Type-7 AS External Link States (Area 1)
//因为完全次末节区域与完全末节区域类似的是:丢弃类型3、4、5的lsa,
//所以此外将默认路由转发类型7,以便向R2进行通告
Link ID ADV Router Age Seq# Checksum Tag
0.0.0.0 4.4.4.1 582 0x80000001 0x00AB8E 0
//从R2收到lsa 7,此类型的lsa在送达到区域边界路由器(ABR),即R4,
//R4会将其转换为lsa 5转发给其他区域路由
1.1.1.0 23.23.23.2 500 0x80000001 0x0063EC 0
12.12.12.0 23.23.23.2 500 0x80000001 0x00D559 0
查看R1、R2路由表,并确认其网络联通性
R2#show ip route
Gateway of last resort is 23.23.23.3 to network 0.0.0.0
34.0.0.0/24 is subnetted, 1 subnets
O 34.34.34.0 [110/2] via 23.23.23.3, 00:16:39, FastEthernet0/1
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 12.12.12.1, 00:00:18, FastEthernet0/0
23.0.0.0/24 is subnetted, 1 subnets
C 23.23.23.0 is directly connected, FastEthernet0/1
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/3] via 23.23.23.3, 00:10:39, FastEthernet0/1
R1#ping 6.6.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 104/149/188 ms
在R5上查看R3上产生的lsa 7是否被转换为lsa 5:
R5#show ip ospf database
OSPF Router with ID (56.56.56.5) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
4.4.4.1 4.4.4.1 1193 0x80000008 0x001E4D 6
56.56.56.5 56.56.56.5 1691 0x80000003 0x007546 1
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
45.45.45.4 4.4.4.1 34 0x80000002 0x004D98
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
23.23.23.0 4.4.4.1 1132 0x80000001 0x00F7F0
34.34.34.0 4.4.4.1 1183 0x80000003 0x005C6A
Type-5 AS External Link States
//在R5上发现描述1.1.1.0/24和12.12.12.0/24网络的lsa 5,
//说明R4确实将R3发送给R4的lsa 7转换为lsa 5向其他区域路由转发了
Link ID ADV Router Age Seq# Checksum Tag
1.1.1.0 4.4.4.1 1101 0x80000001 0x00C7CC 0
6.6.0.0 56.56.56.5 1693 0x80000001 0x00FC35 0
6.6.1.0 56.56.56.5 1693 0x80000001 0x00F13F 0
6.6.2.0 56.56.56.5 1693 0x80000001 0x00E649 0
6.6.3.0 56.56.56.5 1693 0x80000001 0x00DB53 0
6.6.4.0 56.56.56.5 1693 0x80000001 0x00D05D 0
12.12.12.0 4.4.4.1 1103 0x80000001 0x003A39 0
56.56.56.0 56.56.56.5 1693 0x80000001 0x00ABE9 0