SwitchA #show vlan id 10 !验证已创建了VLAN 10并已将F0/5端口划入VLAN 10中
VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------ 10 sales active Fa0/5
3.在交换机SwitchA上创建VLAN 20,并将F0/15口划分到VLAN 20中。
SwitchA(config)#vlan 20 !创建VLAN 20
SwitchA (config-vlan)#name technical ! 将VLAN 20 命名为technical SwitchA (config)#interface f0/15 !进入F0/15接口配置模式
SwitchA (config-if)#switchport access vlan20 !将F0/15端口划入VLAN 20
SwitchA #show vlan id 20 !验证已创建了VLAN 20并已将F0/15端口划入VLAN 20中
VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------ 20 technical active Fa0/5
4.在交换机SwitchA上与SwitchB相连的端口(此处为F0/24端口)定义为tag vlan 模式。
SwitchA (config)#interface f0/24 !进入接口配置模式
SwitchA (config-if)#switchport mode trunk !将F0/24口设置为tag vlan模式 SwitchA #show interfaces f0/24 switch !验证F0/24口已被设置为tag vlan 模式 Interface Switchport Mode Access Native Protected VLAN lists ---------- ---------- --------- ------- -------- --------- -------------------
Fa0/24 Enabled Trunk 1 1 Disabled All
5.在交换机SwitchB上创建VLAN 10,并将F0/5端口划入VLAN 10中。
SwitchB(config)#vlan 10 !创建VLAN 10
SwitchB (config-vlan)#name sales ! 将VLAN 10 命名为sales SwitchB (config)#interface f0/5 !进入F0/5接口配置模式
SwitchB (config-if)#switchport access vlan10 !将F0/5端口划入VLAN 10
SwitchB #show vlan id 10 !验证已创建了VLAN 10并已将F0/5端口划入VLAN 10中
VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------ 10 sales active Fa0/5
6.在交换机SwitchB上与SwitchA相连的端口(此处为F0/24端口)定义为tag vlan 模式。
SwitchB (config)#interface f0/24 !进入接口配置模式
SwitchB (config-if)#switchport mode trunk !将F0/24口设置为tag vlan模式 SwitchB #show interfaces f0/24 switch !验证F0/24口已被设置为tag vlan 模式
Interface Switchport Mode Access Native Protected VLAN lists ---------- ---------- --------- ------- -------- --------- -------------------
Fa0/24 Enabled Trunk 1 1 Disabled All
7.验证PC1与PC3能相互ping通,但PC2与PC3不能相互ping通。
C:\\ >ping 192.168.0.1 !从PC1上ping PC3 C:\\ >ping 192.168.0.2 !从PC3上ping PC1 C:\\>ping 192.168.0.15 !从PC2上ping PC3
相关推荐: