实验要求
1、pc1和pc3所在接口为access;属于vlan 2;
pc2/pc4/pc5/pc6处于同一网段;其中pc2可以访问pc4/pc5/pc6;
pc4可以访问pc6;pc5不能访问pc6;
2、pc1/pc3与pc2/pc4/pc5/pc6不在同一个网段;
3、所有pc通过DHCP获取IP地址,且pc1/pc3可以正常访问pc2/pc4/pc5/pc6;
修改PC获取IP方式为DHCP
交换机配置
分析拓扑图得知,vlan2单独为一个网段,设置为access口,而其他局域网为一个网段,但又因为具有多个vlan所以用hybird口。又因为路由器子接口可以接收带标签的数据帧,而物理接口不能接收带标签的数据帧且在路由器与交换机连接的那个接口需要通过多个vlan的数据流,故将其PVID设置为vlan1
LSW1:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname LSW1
[LSW1]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.
May 17 2024 22:41:30-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 5, the
change loop count is 0, and the maximum number of records is 4095.
[LSW1]int GigabitEthernet 0/0/1
[LSW1-GigabitEthernet0/0/1]port link-type access
[LSW1-GigabitEthernet0/0/1]port default vlan 2
[LSW1-GigabitEthernet0/0/1]
May 17 2024 22:41:50-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 7, the
change loop count is 0, and the maximum number of records is 4095.
[LSW1-GigabitEthernet0/0/1]int g0/0/2
[LSW1-GigabitEthernet0/0/2]port hybrid pvid vlan 3
[LSW1-GigabitEthernet0/0/2]
May 17 2024 22:42:20-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 8, the
change loop count is 0, and the maximum number of records is 4095.
[LSW1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6
May 17 2024 22:42:50-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 9, the
change loop count is 0, and the maximum number of records is 4095.
[LSW1-GigabitEthernet0/0/2]int g0/0/3
[LSW1-GigabitEthernet0/0/3]port link-type trunk
May 17 2024 22:43:10-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 10, the
change loop count is 0, and the maximum number of records is 4095.
[LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
[LSW1-GigabitEthernet0/0/3]int g0/0/4
[LSW1-GigabitEthernet0/0/4]
May 17 2024 22:43:40-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 11, the
change loop count is 0, and the maximum number of records is 4095.
[LSW1-GigabitEthernet0/0/4]port hybrid pvid vlan 1
May 17 2024 22:44:00-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.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.
[LSW1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 to 6
LSW2:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname LSW2
[LSW2]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.
[LSW2]int g0/0/1
May 17 2024 22:47:59-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 6, the
change loop count is 0, and the maximum number of records is 4095.
[LSW2-GigabitEthernet0/0/1]port link-type access
[LSW2-GigabitEthernet0/0/1]port default vlan 2
[LSW2-GigabitEthernet0/0/1]int g0/0/2
May 17 2024 22:48:20-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 7, the
change loop count is 0, and the maximum number of records is 4095.
[LSW2-GigabitEthernet0/0/2]port hybrid pvid vlan 4
May 17 2024 22:48:40-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 8, the
change loop count is 0, and the maximum number of records is 4095.
[LSW2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6
[LSW2-GigabitEthernet0/0/2]int g0/0/3
[LSW2-GigabitEthernet0/0/3]
May 17 2024 22:48:50-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 9, the
change loop count is 0, and the maximum number of records is 4095.
[LSW2-GigabitEthernet0/0/3]port link-type trunk
[LSW2-GigabitEthernet0/0/3]
May 17 2024 22:49:00-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 10, the
change loop count is 0, and the maximum number of records is 4095.
[LSW2-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
May 17 2024 22:49:20-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 11, the
change loop count is 0, and the maximum number of records is 4095.
[LSW2-GigabitEthernet0/0/3]int g0/0/4
[LSW2-GigabitEthernet0/0/4]port link-type trunk
May 17 2024 22:49:40-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.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.6
[LSW2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 to 6
LSW3:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname LSW3
May 17 2024 22:51:51-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 4, the
change loop count is 0, and the maximum number of records is 4095.
[LSW3]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.
May 17 2024 22:52:01-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 5, the
change loop count is 0, and the maximum number of records is 4095.
[LSW3]int GigabitEthernet 0/0/1
[LSW3-GigabitEthernet0/0/1]port hybrid pvid vlan 5
May 17 2024 22:52:31-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 6, the
change loop count is 0, and the maximum number of records is 4095.
[LSW3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 to 5
[LSW3-GigabitEthernet0/0/1]int g0/0/2
May 17 2024 22:52:41-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 7, the
change loop count is 0, and the maximum number of records is 4095.
[LSW3-GigabitEthernet0/0/2]port hybrid pvid vlan 6
May 17 2024 22:53:01-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 8, the
change loop count is 0, and the maximum number of records is 4095.
[LSW3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 6
[LSW3-GigabitEthernet0/0/2]
May 17 2024 22:53:11-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 9, the
change loop count is 0, and the maximum number of records is 4095.
[LSW3-GigabitEthernet0/0/2]int g0/0/4
[LSW3-GigabitEthernet0/0/4]port link-type trunk
May 17 2024 22:53:32-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 10, the
change loop count is 0, and the maximum number of records is 4095.
[LSW3-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 to 6
路由器需要通过vlan2的数据帧:
[LSW1]int g0/0/4
[LSW1-GigabitEthernet0/0/4]port hybrid tagged vlan 2
LSW1:
LSW2:
LSW3:
路由器配置
DHCP
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/0]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]ip add 192.168.2.1 24
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 2
May 17 2024 23:01:33-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0.1 has entered the UP state.
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
[R1-GigabitEthernet0/0/0.1]q
[R1]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 3
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.1/24 up up
GigabitEthernet0/0/0.1 192.168.2.1/24 up down
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
[R1]
[R1]dhcp enable
[R1]ip pool a
[R1-ip-pool-a]network 192.168.1.0 mask 24
[R1-ip-pool-a]gateway-list 192.168.1.1
[R1-ip-pool-a]dns-list 8.8.8.8
[R1-ip-pool-a]q
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]dhcp select global
[R1-GigabitEthernet0/0/0]q
[R1]ip pool b
[R1-ip-pool-b]network 192.168.2.0 mask 24
[R1-ip-pool-b]gateway-list 192.168.2.1
[R1-ip-pool-b]dns-list 8.8.8.8
[R1-ip-pool-b]q
[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]dhcp select global
PC1:
PC2/3/4/5/6同上
PC2访问PC4/5/6:
检查发现全网通