# 配置ip地址,必须配环回接口
#配置ospf
方式一
R1(config)#router ospf 1
R1(config-router)#network 1.0.0.0 0.0.0.255 area 0
方式二
R2(config)#int range e0/0-1,lo0
R2(config-if-range)#ip ospf 1 area 0
R1:
int range e0/0,lo0
ip ospf 1 area 0
R2:
int range e0/0-1,lo0
ip ospf 1 area 0
R3:
int range e0/0,lo0
ip ospf 1 area 0
int e0/0
ip address 192.168.12.1 255.255.255.0
no sh
int e0/1
ip addr 192.168.14.1 255.255.255.0
no sh
int lo0
ip add 1.1.1.1 255.255.255.255
router rip
ver 2
network 192.168.12.0
network 1.1.1.1
int range e0/1,lo0
ip ospf 1 area 0
R2:
int e0/0
ip add 192.168.12.2 255.255.255.0
no sh
int e0/1
ip add 192.168.23.2 255.255.255.0
no sh
int lo0
ip add 2.2.2.2 255.255.255.255
router rip
ver 2
network 192.168.12.0
network 192.168.23.0
network 2.2.2.2
R3:
int e0/0
ip add 192.168.23.3 255.255.255.0
no sh
int e0/1
ip addr 192.168.34.3 255.255.255.0
no sh
int lo0
ip add 3.3.3.3 255.255.255.255
router rip
ver 2
network 192.168.23.0
network 3.3.3.3
int range e0/1,lo0
ip ospf 1 area 0
R4:
int e0/0
ip add 192.168.14.4 255.255.255.0
no sh
int e0/1
ip add 192.168.34.4 255.255.255.0
no sh
int lo0
ip add 4.4.4.4 255.255.255.255
int range lo0,e0/0-1
ip ospf 1 area 0
R3#show ip route
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.0.0.0/8 [120/2] via 192.168.23.2, 00:00:19, Ethernet0/0
O 1.1.1.1/32 [110/21] via 192.168.34.4, 00:00:21, Ethernet0/1
......
R3#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 192.168.34.4 5 msec 6 msec 5 msec
2 192.168.14.1 1 msec * 1 msec
可以看到在两个路由表都可以去1.1.1.1的时候,选择了匹配更精确的那一条,这里是因为最长匹配原则
所以在
R 1.0.0.0/8
O 1.1.1.1/32
两个路由中选择了下面一条,但是我们是要为了验证管理距离对于选路的影响,所以可以关闭rip协议的自动汇总,再重启一下接口,更新路由表,可以看到更新完成后,只有一条路由表
R3#show ip route
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/21] via 192.168.34.4, 00:08:08, Ethernet0/1
.......
R3#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 192.168.34.4 1 msec 1 msec 0 msec
2 192.168.14.1 0 msec * 1 msec
最终选择了管理距离短的ospf协议的路径
OSPF(Open Shortest Path First,开放最短路径优先)是一种链路状态路由协议,无路由循环(全局拓扑),属于IGP。RFC 2328,“开放”意味着非私有的,对公众开放的。
OSPF的报文封装
OSPF协议包直接封装于IP,协议号89。
OSPF协议使用的组播地址
所有OSPF路由器——224.0.0.5;DR BDR——224.0.0.6
OSPF路由协议的管理距离:110
R2#sh ip route
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 192.168.12.1, 00:00:15, Ethernet0/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, Loopback0
L 2.2.2.2/32 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/11] via 192.168.23.3, 00:02:40, Ethernet0/1
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Ethernet0/0
L 192.168.12.2/32 is directly connected, Ethernet0/0
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Ethernet0/1
L 192.168.23.2/32 is directly connected, Ethernet0/1
R1#sh ip route
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback0
L 1.1.1.1/32 is directly connected, Loopback0
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Ethernet0/0
L 192.168.12.1/32 is directly connected, Ethernet0/0
R3#sh ip route
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/11] via 192.168.23.2, 00:00:12, Ethernet0/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Loopback0
L 3.3.3.3/32 is directly connected, Loopback0
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Ethernet0/0
L 192.168.23.3/32 is directly connected, Ethernet0/0
做双向重发步
R2(config-if-range)#router rip
R2(config-router)#ver 2
R2(config-router)#redistribute ospf 1 metric 5
R2(config-router)#router ospf 1
R2(config-router)#redistribute rip subnets
再次检查路由表
R1#sh ip route
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback0
L 1.1.1.1/32 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0 [120/5] via 192.168.12.2, 00:00:28, Ethernet0/0
3.0.0.0/32 is subnetted, 1 subnets
R 3.3.3.3 [120/5] via 192.168.12.2, 00:00:28, Ethernet0/0
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Ethernet0/0
L 192.168.12.1/32 is directly connected, Ethernet0/0
R 192.168.23.0/24 [120/5] via 192.168.12.2, 00:00:28, Ethernet0/0
R2#sh ip route
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 192.168.12.1, 00:00:24, Ethernet0/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, Loopback0
L 2.2.2.2/32 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/11] via 192.168.23.3, 00:07:58, Ethernet0/1
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Ethernet0/0
L 192.168.12.2/32 is directly connected, Ethernet0/0
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Ethernet0/1
L 192.168.23.2/32 is directly connected, Ethernet0/1
R3# sh ip route
1.0.0.0/24 is subnetted, 1 subnets
O E2 1.1.1.0 [110/20] via 192.168.23.2, 00:02:30, Ethernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/11] via 192.168.23.2, 00:04:10, Ethernet0/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Loopback0
L 3.3.3.3/32 is directly connected, Loopback0
O E2 192.168.12.0/24 [110/20] via 192.168.23.2, 00:02:30, Ethernet0/0
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Ethernet0/0
L 192.168.23.3/32 is directly connected, Ethernet0/0
R2#show ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 1 FULL/DR 00:00:31 192.168.23.3 Ethernet0/1
1.1.1.1 1 FULL/BDR 00:00:39 192.168.12.1 Ethernet0/0
router ospf 1
router-id 30.30.30.30
R2(config)#int e0/0
R2(config-if)#ip ospf network point-to-point
R1#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 FULL/ - 00:00:32 192.168.12.2 Ethernet0/0
# 状态中是没有DR或者BDR的
int e0/0
ip ospf priority 5
clear ip ospf nei
OSPF COST
Router(config)# int e0/0
Router(config-if)# ip ospf cost 100 该命令在接收路由的入口上配置,也就是数据流量的出口
Router(config)# int e0/0
Router(config-if)# bandwidth 100
骨干区域,编号为0的区域
非骨干区域,编号非0的区域
所有非骨干区域必须和骨干区域相连
area0:
R2 e0/1,lo0 R3 e0/0,lo0
area2:
R3 e0/1 R4 e0/0,lo0
show ip ospf
显示OSPF路由器ID,OSPF定时器以及LSA信息
show ip ospf interface type
显示各种定时器和邻接关系
show ip route ospf
显示路由器学习到的OSPF路由
show ip protocols
显示IP路由协议参数
debug ip ospf events
显示OSPF相关事件
debug ip ospf adj
跟踪邻接关系的建立和终止
debug ip ospf packet
查看正在传输的OSPF分组
area3: R1 e0/1 R5 e0/0,lo0
area4: R4 e0/1 R6 e0/0,lo0
R1(config)#router ospf 1
R1(config-router)#area 1 virtual-link 2.2.2.2
R2(config)#router ospf 1
R2(config-router)#area 1 virtual-link 1.1.1.1
当R1跟R2建立虚链路之后,就相当于R1直接起了一个虚拟的接口,这个虚拟接口划分在area0当中,也就相当于area3直接于area0相邻,area3中的信息也可以被其他区域正常学习了
R3(config)#int tunnel 0
R3(config-if)#ip add 192.168.100.3 255.255.255.0
R3(config-if)#ip ospf 1 area 0
R3(config-if)#tunnel source e0/1
R3(config-if)#tunnel mode ipip
R3(config-if)#tunnel destination 192.168.34.4
R4(config)#int tunnel 0
R4(config-if)#ip add 192.168.100.4 255.255.255.0
R4(config-if)#ip ospf 1 area 0
R4(config-if)#tunnel source e0/0
R4(config-if)#tunnel mode ipip
R4(config-if)#tunnel destination 192.168.34.3
类型 | 解释 |
---|---|
1 | 路由器LSA |
2 | 网络LSA |
3 | 网络汇总LSA |
4 | ASBR汇总LSA |
5 | AS外部LSA |
6 | 组成员LSA |
7 | NSSA外部LSA |
8 | 外部属性LSA |
9 | Opaque LSA (链路本地范围) |
10 | Opaque LSA (本地区域范围) |
11 | Opaque LSA (AS范围) |
R1#sh 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 88 0x80000005 0x006F8C 3
2.2.2.2 2.2.2.2 89 0x80000006 0x000BE6 3
R1#sh ip ospf database network
OSPF Router with ID (1.1.1.1) (Process ID 1)
Net Link States (Area 0)
LS age: 148
Options: (No TOS-capability, DC)
LS Type: Network Links
Link State ID: 192.168.12.3 (address of Designated Router)
Advertising Router: 3.3.3.3
LS Seq Number: 80000002
Checksum: 0x1484
Length: 36
Network Mask: /24
Attached Router: 3.3.3.3
Attached Router: 1.1.1.1
Attached Router: 2.2.2.2
R1#show ip ospf database summary
OSPF Router with ID (1.1.1.1) (Process ID 1)
Summary Net Link States (Area 0)
LS age: 145
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 5.5.5.5 (summary Network Number)
Advertising Router: 2.2.2.2
LS Seq Number: 80000001
Checksum: 0xD441
Length: 28
Network Mask: /32
MTID: 0 Metric: 11
LS age: 186
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.25.0 (summary Network Number)
Advertising Router: 2.2.2.2
LS Seq Number: 80000001
Checksum: 0xEBBC
Length: 28
Network Mask: /24
MTID: 0 Metric: 10
#给R1再定义个环回接口,使用重发步的方式把路由加进去
R1(config-if)#int lo10
R1(config-if)#ip add 172.16.10.10 255.255.255.0
R1(config)#router ospf 1
R1(config-router)#redistribute connected subnets
R5#sh ip ospf database asbr-summary
OSPF Router with ID (5.5.5.5) (Process ID 1)
Summary ASB Link States (Area 1)
LS age: 318
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: 2.2.2.2
LS Seq Number: 80000001
Checksum: 0x75B0
Length: 28
Network Mask: /0
MTID: 0 Metric: 10
R1(config)#router ospf 1
R1(config-router)#no redistribute connected subnets
R1(config-router)#redistribute connected subnets metric-type 1
# metric-type不指定时默认重发布进来为OE2类型
R5#sh ip ospf database external
OSPF Router with ID (5.5.5.5) (Process ID 1)
Type-5 AS External Link States
LS age: 71
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 0.0.0.0 (External Network Number )
Advertising Router: 1.1.1.1
LS Seq Number: 80000002
Checksum: 0xA9E8
Length: 36
Network Mask: /0
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 666
Forward Address: 0.0.0.0
External Route Tag: 1
四类和五类的理解
R2#sh ip ospf database nssa-external
OSPF Router with ID (2.2.2.2) (Process ID 1)
Type-7 AS External Link States (Area 1)
LS age: 493
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 100.100.100.0 (External Network Number )
Advertising Router: 1.1.1.1
LS Seq Number: 80000002
Checksum: 0x4719
Length: 36
Network Mask: /24
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 1.1.1.1
External Route Tag: 0
目的是精简自治系统外部的路由
# 在R1上多定义几个环回接口,模拟庞大的信息
R1(config-if)#int lo20
R1(config-if)#ip add 172.16.20.20 255.255.255.0
R1(config)#int lo30
R1(config-if)#ip add 172.16.30.30 255.255.255.0
R1(config-if)#int lo40
R1(config-if)#ip add 172.16.40.40 255.255.255.0
R1(config-if)#int lo50
R1(config-if)#ip add 172.16.50.50 255.255.255.0
R1(config-if)#int lo60
R1(config-if)#ip add 172.16.60.60 255.255.255.0
R1(config-if)#int lo70
R1(config-if)#ip add 172.16.70.70 255.255.255.0
R1(config-if)#int lo80
R1(config-if)#ip add 172.16.80.80 255.255.255.0
R1(config-if)#int lo90
R1(config-if)#ip add 172.16.90.90 255.255.255.0
R6#sh ip route
O*E2 0.0.0.0/0 [110/1] via 192.168.46.4, 00:00:03, Ethernet0/0
1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/31] via 192.168.46.4, 00:08:01, Ethernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/31] via 192.168.46.4, 00:08:01, Ethernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/21] via 192.168.46.4, 00:08:01, Ethernet0/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/11] via 192.168.46.4, 00:08:01, Ethernet0/0
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/21] via 192.168.46.4, 00:08:01, Ethernet0/0
6.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 6.6.6.0/24 is directly connected, Loopback0
L 6.6.6.6/32 is directly connected, Loopback0
O IA 192.168.13.0/24 [110/30] via 192.168.46.4, 00:08:01, Ethernet0/0
O IA 192.168.23.0/24 [110/30] via 192.168.46.4, 00:08:01, Ethernet0/0
O IA 192.168.34.0/24 [110/20] via 192.168.46.4, 00:08:01, Ethernet0/0
O 192.168.45.0/24 [110/20] via 192.168.46.4, 00:08:01, Ethernet0/0
192.168.46.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.46.0/24 is directly connected, Ethernet0/0
L 192.168.46.6/32 is directly connected, Ethernet0/0
将area2设置为末梢区域,这样旧学习不到自治系统外部的路由了
R4(config)#router ospf 1
R4(config-router)#area 2 stub
R5(config)#router ospf 1
R5(config-router)#area 2 stub
R6(config)#router ospf 1
R6(config-router)#area 2 stub
R6#sh ip route
O*IA 0.0.0.0/0 [110/11] via 192.168.46.4, 00:00:14, Ethernet0/0
1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/31] via 192.168.46.4, 00:00:24, Ethernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/31] via 192.168.46.4, 00:00:24, Ethernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/21] via 192.168.46.4, 00:00:24, Ethernet0/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/11] via 192.168.46.4, 00:00:24, Ethernet0/0
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/21] via 192.168.46.4, 00:00:24, Ethernet0/0
6.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 6.6.6.0/24 is directly connected, Loopback0
L 6.6.6.6/32 is directly connected, Loopback0
O IA 192.168.13.0/24 [110/30] via 192.168.46.4, 00:00:24, Ethernet0/0
O IA 192.168.23.0/24 [110/30] via 192.168.46.4, 00:00:24, Ethernet0/0
O IA 192.168.34.0/24 [110/20] via 192.168.46.4, 00:00:24, Ethernet0/0
O 192.168.45.0/24 [110/20] via 192.168.46.4, 00:00:24, Ethernet0/0
192.168.46.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.46.0/24 is directly connected, Ethernet0/0
L 192.168.46.6/32 is directly connected, Ethernet0/0
R6#
R4(config-router)#router ospf 1
R4(config-router)#no area 2 stub
R4(config-router)#area 2 stub no-summary
R5(config-router)#router ospf 1
R5(config-router)#no area 2 stub
R5(config-router)#area 2 stub no-summary
R6(config)#router ospf 1
R6(config-router)#no area 2 stub
R6(config-router)#area 2 stub no-summary
R6#sh ip route
O*IA 0.0.0.0/0 [110/11] via 192.168.46.4, 00:08:11, Ethernet0/0
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/21] via 192.168.46.4, 00:08:21, Ethernet0/0
6.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 6.6.6.0/24 is directly connected, Loopback0
L 6.6.6.6/32 is directly connected, Loopback0
O 192.168.45.0/24 [110/20] via 192.168.46.4, 00:08:21, Ethernet0/0
192.168.46.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.46.0/24 is directly connected, Ethernet0/0
L 192.168.46.6/32 is directly connected, Ethernet0/0
只有本区域的路由和一条默认路由
当我们把区域配置成末梢区域时,有时候有特例想要加入一些外部路由,这个时候nssa允许存在ASBR通过7类LSA的方式将外部路由引入本区域,不会自动注入默认路由
不会学习外部路由
会学习其他区域路由
可以学习ASBR注入的外部路由
没有注入默认路由
配置
在区域内所有路由器配置以下命令
router ospf 1
area 1 nssa
配置NSSA之前的路由表
R6(conf-if)#int lo100
R6(conf-if)#ip add 100.100.100.100 255.255.255.0
R6(config)#router ospf 1
R6(config-router)#redistribute connected subnets
R5#sh ip route
O*IA 0.0.0.0/0 [110/11] via 192.168.45.4, 00:03:09, Ethernet0/0
5.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 5.5.5.0/24 is directly connected, Loopback0
L 5.5.5.5/32 is directly connected, Loopback0
6.0.0.0/32 is subnetted, 1 subnets
O 6.6.6.6 [110/21] via 192.168.45.4, 00:02:59, Ethernet0/0
192.168.45.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.45.0/24 is directly connected, Ethernet0/0
L 192.168.45.5/32 is directly connected, Ethernet0/0
O 192.168.46.0/24 [110/20] via 192.168.45.4, 00:03:09, Ethernet0/0
R4(config)#router ospf 1
R4(config-router)#no area 2 stub no-summary
R4(config-router)#no area 2 stub
R4(config-router)#area 2 nssa
R5(config)#router ospf 1
R5(config-router)#no area 2 stub no-summary
R5(config-router)#no area 2 stub
R5(config-router)#area 2 nssa
R6(config)#router ospf 1
R6(config-router)#no area 2 stub no-summary
R6(config-router)#no area 2 stub
R6(config-router)#area 2 nssa
R5#sh ip route
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback0
L 1.1.1.1/32 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/21] via 192.168.13.3, 00:00:02, Ethernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/11] via 192.168.13.3, 00:00:12, Ethernet0/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/21] via 192.168.13.3, 00:00:12, Ethernet0/0
5.0.0.0/32 is subnetted, 1 subnets
O IA 5.5.5.5 [110/31] via 192.168.13.3, 00:00:12, Ethernet0/0
6.0.0.0/32 is subnetted, 1 subnets
O IA 6.6.6.6 [110/31] via 192.168.13.3, 00:00:12, Ethernet0/0
192.168.13.0/24 is variably subnetted, 2 subnets, 2 masks
O N2 100.100.100.0 [110/20] via 192.168.23.3, 00:00:19, Ethernet0/0
C 192.168.13.0/24 is directly connected, Ethernet0/0
L 192.168.13.1/32 is directly connected, Ethernet0/0
O 192.168.23.0/24 [110/20] via 192.168.13.3, 00:00:12, Ethernet0/0
O IA 192.168.34.0/24 [110/20] via 192.168.13.3, 00:00:12, Ethernet0/0
O IA 192.168.45.0/24 [110/30] via 192.168.13.3, 00:00:12, Ethernet0/0
O IA 192.168.46.0/24 [110/30] via 192.168.13.3, 00:00:12, Ethernet0/0
还是没有学习到其他区域的外部的172.16.x.x的路由,但是本区域的100.100.100.100学习到了
R5#sh ip ospf data
Type-7 AS External Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Tag
100.100.100.0 6.6.6.6 208 0x80000001 0x00AD8B 0
可以看到通过7类lsa实现的本区域外部路由的学习
R4(config)#router ospf 1
R4(config-router)#area 2 nssa no-summary
R5(config)#router ospf 1
R5(config-router)#area 2 nssa no-summary
R6(config)#router ospf 1
R6(config-router)#area 2 nssa no-summary
R5#sh ip route
O*IA 0.0.0.0/0 [110/11] via 192.168.45.4, 00:00:52, Ethernet0/0
5.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 5.5.5.0/24 is directly connected, Loopback0
L 5.5.5.5/32 is directly connected, Loopback0
6.0.0.0/32 is subnetted, 1 subnets
O 6.6.6.6 [110/21] via 192.168.45.4, 00:00:52, Ethernet0/0
100.0.0.0/24 is subnetted, 1 subnets
O N2 100.100.100.0 [110/20] via 192.168.45.4, 00:00:52, Ethernet0/0
192.168.45.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.45.0/24 is directly connected, Ethernet0/0
L 192.168.45.5/32 is directly connected, Ethernet0/0
O 192.168.46.0/24 [110/20] via 192.168.45.4, 00:00:52, Ethernet0/0
会在nssa配置基础上,实现一条默认路由,用来实现不学习其他区域的路由