OSPF(Open Shortest Path First)
开放式最短路径优先
由IETF组织开发
基于链路状态的内部网关协议
版本
IPv4:OSPF Version 2(RFC2328)
IPv6:OSPF Version 3(RFC2740)
“why” 需要 “ospf” ?
上世纪,传统Internet 路由协议RIP
其基于距离矢量的算法
仅根据跳数而忽略其他因数
OSPF则通过cost为度量值
需要综合带宽、跳数...
作为链路状态协议
它将链路作为路由接口
进行接口与相邻路由关系的描述
在路由的自治系统中
通过给链路分配区域
区域通过向周边发送报文
实现自治系统自动管理
A
[A]interface GigabitEthernet 0/0/1
[A-GigabitEthernet0/0/1]ip address 192.168.1.1 24
[A]ospf 1 router-id 1.1.1.1
[A-ospf-1]area 0
[A-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
B
[B]interface GigabitEthernet 0/0/1
[B-GigabitEthernet0/0/1]ip address 192.168.1.2 24
[B]interface GigabitEthernet 0/0/2
[B-GigabitEthernet0/0/2]ip address 192.168.2.1 24
[B]ospf 1 router-id 2.2.2.2
[B-ospf-1]area 0
[B-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[B-ospf-1]area 1
[B-ospf-1-area-0.0.0.1]network 192.168.2.0 0.0.0.255
C
[C]interface GigabitEthernet 0/0/2
[C-GigabitEthernet0/0/2]ip address 192.168.2.2 24
[C]ospf 1 router-id 3.3.3.3
[C-ospf-1]area 1
[C-ospf-1-area-0.0.0.1]network 192.168.2.0 0.0.0.255
查看OSPF邻居
[B]display ospf peer
OSPF Process 1 with Router ID 2.2.2.2
Neighbors
Area 0.0.0.0 interface 192.168.1.2(GigabitEthernet0/0/1)'s neighbors
Router ID: 192.168.1.1 Address: 192.168.1.1
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 37 sec
Retrans timer interval: 5
Neighbor is up for 00:03:38
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.1 interface 192.168.2.1(GigabitEthernet0/0/2)'s neighbors
Router ID: 3.3.3.3 Address: 192.168.2.2
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.2.1 BDR: 192.168.2.2 MTU: 0
Dead timer due in 37 sec
Retrans timer interval: 5
Neighbor is up for 00:01:28
Authentication Sequence: [ 0 ]
查看OSPF路由
[B]dis ospf routing
OSPF Process 1 with Router ID 2.2.2.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
192.168.1.0/24 1 Transit 192.168.1.2 2.2.2.2 0.0.0.0
192.168.2.0/24 1 Transit 192.168.2.1 2.2.2.2 0.0.0.1
Total Nets: 2
Intra Area: 2 Inter Area: 0 ASE: 0 NSSA: 0
开启ospf并设置进程为1,配置自治区的路由ID
ospf 1 router-id 1.1.1.1
配置路由管理的自治区,0为最高级自治区
area 0
通告该自治区的网络
network 192.168.1.0 0.0.0.255
标签:eNSP,area,ospf,192.168,0.0,2.2,OSPF
From: https://blog.csdn.net/PanJunJie2003/article/details/140065697