思科交换机划分vlan的命令
思科交换机怎么划分vlan,基本配置命令是什么呢?下面跟yjbys小编一起来看看吧!
//添加vlan
Switch>enable
Switch#vlan data
Switch(vlan)#vlan 10 name v1
VLAN 10 added:
Name: v1
Switch(vlan)#vlan 20 name v2
VLAN 20 added:
Name: v2
Switch(vlan)#vlan 30 name v3
VLAN 30 added:
Name: v3
Switch(vlan)#exit
APPLY completed.
Exiting…
//为vlan添加接口
Switch#config t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int f0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport acc vlan 10
Switch(config-if)#no shutdown
Switch(config-if)#exit //留给管理员用
Switch(config)#int range f0/2-15
Switch(config-if-range)#switchport mode acc
Switch(config-if-range)#switchport acc vlan 20
Switch(config-if-range)#no sh
Switch(config-if-range)#exit
Switch(config)#int range f0/16-24
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 30
Switch(config-if-range)#no sh
Switch(config-if-range)#exit
//激活vlan,并且给vlan 10 添加ip以便管理
Switch(config)#int vlan 10
Switch(config-if)#ip add 192.168.1.1 255.255.255.0 //给vlan 10 添加ip以便管理
Switch(config-if)#no sh
Switch(config-if)#exit
Switch(config)#int vlan 20
Switch(config-if)#no sh
Switch(config-if)#exit
Switch(config)#int vlan 30
Switch(config-if)#no sh ^
Switch(config-if)#exit
//指定网关
Switch(config)#ip default-gateway 192.168.1.254
Switch(config)#end
//检测配置
Switch#show vlan brief
//以上为检测结果
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active
10 v1 active Fa0/1
20 v2 active 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
30 v3 active Fa0/16, Fa0/17, Fa0/18, Fa0/19
Fa0/20, Fa0/21, Fa0/22, Fa0/23
Fa0/24
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
Switch#
//保存配置
Switch#write
Building configuration…
[OK]
Switch#
补充:
//删除一个接口的.vlan
Switch>enable
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int f0/5
Switch(config-if)#no switchport access vlan
Switch(config-if)#end
Switch#
检查一个特定端口的生成树信息
Switch#show spanning-tree ?
Switch#show spanning-tree vlan ? 指定vlan显示其STP配置
Switch#show spanning-tree vlan 10
【思科交换机划分vlan的命令】相关文章: