一,实验需求
1,R1-3为区域0,R3-R4为区域1;其中r3的环回也在区域0。R1,R2也各有一个环回 R1-R3 R3为DR设备,没有BDR。
2,R1-R3 R3为DR设备,没有BDR。
3,R4环回地址已固定,其他所有网段使用192.168.1.0/24进行合理的分配 。
4,R4环回不能宣告,全网可达,保障更新安全,避免环路,减少路由条目。
二,实验目的
掌握OSPF手工认证配置
掌握OSPF的手工汇总配置
掌握OSPF缺省路由配置
掌握空接口路由配置防止环路出现
掌握动态路由配置
掌握BDR/DR的选举
三,实验步骤
1,新建拓扑,布置器件,连线开机
2,数广播域,划分网段
192.1681.0/24
area 0 192.168.1.0/25
R1环回192.168.1.32/27
R2环回192.168.1.64/27
R3环回192.168.1.96/27
area 1 192.168.1.128/25
3,每个接口配置IP地址并更改名字(记得保存配置)
R1配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r1
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 27
Oct 15 2023 20:09:58-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]int l 0
[r1-LoopBack0]ip address 192.168.1.33 27
[r1-LoopBack0]q
[r1]q
<r1>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
R2配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r2
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.1.2 27
Oct 15 2023 20:12:20-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]int l 0
[r2-LoopBack0]ip address 192.168.1.65 27
[r2-LoopBack0]q
[r2]q
<r2>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
R3配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r3
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.1.3 27
Oct 15 2023 20:13:34-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]int l
[r3-GigabitEthernet0/0/0]int l 0
[r3-LoopBack0]ip address 192.168.1.97 27
[r3-LoopBack0]q
[r3]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.1.129 25
Oct 15 2023 20:17:05-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]q
[r3]q
<r3>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
R4配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r4
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.1.130 25
Oct 15 2023 20:15:47-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]int l 0
[r4-LoopBack0]ip address 4.4.4.4 24
[r4-LoopBack0]q
[r4]q
<r4>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
4,配置OSPF,实现全网可达。
1,启动OSPF进程
2,创建区域
3,宣告
4,R3为DR设备,没有BDR,进行DR/BDR的选举,配置接口优先级为0 ,不参与选举。
R1配置
<r1>sys
Enter system view, return user view with Ctrl+Z.
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.33 0.0.0.0
[r1-ospf-1-area-0.0.0.0]q
[r1-ospf-1]q
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ospf dr 0
[r1-GigabitEthernet0/0/0]q
[r1]q
<r1>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
R2配置
<r2>sys
Enter system view, return user view with Ctrl+Z.
[r2]ospf 1 ro
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]net
[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]
Oct 15 2023 20:37:08-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.0]
Oct 15 2023 20:37:08-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.0]network 192.168.1.65 0.0.0.0
[r2-ospf-1-area-0.0.0.0]
Oct 15 2023 20:37:46-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.0]
Oct 15 2023 20:37:46-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.0]
Oct 15 2023 20:37:46-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.0]
Oct 15 2023 20:37:46-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.0]q
[r2-ospf-1]q
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ospf dr 0
Oct 15 2023 20:38:15-08:00 r2 %%01OSPF/3/NBR_CHG_DOWN(l)[6]:Neighbor event:neigh
bor state changed to Down. (ProcessId=256, NeighborAddress=1.1.1.1, NeighborEven
t=KillNbr, NeighborPreviousState=Full, NeighborCurrentState=Down)
[r2-GigabitEthernet0/0/0]
Oct 15 2023 20:38:15-08:00 r2 %%01OSPF/3/NBR_DOWN_REASON(l)[7]:Neighbor state le
aves full or changed to Down. (ProcessId=256, NeighborRouterId=1.1.1.1, Neighbor
AreaId=0, NeighborInterface=GigabitEthernet0/0/0,NeighborDownImmediate reason=Ne
ighbor Down Due to Kill Neighbor, NeighborDownPrimeReason=Interface Parameter Mi
smatch, NeighborChangeTime=2023-10-15 20:38:15-08:00)
[r2-GigabitEthernet0/0/0]q
[r2]q
<r2>s
Oct 15 2023 20:38:24-08:00 r2 %%01OSPF/4/NBR_CHANGE_E(l)[8]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neighb
orEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
<r2>s
Oct 15 2023 20:38:24-08:00 r2 %%01OSPF/4/NBR_CHANGE_E(l)[9]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neighb
orEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way)
<r2>s
Oct 15 2023 20:38:24-08:00 r2 %%01OSPF/4/NBR_CHANGE_E(l)[10]:Neighbor changes ev
ent: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neigh
borEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=2Way)
<r2>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
R3配置
<r3>sys
Enter system view, return user view with Ctrl+Z.
[r3]ospf 1 r
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]net
[r3-ospf-1-area-0.0.0.0]network 192.168.1.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.3 0.0.0.0
Oct 15 2023 20:39:59-08:00 r3 %%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)
[r3-ospf-1-area-0.0.0.0]network 192.168.1.3 0.0.0.0
Oct 15 2023 20:39:59-08:00 r3 %%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)
[r3-ospf-1-area-0.0.0.0]
Oct 15 2023 20:40:01-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=2.1.168.192, Neighb
orEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[r3-ospf-1-area-0.0.0.0]
Oct 15 2023 20:40:01-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=2.1.168.192, Neighb
orEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way)
[r3-ospf-1-area-0.0.0.0]network 192.168.1.97
Oct 15 2023 20:40:33-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neighb
orEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart)
[r3-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.0
Oct 15 2023 20:40:33-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=2.1.168.192, Neighb
orEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart)
[r3-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.0
Oct 15 2023 20:40:33-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[6]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neighb
orEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exc
hange)
[r3-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.0
Oct 15 2023 20:40:33-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[7]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=2.1.168.192, Neighb
orEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exc
hange)
[r3-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.0
Oct 15 2023 20:40:33-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[8]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neighb
orEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loadi
ng)
[r3-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.0
Oct 15 2023 20:40:33-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[9]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.1.168.192, Neighb
orEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
[r3-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.0 0.0.0.0
Oct 15 2023 20:40:33-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[10]:Neighbor changes ev
ent: neighbor status changed. (ProcessId=256, NeighborAddress=2.1.168.192, Neigh
borEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Load
ing)
[r3-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.0
Oct 15 2023 20:40:33-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[11]:Neighbor changes ev
ent: neighbor status changed. (ProcessId=256, NeighborAddress=2.1.168.192, Neigh
borEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
[r3-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.0
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]net
[r3-ospf-1-area-0.0.0.1]network 192.168.1.129 0.0.0.0
[r3-ospf-1-area-0.0.0.1]q
[r3-ospf-1]q
[r3]q
<r3>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
R4配置(4.4.4.0进行缺省配置)
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r4
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.1.130 25
Oct 15 2023 20:15:47-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]int l 0
[r4-LoopBack0]ip address 4.4.4.4 24
[r4-LoopBack0]q
[r4]q
<r4>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
<r4>
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<r4>sys
Enter system view, return user view with Ctrl+Z.
[r4]ospf 1 ro
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 1
[r4-ospf-1-area-0.0.0.1]network 192.168.1.130 0.0.0.0
[r4-ospf-1-area-0.0.0.1]q
[r4-ospf-1]default-route-advertise always
[r4-ospf-1]q
[r4]q
<r4>
Oct 15 2023 20:44:02-08:00 r4 %%01OSPF/4/NBR_CHANGE_E(l)[0]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=129.1.168.192, Neig
hborEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
<r4>
Oct 15 2023 20:44:02-08:00 r4 %%01OSPF/4/NBR_CHANGE_E(l)[1]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=129.1.168.192, Neig
hborEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way)
<r4>
Oct 15 2023 20:44:02-08:00 r4 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=129.1.168.192, Neig
hborEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart)
<r4>
Oct 15 2023 20:44:02-08:00 r4 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=129.1.168.192, Neig
hborEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=E
xchange)
<r4>
Oct 15 2023 20:44:02-08:00 r4 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=129.1.168.192, Neig
hborEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loa
ding)
<r4>
Oct 15 2023 20:44:02-08:00 r4 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=129.1.168.192, Neig
hborEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
5,为了保障更新安全,进行手工认证;为了减少路由条目,进行手工汇总,记得配置空接口防环;R4环回不能宣告,全网可达,配置R4缺省路由
R1配置
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
R2配置
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
R3配置
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r3]int g 0/0/1
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r3-ospf-1-area-0.0.0.0]abr-summary 192.168.1.0 255.255.255.128
[r3]ip route-static 192.168.1.0 25 null0
R4配置
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456