命令

命令功能

configure terminal

进入全局配置模式

vlan vlan-id

创建VLAN命令

name vlan-name

给创建的VLAN添加名称

end

结束配置,退回特权模式

show vlan {name vlan-name | id vlan-id}

查看配置完成的结果

copy running-config startup config

将配置信息保存

no vlan vlan-id

删除已存在的VLAN

interface interface-id

进入指定接口

shutdown

关闭指定接口

no shutdown

开启指定接口

switchport mode access

将接口的模式设为访问模式

switchport access vlan vlan-id

将接口加入指定的VLAN

switchport mode dynamic desirable

将接口设置为动态主动自适应模式

switchport mode dynamic auto

将接口设置为动态被动自适应模式

switchport mode trunk

将接口设置为干道模式

switchport nonegotiate

将接口设置为不协商模式,关闭DTP协议

switchport trunk encapsulation dot1q

设置接口的干道协议

switchport trunk encapsulation isl

设置接口的干道协议

switchport trunk native vlan vlan-id

设置本征VLAN

vtp mode m ode

设置VTP的工作模式

vtp domain domain-name

设置VTP工作的域名

vtp password password

设置VTP的密码

vtp version v ersion-number

设置VTP工作版本,有12两个版本

vtp pruning

配置VTP裁剪功能

show vtp status

查看VTP信息

private-vlan primary

设置PVLAN为主VLAN

private-vlan isolated

设置PVLAN为隔离VLAN

private-vlan community

设置PVLAN为共同体VLAN

private-vlan association vlan-id

设置和主VLAN关联的次VLAN信息

switchport private-vlan host-association vlan-id

设置接口和主VLAN和次VLAN的关联

private-vlan mapping vlan-id vlan-id vlan-id…

设置接口和VLAN的映射关联