基礎(chǔ)配置:cisco交換機(jī)配置vlan(1)
vlan 配置思路 (access 、Trunk)
(1)創(chuàng)建Vlan
在基于IOS的交換機(jī)上配置靜態(tài)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 // 設(shè)置端口模式為access模式
- switch(config-if)# switchport access vlan vlan-num // 設(shè)置端口所屬的VLAN
- switch(config-if)# end
核驗(yàn)配置:show vlan
(2)配置干道鏈路
干道是在兩臺(tái)catalyst交換機(jī)端口或catalyst交換機(jī)與路由器間的一條點(diǎn)對(duì)點(diǎn)鏈路。 干道鏈路可以承載多個(gè)vlan。
在基于IOS的交換機(jī)上配置干道鏈路
- switch(config)# interface interface mod/port
- switch(config-if)# switchport mode trunk // 設(shè)置端口模式為trunk模式
- switch(config-if)# switchport trunk encapsulation {isl|dotlq} // 設(shè)置trunk所封裝的幀
- switch(config-if)# switchport trunk allowed vlan remove vlan-list // 允許那些VLAN通過(guò)干路
- ( 附:switchport trunk allowed vlan {add | all | except | remove} vlan-list )
no switchport
no switchport // 把物理端口變成三層口,即把三層口當(dāng)成路由器上的口,當(dāng)將一個(gè)端口配置成三層端口之后,就可以在此端口上分配IP地址了,當(dāng)然還是可以連接PC機(jī)的,。 路由口:路由口是指某一物理端口在端口配置狀態(tài)下用no switchport命令生成的端口,所有的三層都需要IP地址以實(shí)現(xiàn)路由交換。
配置舉例如下:
- 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 // 顯示二層端口的狀態(tài),可以用來(lái)決定此口是否為二層或三層口。 Eg:Switch# show interfaces fastethernet 0/1 switchport
VLAN的配置還有很多內(nèi)容,本文只是介紹了一部分,希望大家多多掌握。
【編輯推薦】