一,实验拓扑:
二,实验需求:
1、pc1和pc3所在接口为access;属于vlan 2;P可以骄问pcepces不的一段;其中pc2可以访问pc4/pc5/pc6;
2、pc1/pc3与pc2/pc4/pc5/pc6不在同一网段;
3、所有pc通过DHCP获取Ip地址,且pc1/pc3可以正常访问pc2/pc4/pc5/pc6;
三,实验配置:
pc1到pc6的配置:
1,创建vlan
LSW1
[LSW1]vlan batch 2 to 6
LSW2
[LSW2]vlan batch 2 to 6
LSW3
[LSW3]vlan batch 2 to 6
2、接口划分vlan(pc1/3使用avvess模式,pc2/4/5/6使用hybrid)
LSW1
[LSW1]int g0/0/1
[LSW1-GigabitEthernet0/0/1]port link-type access
[LSW1-GigabitEthernet0/0/1]port default vlan 2
[LSW1-GigabitEthernet0/0/1]int g0/0/2
[LSW1-GigabitEthernet0/0/2]port hybrid pvid vlan 3
[LSW1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6
LSW2
[LSW2]int g0/0/1
[LSW2-GigabitEthernet0/0/1]port link-type access
[LSW2-GigabitEthernet0/0/1]port default vlan 2
[LSW2-GigabitEthernet0/0/1]int g0/0/2
[LSW2-GigabitEthernet0/0/2]port hybrid pvid vlan 4
[LSW2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6
LSW3
[LSW3]int g0/0/1
[LSW3-GigabitEthernet0/0/1]port hybrid pvid vlan 5
[LSW3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 to 5
[LSW3-GigabitEthernet0/0/1]int g0/0/2
[LSW3-GigabitEthernet0/0/2]port hybrid pvid vlan 6
[LSW3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 6
3、trunk干道
LSW1
[LSW1-GigabitEthernet0/0/2]int g0/0/3
[LSW1-GigabitEthernet0/0/3]port link-type trunk
[LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
LSW2
[LSW2-GigabitEthernet0/0/2]int g0/0/3
[LSW2-GigabitEthernet0/0/3]port link-type trunk
[LSW2-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
[LSW2-GigabitEthernet0/0/3]int g0/0/4
[LSW2-GigabitEthernet0/0/4]port link-type trunk
[LSW2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 to 6
LSW3
[LSW3-GigabitEthernet0/0/2]int g0/0/3
[LSW3-GigabitEthernet0/0/3]port link-type trunk
[LSW3-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
4、vlan间路由器
LSW1
[LSW1-GigabitEthernet0/0/3]int g0/0/4
[LSW1-GigabitEthernet0/0/4]port hybrid pvid vlan 1
[LSW1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 to 6
[LSW1-GigabitEthernet0/0/4]port hybrid tagged vlan 2
R1
[Huawei]sys R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
May 18 2024 19:14:29-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-GigabitEthernet0/0/1]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 18 2024 18:47:21-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 3Interface 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 up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
[R1]
[R1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R1]ip pool a
Info: It's successful to create an IP address pool.
[R1-ip-pool-a]net 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
Info: It's successful to create an IP address pool.
[R1-ip-pool-b]net 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
[R1-GigabitEthernet0/0/0.1]
查看:
测试:
PC2访问PC4/5/6
PC4访问PC6
PC5访问PC6
PC1访问平常/4/5/6
PC3访问PC2/4/5/6
配置成功!!!