新聞中心
深入了解交換機(jī)的vlan數(shù)據(jù)庫(kù)及其作用

在計(jì)算機(jī)網(wǎng)絡(luò)中,交換機(jī)是一種用于局域網(wǎng)中的網(wǎng)絡(luò)設(shè)備。它通過學(xué)習(xí)、過濾和發(fā)送數(shù)據(jù),使得局域網(wǎng)上的不同主機(jī)之間可以通信。而在交換機(jī)中,VLAN(Virtual Local Area Network)是一種將物理網(wǎng)絡(luò)劃分為多個(gè)虛擬網(wǎng)絡(luò)的技術(shù)。這種技術(shù)可以將不同的主機(jī)分組管理,實(shí)現(xiàn)更靈活的網(wǎng)絡(luò)配置。在交換機(jī)中,VLAN數(shù)據(jù)庫(kù)是實(shí)現(xiàn)VLAN技術(shù)的關(guān)鍵所在。
VLAN數(shù)據(jù)庫(kù)是交換機(jī)中存儲(chǔ)VLAN信息的地方。它通常包含VLAN ID、VLAN名稱、VLAN成員端口以及VLAN端口狀態(tài)等信息。在交換機(jī)啟用VLAN功能之后,交換機(jī)會(huì)根據(jù)VLAN數(shù)據(jù)庫(kù)中的配置,將交換機(jī)的端口劃分到不同的VLAN中。這樣,不同主機(jī)就可以通過不同的VLAN進(jìn)行通信。VLAN數(shù)據(jù)庫(kù)中的信息可以由管理員手動(dòng)配置,也可以通過VLAN協(xié)議自動(dòng)配置。
VLAN數(shù)據(jù)庫(kù)的作用不僅僅是在物理層面上實(shí)現(xiàn)隔離,同時(shí)還能夠幫助管理員更高效地管理網(wǎng)絡(luò)。具體來說,VLAN數(shù)據(jù)庫(kù)的作用體現(xiàn)在以下幾個(gè)方面。
之一,實(shí)現(xiàn)物理網(wǎng)絡(luò)的邏輯劃分。在交換機(jī)中啟用VLAN功能后,不同VLAN之間的通信將基于邏輯層面,并不會(huì)受到網(wǎng)絡(luò)拓?fù)涞南拗?。這樣,網(wǎng)絡(luò)管理員就可以將不同的主機(jī)分組管理,并為不同的用戶群體定制不同的網(wǎng)絡(luò)策略。例如,可以將公司的銷售部門放置在同一個(gè)VLAN中,并為這個(gè)VLAN配置相應(yīng)的安全策略。這樣就能夠保證銷售部門的網(wǎng)絡(luò)安全,避免被黑客攻擊。
第二,提高網(wǎng)絡(luò)的可擴(kuò)展性和可管理性。在運(yùn)維過程中,管理員可以在任何時(shí)候?qū)⒍丝趶囊粋€(gè)VLAN移動(dòng)到另一個(gè)VLAN中,或者將整個(gè)VLAN從一個(gè)交換機(jī)移動(dòng)到另一個(gè)交換機(jī)。這樣,管理員就可以更靈活地管理網(wǎng)絡(luò),提高網(wǎng)絡(luò)的可擴(kuò)展性和可管理性。例如,當(dāng)需要對(duì)網(wǎng)絡(luò)進(jìn)行升級(jí)或停機(jī)維護(hù)時(shí),管理員可以暫停一個(gè)VLAN的服務(wù)而不影響其他VLAN的正常使用。
第三,提高網(wǎng)絡(luò)性能。VLAN技術(shù)可以將不同的主機(jī)分組管理,避免廣播風(fēng)暴導(dǎo)致網(wǎng)絡(luò)性能下降。例如,在一個(gè)無VLAN的網(wǎng)絡(luò)中,當(dāng)有一個(gè)廣播包從一個(gè)主機(jī)發(fā)送出去時(shí),所有網(wǎng)絡(luò)中的主機(jī)都會(huì)接收到這個(gè)廣播包。這就會(huì)占用網(wǎng)絡(luò)中的帶寬,并使得網(wǎng)絡(luò)性能下降。而在一個(gè)使用VLAN技術(shù)的網(wǎng)絡(luò)中,只有和該主機(jī)在同一個(gè)VLAN中的主機(jī)才會(huì)接收到這個(gè)廣播包。這樣就能夠有效避免廣播風(fēng)暴,并提高網(wǎng)絡(luò)的性能。
在使用VLAN技術(shù)時(shí),需要注意一些問題。要確保在網(wǎng)絡(luò)中啟用VLAN功能之前,先計(jì)劃好如何配置VLAN數(shù)據(jù)庫(kù)。在網(wǎng)絡(luò)升級(jí)或停機(jī)時(shí),要謹(jǐn)慎地處理VLAN配置信息。要避免配置復(fù)雜或錯(cuò)誤的VLAN數(shù)據(jù)庫(kù)信息,以免影響網(wǎng)絡(luò)的性能和可用性。
VLAN技術(shù)是一種非常實(shí)用的網(wǎng)絡(luò)劃分技術(shù)。在使用VLAN技術(shù)時(shí),VLAN數(shù)據(jù)庫(kù)是實(shí)現(xiàn)VLAN的關(guān)鍵所在。通過深入了解交換機(jī)的VLAN數(shù)據(jù)庫(kù)及其作用,管理員可以更好地掌握VLAN技術(shù),更加有效地管理局域網(wǎng)。
相關(guān)問題拓展閱讀:
- 關(guān)于cisco交換機(jī)vlan問題
- 怎樣配置VLAN?
關(guān)于cisco交換機(jī)vlan問題
說明
本手冊(cè)只包括日常使用的有關(guān)命令及特性,其它未涉及的命令及特性請(qǐng)參考英文的詳細(xì)配置手冊(cè)。
產(chǎn)品特性
2950是只支持二層的交換機(jī)
支持VLAN
? 到250 個(gè)VLAN
? 支持VLAN ID從1到4094( IEEE 802.1Q 標(biāo)準(zhǔn))
? 支持ISL及IEEE 802.1Q封裝
安全
? 支持IOS標(biāo)準(zhǔn)的密碼保護(hù)
? 支持標(biāo)準(zhǔn)及擴(kuò)展的訪問列表來定義安全策略
? 支持基于VLAN的訪問列表
監(jiān)視
? 交換機(jī)LED指示端口狀態(tài)
? SPAN及遠(yuǎn)端SPAN (RSPAN) 可以監(jiān)視任何端口或VLAN的流量
? 內(nèi)培祥置支持四組的RMON監(jiān)控功能(歷史、統(tǒng)計(jì)、告警及事件)
配置端口
配置一組端口
命令 目的
Step 1 configure terminal 進(jìn)入配置狀態(tài)
Step 2 interface range {port-range} 進(jìn)入廳擾組配置狀態(tài)
Step 3 可以使用平時(shí)的端口配置命令進(jìn)行配置
Step 4 end 退回
Step 5 show interfaces 驗(yàn)證配置
Step 6 copy running-config startup-config 保存
當(dāng)使用interface range命令時(shí)有如下的規(guī)則:
? 有效的組范圍:
o vlan從1 到4094
o fastethernet 槽位/{first port} – {last port}, 槽位為0
o gigabitethernet槽位/{first port} – {last port},槽位為0
o port-channel port-channel-number – port-channel-number, port-channel號(hào)從1到64
? 端口號(hào)之間需要加入空格,如:interface range fastethernet 0/1 – 5 是有效的,而interface range fastethernet 0/1-5 是無效的扮中旦.
? interface range 命令只能配置已經(jīng)存在的interface vlan
? 所有在同一組的端口必須是相同類別的。
見以下例子:
Switch# configure terminal
Switch(config)# interface range fastethernet0/1 – 5
Switch(config-if-range)# no shutdown
Switch(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 FastEthernet0/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, changed
state to up
*Oct 6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed
state to up
以下的例子顯示使用句號(hào)來配置不同類型端口的組:
Switch# configure terminal
Switch(config)# interface range fastethernet0/1 – 3, gigabitethernet0/1 – 2
Switch(config-if-range)# no shutdown
Switch(config-if-range)#
*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 GigabitEthernet0/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,
changed state to up
*Oct 6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/ 3,
changed state to up
配置二層端口
2950的所有端口缺省的端口都是二層口,如果此端口已經(jīng)配置成三層端口的話,則需要用switchport來使其成為二層端口。
配置端口速率及雙工模式
可以配置快速以太口的速率為10/100Mbps及千兆以太口的速率為10/100/1000-Mbps; 但對(duì)于GBIC端口則不能配置速率及雙工模式,有時(shí)可以配置nonegotiate,當(dāng)需要聯(lián)接不支持自適應(yīng)的其它千兆端口時(shí)
命令 目的
Step 1 configure terminal 進(jìn)入配置狀態(tài).
Step 2 interface interface-id 進(jìn)入端口配置狀態(tài).
Step 3 speed {10 | 100 | 1000 | auto | nonegotiate} 設(shè)置端口速率
注只工作在千兆口. GBIC模塊只工作在1000 Mbps下. nonegotiate 只能在這些GBIC上用 1000BASE-SX, -LX, and -ZX GBIC.
Step 4 duplex {auto | full | half} 設(shè)置全雙工或半雙工.
Step 5 end 退出
Step 6 show interfaces interface-id 顯示有關(guān)配置情況
Step 7 copy running-config startup-config 保存
Switch# configure terminal
Switch(config)# interface fastethernet0/3
Switch(config-if)# speed 10
Switch(config-if)# duplex half
端口描述
命令 目的
Step 1 configure terminal 進(jìn)入配置模式
Step 2 interface interface-id 進(jìn)入要加入描述的端口
Step 3 description string 加入描述 (最多240個(gè)字符).
Step 4 end 退回.
Step 5 show interfaces interface-id description
or
show running-config 驗(yàn)證.
Step 6 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 description:
Switch# config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# interface fastethernet0/4
Switch(config-if)# description Connects to Marketing
Switch(config-if)# end
Switch# show interfaces fastethernet0/4 description
Interface StatusProtocol Description
Fa0/4 updown Connects to Marketing
監(jiān)控及維護(hù)端口
監(jiān)控端口和控制器的狀態(tài)
主要命令見下表:
Show Commands for Interfaces Command 目的
show interfaces 顯示所有端口或某一端口的狀態(tài)和配置.
show interfaces interface-id status 顯示一系列端口的狀態(tài)或錯(cuò)誤-關(guān)閉的狀態(tài)
show interfaces switchport 顯示二層端口的狀態(tài),可以用來決定此口是否為二層或三層口。
show interfaces description 顯示端口描述
show running-config interface 顯示當(dāng)前配置中的端口配置情況
show version 顯示軟硬件等情況
舉例如下:
Switch# show interfaces status
Port Name StatusVlanDuplex Speed Type
Gi0/connected routed a-full a/100/1000Base
TX
Gi0/2 wce server 20.20.2 disabled routedauto auto 10/100/1000Base TX
Gi0/3 ip wccp web-cache notconnect routedauto auto 10/100/1000Base TX
Gi0/notconnect routedauto auto 10/100/1000Base TX
Gi0/notconnect routedauto auto 10/100/1000Base TX
Gi0/disabled routedauto auto 10/100/1000Base TX
Gi0/disabled routedauto auto 10/100/1000Base TX
Gi0/disabled routedauto/100/1000Base TX
Gi0/notconnect routedauto auto 10/100/1000Base TX
Gi0/notconnect routedauto auto 10/100/1000Base TX
Gi0/disabled routedauto auto unknown
Gi0/notconnect routedauto auto unknown
Switch# show interfaces fastethernet 0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: static access
Operational Mode: down
Administrative Trunking Encapsulation: dot1q
Negotiation of Trunking: Off
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled:
Protected: false
Unknown unicast blocked: disabled
Unknown multicast blocked: disabled
Voice VLAN: dot1p (Inactive)
Appliance trust: 5
Switch# show running-config interface fastethernet0/2
Building configuration…
Current configuration : 131 bytes
!
interface FastEthernet0/2
switchport mode access
switchport protected
no ip address
mls qos cos 7
mls qos cos override
end
刷新、重置端口及計(jì)數(shù)器
Clear命令 目的
clear counters 清除端口計(jì)數(shù)器.
clear line 重置異步串口的硬件邏輯
________________________________________
Note clear counters 命令只清除用show interface所顯示的計(jì)數(shù),不影響用snmp得到的計(jì)數(shù)
________________________________________
舉例如下:
Switch# clear counters fastethernet0/5
Clear “show interface” counters on this interface y
Switch#
*Sep 30 08:42:55: %CLEAR-5-COUNTERS: Clear counter on interface FastEthernet0/5
by vty1 (171.69.115.10)
可使用clear line 命令來清除或重置某一端口或串口,在大部分情況下并不需要這樣做:
Switch# clear interface fastethernet0/5
關(guān)閉和打開端口
命令 目的
Step 1 configure terminal 進(jìn)入配置狀態(tài)
Step 2 interface {vlan vlan-id} | {{fastethernet | gigabitethernet} interface-id} | {port-channel port-channel-number} 選擇要關(guān)閉的端口
Step 3 shutdown 關(guān)閉
Step 4 end 退出
Step 5 show running-config 驗(yàn)證
使用 no shutdown 命令重新打開端口.
舉例如下:
Switch# configure terminal
Switch(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
administratively down
Switch# configure terminal
Switch(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
一個(gè)VLAN就是一個(gè)交換網(wǎng),其邏輯上按功能、項(xiàng)目、應(yīng)用來分而不必考慮用戶的物理位置。任何交換口都可以屬于某一VLAN, IP包、廣播包及組播包均可以發(fā)送或廣播給在此VLAN內(nèi)的最終用戶。每一個(gè)VLAN均可看成是一個(gè)邏輯網(wǎng)絡(luò),發(fā)往另一VLAN的數(shù)據(jù)包必須由路由器或網(wǎng)橋轉(zhuǎn)發(fā)(如下圖)。由于VLAN被看成是一個(gè)邏輯網(wǎng)絡(luò),其具有自己的網(wǎng)橋管理信息庫(kù) (MIB) 并可支持自己的生成樹
VLAN作為邏輯定義的網(wǎng)絡(luò)示意圖
VLAN常常與IP子網(wǎng)相聯(lián)系,同一IP子網(wǎng)屬于同一VLAN。在3550上VLAN之間的數(shù)據(jù)包可以由VLAN端口進(jìn)行轉(zhuǎn)發(fā)。
可支持的VLAN
Catalyst 3550交換機(jī)支持250個(gè) VLAN,可以分別是VTP client, server, 及 transparent modes. VLAN號(hào)可以從1到4094. VLAN號(hào)1002到1005保留給令牌環(huán)及FDDI VLAN. VTP只能學(xué)習(xí)到普通范圍的VLAN, 即從VLAN到1到1005; VLAN號(hào)大于1005屬于擴(kuò)展VLAN,不存在VLAN數(shù)據(jù)庫(kù)中。 交換機(jī)必須配置成VTP透明模式當(dāng)需要生成VLAN 號(hào)從1006到4094.
本交換機(jī)支持基于每一VLAN的生成樹(PVST),最多支持128個(gè)生成樹。本交換機(jī)支持ISL及IEEE 802.1Q trunk二種封裝。
配置正常范圍的VLAN
VLAN號(hào)1, 1002到1005是自動(dòng)生成的不能被去掉。
VLAN號(hào)1到1005的配置被寫到文件vlan.dat 中, 可以用show vlan 命令查看, vlan.dat 文件存放在NVRAM中.
________________________________________
注意 不要手工刪除vlan.dat 文件,可能造成VLAN的不完整。 如要?jiǎng)h除vlan需要用有關(guān)的命令來進(jìn)行
________________________________________
生成、修改以太網(wǎng)VLAN
命令 目的
Step 1 configure terminal 進(jìn)入配置狀態(tài)
Step 2 vlan vlan-id 輸入一個(gè)VLAN號(hào), 然后進(jìn)入vlan配置狀態(tài),可以輸入一個(gè)新的VLAN號(hào)或舊的來進(jìn)行修改。
Step 3 name vlan-name (可選)輸入一個(gè)VLAN名,如果沒有配置VLAN名,缺省的名字是VLAN號(hào)前面用0填滿的4位數(shù),如VLAN0004是VLAN4的缺省名字
Step 4 mtu mtu-size (可選) 改變MTU大小
Step 5 end 退出
Step 6 show vlan {name vlan-name | id vlan-id} 驗(yàn)證
Step 7 copy running-config startup config (可選) 保存配置
用no vlan name 或 no vlan mtu 退回到缺省的vlan配置狀態(tài)
舉例如下:
Switch# configure terminal
Switch(config)# vlan 20
Switch(config-vlan)# name test20
Switch(config-vlan)# end
也可以在enable狀態(tài)下,進(jìn)行VLAN配置:
命令 目的
Step 1 vlan database 進(jìn)入VLAN配置狀態(tài)
Step 2 vlan vlan-id name vlan-name 加入VLAN號(hào)及VLAN名
Step 3 vlan vlan-id mtu mtu-size (可選) 修改MTU大小
Step 4 exit 更新VLAN數(shù)據(jù)庫(kù)并退出
Step 5 show vlan {name vlan-name | id vlan-id} 驗(yàn)證配置
Step 6 copy running-config startup config 保存配置(可選)
舉例如下:
Switch# vlan database
Switch(vlan)# vlan 20 name test20
Switch(vlan)# exit
APP completed.
Exiting….
Switch#
刪除VLAN
當(dāng)刪除一個(gè)處于VTP服務(wù)器的交換機(jī)上刪除VLAN時(shí),則此VLAN將在所有相同VTP的交換機(jī)上刪除。當(dāng)在透明模式下刪除時(shí),只在當(dāng)前交換機(jī)上刪除。
注意 當(dāng)刪除一個(gè)VLAN時(shí),原來屬于此VLAN的端口將處于非激活的狀態(tài),直到將其分配給某一VLAN。
________________________________________
命令 目的
Step 1 configure terminal 進(jìn)入配置狀態(tài)
Step 2 no vlan vlan-id 刪除某一VLAN.
Step 3 end 退出
Step 4 show vlan brief 驗(yàn)證
Step 5 copy running-config startup config 保存
也可用vlan database 進(jìn)入VLAN配置狀態(tài),用no vlan vlan-id 來刪除。
將端口分配給一個(gè)VLAN
命令 目的
Step 1 configure terminal 進(jìn)入配置狀態(tài)
Step 2 interface interface-id 進(jìn)入要分配的端口
Step 3 switchport mode access 定義二層口
Step 4 switchport access vlan vlan-id 把端口分配給某一VLAN
Step 5 end 退出
Step 6 show running-config interface interface-id 驗(yàn)證端口的VLAN號(hào)
Step 7 show interfaces interface-id switchport 驗(yàn)證端口的管理模式和VLAN情況
Step 8 copy running-config startup-config 保存配置
使用 default interface interface-id 還原到缺省配置狀態(tài)。
舉例如下:
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# interface fastethernet0/1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 2
Switch(config-if)# end
Switch#
配置VLAN Trunks
命令 目的
Step 1 configure terminal 進(jìn)入配置狀態(tài)
Step 2 interface interface-id 進(jìn)入端口配置狀態(tài)
Step 3 switchport mode {dynamic {auto | desirable} | trunk} 配置二層trunk模式。
? dynamic auto—自動(dòng)協(xié)商是否成為trunk
? dynamic desirable—把端口設(shè)置為trunk如果對(duì)方端口是trunk, desirable, 或自動(dòng)模式
? trunk—設(shè)置端口為強(qiáng)制的trunk方式,而不理會(huì)對(duì)方端口是否為trunk
Step 4 switchport access vlan vlan-id (可選) 指定一個(gè)缺省VLAN, 如果此端口不再是trunk
Step 5 switchport trunk native vlan vlan-id 指定802.1Q native VLAN號(hào)
Step 6 end 退出
Step 7 show interfaces interface-id switchport 顯示有關(guān)switchport 的配置
Step 8 show interfaces interface-id trunk 顯示有關(guān)trunk的配置
Step 9 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 trunk allowed vlan remove vlan-list 來去掉某一VLAN
Command Purpose
Step 1 configure terminal 進(jìn)入配置狀態(tài)
Step 2 interface interface-id 進(jìn)入端口配置
Step 3 switchport mode trunk 配置二層口為trunk
Step 4 switchport trunk allowed vlan {add | all | except | remove} vlan-list (可選) 配置trunk允許的VLAN.
使用add, all, except, remove關(guān)健字
Step 5 end 退出
Step 6 show interfaces interface-id switchport 驗(yàn)證VLAN配置情況.
Step 7 copy running-config startup-config 保存配置
回到允許所有VLAN通過時(shí), 可用no switchport trunk allowed vlan 端口配置命令.
舉例如下:
Switch(config)# interface fastethernet0/1
Switch(config-if)# switchport trunk allowed vlan remove 2
Switch(config-if)# end
配置Native VLAN(802.1q)
封裝802.1q的trunk端口可以接受帶有標(biāo)簽和不帶標(biāo)簽的數(shù)據(jù)流,交換機(jī)向native vlan傳送不帶標(biāo)簽的數(shù)據(jù)流,缺省情況下native VLAN是1。
命令 目的
Step 1 configure terminal 進(jìn)入配置狀態(tài)
Step 2 interface interface-id 進(jìn)入配置成802.1qtrunk的端口
Step 3 switchport trunk native vlan vlan-id 配置native VLAN號(hào)
Step 4 end 退出
Step 5 show interfaces interface-id switchport 驗(yàn)證native VLAN配置
Step 6 copy running-config startup-config 保存配置
使用no switchport trunk native vlan 端口配置命令回到缺省的狀態(tài)
使用STP實(shí)現(xiàn)負(fù)載均衡
負(fù)載均衡可以使用流量分流到其它平行的trunks上去. 交換機(jī)為了避免環(huán)路, STP通常是阻斷所有端換機(jī)之間只留一條鏈路 。使用負(fù)載均衡后, 可以把不同VLAN的流量分配到不同的trunk上。
可以通過配置STP端口權(quán)值STP路徑值來實(shí)現(xiàn)負(fù)載均衡. 如果使用STP端口權(quán)值來配置那么二條負(fù)載均衡的trunk必須聯(lián)同一交換機(jī)上。使用路徑值則即可以聯(lián)相同的交換機(jī)與可以聯(lián)不同的交換機(jī)。
使用STP端口權(quán)值的負(fù)載均衡
當(dāng)同一臺(tái)交換機(jī)的二個(gè)口形成環(huán)路時(shí), STP端口權(quán)值用來決定那個(gè)口是enable的,那個(gè)口是阻斷的。 可以通過配置端口權(quán)值來決定二對(duì)trunk各走那些VLAN, 有較高權(quán)值的端口(數(shù)字較小的)vlan, 將處于轉(zhuǎn)發(fā)狀態(tài),同一個(gè)VLAN在另一個(gè)trunk有較低的權(quán)值(數(shù)字較大)則將處在阻斷狀態(tài)。 即同一VLAN只在一個(gè)trunk上發(fā)送接受。
基于端口權(quán)值的負(fù)載均衡示意圖
trunk1將發(fā)送和接收VLAN8-10的數(shù)據(jù),trunk2將發(fā)送和接收VLAN3-6的數(shù)據(jù)
配置如下:
Command Purpose
Step 1 configure terminal 進(jìn)入Switch 1配置狀態(tài)
Step 2 vtp domain domain-name 配置VTP域
Step 3 vtp server 將Switch 1配置成VTP server.
Step 4 end 退出
Step 5 show vtp status 驗(yàn)證VTP的配置
Step 6 show vlan 驗(yàn)證VLAN
Step 7 configure terminal 進(jìn)入配置狀態(tài)
Step 8 interface fastethernet 0/1 進(jìn)入F0/1端口
Step 9 switchport mode trunk 配置成trunk端口
Step 10 end 退出
Step 11 show interfaces fastethernet0/1 switchport 驗(yàn)證VLAN配置
Step 12 在switch1上的F0/2上重復(fù)7到11步驟
Step 13 在Switch 2的F0/1,F0/2上重復(fù)7到11步驟。
Step 14 show vlan 當(dāng)trunk已經(jīng)起來,在switch2上驗(yàn)證已經(jīng)學(xué)到相關(guān)的vlan配置
Step 15 configure terminal 在Switch 1上進(jìn)入配置狀態(tài)
Step 16 interface fastethernet0/1 進(jìn)入要配置的端口
Step 17 spanning-tree vlan 8 port-priority 10 將端口權(quán)值10賦與VLAN 8.
Step 18 spanning-tree vlan 9 port-priority 10 將端口權(quán)值10賦與VLAN 9.
Step 19 spanning-tree vlan 10 port-priority 10 將端口權(quán)值10賦與VLAN 10.
Step 20 exit 退回.
Step 21 interface fastethernet0/2 進(jìn)入F0/2
Step 22 spanning-tree vlan 3 port-priority 10 將端口權(quán)值10賦與VLAN 3.
Step 23 spanning-tree vlan 4 port-priority 10 將端口權(quán)值10賦與VLAN 4.
Step 24 spanning-tree vlan 5 port-priority 10 將端口權(quán)值10賦與VLAN 5.
Step 25 spanning-tree vlan 6 port-priority 10 將端口權(quán)值10賦與VLAN 10.
Step 26 end 退出
Step 27 show running-config 驗(yàn)證配置
Step 28 copy running-config startup-config 保存配置
配置STP路徑值的負(fù)載均衡
也可以通過配置配置STP路徑值來實(shí)現(xiàn)負(fù)載均衡,如下圖所示
Trunk1走VLAN8-10,Trunk2走VLAN2-4
命令 目的
Step 1 configure terminal 進(jìn)入 Switch 1配置狀態(tài)
Step 2 interface fastethernet 0/1 進(jìn)入F0/1
Step 3 switchport mode trunk 配置Trunk,只能是dot1q模式
Step 4 exit 退回
Step 5 在F0/2口上重復(fù)2-4步驟
Step 6 end 退出
Step 7 show running-config 驗(yàn)證配置
Step 8 show vlan 驗(yàn)證switch1已經(jīng)學(xué)到Vlan
Step 9 configure terminal 進(jìn)入配置狀態(tài)
Step 10 interface fastethernet 0/1 進(jìn)入F0/1
Step 11 spanning-tree vlan 2 cost 30 設(shè)置Vlan2生成樹路徑值為30
Step 12 spanning-tree vlan 3 cost 30 設(shè)置Vlan3生成樹路徑值為30
Step 13 spanning-tree vlan 4 cost 30 設(shè)置Vlan4生成樹路徑值為30
Step 14 end 退出
Step在switch1的F0/2上重復(fù)9-11步驟設(shè)置VLAN8,9,10生成樹路徑值為30
Step 16 exit 退出
Step 17 show running-config 驗(yàn)證配置
Step 18 copy running-config startup-config 保存配置
看看trunk設(shè)置是否正確?方便的話把拓?fù)浣Y(jié)構(gòu)說一下
“有臺(tái)交換機(jī)山敗在一個(gè)地方只能尋到3個(gè)vlan,但是拿到別的地方就能把所有vlan找到!桐李”換的這個(gè)接口和之前那個(gè)接口配置完全一樣?
看不出問題 debug查局唯遲吧 -_-!!!
把VTP CLIENT模式先停了,清除配置重新啟動(dòng),再配置VLAN,啟用VTP CLIENT模式。
vlan1和1002~1005是自動(dòng)創(chuàng)建,為特殊用途。vlan1用于默認(rèn)管理,1002~~1005保留給與令牌環(huán)顫森伏茄攜和fddi交換相春前關(guān)的功能使用
IOS版本和交換機(jī)型號(hào)是有一定關(guān)聯(lián)的,
但是歸根到底命令的問題還是和IOS有關(guān)系
ENET對(duì)應(yīng)的是Type
,對(duì)應(yīng)的沒槐是網(wǎng)絡(luò)類型,指的是以太網(wǎng)通道,這幾個(gè)VLAN是分配的VLAN號(hào),沒什么大的意思。Parent
RingNo
BridgeNo
Stp
BrdgMode
怎樣配置VLAN?
VLAN的配置過程其實(shí)非常簡(jiǎn)單,只需兩步:(1)為各VLAN組命名;(2)把相應(yīng)的VLAN對(duì)應(yīng)到相應(yīng)的交換機(jī)端口。
下面是具體的配置過程:
第1步:設(shè)置好
超級(jí)終端
,連接上1900交換機(jī),通過超級(jí)終端配置交換機(jī)的VLAN,連接成功后出現(xiàn)如下所示的主配置界面(交換機(jī)在此之前已完成了基本信息的配置):
1 user(s) now active on Management Console.
User Interface Menu
Menus
Command Line
IP Configuration
Enter Selection:
【注】超級(jí)終端是利用Windows系統(tǒng)自帶的”超級(jí)終端”(Hypertrm)程序進(jìn)行的,具體參見有關(guān)資料。
第2步:?jiǎn)螕簟盞”按鍵,選擇主界面菜單中” Command Line”選項(xiàng) ,進(jìn)入如下命令行配置界面:
CLI session with the switch is open.
To end the CLI session,enter .
>
此時(shí)我們進(jìn)入了交換機(jī)的普通用戶模式,就象路由器一樣,這種模式只能查看現(xiàn)在的配置,不能更改配置,并且能夠使用的命雹嘩令很有限。所以我們必須進(jìn)入”特權(quán)模式”。
第3步:在上一步”>”提示符下輸入進(jìn)入特權(quán)模式命令”enable”,進(jìn)入特權(quán)模式,命令格式為”>enable”,此時(shí)就進(jìn)入了交換機(jī)配置的特權(quán)模式提示符:
#config t
Enter configuration commands,one per line.End with CNTL/Z
(config)#
第4步:為了安全和方便起見,我們分別給這3個(gè)Catalyst 1900交換機(jī)起個(gè)名字,并且設(shè)置特權(quán)模式的登銷和陸密碼。下面僅以Switch1為例進(jìn)行介紹。配置代碼如下:
(config)#hostname Switch1
Switch1(config)# enable password level 15 XXXXXX
Switch1(config)#
【注】特權(quán)模式密碼必須是4~8位字符這,要注意,這里所輸入的密碼是以明文形式直接顯示的,要注意保密。交換機(jī)用 level 級(jí)別的大小來決定密碼的權(quán)限。Level 1 是進(jìn)入
命令行界面
的密碼,也就是說,設(shè)置了 level 1 的密碼后,你下次連上交換機(jī),并輸入 K 后,就會(huì)讓你輸入密碼,這個(gè)密碼就是 level 1 設(shè)置的密碼。而 level 15 是你輸入了”enable”命令后讓你輸入的特權(quán)模式密碼。
第5步:設(shè)置VLAN名稱。因四個(gè)VLAN分屬于不同的交換機(jī),VLAN命名的命令為” vlan vlan號(hào) name vlan名稱 ,在Switch1、Switch2、Switch3、交換機(jī)上配置2、3、4、5號(hào)VLAN的代碼為:
Switch1 (config)#vlan 2 name Prod
Switch2 (config)#vlan 3 name Fina
Switch3 (config)#vlan 4 name Huma
Switch3 (config)#vlan 5 name Info
【注】以上配置是按表1規(guī)則進(jìn)行的。
第6步:上一步我們對(duì)各交換機(jī)配置了VLAN組,現(xiàn)在要把這些VLAN對(duì)應(yīng)于表1所規(guī)定的交換機(jī)
端口號(hào)
。對(duì)應(yīng)端口號(hào)的命虧肆盯令是”vlan-membership static/ dynamic VLAN號(hào) “。在這個(gè)命令中”static”(靜態(tài))和”dynamic”(動(dòng)態(tài))分配方式兩者必須選擇一個(gè),不過通常都是選擇”static”(靜態(tài))方式。VLAN端口號(hào)應(yīng)用配置如下:
?。?). 名為”Switch1″的交換機(jī)的VLAN端口號(hào)配置如下:
Switch1(config)#int e0/2
Switch1(config-if)#vlan-membership static 2
Switch1(config-if)#int e0/3
Switch1(config-if)#vlan-membership static 2
Switch1(config-if)#int e0/4
Switch1(config-if)#vlan-membership static 2
……
Switch1(config-if)#int e0/20
Switch(config-if)#vlan-membership static 2
Switch1(config-if)#int e0/21
Switch1(config-if)#vlan-membership static 2
Switch1(config-if)#
【注】”int”是”nterface”命令縮寫,是接口的意思?!眅0/3″是”ethernet 0/2″的縮寫,代表交換機(jī)的0號(hào)模塊2號(hào)端口。
?。?). 名為”Switch2″的交換機(jī)的VLAN端口號(hào)配置如下:
Switch2(config)#int e0/2
Switch2(config-if)#vlan-membership static 3
Switch2(config-if)#int e0/3
Switch2(config-if)#vlan-membership static 3
Switch2(config-if)#int e0/4
Switch2(config-if)#vlan-membership static 3
……
Switch2(config-if)#int e0/15
Switch2(config-if)#vlan-membership static 3
Switch2(config-if)#int e0/16
Switch2(config-if)#vlan-membership static 3
Switch2(config-if)#
?。?). 名為”Switch3″的交換機(jī)的VLAN端口號(hào)配置如下(它包括兩個(gè)VLAN組的配置),先看VLAN 4(Huma)的配置代碼:
Switch3(config)#int e0/2
Switch3(config-if)#vlan-membership static 4
Switch3(config-if)#int e0/3
Switch3(config-if)#vlan-membership static 4
Switch3(config-if)#int e0/4
Switch3(config-if)#vlan-membership static 4
……
Switch3(config-if)#int e0/8
Switch3(config-if)#vlan-membership static 4
Switch3(config-if)#int e0/9
Switch3(config-if)#vlan-membership static 4
Switch3(config-if)#
下面是VLAN5(Info)的配置代碼:
Switch3(config)#int e0/10
Switch3(config-if)#vlan-membership static 5
Switch3(config-if)#int e0/11
Switch3(config-if)#vlan-membership static 5
Switch3(config-if)#int e0/12
Switch3(config-if)#vlan-membership static 5
……
Switch3(config-if)#int e0/20
Switch3(config-if)#vlan-membership static 5
Switch3(config-if)#int e0/21
Switch3(config-if)#vlan-membership static 5
Switch3(config-if)#
vlan配置
switch>enable
switch#conf t
switch(confit)#vlan 2 ? ? //config模式新建一喚弊個(gè)vlan2
switch(confit-vlan)#name tuoyu2 ? //給vlan2起一個(gè)名字
switch(confit-vlan)#exit
switch(confit)#vlan 3 ? ? //config模和寬族式新建vlan3
switch(confit-vlan)#name tuoyu3 ? ?//給vlan3起一個(gè)名字
switch(confit-vlan)#end
switch#vlan database ? ? ?//vlan數(shù)據(jù)庫(kù)模式新建vlan
Switch(vlan)#vlan 10 name tuoyu
VLAN 10 added:
Name: tuoyu
Switch(vlan)#exit
APP completed.
Exiting….
switch(config)#int f0/1
switch(config-if)#switchport access vlan 2 ? ? //將接口F0/1接入到vlan2
switch(config-if)#exit
switch(config)#int f0/2
switch(config-if)#switchport access vlan 3 ? ? //將接口F0/2接巧昌入到vlan3
switch(config-if)#exit
switch(config)#int range f0/17 -24
switch(config-range-if)#switchport access vlan 10 ? //將一組接口加到一個(gè)vlan里
switch#show vlan ? ?//查看vlan的詳細(xì)信息
交換機(jī)的vlan數(shù)據(jù)庫(kù)的介紹就聊到這里吧,感謝你花時(shí)間閱讀本站內(nèi)容,更多關(guān)于交換機(jī)的vlan數(shù)據(jù)庫(kù),深入了解交換機(jī)的vlan數(shù)據(jù)庫(kù)及其作用,關(guān)于cisco交換機(jī)vlan問題,怎樣配置VLAN?的信息別忘了在本站進(jìn)行查找喔。
創(chuàng)新互聯(lián)服務(wù)器托管擁有成都T3+級(jí)標(biāo)準(zhǔn)機(jī)房資源,具備完善的安防設(shè)施、三線及BGP網(wǎng)絡(luò)接入帶寬達(dá)10T,機(jī)柜接入千兆交換機(jī),能夠有效保證服務(wù)器托管業(yè)務(wù)安全、可靠、穩(wěn)定、高效運(yùn)行;創(chuàng)新互聯(lián)專注于成都服務(wù)器托管租用十余年,得到成都等地區(qū)行業(yè)客戶的一致認(rèn)可。
當(dāng)前題目:深入了解交換機(jī)的vlan數(shù)據(jù)庫(kù)及其作用(交換機(jī)的vlan數(shù)據(jù)庫(kù))
轉(zhuǎn)載來于:http://m.fisionsoft.com.cn/article/cccssci.html


咨詢
建站咨詢
