Cisco VLAN 常用命令

查看vlan的配置信息

sw1#show vlan brief

swi#show vlan vlan-id

引申:

在全局模式下配置vlan
sw1(config)#vlan vlan-id //添加一个vlan
sw1(config-vlan)# name vlan-name //给vlan取个名字
在vlan数据库创建vlan
sw1#vlan database //进入vlan数据库
sw1(vlan)#vlan vlan-id name qq //添加一个vlan 名字为qq
sw1(vlan)#exit
删除已创建的vlan
sw1#vlan database
sw1(vlan)# no vlan vlan-id
或者可以 sw1(config)#no vlan 2
将端口加入到vlan
sw1(config)#int f0/1 //进入端口模式
sw1(config-if)#swi acc vlan vlan-id //把端口加入到某个vlan
swi(config-if)#no swi acc vlan vlan-id //将端口从某个vlan上删除
要同时把多个端口加入到某个vlan:
sw1(config)#int range f0/0-10
sw1(config-if-range)#swi acc vlan vlan-id


三层交换机
Switch#vlan database //进入VLAN模式
Switch(vlan)#vlan 10 //创建VLAN10
VLAN 10 added:
Name: VLAN0010
Switch(vlan)#vlan 20 //创建VLAN20
VLAN 20 added:
Name: VLAN0020
Switch(vlan)#exit
Switch#show vlan //查看VLAN
VLAN Name Status Ports


1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig0/1, Gig0/2
10 VLAN0010 active
20 VLAN0020 active
Switch#conf t
Switch(config)#int f0/1 //进入接口
Switch(config-if)#no switchport //关闭二层模式
Switch(config-if)#ip address 192.168.1.1 255.255.255.0 //配置IP
Switch(config-if)#end

你可能感兴趣的:(#,思科Cisco,cisco)