第一步,先进行IP地址规划
第二步,进行IP地址配置
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.1 27
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.97 28
r2和r3同理,其中r3要配置2个网关
r4回环为4.4.4.4 24
第三步,启动ospf并进行宣告,r4环回不宣告
[r1]ospf 1 router-id 192.168.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.97 0.0.0.255
[r2]ospf 1 router-id 192.168.1.33
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.33 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.98 0.0.0.255
[r3]ospf 1 router-id 192.168.1.65
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.65 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.99 0.0.0.255
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.0]network 192.168.1.113 0.0.0.255
[r2]ospf 1 router-id 4.4.4.4
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]network 192.168.1.114 0.0.0.0
第三步,调整r1到r3 的DR/BDR选举优先级
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ospf dr-priority 0
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ospf dr-priority 0
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ospf dr-priority 2
将r1和r2接口优先级调为0,r3可调可不调,即可完成r1-r3无BDR,r3为DR
DR/BDR选举非抢占;故修改优先级后,必须重启ospf的进程,才能重新选举
reset ospf process
Warning: The OSPF process will be reset. Continue? [Y/N]:y
第四步,为避免回路,减少路由条目进行汇总
OSPF的区域汇总—在ABR上将区域A的路由计算好后,传递到区域B时,方可进行汇总计算配置
[r3-ospf-1-area-0.0.0.0]abr-summary 192.168.1.0 255.255.255.128
r4中display ospf routing查看
第五步,保障更新安全进行认证
[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
第六步,全网可达,在r4添加缺省路由
[r4-ospf-1]default-route-advertise always
测试
成功