思科交換機(jī)劃分vlan的命令
思科交換機(jī)怎么劃分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
//指定網(wǎng)關(guān)
Switch(config)#ip default-gateway 192.168.1.254
Switch(config)#end
//檢測(cè)配置
Switch#show vlan brief
//以上為檢測(cè)結(jié)果
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#
補(bǔ)充:
//刪除一個(gè)接口的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#
檢查一個(gè)特定端口的生成樹信息
Switch#show spanning-tree ?
Switch#show spanning-tree vlan ? 指定vlan顯示其STP配置
Switch#show spanning-tree vlan 10
【思科交換機(jī)劃分vlan的命令】相關(guān)文章: