PS:现在工作了,每天都是早出晚归,这段时间公司特别的忙,也很少有时间做试验了,一般都是晚上睡觉前看一会书,昨天晚上在看《TCP/IP路由技术》 卷一讲OSPF的那部分中有一点讲到在NSSA区域内的一条命令时,让我有点迷惑,今天下班后就利用一点时间做了一个试验,我把试验步骤贴出来,没有排版 整理,看上去可能有点乱,包括我现在说的话都有点乱,呵呵,好了,不说了,下面看试验:
实验拓扑:
area x nssa no-redistribution default-information-originate的讲解
R1
:
interface Loopback0
ip address 1.1.1 .1 255.255.255.255
!
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!
interface Serial1/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/1
description ***link to R2***
ip address 199.99.1.1 255.255.255.0
serial restart-delay 0
clockrate 64000
!
interface Serial1/2
description ***link to R4***
ip address 199.99.2.1 255.255.255.0
serial restart-delay 0
clockrate 64000
!
interface Serial1/3
description ***link to R3***
ip address 199.99.3.1 255.255.255.0
serial restart-delay 0
clockrate 64000
!
router ospf 1
log-adjacency-changes
redistribute rip metric 10 subnets
network 199.99.1.0 0.0.0 .255 area 0
network 199.99.2.0 0.0.0 .255 area 1
!
router rip
version 2
network 199.99.3.0
no auto-summary
R2
:
interface Loopback0
ip address 2.2.2 .2 255.255.255.255
!
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!
interface Serial1/0
description ***link to R1***
ip address 199.99.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
network 199.99.1.0 0.0.0 .255 area 0
R3
:
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!
interface Serial1/0
description ***link to R1***
ip address 199.99.3.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
router rip
version 2
network 199.99.3.0
no auto-summary
R4
:
interface Loopback0
ip address 4.4.4 .4 255.255.255.255
!
interface FastEthernet0/0
no ip address
shutdown
duplex auto
speed auto
!
interface Serial1/0
description ***link to R1***
ip address 199.99.2.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
network 199.99.2.0 0.0.0 .255 area 1
这个时候
R2
和
R4
上应该可以学习到一个
type 5
的
AS
外部路由,我们来看一下:
R2#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
2.0.0 .0/32 is subnetted, 1 subnets
C 2.2.2 .2 is directly connected, Loopback0
O E2 199.99.3.0/24 [110/10] via 199.99.1.1, 00:03:23, Serial1/0
O IA 199.99.2.0/24 [110/128] via 199.99.1.1, 00:03:23, Serial1/0
C 199.99.1.0/24 is directly connected, Serial1/0
R4#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
4.0.0 .0/32 is subnetted, 1 subnets
C 4.4.4 .4 is directly connected, Loopback0
O E2 199.99.3.0/24 [110/10] via 199.99.2.1, 00:03:40, Serial1/0
C 199.99.2.0/24 is directly connected, Serial1/0
O IA 199.99.1.0/24 [110/128] via 199.99.2.1, 00:03:40, Serial1/0
R2#show ip ospf database
OSPF Router with ID ( 2.2.2 .2) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 249 0x80000004 0x47ED 2
2.2.2
.2 2.2.2 .2 300 0x80000002 0xE153 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
199.99.2.0 1.1.1 .1 308 0x80000001 0xAC1
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
199.99.3.0 1.1.1 .1 249 0x80000001 0x7602 0
R4#show ip ospf database
OSPF Router with ID ( 4.4.4 .4) (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 270 0x80000003 0xAF 7C 2
4.4.4
.4 4.4.4 .4 305 0x80000002 0x6BB7 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 1.1.1 .1 339 0x80000001 0x15B7
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
199.99.3.0 1.1.1 .1 269 0x80000001 0x7602 0
可以看到两台路由器都有
Type-5 AS External Link States
,我们再来看一下
R1
上都有哪些
LSA
:
R1#show ip ospf database
OSPF Router with ID ( 1.1.1 .1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 326 0x80000004 0x47ED 2
2.2.2
.2 2.2.2 .2 378 0x80000002 0xE153 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
199.99.2.0 1.1.1 .1 385 0x80000001 0xAC1
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 326 0x80000003 0xAF 7C 2
4.4.4
.4 4.4.4 .4 363 0x80000002 0x6BB7 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 1.1.1 .1 395 0x80000001 0x15B7
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
199.99.3.0 1.1.1 .1 327 0x80000001 0x7602 0
可以看到有
1
、
3
、
5
类型的
LSA
,这里没有产生类型
4
的
LSA
的原因是因为这台路由器既是
ABR
又是
ASBR
。
下面我们将
AREA 1
配置成为
NSSA
区域,配置方法这里就不再演示了,不知道得可以参照我以前做得
OSPF
系列试验,配置完成后,
AREA 1
就是一个
NSSA
区域,会产生一个类型
7
的
LSA
在区域内泛洪,我们来验证一下:
R1#show ip ospf database
OSPF Router with ID ( 1.1.1 .1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 625 0x80000004 0x47ED 2
2.2.2
.2 2.2.2 .2 677 0x80000002 0xE153 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
199.99.2.0 1.1.1 .1 684 0x80000001 0xAC1
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 94 0x80000005 0x51D2 2
4.4.4
.4 4.4.4 .4 94 0x80000004 0xD0E 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 1.1.1 .1 104 0x80000002 0xB80D
Type-7 AS External Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Tag
199.99.3.0 1.1.1 .1 104 0x80000001 0xC087 0
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
199.99.3.0 1.1.1 .1 626 0x80000001 0x7602 0
在
R4
上看一下路由表和链路状态数据库:
R4#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
4.0.0 .0/32 is subnetted, 1 subnets
C 4.4.4 .4 is directly connected, Loopback0
O N2 199.99.3.0/24 [110/10] via 199.99.2.1, 00:02:19, Serial1/0
C 199.99.2.0/24 is directly connected, Serial1/0
O IA 199.99.1.0/24 [110/128] via 199.99.2.1, 00:02:19, Serial1/0
R4#show ip ospf database
OSPF Router with ID ( 4.4.4 .4) (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 166 0x80000005 0x51D2 2
4.4.4
.4 4.4.4 .4 166 0x80000004 0xD0E 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 1.1.1 .1 177 0x80000002 0xB80D
Type-7 AS External Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Tag
199.99.3.0 1.1.1 .1 176 0x80000001 0xC087 0
原本的类型
5LSA
没有了,变成了类型
7
的
LSA
,下面开始我们今天主要要演示的内容:
我们在
R1
上输入下面的命令,看看会出现什么情况:
area 1 nssa no-redistribution
输入完后等邻居重新建立起来后,我们到
R4
上再看看路由表和链路状态数据库:
R4#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
4.0.0 .0/32 is subnetted, 1 subnets
C 4.4.4 .4 is directly connected, Loopback0
C 199.99.2.0/24 is directly connected, Serial1/0
O IA 199.99.1.0/24 [110/128] via 199.99.2.1, 00:00:34, Serial1/0
R4#show ip ospf database
OSPF Router with ID ( 4.4.4 .4) (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 51 0x80000007 0x4DD4 2
4.4.4
.4 4.4.4 .4 318 0x80000004 0xD0E 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 1.1.1 .1 52 0x80000004 0xB 40F
我们可以与之前的比较一下就会发现那条类型
7
的外部路有没有了,连路状态数据库里也没有类型
7
的
LSA
了,但是我们到
R2
上看看:
R2#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
2.0.0 .0/32 is subnetted, 1 subnets
C 2.2.2 .2 is directly connected, Loopback0
O E2 199.99.3.0/24 [110/10] via 199.99.1.1, 00:15:35, Serial1/0
O IA 199.99.2.0/24 [110/128] via 199.99.1.1, 00:15:35, Serial1/0
C 199.99.1.0/24 is directly connected, Serial1/0
R2#show ip ospf database
OSPF Router with ID ( 2.2.2 .2) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 943 0x80000004 0x47ED 2
2.2.2
.2 2.2.2 .2 994 0x80000002 0xE153 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
199.99.2.0 1.1.1 .1 1002 0x80000001 0xAC1
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
199.99.3.0 1.1.1 .1 943 0x80000001 0x7602 0
依然存在那条外部路由,再到
R1
上看一下连路状态路数据库:
R1#show ip ospf database
OSPF Router with ID ( 1.1.1 .1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 1023 0x80000004 0x47ED 2
2.2.2
.2 2.2.2 .2 1075 0x80000002 0xE153 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
199.99.2.0 1.1.1 .1 1082 0x80000001 0xAC1
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1
.1 1.1.1 .1 225 0x80000007 0x4DD4 2
4.4.4
.4 4.4.4 .4 492 0x80000004 0xD0E 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 1.1.1 .1 225 0x80000004 0xB 40F
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
199.99.3.0 1.1.1 .1 1024 0x80000001 0x7602 0
没有类型
7
的
LSA
了,只剩下类型
5
的,因为
R1
不仅是
AREA 1
的
ASBR
,同样也是
AREA 0
的
ASBR
,所以
R2
照样可以收到类型
5
的
LSA
,可以
AREA 1
没有类型
7
的
LSA
,也就不知道怎么到达外部路由了,我们还可以通过在刚才那条命令后面添加一个选项:
area 1 nssa no-redistribution default-information-originate
输入完后,我们再到
R4
上看一下路由表和链路状态数据库:
R4#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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 199.99.2.1 to network 0.0.0 .0
4.0.0 .0/32 is subnetted, 1 subnets
C 4.4.4 .4 is directly connected, Loopback0
C 199.99.2.0/24 is directly connected, Serial1/0
O IA 199.99.1.0/24 [110/128] via 199.99.2.1, 00:01:50, Serial1/0
O*N2 0.0.0 .0/0 [110/1] via 199.99.2.1, 00:01:50, Serial1/0
R4#show ip ospf da
R4#show ip ospf database
OSPF Router with ID ( 4.4.4 .4) (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 123 0x8000000B 0x45D8 2
4.4.4
.4 4.4.4 .4 121 0x80000008 0x512 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
199.99.1.0 1.1.1 .1 593 0x80000004 0xB 40F
Type-7 AS External Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Tag
0.0.0
.0 1.1.1 .1 131 0x80000001 0x 552A 0
可以看到有一条类型
7
的默认路由,这样的话在外部路有很多的情况下,我们就可以通过这种方法来减少类型
7
的
LSA
再
NSSA
区域内的泛洪。