骨干链路的链接至少是需要两个路由地址(而一个网段的极限可用网址为/30 ---2^2-2=2位)
所以:骨干的地址的配置为骨干链路:R1-R2:192.168.1.0/30;R2-R4:192.168.1.4/30;R1-R3:192.168.1.8/30;R3-R4:192.168.1.12/30;R4-R5:192.168.1.16/30;R4-R5:192.168.1.20/30
//R1
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
Nov 10 2021 13:49:42-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]int g0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.1.9 30
Nov 10 2021 13:50:10-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
//R2
[R2-GigabitEthernet0/0/0]ip address 192.168.1.2 30
[R2-GigabitEthernet0/0/1]ip address 192.168.1.5 30
//R3
[R3-GigabitEthernet0/0/0]ip address 192.168.1.10 30
[R3-GigabitEthernet0/0/1]ip address 192.168.1.13 30
//R4
[R4-GigabitEthernet0/0/0]ip address 192.168.1.14 30
[R4-GigabitEthernet0/0/1]ip address 192.168.1.6 30
[R4-GigabitEthernet0/0/2]ip address 192.168.1.17 30
[R4-GigabitEthernet4/0/0]ip address 192.168.1.21 30
//R5
[R5-GigabitEthernet0/0/0]ip address 192.168.1.15 30
[R5-GigabitEthernet0/0/1]ip address 192.168.1.22 30
然后开始去配置环回接口,此时,192.168.1.0/24的网段以及被划分了走了24个子网段(/30),分析:此时换回接口需要从2^N-2>24 ---此时N为5(/32-5 ---> /27)
所以R1的环回路由为192.168.1.32/27开始,所以选择配置为192.168.1.33/28和192.168.1.49/28两个网段,以此类推:R2为192.168.1.64/27开始(192.168.1.64/28和192.168.1.80/28),R3为192.168.1.96/27开始(192.168.1.96/28和192.168.1.112/28),R4为192.168.1.128/27开始(192.168.1.128/28和192.168.1.144/28)(R5已给出,不需要配置)
在配置环回地址时,我配错了地址开始位置,需要给换回接口一个开始的ip
//R1
[R1]inter
[R1]interface lo
[R1]interface LoopBack 0
[R1-LoopBack0]ip addres
[R1-LoopBack0]ip address 192.168.1.32 28
Error: The specified IP address is invalid.
[R1-LoopBack0]ip address 192.168.1.33 28
[R1-LoopBack0]inter l
[R1-LoopBack0]inter lo
[R1-LoopBack0]inter loopback1
[R1-LoopBack1]ip addres
[R1-LoopBack1]ip address 192.168.1.49 28
//R2
[R2-LoopBack0]ip address 192.168.1.65 28
[R2-LoopBack0]inter
[R2-LoopBack0]inter loop
[R2-LoopBack0]inter loop 1
[R2-LoopBack1]ip addre
[R2-LoopBack1]ip address 192.168.1.81 28
//R3
[R3-LoopBack0]ip address 192.168.1.96 28
Error: The specified IP address is invalid.
[R3-LoopBack0]ip address 192.168.1.97 28
[R3-LoopBack0]int l 1
[R3-LoopBack1]ip addre
[R3-LoopBack1]ip address 192.168.1.113 28
//R4
[R4-LoopBack0]ip address 192.168.1.129 28
[R4-LoopBack0]int l 1
[R4-LoopBack1]ip add
[R4-LoopBack1]ip address 192.168.1.145 28
//R5
[R5-LoopBack0]ip address 5.0.0.1 24
现在已经配置完骨干链路和环回接口了,现在需要可以ping通5.0.0.0/24网段(非直连),我在这里发现设置下一跳为接口时,存在无法联通情况,所以将下一跳设置为下一个路由器的广播地址
//R1
[R1]ip route-static 0.0.0.0 0 192.168.1.3
//R2
[R2]ip route-static 0.0.0.0 0 192.168.1.7
//R3
[R3]ip route-static 0.0.0.0 0 192.168.1.15
//R4
[R4]ip route-static 0.0.0.0 0 192.168.1.19
[R4]ip route-static 0.0.0.0 0 192.168.1.23
//R4配置两条的原因是为了后面设置优先级时,可能会丢弃
//这里我选择R1去往R2的配置缺省路由
此时从R1ping5.0.0.1单位
R1,R2,R3,R4均联通去往5.0.0.0/24网段
此时开始汇总路由R1的路由段192.168.1.33/28和192.168.1.49/28可以汇总为:192.168.1.32/27
R2路由段192.168.1.65/28和192.168.1.81/28可以汇总为:192.168.1.64/27
R3路由段192.168.1.97/28和192.168.1.113/28可以汇总为:192.168.1.96/27
R4路由段192.168.1.129/28和192.168.1.145/28可以汇总为:192.168.1.128/27
//R1
[R1]ip route-static 192.168.1.64 27 192.168.1.2
[R1]ip route-static 192.168.1.96 27 192.168.1.10
//R2
[R2]ip route-static 192.168.1.32 27 192.168.1.1
[R2]ip route-static 192.168.1.128 27 192.168.1.6
//R3
[R3]ip route-static 192.168.1.32 27 192.168.1.9
[R3]ip route-static 192.168.1.128 27 192.168.1.14
//R4
[R4]ip route-static 192.168.1.64 27 192.168.1.5
[R4]ip route-static 192.168.1.96 27 192.168.1.13
此时已经产生了路由黑洞,需要设置null0口
//R1
[R1]ip route-static 192.168.1.32 null0
//R2
[R2]ip route-static 192.168.1.64 27 null0
//R3
[R3]ip route-static 192.168.1.96 27 null0
//R4
[R4]ip route-static 192.168.1.128 27 null0
最后设置优先级,一般静态为60,我分别设置为80和100
//R4
[R4]ip route-static 0.0.0.0 0 192.168.1.19 preference 80
[R4]ip route-static 0.0.0.0 0 192.168.1.23 preference 100
//R5
[R5]ip route-static 0.0.0.0 0 192.168.1.17 preference 80
[R5]ip route-static 0.0.0.0 0 192.168.1.21 preference 100
此时查看优先级
此时已经全部配置完毕!!!