实验目的:实现vlan10 vlan20 172网段用户互访
1.拓扑图
2.配置
PC1 其它同理
SW4
<Huawei>
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname SW4
[SW4]vlan 10
[SW4-vlan10]q
[SW4]int e0/0/1
[SW4-Ethernet0/0/1]p l a
[SW4-Ethernet0/0/1]p d v 10
[SW4-Ethernet0/0/1]int e0/0/2
[SW4-Ethernet0/0/2]p l a
[SW4-Ethernet0/0/2]p d v 10
[SW4-Ethernet0/0/2]int e0/0/3
[SW4-Ethernet0/0/3]p l t
[SW4-Ethernet0/0/3]p t a v a
SW5
<Huawei>
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname SW5
[SW5]vlan 20
[SW5-vlan20]int e0/0/1
[SW5-Ethernet0/0/1]p l a
[SW5-Ethernet0/0/1]p d v 20
[SW5-Ethernet0/0/1]int e0/0/2
[SW5-Ethernet0/0/2]p l a
[SW5-Ethernet0/0/2]p d v 20
[SW5-Ethernet0/0/2]int e0/0/3
[SW5-Ethernet0/0/3]p l t
[SW5-Ethernet0/0/3]p t a v a
SW2
<Huawei>
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname SW2
[SW2]vlan 10
[SW2-vlan10]int g0/0/1
[SW2-GigabitEthernet0/0/1]p l t
[SW2-GigabitEthernet0/0/1]p t a v a
[SW2-GigabitEthernet0/0/1]int vlanif 10
[SW2-Vlanif10]ip add 192.168.1.254 24
[SW2-Vlanif10]ping 192.168.1.1PING 192.168.1.1: 56 data bytes, press CTRL_C to breakReply from 192.168.1.1: bytes=56 Sequence=1 ttl=128 time=170 msReply from 192.168.1.1: bytes=56 Sequence=2 ttl=128 time=70 msReply from 192.168.1.1: bytes=56 Sequence=3 ttl=128 time=40 msReply from 192.168.1.1: bytes=56 Sequence=4 ttl=128 time=50 msReply from 192.168.1.1: bytes=56 Sequence=5 ttl=128 time=40 ms--- 192.168.1.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 40/74/170 ms[SW2-Vlanif10]
[SW2-Vlanif10]
[SW2-Vlanif10]q
[SW2]vlan 200
[SW2-vlan200]int g0/0/2
[SW2-GigabitEthernet0/0/2]p l t
[SW2-GigabitEthernet0/0/2]p t a v a
[SW2-GigabitEthernet0/0/2]int vlanif 200
[SW2-Vlanif200]ip add 10.1.12.2 30[SW2]ip route-static 172.168.1.0 24 10.1.12.1[SW2]
SW3
<Huawei>
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW3
[SW3]int g0/0/1
[SW3-GigabitEthernet0/0/1]p l t
[SW3-GigabitEthernet0/0/1]p t a v a [SW3]vlan 20
[SW3-vlan20]int vlanif 20
[SW3-Vlanif20]ip add 192.168.2.254 24
[SW3-Vlanif20]q
[SW3]vlan 300
[SW3-vlan300]int g0/0/2
[SW3-GigabitEthernet0/0/2]p l t
[SW3-GigabitEthernet0/0/2]p t a v a
[SW3-GigabitEthernet0/0/2]int vlanif 300
[SW3-Vlanif300]ip add 10.1.13.2 30
[SW3-Vlanif300]q
[SW3]ping 192.168.2.1PING 192.168.2.1: 56 data bytes, press CTRL_C to breakReply from 192.168.2.1: bytes=56 Sequence=1 ttl=128 time=110 msReply from 192.168.2.1: bytes=56 Sequence=2 ttl=128 time=60 msReply from 192.168.2.1: bytes=56 Sequence=3 ttl=128 time=50 msReply from 192.168.2.1: bytes=56 Sequence=4 ttl=128 time=30 msReply from 192.168.2.1: bytes=56 Sequence=5 ttl=128 time=50 ms--- 192.168.2.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 30/60/110 ms[SW3]
[SW3]
[SW3]
<SW3>sys
Enter system view, return user view with Ctrl+Z.
[SW3]ip route-static 172.168.1.0 24 10.1.13.1
[SW3]
Dec 16 2023 22:19:13-08:00 SW3 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 13, the
change loop count is 0, and the maximum number of records is 4095.
[SW3]
[SW3]
SW1
<Huawei>
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW1
[SW1]vlan batch 200 300
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l t
[SW1-GigabitEthernet0/0/1]p t a v a
[SW1-GigabitEthernet0/0/1]int vlanif 200
[SW1-Vlanif200]ip add 10.1.12.1 30
[SW1-Vlanif200]int g0/0/2
[SW1-GigabitEthernet0/0/2]p l t
[SW1-GigabitEthernet0/0/2]p t a v a
[SW1-GigabitEthernet0/0/2]int vlanif 300
[SW1-Vlanif300]ip add 10.1.13.1 30[SW1-Vlanif300]q
[SW1]vlan 100
[SW1-vlan100]q
[SW1]int g0/0/3
[SW1-GigabitEthernet0/0/3]p l a
[SW1-GigabitEthernet0/0/3]p d v 100
[SW1-GigabitEthernet0/0/3]int vlanif 100
[SW1-Vlanif100]ip add 10.1.11.2 30
[SW1-Vlanif100]
[SW1-Vlanif100]
[SW1-Vlanif100]q
[SW1]ip route-static 192.168.1.0 24 10.1.12.2
[SW1]ip route-static 192.168.2.0 24 10.1.13.2
[SW1]ip route-static 172.168.1.0 24 10.1.11.1
[SW1]
R1
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 10.1.11.1 30
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 172.168.1.254 24
[R1-GigabitEthernet0/0/1]ping 172.168.1.1PING 172.168.1.1: 56 data bytes, press CTRL_C to breakReply from 172.168.1.1: bytes=56 Sequence=1 ttl=255 time=60 msReply from 172.168.1.1: bytes=56 Sequence=2 ttl=255 time=10 msReply from 172.168.1.1: bytes=56 Sequence=3 ttl=255 time=10 msReply from 172.168.1.1: bytes=56 Sequence=4 ttl=255 time=10 msReply from 172.168.1.1: bytes=56 Sequence=5 ttl=255 time=10 ms--- 172.168.1.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 10/20/60 ms[R1-GigabitEthernet0/0/1]
<R1>u t m
Info: Current terminal monitor is off.
<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]ip ro
[R1]ip route-s
[R1]ip route-static 0.0.0.0 0 10.1.11.2
[R1]
3.测试
PC1--->Server1
PC3--->Server1
Server1---PC1
Server1--->PC3