1. 創(chuàng)建、刪除VLAN
注意:在配置狀態(tài)(config)下進(jìn)行配置。
創(chuàng)建vlan :
Switch(config)#vlan vlan-id
命名 vlan:
Switch(config-vlan)#vlan-name
或者在database狀態(tài)下創(chuàng)建并且命名vlan:
Switch#vlan database
Switch#(vlan)vlan vlan-id name vlan-name
刪除vlan:
Switch(config-vlan):no vlan vlan-id
Switch(vlan)#no vlan vlan-id
查看 vlan:
Switch#show vlan
Switch#show vlan brief
保存設(shè)置:
Switch#copy running-config startup-config
2. 在vlan中添加、刪除端口
注意:進(jìn)入要分配的端口,在端口狀態(tài)下。
定義二層端口:
Switch(config-if)# Switch(config)#switichport mode access
把端口分配給vlan:
Switch(config-if)#switchport access vlan vlan-id
查看端口的vlan 配置情況:
Switch#show interface interface-id switchport
3. 在交換機(jī)上配置trunk
注意:在接口狀態(tài)一進(jìn)行配置。
自動協(xié)商是否成為中繼端口:
Switch(config-if)#switchport mode dynamic auto
把端口設(shè)置為中繼端口進(jìn)行主動協(xié)商:
Switch(config-if)#switchport mode dynamic desirable
把端口設(shè)置為強(qiáng)制中繼端口:
Switch(config-if)#switchport mode dynamic trunk
把端口設(shè)定為永久中繼模式,但關(guān)閉協(xié)商機(jī)制:
Switch(config-if)#switchport nonegotiate
查看有關(guān)switchport的設(shè)置:
Switch#show interface interface—id switchport
4.從Trunk中添加,刪除VLAN
注意:在斷口配置狀態(tài)下進(jìn)行配置,并且端口是中繼狀態(tài)。
將端口配置為中繼端口:
Switch(config-if)#switchport mode trunk
在Trunk中刪除一個VLAN:
Switch(config-if)#switchport trunk allowed vlan remore vlan—id
在Trunk中天家一個VLAN
Switch(config-if)#switchport trunk allowed vlan add vlan—id
5.在交換機(jī)上配置Channel(以太網(wǎng)通道):
注意:在接口模式下配置,并且配置Channel的接口必須是相連的,通道兩邊要在同一個組中。
如果使用PAgP協(xié)議:
選擇需要配置Channel的端口,進(jìn)入虛擬接口配置:
Switch(config-if)#interface range fasternet0/1-2
被動協(xié)商配置Channel:
Switch(config-if)#channel-group channel-group-number mode auto
主動協(xié)商配置Channel:
Switch(config-if)#channel-group channel-group-number mode on
如果使用LACP協(xié)議,配置如下:
被動協(xié)商配置:
Switch(config-if)#channel-group channel-group-number mode passive
Switch(config-if)#channel-group channel-group-number mode active
查看Channel配置:
Switch#show etherchannel channel-group-number summary
6.指定在組成Channel的鏈路之間實(shí)現(xiàn)負(fù)載均衡技術(shù):
注意:dst-mac,src-mac參數(shù)用來指定基于目的mac還是源mac實(shí)現(xiàn)負(fù)載均衡。
在已經(jīng)組成的Channel中實(shí)現(xiàn)基于目的地址的負(fù)載均衡:
Switch(config-if)#port-channel load-balance dst-mac
在已經(jīng)組成的Channel中實(shí)現(xiàn)基于源地址的負(fù)載均衡:
Switch(config-if)#port-channel load-balance src-mac
查看負(fù)載均衡的配制:
Switch#show pagp channelgroup-number counters
7.創(chuàng)建VTP域和配置命令:
注意:在培植狀態(tài)下。
創(chuàng)建一個VTP域:
Switch(config-if)#vtp domain domain-name
配置VTP服務(wù)器模式:
Switch(config)#vtp mode server
配置VTP客戶端模式:
Switch(config)#vtp mode client
配置VTP 透明模式:
Switch(config)#vtp mode transparent
配置VTP域口令:
Switch(config)#vtp password mypassword
在整個域內(nèi)啟動VTP修剪:
Switch(config)#vtp pruning
從可修建列表中去除VLAN:
Switch(config)#switchport trunk pruning vlan remore vlan-id
查看VTP的修剪配置:
Switch#show vtp status
Switch#show interface interface-id switchport
VTP 版本的配置(默認(rèn)情況下使用的是version1):
Switch(config)#vtp version 2
8.Spanning-tree的配置:
注意:在配置模式下操作:
在VLAN上啟動生成樹:
Switch(config-if)#spanning-tree vlan vlan-id
查看Spanning-tree的詳細(xì)狀態(tài)信息:
Switch#show spanning-tree vlan vlan-id detail
使用命令建立根網(wǎng)橋:
Switch(config)#spanning-tree vlan vlan-id root primary
使用命令建立備用網(wǎng)橋(當(dāng)根橋故障的時候,自動生成根橋):
Switch(config)#spanning-tree vlan vlan-id root secondary
使用命令修改優(yōu)先級配置根網(wǎng)橋(取值范圍0-65535):
Switch(config)#spanning-tree vlan vlan-id priority bridge-priority
在接口模式下使用命令修改端口成本(取值范圍0-200000000,如果不指定VLAN則修改所
有VLAN的端口成本):
Switch(config-if)#spanning-tree vlan vlan-id cost cost
在借口模式下使用命令修改端口優(yōu)先級(取值范圍0-255):
Switch(config-if)#spanning-tree vlan vlan-id port-priority priority
查看配置:
Switch#show spanning-tree interface interface-id detail
9.修改Spanning-tree記時器:
注意:在配置模式下修改。
修改HELLO時間(缺省2秒,最大10秒):
Switch(config)#spanning-tree vlan vlan-id hello-time seconds
修改轉(zhuǎn)發(fā)延遲記時器(缺省15秒,取值范圍4-30):
Switch(config)#spanning-tree vlan vlan-id forward-time seconds