一,划分网段。
将192.168.1.0 24划分为
192.168.1.0 26 192.168.1.128 26
192.168.1.64 26 192.168.1.192 26
二,添加ip地址
将192.168.1.0 26划分为网络位为29的网段取其中两段添加至路由器各个接口
R1:[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 29
[r1-LoopBack0] ip add 192.168.1.65 26
R2:[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 29
[r2-LoopBack0]ip add 192.168.1.129 26
R3:[r3-GigabitEthernet0/0/0]ip add 192.168.1.3 29
[r3-GigabitEthernet0/0/1]ip add 192.168.1.9 29
[r3-LoopBack0]ip add 192.168.1.129 26
R4:[r4-GigabitEthernet0/0/0]ip add 192.168.1.10 29
[r4-LoopBack0]ip add 4.4.4.4 24
三,启动OSPF进程
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.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.65 0.0.0.0
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.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 192.168.1.129 0.0.0.0
R3:
[r3]ospf 1 router-id 3.3.3.5
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 192.168.1.9 0.0.0.0
[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-0.0.0.0]network 192.168.1.193 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.10 0.0.0.0
四,干涉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 3
并重启ospf进程
五,区域汇总
[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.0
六,防环
[r1]ip route-static 192.168.1.0 25 null 0
[r2]ip route-static 192.168.1.0 24 null 0
[r3]ip route-static 192.168.1.0 24 null 0
七,安全认证
R1:
[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 22 cipher 123456
R2:
[r2-GigabitEthernet0/0/0]ospf authentication-mode md5 22 cipher 123456
R3:
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 22 cipher 123456------0区域
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 23 cipher 123456------1区域
R4:
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 23 cipher 123456
八,下发缺省路由
[r4-ospf-1]default-route-advertise always
区域0可与R4环回互通