NP阶段OSPF总结导图_OSPFOSPF(Open shortest Path First)

1 基本概念

1.1 链路状态路由协议

1.1.1 快速适应网络变化

1.1.2 在网络发生变化时发送触发更新

1.1.3 以较低的频率发送定期更新

1.2 三张表

1.2.1 邻居表(邻接关系数据库)

1.2.2 拓扑表(拓扑数据库LSDB

1.2.3 路由表(转发数据库)

1.3 区域结构

1.3.1 大型网络存在的问题

SPF的频繁计算

路由表庞大

LSDB庞大

1.3.2 骨干区域(Area 0)

主要功能为快速、高效地传输IP数据包

1.3.3 常规区域

标准区域

末节区域

绝对末节区域

次末节区域

绝对次末节区域

1.3.4 每个区域包含的路由器数量不应超过50

1.3.5 每台路由器所属的区域最多不要超过3

1.3.6 术语

内部路由器

骨干路由器

区域边界路由器(ABR

自治系统边界路由器(ASBR

2 工作原理

2.1

2.2 邻接关系

2.2.1 P2P串行链路上建立完全邻接关系

2.2.2 Broadcast/NBMA

选举DRBDR

其他路由器都与这两台路由器建立邻接关系,DR从邻居收到更新后,

将其转发给LAN上的其他所有邻居


DROTHER之间维持部分邻接关系(双向邻接状态)



作用:减少LSA的泛洪(减少设备、带宽资源的消耗)


选举规则:

优先级(默认10代表不参与选举)和RID(用来标识OSPF区域中每台路由器,命名作用)

三个

选举制——世袭制——终身制(不能被抢占)

2.2.3 LSA(链路状态协议单元)

可靠的

被扩散到整个区域

有序列号和寿命

定期刷新以确保拓扑的有效性

2.3 OSPF度量值

2.3.1 默认COST

56kbit/s-----1785

64kbit/s-----1562

T1(1.544Mbit/s)-----64

E1(2.048Mbit/s)-----48

以太网-------10

快速以太网-------1

FDDI---------1

ATM----------1

2.3.2 计算公式:cost=100/带宽(bandwidth)

2.3.3 LSA工作原理


2.4 5种数据包

2.4.1 Hello

参数:AIDBIDAUTHMASKHello/dead-timePriority(0)DR/BDR

作用:建立和维护邻居关系

时间间隔:10s

2.4.2 DBD(数据库描述)

参数:所有LSA摘要信息

作用:周期发送(30min)维护LSDB的一致

2.4.3 LSR(链路状态请求)

参数:LSARID

作用:请求失效路由信息

2.4.4 LSU

参数:路由信息(目标网络/前缀、网络类型、MetricNext-hop

作用:回应LSR请求,更新路由信息

2.4.5 LSack

LSU进行确认

2.5 邻居关系状态

2.5.1 Down-----没有检测到活动邻居

2.5.2 Init-------收到Hello224.0.0.5

2.5.3 Two-way-----路由器在其收到的Hello包中看到了自己路由器ID

2.5.4 ExStart------选举DR/BDR

2.5.5 Exchange----交换DBD

2.5.6 Loading------交换LSRLSU以填充LSDB

2.5.7 Full----------LoadingDone

2.6 维护路由信息

2.6.1 点到点:224.0.0.5

2.6.2 多路访问

1.发生变化后,将LSU发送到224.0.0.6,该多播地址表示DR和BDR


2.DR对LSU进行处理和确认,并使用224.0.0.5将该LSU泛洪到网络中其他路由器,每台路由器都用LSAck来答复


3.连接其他网络的路由器将LSU泛洪到该网络,转给该网络的DR


4.路由器更新LSDB,执行SPF算法



3 查看运行配置命令

3.1 show ipospf

3.2 show ipospf interface brief

3.3 show ipospf neighbor detail

3.4 show iproute ospf

3.5 show ipprotocols

3.6 debug ipospf events

3.7 debug ipospf adj

3.8 debug ipospf packet

3.9 log-adjacency-changes

3.10 ip ospfpriority 0~255

4 网络类型

4.1 Broadcast--------以太网

4.1.1 DR/BDR

根据优先级选举。默认为1

除非故障,不能抢占

每个网段有自己的DR/BDR

BDR用等待定时器来判断DR是否故障

作用

减少路由更新

管理链路状态同步

4.2 Point-to-Point------SDHSerial

4.3 NBMA------------FRATM


OSPF Mode

NBMA  Preferred Topology

Subnet  Address

Hello  Timer

Adjacency

RFC or  Cisco

Broadcast

Full  or partial mesh

Same

10 sec

Automatic,  DR/BDR elected

Cisco

Nonbroadcast  (NBMA)

Full  or partial mesh

Same

30 sec

Manual  configuration, DR/BDR elected

RFC

Point-to-multipoint

Partial-mesh  

or  star

Same

30 Sec

Automatic,  

no  DR/BDR

RFC

Point-to-multipoint  nonbroadcast

partial-mesh  

or  star

Same

30 sec

Manual  configuration, no/DR/BDR

Cisco

Point-to-point

Partial-mesh  or star, using subinterface

Different  for Each Subinterface

10 sec

Automatic,  

no  DR/BDR

Cisco


4.3.1 5种模式下的配置

广播

Router(config)#interface serial 0/0/0

Router(config-if)encapsulation frame-relay

Router(config-if)ip ospf network broadcast

非广播

Router(config)#interface serial 0/0/0

Router(config-if)encapsulation frame-relay

Router(config-if)ip ospf network non-broadcast

Router(config)#router ospf 110

Router(config-router)#network 192.168.1.0 0.0.0.255 area 0

Router(config-router)#neighbor 192.168.1.2

Router(config-router)#neighbor 192.168.1.3

点到多点


interface Serial1/0

ip address 123.1.1.1 255.255.255.0

encapsulation frame-relay

ip ospf network point-to-multipoint

ip ospf priority 200

frame-relay map ip 123.1.1.3 103 broadcast

frame-relay map ip 123.1.1.2 102 broadcast

no frame-relay inverse-arp

点到多点非广播

R1(config-if)#ip ospf networkpoint-to-multipoint non-broadcast R1(config-router)#neighbor 123.1.1.3

点到点

interface Serial1/0

encapsulation frame-relay

no frame-relay inverse-arp

interface Serial1/0.102 point-to-point

ip address 12.1.1.1 255.255.255.0

frame-relay interface-dlci 102 CISCO

5 理解OSPF LSA


LSA Type

Description

1

Router LSAs(路由器本地接口)

2

Network LSAs(从OSPF邻居路由学习到的LSA,区域内部传输)

3 or 4

Summary LSAs(区域间进行传输)

5

Autonomous system

external LSAs(目标路由来源于其他AS的路由信息)

6

Multicast OSPF LSA


7

Defined for not-so-stubby areasNSSA


8

External attributes LSA for

Border Gateway Protocol (BGP)


9, 10, 11

Opaque LSAs







5.1 1LSA

5.1.1 到另一台路由器的点到点连接(邻居路由器ID

5.1.2 到中转网络的连接(DR的接口地址)

5.1.3 到末节网络的连接(IP网络/子网号)

5.1.4 虚电路(邻居路由器的ID

5.2

5.3 2LSA

5.4 3LSA

5.5 4LSA

5.6 5LSA

6 路由类型

6.1 O(区域内路由)

6.2 O IA(区域间路由

6.3 O E1(外部路由)加上内部开销

6.4 O E2(外部路由)

6.5 配置LSDB过载保护

7 OSPF高级功能

7.1 passive-interfacedefault

7.2 传播默认路由

7.3 路由汇总

7.3.1 区域间路由汇总

area 0 range 172.16.96.0 255.255.224.0

7.3.2 外部路由汇总

summary-address 172.16.32.0 255.255.224.0

7.4 虚链路

7.4.1 将区域通过中转区域连接到区域0

7.4.2 DNA技术使LSA不会过期

7.4.3 配置

area  中转区域  virtual-link 对端RID/IP

show ip ospf virtual-links

7.5 修改COST

7.5.1 端口下 ip ospf cost

7.5.2 ip ospfbandwidth

7.5.3 auto-costreference-bangdwidth

7.6 OSPF特殊区域

骨干区域——Area 0 (作为企业核心网)


末节区域(Stub)——限制LSA 5传输(默认由ABR推送一条OSPF默认路由到Stub路由器)

R1(config-router)#area 13 stub


完全末节区域Totally Stub)——限制LSA 345传输

R1(config-router)#area 13 stub no-summary


次末节区域(NSSA)(默认由ABR不会推送一条OSPF默认路由到Stub路由器)

将LSA7伪装成LSA5

R2(config-router)#area 24 nssa

R2(config-router)#area 24 nssa default-information-originate手动推送默认路由

推送(O*N2 0.0.0.0/0 [110/1] via 24.1.1.2, 00:00:05, FastEthernet0/0)


完全次末节区域Totally NSSA

R2(config-router)#area 24 nssa no-summary默认由ABR推送一条OSPF 默认路由到Stub路由器

O*IA 0.0.0.0/0 [110/2] via 24.1.1.2,00:00:01, FastEthernet0/0

7.6.1 show ipospf database nssa-externa

7.7 OSPF验证

7.7.1 身份验证

端口下 ip ospf authentication

ip ospf authentication-key huo

7.7.2 虚链路

area 1 virtual-link 3.3.3.3authentication-key huo

7.7.3 区域验证area 1authentication

7.7.4 MD5

ip ospf message-digest-key key-id md5 key