拓扑图:
PC1:
PC2:
CE-1:
首先进入系统试图,修改名称
<HUAWEI>sys
<HUAWEI>system-view
Enter system view, return user view with return command.
[~HUAWEI]sysname CE-1
[*HUAWEI]com
[~CE-1]
配置交换机GE1/0/1接口类型为access,GE1/0/2口为trunk,体验不同类型交换机口配置方式
[~CE-1]vlan batch 10 20
Info: Operating, please wait for a moment...........done.
[*CE-1]com
[~CE-1]int ge1/0/1
[~CE-1-GE1/0/1]port link-type access
[~CE-1-GE1/0/1]port default vlan 10
[*CE-1-GE1/0/1]com
[~CE-1-GE1/0/1]q
[~CE-1]int ge1/0/2
[~CE-1-GE1/0/2]port link-type trunk
[*CE-1-GE1/0/2]port trunk allow-pass vlan 20
[*CE-1-GE1/0/2]com
[~CE-1-GE1/0/2]
[~CE-1-GE1/0/2]port trunk pvid vlan 20
[*CE-1-GE1/0/2]com
配置VLAN10和20的网关和掩码
[~CE-1]int vlanif10
[*CE-1-Vlanif10]ip a 192.168.10.254 24
Info: Operating, please wait for a moment......done.
[*CE-1-Vlanif10]com
[~CE-1-Vlanif10]q
[~CE-1]int vlanif20
[*CE-1-Vlanif20]ip a 192.168.20.254 24
[*CE-1-Vlanif20]com
[~CE-1-Vlanif20]q
结果
PC1:
Welcome to use PC Simulators!
PC> ping 192.168.10.254
PING 192.168.10.254 (192.168.10.254) 56(84) bytes of data.
64 bytes from 192.168.10.254: icmp_seq=1 ttl=254 time=139 ms
64 bytes from 192.168.10.254: icmp_seq=2 ttl=254 time=9.48 ms
64 bytes from 192.168.10.254: icmp_seq=3 ttl=254 time=5.29 ms
64 bytes from 192.168.10.254: icmp_seq=4 ttl=254 time=15.7 ms
64 bytes from 192.168.10.254: icmp_seq=5 ttl=254 time=2.72 ms
^C
--- 192.168.10.254 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4016ms
rtt min/avg/max/mdev = 2.716/34.447/139.008/52.465 ms
PC> ping 192.168.20.1
PING 192.168.20.1 (192.168.20.1) 56(84) bytes of data.
64 bytes from 192.168.20.1: icmp_seq=1 ttl=63 time=50.6 ms
64 bytes from 192.168.20.1: icmp_seq=2 ttl=63 time=52.2 ms
64 bytes from 192.168.20.1: icmp_seq=3 ttl=63 time=8.71 ms
64 bytes from 192.168.20.1: icmp_seq=4 ttl=63 time=54.2 ms
^C
--- 192.168.20.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3018ms
rtt min/avg/max/mdev = 8.708/41.442/54.218/18.941 ms
PC>
PC2:
Welcome to use PC Simulators!
PC> ping 192.168.20.254
PING 192.168.20.254 (192.168.20.254) 56(84) bytes of data.
64 bytes from 192.168.20.254: icmp_seq=1 ttl=254 time=8.87 ms
64 bytes from 192.168.20.254: icmp_seq=2 ttl=254 time=3.18 ms
64 bytes from 192.168.20.254: icmp_seq=3 ttl=254 time=6.52 ms
^C
--- 192.168.20.254 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2016ms
rtt min/avg/max/mdev = 3.180/6.189/8.872/2.335 ms
PC> ping 192.168.10.1
PING 192.168.10.1 (192.168.10.1) 56(84) bytes of data.
64 bytes from 192.168.10.1: icmp_seq=1 ttl=63 time=10.3 ms
64 bytes from 192.168.10.1: icmp_seq=2 ttl=63 time=15.7 ms
64 bytes from 192.168.10.1: icmp_seq=3 ttl=63 time=49.9 ms
^C
--- 192.168.10.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2016ms
rtt min/avg/max/mdev = 10.348/25.321/49.934/17.539 ms
PC>