资源简介 VLAN与Trunk配置一、实训拓扑说明本次实训采用2台二层交换机(Switch0、Switch1)+4台PC(PC0~PC3)的拓扑:- PC0(192.168.10.10/24)→ 连接Switch0的Fa0/1端口- PC1(192.168.20.10/24)→ 连接Switch0的Fa0/2端口- PC2(192.168.10.11/24)→ 连接Switch1的Fa0/1端口- PC3(192.168.20.11/24)→ 连接Switch1的Fa0/2端口- Switch0与Switch1通过Fa0/4端口互联拓扑结构:二、实验目标1. 配置VLAN,将PC0/PC2划分到VLAN10,PC1/PC3划分到VLAN20;2. 配置Trunk中继,实现跨交换机的同VLAN通信;3. 验证同VLAN设备的连通性(PC0 PC2、PC1 PC3)。实训步骤步骤1:配置IP地址主机 IP地址PC0 192.168.10.10PC1 192.168.20.10PC2 192.168.10.11PC3 192.168.20.11步骤2:配置VLAN与端口VLAN10 PC0,PC2VLAN20 PC1,PC3在Switch0上配置VLAN与端口1. 进入全局配置模式,创建VLAN10、VLAN20:Switch0>enableSwitch0#configure terminalSwitch0(config)#vlan 10Switch0(config-vlan)#name ROOM1Switch0(config-vlan)#exitSwitch0(config)#vlan 20Switch0(config-vlan)#name ROOM2Switch0(config-vlan)#exit 2. 将端口划分到对应VLAN:// Fa0/1→VLAN10(PC0)Switch0(config)#interface fa0/1Switch0(config-if)#switchport access vlan 10Switch0(config-if)#exit// Fa0/2→VLAN20(PC1)Switch0(config)#interface fa0/2Switch0(config-if)#switchport access vlan 20Switch0(config-if)#exit 3. 配置互联端口为Trunk:Switch0(config)#interface fa0/4Switch0(config-if)#switchport mode trunkSwitch0(config-if)#switchport trunk allowed vlan 10,20 // 允许VLAN10、20通过Switch0(config-if)#exit 在Switch1上配置VLAN与端口1. 进入全局配置模式,创建VLAN10、VLAN20:Switch1>enableSwitch1#configure terminalSwitch1(config)#vlan 10Switch1(config-vlan)#name ROOM1Switch1(config-vlan)#exitSwitch1(config)#vlan 20Switch1(config-vlan)#name ROOM2Switch1(config-vlan)#exit 2. 将端口划分到对应VLAN:// Fa0/1→VLAN10(PC2)Switch1(config)#interface fa0/1Switch1(config-if)#switchport access vlan 10Switch1(config-if)#exit// Fa0/2→VLAN20(PC3)Switch1(config)#interface fa0/2Switch1(config-if)#switchport access vlan 20Switch1(config-if)#exit 3. 配置互联端口为Trunk:Switch1(config)#interface fa0/4Switch1(config-if)#switchport mode trunkSwitch1(config-if)#switchport trunk allowed vlan 10,20Switch1(config-if)#exit 步骤3:连通性验证1. 在PC0上ping PC2(192.168.10.11),应能ping通;2. 在PC1上ping PC3(192.168.20.11),应能ping通;3. (可选)验证跨VLAN不通:PC0 ping PC1(192.168.20.10),应无法ping通(VLAN隔离效果)。四、常见问题排查- 若同VLAN不通:检查端口VLAN划分是否正确( show vlan brief )、Trunk是否允许对应VLAN( show interface trunk );- 若Trunk不生效:检查互联端口是否为Trunk模式( switchport mode trunk )。五、实训成果提交拓扑结构图:ping命令测试结果 展开更多...... 收起↑ 资源预览