1.子网划分
192.168.1.0/25 区域0
192.168.1.0/27 骨干
192.168.1.0/29 第一个即可使用
192.168.1.8/29
192.168.1.16/29
192.168.1.24/29
192.168.1.32/27 R1
192.168.1.64/27 R2
192.168.1.96/27 R3
192.168.1.128/25 区域1
因为只有一条链路所以没有必要划分
2.分别为四个路由器配置接口
按照如图所示配置
3.配置OSPF
分别为R1R2R3R4配置
R1:
[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.0 0.0.0.255
R2:
[r1]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.0 0.0.0.255
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.129 0.0.0.0
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.130 0.0.0.0
4.干涉选举 题目中要求只能区域0有一个DR
所以我们只需将R1R2的优先级修改为0即可只让R3做DR
R1:
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ospf dr-priority 0
R2:
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ospf dr-priority 0
5.R4环回不能被宣告 而且我们要全网可达 所以只需在R4上设置缺省路由即可
[r4]ospf 1
[r4-ospf-1]default-route-advertise always
6.保障更新安全 所以要求我们要做好认证
在区域0的骨干和区域1上分别做两个认证
[r1]int
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r2]int
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r3]int
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r3]int
[r3]interface g0/0/1
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 654321
[r4]int
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 654321
7.防环
在R3上
[r3]ip route-static 192.168.1.0 25 NULL 0 即可防止环路生成
8.区域汇总 减少路由表条目
区域1不需要汇总 所以只需汇总区域0 来给区域1
[r3]ospf 1
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]abr-summary 192.168.1.0 255.255.255.128
9.测试:
得到结果
ping通
END