华为交换机配置实例
本实验目的是将PC1与PC3划分在一个VLAN下并实现
将PC2与PC5划分在一个VLAN下
2PC的IP设置
IP地址 | 子网掩码 | |
---|---|---|
PC1 | 192.168.1.1 | 255.255.255.0 |
PC2 | 192.168.1.2 | 255.255.255.0 |
PC3 | 192.168.1.3 | 255.255.255.0 |
PC5 | 192.168.1.4 | 255.255.255.0 |
3交换机配置
<Huawei>system-view
[Huawei]vlan 10
[Huawei-vlan10]
Jul 9 2020 09:23:40-08:00 Huawei 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, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-vlan10]q
[Huawei]vlan 20
[Huawei-vlan20]
Jul 9 2020 09:24:00-08:00 Huawei 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, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-vlan20]q
[Huawei]interface Ethernet 0/0/1
[Huawei-Ethernet0/0/1]port link-type access
[Huawei-Ethernet0/0/1]port default vlan 10
[Huawei]interface Ethernet 0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port default vlan 10
[Huawei]interface Ethernet 0/0/3
[Huawei-Ethernet0/0/3]port link-type trunk
[Huawei-Ethernet0/0/3]
Jul 9 2020 09:29:40-08:00 Huawei 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, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei-Ethernet0/0/3]port trunk allow-pass vlan 10 20
[Huawei-Ethernet0/0/3]q
[Huawei]interface Ethernet 0/0/4
[Huawei-Ethernet0/0/4]port link-type trunk
[Huawei-Ethernet0/0/4]port trunk allow-pass vlan 10 20
两台交换机配置相同
测试
在PC1上测试
Welcome to use PC Simulator!
PC>ping 192.168.1.3
Ping 192.168.1.3: 32 data bytes, Press Ctrl_C to break
From 192.168.1.3: bytes=32 seq=1 ttl=128 time=62 ms
From 192.168.1.3: bytes=32 seq=2 ttl=128 time=47 ms
From 192.168.1.3: bytes=32 seq=3 ttl=128 time=63 ms
From 192.168.1.3: bytes=32 seq=4 ttl=128 time=63 ms
From 192.168.1.3: bytes=32 seq=5 ttl=128 time=62 ms
--- 192.168.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 47/59/63 ms
PC>192.168.1.2
Invalid command!
PC>ping 192.168.1.2
Ping 192.168.1.2: 32 data bytes, Press Ctrl_C to break
From 192.168.1.1: Destination host unreachable
From 192.168.1.1: Destination host unreachable
From 192.168.1.1: Destination host unreachable
From 192.168.1.1: Destination host unreachable
From 192.168.1.1: Destination host unreachable
--- 192.168.1.2 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
PC>ping 192.168.1.4
Ping 192.168.1.4: 32 data bytes, Press Ctrl_C to break
From 192.168.1.1: Destination host unreachable
From 192.168.1.1: Destination host unreachable
From 192.168.1.1: Destination host unreachable
From 192.168.1.1: Destination host unreachable
From 192.168.1.1: Destination host unreachable
--- 192.168.1.4 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
** PC1与PC3可以通信,与PC2\PC5不能通信. **