要求
1、R1-R3为区域0,R3、R4为区域1,其中R3的环回也在区域0
2、R3为DR设备,没有BDR
3、R4环回地址已固定,其他所有网段使用192.168.1.0/24进行合理分配
4、R4环回不能宣告,全网可达,保障更新安全,减少路由条目数量,避免环路
使用的设备:4台路由器、1台交换机
解决网络拓扑:
1、确定广播域的个数
2、分配网段
3、配置IP地址 (优先配置路由器)
确定广播域的个数
根据拓扑结构图以及要求可知,本拓扑结构一共拥有9个网段,包括7个环回和两个接口网段
分配网段
其中6个环回网段和两个接口网段基于192.168.1.0/24进行划分
划分为8个网段,需要借3位子网掩码:
两个接口网段:
192.168.1.0/27
划分为192.168.1.0/29(给区域0的接口用)和192.168.1.8/30(给区域1的接口用)
6个环回网段:
192.168.1.32/27
192.168.1.64/27
192.168.1.96/27
192.168.1.128/27
192.168.1.160/27
192.168.1.192/27
1个备用网段地址
192.168.1.224/27
配置路由器IP地址
AR1:
system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r1
[r1]
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip addre
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 29
[r1-GigabitEthernet0/0/0]
Apr 15 2023 21:57:37-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]q
[r1]
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.33 27
[r1-LoopBack0]q
[r1]
[r1]interface LoopBack 1
[r1-LoopBack1]ip address 192.168.1.65 27
[r1-LoopBack1]q
[r1]
AR2:
sys
system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r2
[r2]
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.1.2 29
[r2-GigabitEthernet0/0/0]
Apr 15 2023 22:01:14-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]q
[r2]
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.1.97 27
[r2-LoopBack0]q
[r2]
[r2]interface LoopBack 1
[r2-LoopBack1]ip address 192.168.1.129 27
[r2-LoopBack1]q
[r2]
AR3:
system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r3
[r3]
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.1.3 29
[r3-GigabitEthernet0/0/0]
Apr 15 2023 22:06:37-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]q
[r3]
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.1.9 30
Apr 15 2023 22:07:00-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]
[r3]interface l
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 192.168.1.161 27
[r3-LoopBack0]q
[r3]
[r3]interface LoopBack 1
[r3-LoopBack1]ip address 192.168.1.193 27
[r3-LoopBack1]q
[r3]
AR4:
system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r4
[r4]
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.1.10 30
[r4-GigabitEthernet0/0/0]
Apr 15 2023 22:13:13-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]q
[r4]
[r4]interface LoopBack 0
[r4-LoopBack0]ip address 4.4.4.4 24
[r4-LoopBack0]q
[r4]
配置OSPF动态路由协议
AR1:
[r1]
[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.
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.32 0.0.0.63
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.7
[r1-ospf-1-area-0.0.0.0]q
[r1-ospf-1]q
AR2:
[r2]
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.96 0.0.0.63
[r2-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.7
[r2-ospf-1-area-0.0.0.0]q
[r2-ospf-1]
AR3:
[r3]
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.7
[r3-ospf-1-area-0.0.0.0]network 192.168.1.160 0.0.0.63
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 192.168.1.8 0.0.0.3
[r3-ospf-1-area-0.0.0.1]q
[r3-ospf-1]
AR4:
[r4]
[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.8 0.0.0.3
[r4-ospf-1-area-0.0.0.1]q
[r4-ospf-1]
此时IP地址已经配置成功,此时区域内部可以正常通信,区域0和区域1也可以正常通信,但并不能访问到4.4.4.4
干涉DR/BDR选举
AR1:
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ospf dr-priority 0
AR2:
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ospf dr-priority 0
AR3:
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ospf dr-priority 3
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ospf dr-priority 3
AR4:
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ospf dr-priority 0
最后的效果为R3为DR设备,其他设备不参与选举,没有BDR设备
要求四的配置
可以访问R4的环回,但是R4的环回不被宣告,所以向area0区域发布一条去往R4的缺省路由;并在路由器间进行OSPF协议认证保障更新安全。
AR1:
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
AR2:
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
AR3:
[r3]ospf 1
[r3-ospf-1]default-route-advertise always
[r3-ospf-1]q
[r3]ip route-static 0.0.0.0 0 192.168.1.10
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456
AR4:
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r4-GigabitEthernet0/0/0]q
此时AR1的环回可以和AR4的环回正常通信,其他路由器也是如此,此时全网可达