VLAN划分步骤与命令
第一步:交换机恢复出厂设置(思考怎么进入管理模式)
Switch# set default
Switch# write
Switch# reload
第二步:给交换机设置标识符和管理IP
交换机A:
Switch(config)#hostname switchA
SwitchA(config)#interface vlan1 //默认全是VLAN1
SwitchA(config-if-vlan1)#ip address 192.168.1.1 255.255.255.0
SwitchA(config-if-vlan1)#no shutdown
SwitchA(config-if-vlan)exit
第三步:创建VLAN100和VLAN200
Switch(config)vlan 100 //也可以给每个VLAN设置IP地址
Switch(config-if-vlan1)#name teacher
Switch#show vlan
第四步:给VLAN100和VLAN200添加端口
Switch(config)vlan 100 //进入vlan100
Switch(config-vlan100)#switchport interface Ethernet 0/0/1-2 //给VLAN100加入端口1和2
验证配置
Switch#show vlan
第五步:设置交换机trunk端口
交换机A:
switchA(config)#interface eth 0/0/24
switchA(config-ethernet0/0/24)#switchport mode trunk
switchA(config-ethernet0/0/24)#switchport trunk allowed vlan all
//也可以只允许其中几个VLAN allowed vlan 100;200
switchA(config-ethernet0/0/24)#exit
单独把端口划入VLAN
switchA(config-ethernet0/0/23)#switchport access vlan 200
验证配置:
switchA#show vlan
转载于:https://blog.51cto.com/nettao/210729