简单配置ospf

实验拓扑

 

 将所有路由器如图所示,在各个接口上配置好IP地址

首先配置骨干区域(area 0)

ar1上的配置

[ar1]router id 1.1.1.1 #配置router id 相当于路由器的身份证号

[ar1]ospf 1 #ospf进程,进程编号为1

[ar1-ospf-1]area 0 #配置区域0,0号区域代表骨干区域

[ar1-ospf-1-area-0.0.0.0]

[ar1-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255 #宣告area 0区域网段及掩码的反码

ar2上的配置

[ar1]router id 2.2.2.2 #配置router id 相当于路由器的身份证号

[ar1]ospf 1 #ospf进程,进程编号为1

[ar1-ospf-1]area 0 #配置区域0,0号区域代表骨干区域

[ar1-ospf-1-area-0.0.0.0]

[ar1-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255 #宣告area 0区域网段及掩码的反码

当两台同区域的路由器ospf配置好后,它们会互相发现邻居,会有一下过程

Dec 9 2021 15:03:12-08:00 ar2 %%01OSPF/4/NBR_CHANGE_E(l)[0]:Neighbor changes event: neighbor status changed. (ProcessId=1, NeighborAddress=192.168.2.1, NeighborEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)

Dec 9 2021 15:03:12-08:00 ar2 %%01OSPF/4/NBR_CHANGE_E(l)[1]:Neighbor changes event: neighbor status changed. (ProcessId=1, NeighborAddress=192.168.2.1, NeighborEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way) #到2way状态时说明两台路由器到达了邻接关系

Dec 9 2021 15:03:12-08:00 ar2 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes event: neighbor status changed. (ProcessId=1, NeighborAddress=192.168.2.1, NeighborEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart)

Dec 9 2021 15:03:12-08:00 ar2 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes event: neighbor status changed. (ProcessId=1, NeighborAddress=192.168.2.1, NeighborEvent=NegotiationDone,NeighborPreviousState=ExStart,NeighborCurrentState=Exchange)

Dec 9 2021 15:03:12-08:00 ar2 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes event: neighborstatuschanged.(ProcessId=1,NeighborAddress=192.168.2.1,NeighborEvent=ExchangeDone,NeighborPreviousState=Exchange, NeighborCurrentState=Loading)

Dec 9 2021 15:03:12-08:00 ar2 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes event: neighbor status changed. (ProcessId=1, NeighborAddress=192.168.2.1, NeighborEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full) #当到达full状态时,说明邻居关系已经建立,开始传递链路信息

其他区域路由器ospf设置也依照这些命令设置好

开始测试

查看骨干区域路由器的路由表

ar1

 

 查看非骨干区域路由器的路由表

ar3

 

 用ar3 ping ar4

 

 可以通,完成

posted @ 2022-09-02 15:22  er狗  阅读(727)  评论(0编辑  收藏  举报