1、2950交換機簡明配置維護手冊xx商業機器公司20xx-12-14目錄說明3產品特性3配置端口4配置一組端口4配置二層端口6配置端口速率及雙工模式6端口描述7監控及維護端口8監控端口和控制器的狀態8刷新、重置端口及計數器10關閉和打開端口10配置VLAN11理解VLAN11可支持的VLAN12配置正常范圍的VLAN12生成、修改以太網VLAN13刪除VLAN14將端口分配給一個VLAN15配置VLAN Trunks16使用STP實現負載均衡19配置Cluster23說明本手冊只包括日常使用的有關命令及特性,其它未涉及的命令及特性請參考英文的詳細配置手冊。產品特性2950是只支持二層的交換機支持
2、VLAN 到250個VLAN 支持VLAN ID從1到4094( IEEE 8xx.1Q 標準) 支持ISL及IEEE 8xx.1Q封裝安全 支持IOS標準的密碼保護 支持標準及擴展的訪問列表來定義安全策略 支持基于VLAN的訪問列表監視 交換機LED指示端口狀態 SPAN及遠端SPAN (RSPAN) 可以監視任何端口或VLAN的流量 內置支持四組的RMON監控功能(歷史、統計、告警及事件)配置端口配置一組端口命令 目的 Step1 configure terminal進入配置狀態Step2 interface range port-range 進入組配置狀態Step3 可以使用平時的端口配
3、置命令進行配置Step4 end退回Step5 show interfaces interface-id驗證配置Step6 copy running-config startup-config保存當使用interface range命令時有如下的規則: 有效的組范圍:o vlan從1 到4094 o fastethernet 槽位/first port - last port, 槽位為0o gigabitethernet槽位/first port - last port,槽位為0o port-channel port-channel-number - port-channel-number,
4、port-channel號從1到64 端口號之間需要加入空格,如:interface range fastethernet 0/15 是有效的,而interface range fastethernet 0/1-5 是無效的. interface range 命令只能配置已經存在的interface vlan 所有在同一組的端口必須是相同類別的。見以下例子:Switch# configure terminalSwitch(config)# interface range fastethernet0/1 - 5 Switch(config-if-range)# no shutdown Switc
5、h(config-if-range)#*Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up*Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to up*Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up*Oct 6 08:24:35: %LINK-3-UPDOWN: Interface F
6、astEthernet0/4, changed state to up*Oct 6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet0/5, changed state to up*Oct 6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/05, changed state to up*Oct 6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, ch
7、anged state to up*Oct 6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up 以下的例子顯示使用句號來配置不同類型端口的組:Switch# configure terminalSwitch(config)# interface range fastethernet0/1 - 3, gigabitethernet0/1 - 2 Switch(config-if-range)# no shutdown Switch(config-if-ra
8、nge)#*Oct 6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up*Oct 6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to up*Oct 6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up*Oct 6 08:29:28: %LINK-3-UPDOWN: Interface GigabitEthernet
9、0/1, changed state to up*Oct 6 08:29:28: %LINK-3-UPDOWN: Interface GigabitEthernet0/2, changed state to up*Oct 6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/ 1, changed state to up*Oct 6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/ 2, change
10、d state to up*Oct 6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/ 3, changed state to up 配置二層端口2950的所有端口缺省的端口都是二層口,如果此端口已經配置成三層端口的話,則需要用switchport來使其成為二層端口。配置端口速率及雙工模式可以配置快速以太口的速率為10/100Mbps及千兆以太口的速率為10/100/1000-Mbps; 但對于GBIC端口則不能配置速率及雙工模式,有時可以配置nonegotiate,當需要聯接不支持自適應的其它千
11、兆端口時命令目的 Step1 configure terminal進入配置狀態.Step2 interface interface-id進入端口配置狀態.Step3 speed 10 | 100 | 1000 | auto | nonegotiate設置端口速率 注1000 只工作在千兆口. GBIC模塊只工作在1000 Mbps下. nonegotiate 只能在這些GBIC上用 1000BASE-SX, -LX, and -ZX GBIC.Step4 duplex auto | full | half設置全雙工或半雙工. Step5 end退出Step6 show interfaces i
12、nterface-id顯示有關配置情況Step7 copy running-config startup-config保存Switch# configure terminalSwitch(config)# interface fastethernet0/3Switch(config-if)# speed 10Switch(config-if)# duplex half端口描述 命令目的 Step1 configure terminal進入配置模式Step2 interface interface-id進入要加入描述的端口Step3 description string加入描述 (最多240個字
13、符).Step4 end退回.Step5 show interfaces interface-id descriptionorshow running-config驗證.Step6 copy running-config startup-config保存Use the no description interface configuration command to delete the description.This example shows how to add a description on Fast Ethernet interface 0/4 and to verify the
14、 description:Switch# config terminalEnter configuration commands, one per line. End with CNTL/Z.Switch(config)# interface fastethernet0/4Switch(config-if)# description Connects to MarketingSwitch(config-if)# endSwitch# show interfaces fastethernet0/4 descriptionInterface Status Protocol DescriptionF
15、a0/4 up down Connects to Marketing監控及維護端口監控端口和控制器的狀態主要命令見下表:Show Commands for Interfaces Command 目的 show interfaces interface-id顯示所有端口或某一端口的狀態和配置.show interfaces interface-id status err-disabled顯示一系列端口的狀態或錯誤關閉的狀態show interfaces interface-id switchport顯示二層端口的狀態,可以用來決定此口是否為二層或三層口。show interfaces inter
16、face-id description顯示端口描述show running-config interface interface-id顯示當前配置中的端口配置情況show version顯示軟硬件等情況舉例如下:Switch# show interfaces status Port Name Status Vlan Duplex Speed TypeGi0/1 connected routed a-full a-100 10/100/1000BaseTXGi0/2 wce server disabled routed auto auto 10/100/1000Base TXGi0/3 ip w
17、ccp web-cache notconnect routed auto auto 10/100/1000Base TXGi0/4 notconnect routed auto auto 10/100/1000Base TXGi0/5 notconnect routed auto auto 10/100/1000Base TXGi0/6 disabled routed auto auto 10/100/1000Base TXGi0/7 disabled routed auto auto 10/100/1000Base TXGi0/8 disabled routed auto 100 10/10
18、0/1000Base TXGi0/9 notconnect routed auto auto 10/100/1000Base TXGi0/10 notconnect routed auto auto 10/100/1000Base TXGi0/11 disabled routed auto auto unknownGi0/12 notconnect routed auto auto unknown Switch# show interfaces fastethernet 0/1 switchportName: Fa0/1Switchport: EnabledAdministrative Mod
19、e: static accessOperational Mode: downAdministrative Trunking Encapsulation: dot1qNegotiation of Trunking: OffAccess Mode VLAN: 1 (default)Trunking Native Mode VLAN: 1 (default)Trunking VLANs Enabled: ALLPruning VLANs Enabled: 2-1001 Protected: falseUnknown unicast blocked: disabledUnknown multicast
20、 blocked: disabled Voice VLAN: dot1p (Inactive)Appliance trust: 5Switch# show running-config interface fastethernet0/2Building configuration. Current configuration : 131 bytes!interface FastEthernet0/2 switchport mode access switchport protected no ip address mls qos cos 7 mls qos cos overrideend刷新、
21、重置端口及計數器Clear命令目的 clear counters interface-id清除端口計數器.clear line number | console 0 | vty number重置異步串口的硬件邏輯Noteclear counters 命令只清除用show interface所顯示的計數,不影響用snmp得到的計數 舉例如下:Switch# clear counters fastethernet0/5 Clear show interface counters on this interface confirm y Switch#*Sep 30 08:42:55: %CLEAR-
22、5-COUNTERS: Clear counter on interface FastEthernet0/5by vty1 (171.69.115.10) 可使用clear line 命令來清除或重置某一端口或串口,在大部分情況下并不需要這樣做:Switch# clear interface fastethernet0/5 關閉和打開端口命令 目的 Step1 configure terminal進入配置狀態Step2 interface vlan vlan-id | fastethernet | gigabitethernet interface-id | port-channel port
23、-channel-number選擇要關閉的端口Step3 shutdown關閉Step4 end退出Step5 show running-config驗證使用 no shutdown 命令重新打開端口.舉例如下:Switch# configure terminalSwitch(config)# interface fastethernet0/5 Switch(config-if)# shutdown Switch(config-if)#*Sep 30 08:33:47: %LINK-5-CHANGED: Interface FastEthernet0/5, changed state to a
24、 administratively down Switch# configure terminalSwitch(config)# interface fastethernet0/5 Switch(config-if)# no shutdown Switch(config-if)#*Sep 30 08:36:00: %LINK-3-UPDOWN: Interface FastEthernet0/5, changed state to up 配置VLAN理解VLAN 一個VLAN就是一個交換網,其邏輯上按功能、項目、應用來分而不必考慮用戶的物理位置。任何交換口都可以屬于某一VLAN, IP包、廣播
25、包及組播包均可以發送或廣播給在此VLAN內的最終用戶。每一個VLAN均可看成是一個邏輯網絡,發往另一VLAN的數據包必須由路由器或網橋轉發(如下圖)。由于VLAN被看成是一個邏輯網絡,其具有自己的網橋管理信息庫 (MIB) 并可支持自己的生成樹 VLAN作為邏輯定義的網絡示意圖VLAN常常與IP子網相聯系,同一IP子網屬于同一VLAN。在3550上VLAN之間的數據包可以由VLAN端口進行轉發。可支持的VLANCatalyst 3550交換機支持250個 VLAN,可以分別是VTPclient, server, 及 transparent modes. VLAN號可以從1到4094. VLAN
26、號10xx到1005保留給令牌環及FDDI VLAN. VTP只能學習到普通范圍的VLAN, 即從VLAN到1到1005; VLAN號大于1005屬于擴展VLAN,不存在VLAN數據庫中。 交換機必須配置成VTP透明模式當需要生成VLAN 號從1006到4094. 本交換機支持基于每一VLAN的生成樹(PVST),最多支持128個生成樹。本交換機支持ISL及IEEE 8xx.1Q trunk二種封裝。配置正常范圍的VLANVLAN號1, 10xx到1005是自動生成的不能被去掉。 VLAN號1到1005的配置被寫到文件vlan.dat 中, 可以用show vlan 命令查看, vlan.da
27、t 文件存放在NVRAM中. 注意不要手工刪除vlan.dat 文件,可能造成VLAN的不完整。如要刪除vlan需要用有關的命令來進行生成、修改以太網VLAN命令目的Step1 configure terminal進入配置狀態Step2 vlan vlan-id輸入一個VLAN號, 然后進入vlan配置狀態,可以輸入一個新的VLAN號或舊的來進行修改。 Step3 name vlan-name(可選)輸入一個VLAN名,如果沒有配置VLAN名,缺省的名字是VLAN號前面用0填滿的4位數,如VLAN0004是VLAN4的缺省名字Step4 mtu mtu-size(可選) 改變MTU大小Step
28、5 end退出Step6 show vlan name vlan-name | id vlan-id驗證Step7 copy running-config startup config(可選) 保存配置用no vlan name 或 no vlan mtu 退回到缺省的vlan配置狀態舉例如下:Switch# configure terminalSwitch(config)# vlan 20Switch(config-vlan)# name test20Switch(config-vlan)# end也可以在enable狀態下,進行VLAN配置:命令 目的 Step1 vlan databas
29、e進入VLAN配置狀態Step2 vlan vlan-id name vlan-name加入VLAN號及VLAN名Step3 vlan vlan-id mtu mtu-size(可選) 修改MTU大小Step4 exit更新VLAN數據庫并退出Step5 show vlan name vlan-name | id vlan-id驗證配置Step6 copy running-config startup config保存配置(可選)舉例如下:Switch# vlan databaseSwitch(vlan)# vlan 20 name test20Switch(vlan)# exitAPPLY
30、completed.Exiting.Switch# 刪除VLAN當刪除一個處于VTP服務器的交換機上刪除VLAN時,則此VLAN將在所有相同VTP的交換機上刪除。當在透明模式下刪除時,只在當前交換機上刪除。注意當刪除一個VLAN時,原來屬于此VLAN的端口將處于非激活的狀態,直到將其分配給某一VLAN。命令 目的 Step1 configure terminal進入配置狀態Step2 no vlan vlan-id刪除某一VLAN. Step3 end退出Step4 show vlan brief驗證Step5 copy running-config startup config保存也可用vl
31、an database 進入VLAN配置狀態,用no vlan vlan-id 來刪除。將端口分配給一個VLAN命令 目的 Step1 configure terminal進入配置狀態Step2 interface interface-id進入要分配的端口Step3 switchport mode access定義二層口Step4 switchport access vlan vlan-id把端口分配給某一VLANStep5 End退出Step6 show running-config interface interface-id 驗證端口的VLAN號Step7 show interfaces
32、 interface-id switchport驗證端口的管理模式和VLAN情況Step8 copy running-config startup-config保存配置使用 default interface interface-id 還原到缺省配置狀態。舉例如下:Switch# configure terminal Enter configuration commands, one per line. End with CNTL/Z.Switch(config)# interface fastethernet0/1 Switch(config-if)# switchport mode acc
33、ess Switch(config-if)# switchport access vlan 2Switch(config-if)# end Switch#配置VLAN Trunks命令 目的 Step1 configure terminal進入配置狀態Step2 interface interface-id進入端口配置狀態Step3 switchport mode dynamic auto | desirable | trunk配置二層trunk模式。 dynamic auto自動協商是否成為trunk dynamic desirable把端口設置為trunk如果對方端口是trunk, des
34、irable, 或自動模式 trunk設置端口為強制的trunk方式,而不理會對方端口是否為trunkStep4 switchport access vlan vlan-id(可選) 指定一個缺省VLAN, 如果此端口不再是trunkStep5 switchport trunk native vlan vlan-id指定8xx.1Q native VLAN號 Step6 end退出Step7 show interfaces interface-id switchport顯示有關switchport 的配置Step8 show interfaces interface-id trunk顯示有關t
35、runk的配置Step9 copy running-config startup-config保存配置舉例:Switch# configure terminal Enter configuration commands, one per line. End with CNTL/Z.Switch(config)# interface fastethernet0/4 Switch(config-if)# switchport mode trunk Switch(config-if)# end 定義trunk允許的VLAN缺省情況下trunk允許所有的VLAN通過。可以使用 switchport t
36、runk allowed vlan remove vlan-list 來去掉某一VLAN Command Purpose Step1 configure terminal進入配置狀態Step2 interface interface-id進入端口配置Step3 switchport mode trunk配置二層口為trunkStep4 switchport trunk allowed vlan add | all | except | remove vlan-list (可選) 配置trunk允許的VLAN. 使用add, all, except, remove關健字Step5 end退出St
37、ep6 show interfaces interface-id switchport 驗證VLAN配置情況.Step7 copy running-config startup-config保存配置回到允許所有VLAN通過時, 可用no switchport trunk allowed vlan 端口配置命令.舉例如下:Switch(config)# interface fastethernet0/1Switch(config-if)# switchport trunk allowed vlan remove 2Switch(config-if)# end配置Native VLAN(8xx.1
38、q)封裝8xx.1q的trunk端口可以接受帶有標簽和不帶標簽的數據流,交換機向native vlan傳送不帶標簽的數據流,缺省情況下native VLAN是1。命令 目的 Step1 configure terminal進入配置狀態Step2 interface interface-id進入配置成8xx.1qtrunk的端口Step3 switchport trunk native vlan vlan-id配置native VLAN號Step4 end退出Step5 show interfaces interface-id switchport驗證native VLAN配置Step6 cop
39、y running-config startup-config保存配置使用no switchport trunk native vlan 端口配置命令回到缺省的狀態使用STP實現負載均衡負載均衡可以使用流量分流到其它平行的trunks上去. 交換機為了避免環路, STP通常是阻斷所有端口交換機之間只留一條鏈路 。使用負載均衡后, 可以把不同VLAN的流量分配到不同的trunk上。 可以通過配置STP端口權值STP路徑值來實現負載均衡. 如果使用STP端口權值來配置那么二條負載均衡的trunk必須聯同一交換機上。使用路徑值則即可以聯相同的交換機與可以聯不同的交換機。使用STP端口權值的負載均衡當
40、同一臺交換機的二個口形成環路時, STP端口權值用來決定那個口是enable的,那個口是阻斷的。 可以通過配置端口權值來決定二對trunk各走那些VLAN, 有較高權值的端口(數字較小的)vlan, 將處于轉發狀態,同一個VLAN在另一個trunk有較低的權值(數字較大)則將處在阻斷狀態。 即同一VLAN只在一個trunk上發送接受。基于端口權值的負載均衡示意圖 trunk1將發送和接收VLAN810的數據,trunk2將發送和接收VLAN36的數據配置如下:Command Purpose Step1 configure terminal進入Switch1配置狀態Step2 vtp domai
41、n domain-name配置VTP域Step3 vtp server將Switch 1配置成VTP server.Step4 end退出Step5 show vtp status驗證VTP的配置Step6 show vlan驗證VLANStep7 configure terminal進入配置狀態Step8 interface fastethernet 0/1進入F0/1端口Step9 switchport mode trunk配置成trunk端口Step10 end退出Step11 show interfaces fastethernet0/1 switchport驗證VLAN配置Step1
42、2 在switch1上的F0/2上重復7到11步驟Step13 在Switch 2的F0/1,F0/2上重復7到11步驟。Step14 show vlan當trunk已經起來,在switch2上驗證已經學到相關的vlan配置Step15 configure terminal在Switch 1上進入配置狀態Step16 interface fastethernet0/1進入要配置的端口Step17 spanning-tree vlan 8 port-priority 10將端口權值10賦與VLAN 8.Step18 spanning-tree vlan 9 port-priority 10將端口
43、權值10賦與VLAN 9.Step19 spanning-tree vlan 10 port-priority 10將端口權值10賦與VLAN 10.Step20 exit退回.Step21interface fastethernet0/2進入F0/2Step22spanning-tree vlan 3 port-priority 10將端口權值10賦與VLAN 3.Step23 spanning-tree vlan 4 port-priority 10將端口權值10賦與VLAN 4.Step24 spanning-tree vlan 5 port-priority 10將端口權值10賦與VL
44、AN 5.Step25 spanning-tree vlan 6 port-priority 10將端口權值10賦與VLAN 10.Step26 end退出Step27 show running-config驗證配置Step28 copy running-config startup-config保存配置配置STP路徑值的負載均衡也可以通過配置配置STP路徑值來實現負載均衡,如下圖所示Trunk1走VLAN810,Trunk2走VLAN24命令 目的 Step1 configure terminal進入 Switch1配置狀態Step2 interface fastethernet 0/1進入
45、F0/1Step3 switchport mode trunk配置Trunk,只能是dot1q模式 Step4 exit退回Step5在F0/2口上重復24步驟Step6 end退出Step7 show running-config驗證配置Step8 show vlan驗證switch1已經學到VlanStep9 configure terminal進入配置狀態Step10 interface fastethernet 0/1進入F0/1Step11 spanning-tree vlan 2 cost 30設置Vlan2生成樹路徑值為30Step12 spanning-tree vlan 3
46、cost 30設置Vlan3生成樹路徑值為30Step13 spanning-tree vlan 4 cost 30設置Vlan4生成樹路徑值為30Step14 end退出Step15 在switch1的F0/2上重復911步驟設置VLAN8,9,10生成樹路徑值為30Step16 exit退出Step17 show running-config驗證配置Step18 copy running-config startup-config保存配置配置Cluster以本工程一個例子說明,該例子是信息大廈主樓十樓四臺2950交換機堆疊的例子。例子中,第一、二臺管理vlan做hsrp,IP地址如圖所示。
47、1、STEP 1:配置Clust管理vlan,如將vlan 5作為管理vlan。命令:interface vlan 5no shutdownend2、STEP 2:查看各臺設備上管理vlan的MAC地址。命令:show interface vlan 5結果:ZL-10th -Floor-1中的MAC地址為:ZL-10th -Floor-2中的MAC地址為:ZL-10th -Floor-3中的MAC地址為:ZL-10th -Floor-1ZL-10th -Floor-2ZL-10th -Floor-3Standby ip:ZL-10th -Floor-4中的MAC地址為:3、STEP 3:在第一
48、臺設備上的配置命令:cluster standby-group ZL-10th-Floor由于要配置standby,所以該命令是配置standby組名cluster enable ZL-10th-Floor 0配置cluster名,該臺機是主設備配置第二臺堆疊設備的參數,硬件地址為管理vlan地址配置第三臺堆疊設備的參數配置第四臺堆疊設備的參數interface vlan 54standby 2 priority 110standby 2 preempt delay sync 0standby 2 name ZL-10th-Floor上面幾條命令是管理vlan里standby的配置4、STEP
49、 4:配置第二臺堆疊設備命令:cluster standby-group ZL-10th-Floor配置第一臺堆疊設備參數cluster commander-address 000a.f404.ad80 member 1 name ZL-10th-Floor上面一條命令指明是第二臺堆疊設備interface Vlan5standby 2 priority 100standby 2 preempt delay sync 0standby 2 name ZL-10th-Floor 配置standby參數5、STEP 5:配置第三臺堆疊設備cluster commander-address 000a.f404.ad80 member 2 name ZL-10th-Floor6、配置第四臺堆疊設備cluster commander-address 000a.f404.ad80 member 3 name ZL-10th-Floor