您的位置:首页 > 其它

OSPF基本概念和基本配置之一

2010-05-11 16:33 369 查看
一拓扑图


二、ospf的基本概念
OSPF(Open Shortest Path First)是一个内部网关协议(Interior Gateway Protocol,简称IGP)。与RIP相对,OSPF是链路状态路有协议,而RIP是距离向量路由协议。 链路是路由器接口的另一种说法,因此OSPF也称为接口状态路由协议。OSPF通过路由器之间通告网络接口的状态来建立链路状态数据库,生成最短路径树,每个OSPF路由器使用这些最短路径构造路由表。
区域
OSPF协议引入“分层路由”的概念,将网络分割成一个“主干”连接的一组相互独立的部分,这些相互独立的部分被称为“区域”(Area),“主干”的部分称为“主干区域”。每个区域就如同一个独立的网络,该区域的OSPF路由器只保存该区域的链路状态。每个路由器的链路状态数据库都可以保持合理的大小,路由计算的时间、报文数量都不会过大。
共有五种区域的主要区别在于它们和外部路由器间的关系:
标准区域: 一个标准区域可以接收链路更新信息和路由总结。

主干区域(传递区域):主干区域是连接各个区域的中心实体。主干区域始终是“区域0”,所有其他的区域都要连接到这个区域上交换路由信息。主干区域拥有标准区域的所有性质。

存根区域(stub Area):存根区域是不接受自治系统以外的路由信息的区域。如果需要自治系统以外的路由,它使用默认路由0.0.0.0。

完全存根区域:它不接受外部自治系统的路由以及自治系统内其他区域的路由总结。需要发送到区域外的报文则使用默认路由:0.0.0.0。完全存根区域是Cisco自己定义的。

不完全存根区域(NSAA): 它类似于存根区域,但是允许接收以LSA Type 7发送的外部路由信息,并且要把LSA Type 7转换成LSA Type 5。
指派路由器(DR)和备份指派路由器(BDR
在多路访问网络上可能存在多个路由器,为了避免路由器之间建立完全相邻关系而引起的大量开销,OSPF要求在区域中选举一个DR。每个路由器都与之建立完全相邻关系。DR负责收集所有的链路状态信息,并发布给其他路由器。选举DR的同时也选举出一个BDR,在DR失效的时候,BDR担负起DR的职责
ospf一般用于比较大企业网络
下章就介绍一下ospf的四种路由器以及链路状态公告类型
二、实验目的:
1、总部的路由器上均配置lookback接口 并通告ospf区域
2、让A成为192.168.1.0/24网段的DR路由器
3、更改172.16.1.0/24网段的默认hello计时器为5秒和30秒
4、所有的路由器上要有全部的路由信息
三、实验配置步骤

1、在各路由器上配置接口ip 及loopback接口
RA(config)#interface f0/0
RA(config-if)#ip address 192.168.1.1 255.255.255.0
RA(config-if)#no shut
*May 12 09:51:50.799: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state t
o up
RA(config)#interface loopback 1
RA(config-if)#ip address 1.1.1.1 255.255.255.0
RA(config-if)#interface s1/0
RA(config-if)#encapsulation ppp
RA(config-if)#ip address 172.16.1.1 255.255.255.0
RA(config-if)#no shut

R2(config)#interface f0/0
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#no shut
*May 12 10:04:41.303: %LINK-3-UPDOWN: Interface FastEthernet0/0
o up
*May 12 10:04:42.303: %LINEPROTO-5-UPDOWN: Line protocol on Int
et0/0, changed state to up
R2(config-if)#exit
R2(config)#interface loopback 1
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#no shut

RC(config)#interface f0/0
RC(config-if)#ip address 192.168.1.3 255.255.255.0
RC(config-if)#no shut
RC(config-if)#exit
*May 12 10:10:24.435: %LINK-3-UPDOWN: Interface FastEthe
o up
*May 12 10:10:25.435: %LINEPROTO-5-UPDOWN: Line protocol
et0/0, changed state to up
RC(config)#interface loopback 1
RC(config-if)#ip address 3.3.3.3 255.255.255.0
RC(config-if)#no shut
RD(config)#interface s1/0
RD(config-if)#encapsulation ppp
RD(config-if)#ip address 172.16.1.2 255.255.255.0
RD(config-if)#no shut
RD(config-if)#exit
RD(config)#interface loopback 1
RD(config-if)#ip address 4.4.4.4 255.255.255.0
RD(config-if)#no shut
2、通告ospf
RA(config)#router ospf 10
RA(config-router)#network 192.168.1.0 0.0.0.255 area
RA(config)#outer)#network 192.168.1.0 0.0.0.255 area 0
RA(config)#outer)#network 172.16.1.0 0.0.0.255 area 0
RA(config)#outer)#network 1.1.1.1 0.0.0.0 area 0
RA(config)#outer)#exit
RA(config)#interface s1/0

RA(config)#f)#ip ospf hello
RA(config)#f)#ip ospf hello-interval 5 更改172.16.1.0网段的hello值为5秒
RA(config)#f)#exit
RB(config)#router ospf 10
RB(config-router)#network 192.168.1.0 0.0.0.255 area 0
RB(config-router)#network 2.2.2.2 0.0.0.0 area 0
RB(config-router)#exit
RC(config)#router ospf 10
RC(config-router)#network 192.168.1.0 0.0.0.255 area 0
RC(config-router)#network 3.3.3.3 0.0.0.0 area 0
RC(config-router)#exit
RD(config)#router ospf 10
RD(config-router)#network 172.16.1.0 0.0.0.255 area 0
RD(config-router)#network 4.4.4.4 0.0.0.0 area 0
RD(config)#interface s1/0
RD(config-if)#ip ospf hello-interval 5
3、查看各路有信息

RD#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
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 172.16.1.1, 00:00:51, Serial1/0
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback1
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.1.1/32 is directly connected, Serial1/0
C 172.16.1.0/24 is directly connected, Serial1/0
O 192.168.1.0/24 [110/65] via 172.16.1.1, 00:00:51, Serial1/0
RA#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B -
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA exter
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L
ia - IS-IS inter area, * - candidate default, U - pe
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
Codes: C - connected, S - static, R - RIP, M - mobile, B -
1.0.0.0/24 is subnetted, 1 subnetsO - OSPF, IA - OSPF
C 1.1.1.0 is directly connected, Loopback1ult, U - pe
4.0.0.0/32 is subnetted, 1 subnets static route type 2
O 4.4.4.4 [110/65] via 172.16.1.2, 00:00:49, Serial1/
172.16.0.0/16 is variably subnetted, 2 subnets, 2 mask
C 172.16.1.0/24 is directly connected, Serial1/0
C 172.16.1.2/32 is directly connected, Serial1/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
show ip ospf database

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: