实验要求
1.全网可达
2.拓扑中所需地址全部基于192.168.0.0/24划分所得
3.静态路由(不许使用其他动态路由)
4.R6环回需要汇总
实验拓扑
实验内容
地址划分
192.168.0.0/24
192.168.0.0/28
192.168.0.16/28
192.168.0.32/28
192.168.0.48/28
192.168.0.64/28
192.168.0.80/28
192.168.0.96/28
192.168.0.112/28
192.168.0.128/28
R6的三个环回,基于192.168.0.0/28 划分
192.168.0.0/30
192.168.0.4/30
192.168.0.8/30
R6和R5之间的网段为:192.168.0.16/28
R8和R5之间的网段为:192.168.0.32/28
R8和R9之间的网段为:192.168.0.48/28
R8和R9之间的网段为:192.168.0.64/28
R8和R7之间的网段为:192.168.0.80/28
R6和R7之间的网段为:192.168.0.96/28
vlan2 192.168.0.112/28
vlan3 192.168.0.128/28
首先给每个路由器上配上地址
R1
[Huawei]sys r1
[r1]int lo0
[r1-LoopBack0]ip add 192.168.0.1 30
[r1-LoopBack0]q
[r1]int lo1
[r1-LoopBack1]ip add 192.168.0.5 30
[r1-LoopBack1]q
[r1]int lo2
[r1-LoopBack2]ip add 192.168.0.9 30
[r1-LoopBack2]q
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.0.17 28
Jul 19 2022 11:55:56-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]
<r1>sys
Enter system view, return user view with Ctrl+Z.
[r1] int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 192.168.0.98 28
R2
[Huawei] sys r2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0] ip add 192.168.0.18 28
Jul 19 2022 11:56:35-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]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.0.33 28
R3
[Huawei]sys r3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.0.34 28
Jul 19 2022 11:57:38-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]
[r3-GigabitEthernet0/0/0]q
[r3]int g0/0/2
[r3-GigabitEthernet0/0/2]ip add 192.168.0.49 28
Jul 19 2022 11:58:54-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r3-GigabitEthernet0/0/2]q
[r3]
[r3]int g4/0/0
[r3-GigabitEthernet4/0/0]ip add 192.168.0.66 28
Jul 19 2022 12:00:13-08:00 r3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[r3-GigabitEthernet4/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.0.81 28
R4
[Huawei]sys r4
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.0.82 28
Jul 19 2022 12:01:27-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]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.0.97 28
R5
[Huawei]sys r5
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.0.50 28
Jul 19 2022 11:59:23-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r5-GigabitEthernet0/0/0]int g0/0/1
[r5-GigabitEthernet0/0/1]ip add 192.168.0.65 28
ISP
[ISP]int g0/0/0
[ISP-GigabitEthernet0/0/0]ip add 100.1.1.2 24
由于要划分vlan,所以我们要在R4的接口上做子接口
[r4]int g0/0/2.1
[r4-GigabitEthernet0/0/2.1]do
[r4-GigabitEthernet0/0/2.1]dot1q ter
[r4-GigabitEthernet0/0/2.1]dot1q termination vid 2
[r4-GigabitEthernet0/0/2.1]ip ad
[r4-GigabitEthernet0/0/2.1]ip address 192.168.0.113 28
Jul 19 2022 12:03:07-08:00 r4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2.1 has entered the UP state.
[r4-GigabitEthernet0/0/2.1]arp br
[r4-GigabitEthernet0/0/2.1]arp broadcast en
[r4-GigabitEthernet0/0/2.1]arp broadcast enable
[r4-GigabitEthernet0/0/2.1]q
[r4]int g0/0/2.2
[r4-GigabitEthernet0/0/2.2]do
[r4-GigabitEthernet0/0/2.2]dot1q ter
[r4-GigabitEthernet0/0/2.2]dot1q termination vid 3
[r4-GigabitEthernet0/0/2.2]ip add 192.168.0.129 28
Jul 19 2022 12:04:49-08:00 r4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/2.2 has entered the UP state.
[r4-GigabitEthernet0/0/2.2]arp bro
[r4-GigabitEthernet0/0/2.2]arp broadcast en
[r4-GigabitEthernet0/0/2.2]arp broadcast enable
PC采用dhcp来自动获取地址,则在R4上
[r4]dhcp en
[r4]dhcp enable
[r4]int g0/0/2.1
[r4-GigabitEthernet0/0/2.1]dhcp se
[r4-GigabitEthernet0/0/2.1]dhcp select g
[r4-GigabitEthernet0/0/2.1]dhcp select global
[r4-GigabitEthernet0/0/2.1]q
[r4]int g0/0/2.2
[r4-GigabitEthernet0/0/2.2]dhcp sel
[r4-GigabitEthernet0/0/2.2]dhcp select g
[r4-GigabitEthernet0/0/2.2]dhcp select global
在交换机上我们需要改接口的类型
SW
[Huawei]sys sw1
[sw1]
Jul 19 2022 12:11:53-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]vlan ba
[sw1]vlan batch 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]int g0/0/4
[sw1-GigabitEthernet0/0/4]
Jul 19 2022 12:12:33-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-GigabitEthernet0/0/4]pol
[sw1-GigabitEthernet0/0/4]po
[sw1-GigabitEthernet0/0/4]port-lin
[sw1-GigabitEthernet0/0/4]port-lin
[sw1-GigabitEthernet0/0/4]port
[sw1-GigabitEthernet0/0/4]port lin
[sw1-GigabitEthernet0/0/4]port link-t
[sw1-GigabitEthernet0/0/4]port link-type tu
[sw1-GigabitEthernet0/0/4]port link-type t
[sw1-GigabitEthernet0/0/4]port link-type trunk
[sw1-GigabitEthernet0/0/4]por
[sw1-GigabitEthernet0/0/4]port t
[sw1-GigabitEthernet0/0/4]port trunk
Jul 19 2022 12:13:23-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of recordport link-type tr
[sw1-GigabitEthernet0/0/4]port link-type tr
[sw1-GigabitEthernet0/0/4]port link-type trunk allo
[sw1-GigabitEthernet0/0/4]port link-type trunk all
[sw1-GigabitEthernet0/0/4]port tr
[sw1-GigabitEthernet0/0/4]port trunk all
[sw1-GigabitEthernet0/0/4]port trunk allow-pass all
^
Error: Unrecognized command found at '^' position.
[sw1-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[sw1-GigabitEthernet0/0/4]
Jul 19 2022 12:14:13-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 7, the c
hange loop count is 0, and the maximum number of records is 4095.q
[sw1]int g0/0/3
[sw1-GigabitEthernet0/0/3]port link
[sw1-GigabitEthernet0/0/3]port link-t
[sw1-GigabitEthernet0/0/3]port link-type tr
[sw1-GigabitEthernet0/0/3]port link-type trunk
[sw1-GigabitEthernet0/0/3]port
Jul 19 2022 12:14:43-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 8, the c
hange loop count is 0, and the maximum number of records is
[sw1-GigabitEthernet0/0/3]port tr
[sw1-GigabitEthernet0/0/3]port trunk all
[sw1-GigabitEthernet0/0/3]port trunk allow-pass v
[sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[sw1-GigabitEthernet0/0/3]
Jul 19 2022 12:15:03-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 9, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-GigabitEthernet0/0/3]
[sw1-GigabitEthernet0/0/3]q
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type access
[sw1-GigabitEthernet0/0/1]port default vlan 2
[sw1-GigabitEthernet0/0/1]int g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type access
[sw1-GigabitEthernet0/0/2]po
Jul 19 2022 12:16:03-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 12, the
change loop count is 0, and the maximum number of records is 4095.r
Error: The interface is already a L2 interface.
[sw1-GigabitEthernet0/0/2]
[sw1-GigabitEthernet0/0/2]port de
[sw1-GigabitEthernet0/0/2]port default vlan 3
在另一个交换机上同理操作
在PC就能获取到地址了
地址
全部配置完成后,接着我们就可以来写静态路由了
R1上
ip route-static 192.168.0.32 255.255.255.240 192.168.0.18
ip route-static 192.168.0.48 255.255.255.240 192.168.0.18
ip route-static 192.168.0.64 255.255.255.240 192.168.0.18
ip route-static 192.168.0.80 255.255.255.240 192.168.0.97
ip route-static 192.168.0.112 255.255.255.240 192.168.0.97
ip route-static 192.168.0.128 255.255.255.240 192.168.0.97
R2
ip route-static 192.168.0.96 255.255.255.240 192.168.0.17
ip route-static 192.168.0.48 255.255.255.240 192.168.0.34
ip route-static 192.168.0.64 255.255.255.240 192.168.0.34
ip route-static 192.168.0.80 255.255.255.240 192.168.0.34
ip route-static 192.168.0.112 255.255.255.240 192.168.0.34
ip route-static 192.168.0.128 255.255.255.240 192.168.0.34
R5
ip route-static 192.168.0.96 255.255.255.240 192.168.0.49
ip route-static 192.168.0.16 255.255.255.240 192.168.0.49
ip route-static 192.168.0.32 255.255.255.240 192.168.0.49
ip route-static 192.168.0.80 255.255.255.240 192.168.0.49
ip route-static 192.168.0.112 255.255.255.240 192.168.0.49
ip route-static 192.168.0.128 255.255.255.240 192.168.0.49
R3
ip route-static 192.168.0.96 255.255.255.240 192.168.0.82
ip route-static 192.168.0.16 255.255.255.240 192.168.0.33
ip route-static 192.168.0.112 255.255.255.240 192.168.0.82
ip route-static 192.168.0.128 255.255.255.240 192.168.0.82
R4
ip route-static 192.168.0.32 255.255.255.240 192.168.0.98
ip route-static 192.168.0.16 255.255.255.240 192.168.0.98
ip route-static 192.168.0.48 255.255.255.240 192.168.0.81
ip route-static 192.168.0.64 255.255.255.240 192.168.0.81
路由写完就可以去进行测试了
<r1>ping 192.168.0.113
PING 192.168.0.113: 56 data bytes, press CTRL_C to break
Reply from 192.168.0.113: bytes=56 Sequence=1 ttl=255 time=120 ms
Reply from 192.168.0.113: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.0.113: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 192.168.0.113: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.0.113: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 192.168.0.113 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/46/120 ms
然后进行汇总了
在R4上
ip route-static 192.168.0.0 28 192.168.0.98
R2上
ip route-static 192.168.0.0 28 192.168.0.17
R3上
[r3]ip route-static 192.168.0.0 28 192.168.0.33
[r3]ip route-static 192.168.0.0 28 192.168.0.82
R5上
[r5]ip route-static 192.168.0.0 28 192.168.0.82
查看路由表
[r5]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
Destinations : 7 Routes : 7 Configured Routes : 7
Static routing table status : <Active>
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.0.0/28 Static 60 0 RD 192.168.0.82 GigabitEthernet
0/0/0
192.168.0.16/28 Static 60 0 RD 192.168.0.49 GigabitEthernet
0/0/0
192.168.0.32/28 Static 60 0 RD 192.168.0.49 GigabitEthernet
0/0/0
192.168.0.80/28 Static 60 0 RD 192.168.0.49 GigabitEthernet
0/0/0
192.168.0.96/28 Static 60 0 RD 192.168.0.49 GigabitEthernet
0/0/0
192.168.0.112/28 Static 60 0 RD 192.168.0.49 GigabitEthernet
0/0/0
192.168.0.128/28 Static 60 0 RD 192.168.0.49 GigabitEthernet
0/0/0
Static routing table status : <Inactive>
Destinations : 0 Routes : 0
这里发现已经汇总了
pingR1的一个环回
[r5]ping 192.168.0.1
PING 192.168.0.1: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Reply from 192.168.0.1: bytes=56 Sequence=3 ttl=253 time=70 ms
Reply from 192.168.0.1: bytes=56 Sequence=4 ttl=253 time=40 ms
Reply from 192.168.0.1: bytes=56 Sequence=5 ttl=253 time=40 ms
--- 192.168.0.1 ping statistics ---
5 packet(s) transmitted
3 packet(s) received
40.00% packet loss
round-trip min/avg/max = 40/50/70 ms
然后则在R1上写空接口防环路由
[r1]ip route-static 192.168.0.0 28 null 0
接着就写缺省
[r1]ip route-static 0.0.0.0 0 192.168.0.18
[r1]ip route-static 0.0.0.0 0 192.168.0.97
R2上
ip route-static 0.0.0.0 0 192.168.0.34
R4
ip route-static 0.0.0.0 0 192.168.0.81
R3
[r3]ip route-static 0.0.0.0 0 192.168.0.50 preference 80
[r3]ip rou
[r3]ip route-s
[r3]ip route-static 0.0.0.0 0 192.168.0.65
然后接着可以大致测试一下了