基礎配置:cisco交換機配置vlan(1)
vlan 配置思路 (access 、Trunk)
(1)創建Vlan
在基于IOS的交換機上配置靜態VLAN:
- switch# vlan database
- switch(vlan)# vlan vlan-num name vlan-name
- switch(vlan)# exit
- switch# configure teriminal
- switch(config)# interface interface module/number
- switch(config-if)# switchport mode access // 設置端口模式為access模式
- switch(config-if)# switchport access vlan vlan-num // 設置端口所屬的VLAN
- switch(config-if)# end
核驗配置:show vlan
(2)配置干道鏈路
干道是在兩臺catalyst交換機端口或catalyst交換機與路由器間的一條點對點鏈路。 干道鏈路可以承載多個vlan。
在基于IOS的交換機上配置干道鏈路
- switch(config)# interface interface mod/port
- switch(config-if)# switchport mode trunk // 設置端口模式為trunk模式
- switch(config-if)# switchport trunk encapsulation {isl|dotlq} // 設置trunk所封裝的幀
- switch(config-if)# switchport trunk allowed vlan remove vlan-list // 允許那些VLAN通過干路
- ( 附:switchport trunk allowed vlan {add | all | except | remove} vlan-list )
no switchport
no switchport // 把物理端口變成三層口,即把三層口當成路由器上的口,當將一個端口配置成三層端口之后,就可以在此端口上分配IP地址了,當然還是可以連接PC機的,。 路由口:路由口是指某一物理端口在端口配置狀態下用no switchport命令生成的端口,所有的三層都需要IP地址以實現路由交換。
配置舉例如下:
- Switch# configure terminal
- Switch(config)# interface gigabitethernet0/2
- Switch(config-if)# no switchport
- Switch(config-if)# ip address 192.20.135.21 255.255.255.0
- Switch(config-if)# no shutdown
- Switch(config-if)# end
附:show interfaces [interface-id] switchport // 顯示二層端口的狀態,可以用來決定此口是否為二層或三層口。 Eg:Switch# show interfaces fastethernet 0/1 switchport
VLAN的配置還有很多內容,本文只是介紹了一部分,希望大家多多掌握。
【編輯推薦】