实验要求
1.R1-3为区域0,R3到R4为区域1;其中R3的环回也在区域0
2.R1-R3,R3为DR设备,没有BDR
3.R4的环回地址已固定,其他所有网段使用192.168.1.0/24进行合理分配
4.R4环回不能宣告,全网可达,保障更新安全,避免环路,减少路由条目数量
实验拓扑
实验内容
地址划分结果如下
给每台路由器配置地址
R1
[Huawei]sys r1
[r1]int lo0
[r1-LoopBack0]ip add 192.168.1.129 27
[r1-LoopBack0]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 29
R2
[Huawei]sys r2
[r2]int lo0
[r2-LoopBack0]ip add 192.168.1.161 27
[r2-LoopBack0]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 29
R3
[r3]int lo0
[r3-LoopBack0]ip add 192.168.1.193 27
[r3-LoopBack0]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.3 29
Jul 21 2022 22:16:42-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 g0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.97 25
R4
[Huawei]sys r4
[r4]int lo0
[r4-LoopBack0]ip add 4.4.4.4 24
[r4-LoopBack0]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.98 25
接着建议 ping一下 直连通不通
接着就可以起OSPF动态路由协议
R1上
[r1]ospf 1 rou
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]ar
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]net
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
R2
[r2]ospf 1 router-id 2.2.2.2
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[r2-ospf-1]ar
[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.0 0.0.0.255
R3
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]ar
[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.193 0.0.0.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 1
[r3-ospf-1-area-0.0.0.1]net
[r3-ospf-1-area-0.0.0.1]network 192.168.1.97 0.0.0.0
R4
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]ar
[r4-ospf-1]area 1
[r4-ospf-1-area-0.0.0.1]net
[r4-ospf-1-area-0.0.0.1]network 192.168.1.0 0.0.0.255
然后在R3上看一下邻居之间的关系
[r3]display ospf peer brief
OSPF Process 1 with Router ID 3.3.3.3
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/0 1.1.1.1 Full
0.0.0.0 GigabitEthernet0/0/0 192.168.1.161 Full
0.0.0.1 GigabitEthernet0/0/1 4.4.4.4 Full
----------------------------------------------------------------------------
发现都已经建立了邻接关系。
接着看一下在区域0里面的DR和BDR
[r3]display ospf peer
OSPF Process 1 with Router ID 3.3.3.3
Neighbors
Area 0.0.0.0 interface 192.168.1.3(GigabitEthernet0/0/0)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.1
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 34 sec
Retrans timer interval: 0
Neighbor is up for 00:02:05
Authentication Sequence: [ 0 ]
要使R3为DR,并且没有BDR。
则在R1-2上的配置
R1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ospf dr
[r1-GigabitEthernet0/0/0]ospf dr-priority 0
R2与R1一样
再在R3上查看
[r3]display ospf peer
OSPF Process 1 with Router ID 3.3.3.3
Neighbors
Area 0.0.0.0 interface 192.168.1.3(GigabitEthernet0/0/0)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.1
State: Full Mode:Nbr is Slave Priority: 0
DR: 192.168.1.3 BDR: None MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 4
Neighbor is up for 00:00:51
Authentication Sequence: [ 0 ]
可以发现R3为DR,并且没有BDR
实验完成。