一、实验设备
1、交换机:1台三层交换机、1台二层交换机
2、终 端:2台PC
二、实验拓扑
三、交换机的配置
1、LSW1的配置
Please press enter to start cmd line!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sy
[Huawei]sysname SW1 //设置交换机名称为SW1
[SW1]
[SW1]vlan batch 10 20 //创建vlan10、vlan20
[SW1]int vlan 10
[SW1-Vlanif10]ip address 192.168.10.254 24 //配置vlanif地址
[SW1-Vlanif10]q
[SW1]
[SW1]int vlan 20
[SW1-Vlanif20]ip address 192.168.20.254 24 //配置vlanif地址
[SW1-Vlanif20]
[SW1-Vlanif20]q
[SW1]
[SW1]int g0/0/1 //进入g0/0/1端口
[SW1-GigabitEthernet0/0/1]port link-type trunk //设置端口类型为trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all //放通所有vlan
[SW1-GigabitEthernet0/0/1]q
[SW1]
2、LSW2的配置
<Huawei>SYS
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW2
[SW2]
[SW2]vlan batch 10 20 //创建vlan10、vlan20
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk //设置端口类型为trunk
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all //放通所有vlan
[SW2-GigabitEthernet0/0/1]q
[SW2]
[SW2]int e0/0/1
[SW2-Ethernet0/0/1]port link-type access //接口类型设置为access
[SW2-Ethernet0/0/1]port default vlan 10 //将端口加入到vlan10
[SW2-Ethernet0/0/1]q
[SW2]int e0/0/2
[SW2-Ethernet0/0/2]
[SW2-Ethernet0/0/2]port link-type access //接口类型设置为access
[SW2-Ethernet0/0/2]port default vlan 20 //将端口加入到vlan10
[SW2-Ethernet0/0/2]q
[SW2]
3、PC1的配置
4、PC2的配置
四、不同Vlan间的访问
1、PC1访问PC2进行ping测试
2、PC2访问PC1行ping测试
总结:通过三层交换机可以实现不能vlan之间的访问。