您的位置:首页 > 其它

OSPF 开放最短路径优先链路状态型路由选择协议(二)

2009-03-28 12:10 288 查看
多区域OSPF
OSPF准许将大型OSPF网络分隔为很多小的,教容易管理的区域。
一个OSPF区域最好不要超过50台路由器
体系化路由:将一个大型化网络分解为多个小区域的能力
OSPF体系化路由的优点:
1 SPF计算频率降低
2 路由表变小
3 链路状态更新(LSU)额外开销降低
OSPF路由器类型 区域0=主干区域
1内部路由器 所有接口都在同一个区域内地路由器
2主干路由器 连接到OSPF网络主干区域地路由器(它们至少由一个接口连接到区域0)
3区域边界路由器(ABR) 连接到多个区域接口的路由器
4自治系统边界路由器(ASBR)至少有一个到外部网络的接口和另一个在OSPF内的接口的路由器。
ASBR可以将两种外部路由发送OSPF中,类型1 (E1)和类型2(E2)。
E1由随着在系统中的传播会增加其度量值
E2路由在整个区域中保持不变
一台路由器连接区域0和区域1,以及一个非OSPF网络,可以被看做是一台ABR,一台ASBR和一台主干路由器
OSPF区域类型
标准区域 一个标准区域能够接受链路更新和路由归纳
主干区域 主干区域总被标注为区域0
末节区域 这个区域不接受那些关于本自治系统以外的路由信息,比如来自非OSPF源的路由,如果路由器需要去自治系统以外的网络,使用缺省路由
完全末节区域 这种区域不接受外部自治系统AS路由或来自本自治系统内其它区域的归纳路由。如果路由器需要去自治系统以外的网络,使用缺省路由(CISCO专有特性)
次末节区域(NSSA)与末节区域类似,但是它能接受有限数量的外部路由,(类型7 LAS)

链路状态通告(LSA)类型
lsa 类型1 路由器链路条目(O-OSPF)
由各个路由器为它所属的各区域而生成,描述路由器到该区域链路的状态。只在特定区域内扩散
lsa 类型2 网络链路条目(O-OSPF)
由指定路由器(DR)在多路访问型网络中所生成。类型2LSA描述连接到某个网络的一组路由器。这些条目只在包含该网络的区域内进行扩散
lsa 类型3 汇总链路条目(IA-OSPF区域间)
由ABR产生,描述ABR和其某各本地区域各内部路由器之间的链路。这些条目通过主干区域被扩散到其它路由器。
lsa 类型4 汇总链路条目(IA-OSPF区域间)
由ABR产生,LSA被通过主干区域扩散到其他的ABR.描述到ASBR的可达性。 这些条路将不被扩散到完全末节区域。
lsa 类型5 自治系统外部链路条目(E1-OSPF外部类型1)
(E2-OSPF外部类型2)
由ASBR产生,描述到自治系统外部目的地地路由。它们被扩散到OSPF自治系统内除了末节,完全末节和次末节以外地区域。
lsa 类型6 多目组播OSPF
它不被CISCO所实施
lsa 类型7 自治系统外部链路条目 (N1-OSPF NSSA 外部类型1)
(N2-OSPF 外部类型2)
由一个连接到NSSA地ASBR产生。可以在NSSA内进行扩散。并可以被ABR转换为类型5地LSA消息。
配置OSPF在多个区域上运行
1扩散LSU到多个区域
2更新路由表
使用和配置OSPF的多区域组件
配置ABR和ASBR
配置OSPF路由归纳
1区域间路由归纳 在ABR上完成,被应用来自各区域内的路由。
router(config-router)#area area-id range address mask
2外部路由归纳 是针对通过再发布被注入到OSPF网络中的外部路由;通常只有ASBR才能归纳外部路由
router(config-router)#summary-address address mask
使用末节和完全末节区域
末节和完全末节区域的标准
1该区域只有一个出口,或者该区域有多个出口(ABR),但到外部区域的路由不惜采用最佳路径
2该区域不需要作为虚拟链路的一个转接区域
3该末节区域内没有ASBR
4该区域不是主干区域
配置
router(config-router)#area area-id stub[no -summary]
虚拟链路
使用虚拟链路的两个条件
1 它必须被建立在连接着一个共同区域的两台ABR之间
2 这两台ABR其中的一台必须连接着主干区域

虚拟链路目的
1链接一个没有到主干区域直接物理连接的区域
2在区域0发生不连续时对主干区域进行弥补。
3在因路由器失效而导致主干区域被分成两个部分时能提供冗余
router(config-router)#area area-id virtual-link router-id

配置使用NSSA

检验多区域OSPF运行命令
show ip ospf border-routers
show ip ospf virtual-links
show ip ospf process-id
show ip ospf database

虚链路配置和汇总路由都
必须在
config t
router ospf 1
下面配置
area 1 virtual-link 2.2.2.2 这里的2.2.2.2是对端 路由器的ID
area 0 range 30.1.0.0 255.255.252.0 (汇总路由 而且在同一个区域都要做)

重新发布到OSPF中时记住subnet这个词必须加上。
实施配置过程:
注意虚链路的配置,在router ospf 1下面配置 area 1 virtual-link 2.2.2.2
area 1 virtual-link 1.1.1.1
在OSPF配置中OSPF的进程号可以配置为不同,但是CISCO建议配置一样
配置路由汇总注意:
在router ospf 1下面配置
R1(config)#router ospf 1
R1(config-router)#area 0 range 30.1.0.0 255.255.252.0
R2(config)#router ospf 1
R2(config-router)#area 0 range 30.1.0.0 255.255.252.0 由于上面使用了虚链接,所有AREA 0已经延伸到R2上,所以R2也需要做汇总。
在OSPF 下的认证
必须在端口下做这个认证,线路的两端端口上都必须做。
命令如下:
R3(config-if)#ip ospf authentication message-digest
R3(config-if)#ip ospf message-digest-key 1 md5 test

O E2 192.168.1.0/24 [110/20] via 20.1.1.2, 00:03:42, Serial0 ?
0 E2 表示 ospf外部路由条目类型2
O E2 192.168.2.0/24 [110/20] via 20.1.1.2, 00:03:42, Serial0
O IA 10.1.1.0 [110/128] via 20.1.1.2, 00:07:07, Serial1/0
30.0.0.0/32 is subnetted, 3 subnets
0 IA 表示 从OSPF其他区域学好的路由

router ospf 1
router-id 1.1.1.1
log-adjacency-changes
area 1 virtual-link 2.2.2.2 虚链路配置
network 10.1.1.0 0.0.0.255 area 1
network 30.1.1.0 0.0.0.255 area 0
network 30.1.2.0 0.0.0.255 area 0
network 30.1.3.0 0.0.0.255 area 0

R1#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
20.0.0.0/24 is subnetted, 1 subnets
O IA 20.1.1.0 [110/128] via 10.1.1.2, 00:03:23, Serial1/1
40.0.0.0/32 is subnetted, 1 subnets
O IA 40.1.1.1 [110/129] via 10.1.1.2, 00:03:23, Serial1/1
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial1/1
30.0.0.0/24 is subnetted, 3 subnets
C 30.1.3.0 is directly connected, Loopback2
C 30.1.2.0 is directly connected, Loopback1
C 30.1.1.0 is directly connected, Loopback0
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
20.0.0.0/24 is subnetted, 1 subnets
C 20.1.1.0 is directly connected, Serial1/1
40.0.0.0/32 is subnetted, 1 subnets
O 40.1.1.1 [110/65] via 20.1.1.3, 00:06:41, Serial1/1
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial1/0
30.0.0.0/32 is subnetted, 3 subnets
O 30.1.2.1 [110/65] via 10.1.1.1, 00:06:31, Serial1/0
O 30.1.3.1 [110/65] via 10.1.1.1, 00:06:31, Serial1/0
O 30.1.1.1 [110/65] via 10.1.1.1, 00:06:31, Serial1/0

R3#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
20.0.0.0/24 is subnetted, 1 subnets
C 20.1.1.0 is directly connected, Serial1/0
40.0.0.0/24 is subnetted, 1 subnets
C 40.1.1.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
O IA 10.1.1.0 [110/128] via 20.1.1.2, 00:07:07, Serial1/0
30.0.0.0/32 is subnetted, 3 subnets
O IA 30.1.2.1 [110/129] via 20.1.1.2, 00:06:58, Serial1/0
O IA 30.1.3.1 [110/129] via 20.1.1.2, 00:06:58, Serial1/0
O IA 30.1.1.1 [110/129] via 20.1.1.2, 00:06:58, Serial1/0

R3#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
20.0.0.0/24 is subnetted, 1 subnets
C 20.1.1.0 is directly connected, Serial1/0
172.168.0.0/22 is subnetted, 1 subnets
O E2 172.168.0.0 [110/20] via 20.1.1.2, 00:09:46, Serial1/0
10.0.0.0/24 is subnetted, 1 subnets
O E2 10.1.1.0 [110/20] via 20.1.1.2, 00:09:46, Serial1/0
C 192.168.1.0/24 is directly connected, Loopback0
C 192.168.2.0/24 is directly connected, Loopback1
C 192.168.3.0/24 is directly connected, Loopback2
R2的完整配置
R2#show running-config
Building configuration...
Current configuration : 1411 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip subnet-zero
!
!
no ip domain lookup
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial1/0
ip address 10.1.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 20.1.1.2 255.255.255.0
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 cisco
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
!
interface Serial2/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
router eigrp 100
redistribute ospf 1 metric 10000 100 255 1 1500
network 10.1.1.0 0.0.0.255
no auto-summary
!
router ospf 1
log-adjacency-changes
redistribute eigrp 100 subnets
network 20.1.1.0 0.0.0.255 area 0
!
ip classless
no ip http server
!
!
!
!
!
!
!
!
!
gatekeeper
shutdown
!
!
line con 0
exec-timeout 0 0
logging synchronous
stopbits 1
line aux 0
stopbits 1
line vty 0 4
login
!
!
end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: