第一步:分配IP
在192.168.1.0 /24里划分
所以划分8个网段 ---- 借三位
192.168.1.000 0 0000 /27 --- 192.168.1.0/27
192.168.1.001 0 0000 /27 --- 192.168.1.32/27
192.168.1.010 0 0000 /27 --- 192.168.1.64/27
192.168.1.011 0 0000 /27 --- 192.168.1.96/27
192.168.1.100 0 0000 /27 --- 192.168.1.128/27
192.168.1.101 0 0000 /27
192.168.1.110 0 0000 /27
192.168.1.111 0 0000 /27
第二步:配IP与环回地址
R1
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 27
Sep 14 2021 21:49:28-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]interface l 1
[r1-LoopBack1]ip add 192.168.1.65 27
[r1-LoopBack1]
R2
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 27
[r2-GigabitEthernet0/0/0]
Sep 14 2021 21:51:45-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]interface l 2
[r2-LoopBack2]ip add 192.168.1.97 27
R3
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.3 27
Sep 14 2021 21:54:08-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]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.33 27
Sep 14 2021 21:54:26-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]interface l1
[r3-LoopBack1]ip add 192.168.1.129 27
[r3-LoopBack1]
R4
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.34 27
Sep 14 2021 21:55:23-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]interface l 1
[r4-LoopBack1]ip add 4.4.4.1 24
[r4-LoopBack1]
第三步:配置OSPF 分三步走:启动、创建、宣告。
[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.255
[r1-ospf-1-area-0.0.0.0]network 192.168.1.65 0.0.0.255
[r1-ospf-1-area-0.0.0.0]
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]net
[r2-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.255
[r2-ospf-1-area-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.129 0.0.0.255
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]net
[r3-ospf-1-area-0.0.0.1]network 192.168.1.33 0.0.0.0
[r3-ospf-1-area-0.0.0.1]
第四步:设置优先级(r1/r2)
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ospf dr-priority 0
<r1>reset ospf 1 process
Warning: The OSPF process will be reset. Continue? [Y/N]:y
Sep 14 2021 22:15:07-08:00 r1 %%01OSPF/3/NBR_CHG_DOWN(l)[16]:Neighbor event:neig
hbor state changed to Down. (ProcessId=256, NeighborAddress=2.2.2.2, NeighborEve
nt=KillNbr, NeighborPreviousState=Full, NeighborCurrentState=Down)
<r1>
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ospf dr-priority 0
<r2>reset ospf 1 process
Warning: The OSPF process will be reset. Continue? [Y/N]:y
Sep 14 2021 22:17:58-08:00 r2 %%01OSPF/3/NBR_CHG_DOWN(l)[13]:Neighbor event:neig
hbor state changed to Down. (ProcessId=256, NeighborAddress=1.1.1.1, NeighborEve
nt=KillNbr, NeighborPreviousState=2Way, NeighborCurrentState=Down)
第五步:配置缺省路由
[r3-ospf-1]default-route-advertise always ---- 强制发缺省路由
[r3-ospf-1]
[r4]ospf 1 router-id 1.1.1.1
[r4-ospf-1]area 1
[r4-ospf-1-area-0.0.0.1]network 192.168.1.32 0.0.0.0 --- area1中宣告0/0/0/0接口
第六步:分别配area1和area0的网络域
[r1]int g 0/0/0 ---area0
[r1-GigabitEthernet0/0/0]ospf auth
[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 12345
[r2]int g 0/0/0---area0
[r2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 12345
[r3]int g 0/0/0 ---area0
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 12345
r3有两个网络域area 0 与area 1
[r3-GigabitEthernet0/0/0]int g 0/0/1 ---area1
[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 1234578
[r3-GigabitEthernet0/0/1]
[r4]int g 0/0/1 ---area1
[r4-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 1234578
[r4-GigabitEthernet0/0/1]
第七步:r3作为DR,并给R1-R4配置空接口
[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.64 27 NULL 0
[r2]ip route-static 192.168.1.96 27 NULL 0
[r3]ip route-static 192.168.1.0 24 NULL 0
[r4]ip route-static 4.4.4.0 24 NULL 0
最后一步:测试