分析:1.根据广播域和环回合理分配ip
2. 更改R1,R3优先级
3.配置密文认证
4.R5强制下发缺省
配置:1.分配ip
R1
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 28 //配置ip
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.65 26 //环回
[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.65 0.0.0.0 //宣告
[r1-GigabitEthernet0/0/0]ospf dr-priority 20 //修改优先级
Area 0.0.0.0 interface 192.168.1.1(GigabitEthernet0/0/0)'s neighbors
Router ID: 2.2.2.2 Address: 192.168.1.2
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 5
Neighbor is up for 00:00:12
Authentication Sequence: [ 0 ]
Router ID: 3.3.3.3 Address: 192.168.1.3
State: Full Mode:Nbr is Master Priority: 0
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 40 sec
Retrans timer interval: 4
Neighbor is up for 00:00:22
Authentication Sequence: [ 0 ]
R2
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.1.2 28 //配置ip
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.1.129 26 //环回
[r2]ospf 1 rou
[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.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.129 0.0.0.0 //宣告
R3.因为R3同属两个区域所以要更改区域配置.
[Huawei]interface g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.3 28
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.1.17 28 //配置ip
[Huawei]sysname 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.3 0.0.0.0
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 192.168.1.17 0.0.0.0 //宣告
[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 2 cipher 123 //密文认证
R4
[Huawei]interface g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.18 28
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.1.33 28 //配置ip
[Huawei]sysname 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.18 0.0.0.0
[r4-ospf-1-area-0.0.0.1]network 192.168.1.33 0.0.0.0 //宣告
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 2 cipher 123
[r4-GigabitEthernet0/0/0]int g0/0/1
[r4-GigabitEthernet0/0/1]ospf authentication-mode md5 2 cipher abc //密文
R5:根据要求R5环回不能宣告进ospf 所以要强制下发缺省
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ip address 192.168.1.34 28 //配置IP
[r5]interface LoopBack 0
[r5-LoopBack0]ip address 192.168.1.193 26
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 1
[r5-ospf-1-area-0.0.0.1]network 192.168.1.34 0.0.0.0 //宣告
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ospf authentication-mode md5 2 cipher abc //密文
[r5]ospf 1
[r5-ospf-1]default-route-advertise always //强制下发缺省
结果:全网可达
<r1>ping -a 192.168.1.65 192.168.1.193
PING 192.168.1.193: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.193: bytes=56 Sequence=1 ttl=253 time=70 ms
Reply from 192.168.1.193: bytes=56 Sequence=2 ttl=253 time=50 ms
Reply from 192.168.1.193: bytes=56 Sequence=3 ttl=253 time=60 ms
Reply from 192.168.1.193: bytes=56 Sequence=4 ttl=253 time=60 ms
Reply from 192.168.1.193: bytes=56 Sequence=5 ttl=253 time=40 ms
--- 192.168.1.193 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/56/70 ms