[r1]interface gigabitethernet 0/0/0 进入端口
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 255.255.255.0 创建IP
[r1]interface loopback 0 创建虚拟端口
[r1-LoopBack0]ip address 10.10.1.1 255.255.255.0 配置IP
[r2]interface gigabitethernet 0/0/0 进入端口
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 255.255.255.0 创建IP
[r2]interface loopback 0 创建虚拟端口
[r2-LoopBack0]ip address 10.10.2.2 255.255.255.0 配置IP
[r1]ospf
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]network 10.10.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.1]network 192.168.1.0 0.0.0.255
[r2]ospf
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]network 10.10.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.1]network 192.168.1.0 0.0.0.255
验证:
[r1]display ospf peer brief
OSPF Process 1 with Router ID 192.168.1.1
Peer Statistic Information
[r1]
[r2]display ospf peer brief
OSPF Process 1 with Router ID 192.168.1.2
Peer Statistic Information
==================================================================
验证 OSPF hello 包中的关键参数(配置要求)
============================================
直接建立邻居关系的路由器,RID(路由ID)一定不能相同;
查看命令:display ospf peer
RID更改命令:[r1]ospf 1 router-id 1.1.1.1
系统反馈:Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
ospf更新:<r1>reset ospf 1 process
Warning: The OSPF process will be reset. Continue? [Y/N]:y
系统反馈:Jan 16 2018 17:53:45-08:00 r1 %%01OSPF/3/NBR_CHG_DOWN(l)[0]:Neighbor event:neigh
bor state changed to Down. (ProcessId=256, NeighborAddress=2.1.168.192, Neighbor
Event=KillNbr, NeighborPreviousState=Full, NeighborCurrentState=Down)
区域ID必须相同
[r2]ospf
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]undo network 192.168.1.1 0.0.0.0
[r2-ospf-1-area-0.0.0.1]network 192.168.1.2 0.0.0.0
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 10.10.2.2 0.0.0.0
验证:
[r2]display ospf peer brief
系统回应邻居表无数据
OSPF Process 1 with Router ID 10.10.2.2
Peer Statistic Information
区域重新改回
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]undo network 10.10.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]undo network 192.168.1.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]quit
[r2-ospf-1]undo area 0
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]network 10.10.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.1]network 192.168.1.2 0.0.0.0
Jan 16 2018 20:08:16-08:00 r2 %%01OSPF/4/NBR_CHANGE_E(l)[0]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neighb
orEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[r2-ospf-1-area-0.0.0.1]
Jan 16 2018 20:08:16-08:00 r2 %%01OSPF/4/NBR_CHANGE_E(l)[1]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neighb
orEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way)
[r2-ospf-1-area-0.0.0.1]
Jan 16 2018 20:08:16-08:00 r2 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neighb
orEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart)
[r2-ospf-1-area-0.0.0.1]
Jan 16 2018 20:08:16-08:00 r2 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neighb
orEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exc
hange)
[r2-ospf-1-area-0.0.0.1]
Jan 16 2018 20:08:16-08:00 r2 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neighb
orEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loadi
ng)
[r2-ospf-1-area-0.0.0.1]
Jan 16 2018 20:08:16-08:00 r2 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neighb
orEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
系统回应验证
[r2-ospf-1-area-0.0.0.1]display ospf peer brief
OSPF Process 1 with Router ID 10.10.2.2
Peer Statistic Information
验证完成
==================================================================
OSPF链路完成的其它条件:
认证必须成功
子网掩码必须相同【特殊情况下】
hello时间必须相同
特殊标记位必须完全相同
DR优先级,不能全为0【特殊情况下】
3层MTU,必须完全相同
原文:http://blog.51cto.com/13556637/2061801