19 · Implementing VLANs and Trunks實作 VLAN 與中繼

Creating a VLAN建立 VLAN

On Cisco Catalyst Series Switches, you can use the vlan global configuration command to create a VLAN and enter the VLAN configuration mode. Use the no form of this command to delete the VLAN. The example shows how to add VLAN 2 to the VLAN database and how to name it "data."

在 Cisco Catalyst 系列交換器上,你可以使用 vlan 全域設定指令來建立 VLAN 並進入 VLAN 設定模式。使用此指令的 no 形式可刪除該 VLAN。此範例示範如何將 VLAN 2 新增到 VLAN 資料庫中,並將其命名為「data」。

Add VLAN 2 and name it "data".

新增 VLAN 2 並將其命名為「data」。

SW1# configure terminal 
SW1(config)# vlan 2 
SW1(config-vlan)# name data

The following table lists the VLAN ranges on Cisco Catalyst switches:

下表列出 Cisco Catalyst 交換器上的 VLAN 範圍:

Command and Variable
指令與變數
Description
說明
vlanvlan-id
vlanvlan-id
Enter a new VLAN ID (VID) to create a VLAN, or enter an existing VLAN ID to modify that VLAN. Do not enter leading zeros. You can enter a single VID, a series of VIDs that are separated by commas, or a range of VIDs that are separated by hyphens.
輸入一個新的 VLAN ID(VID)以建立 VLAN,或輸入現有的 VLAN ID 以修改該 VLAN。不要輸入前導零。你可以輸入單一 VID、以逗號分隔的一系列 VID,或以連字號分隔的 VID 範圍。
namevlan-name
namevlan-name
(Optional) Specifies the VLAN name, which is an ASCII string from 1 to 32 characters that must be unique within the administrative domain.
(選用)指定 VLAN 名稱,這是一個 1 到 32 個字元的 ASCII 字串,且在管理網域內必須是唯一的。

To add a VLAN to the VLAN database, use the vlan global configuration command by entering a VID.

若要將 VLAN 新增到 VLAN 資料庫中,請使用 vlan 全域設定指令並輸入 VID。

The following table lists the VLAN ranges on Cisco Catalyst switches:

下表列出 Cisco Catalyst 交換器上的 VLAN 範圍:

VLANs
VLAN
Range Type
範圍類型
Usage
用途
0, 4095
0、4095
Reserved
保留
For system use only. You cannot use these VLANs.
僅供系統使用。你無法使用這些 VLAN。
1
1
Normal
一般
The Cisco default VLAN on a switch. You can use this VLAN, but cannot delete/ rename it. All interfaces belong to this VLAN, by default.
交換器上的 Cisco 預設 VLAN。你可以使用此 VLAN,但無法刪除/重新命名它。預設情況下,所有介面都屬於此 VLAN。
2–1001
2–1001
Normal
一般
Used for Ethernet VLANs.
用於乙太網路 VLAN。
1002–1005
1002–1005
Normal
一般
For legacy reasons, these VLANs are used for Token Ring and FDDI VLANs. You cannot delete VLANs 1002-1005.
基於歷史因素,這些 VLAN 用於 Token Ring 與 FDDI VLAN。你無法刪除 VLAN 1002–1005。
1006–4094
1006–4094
Extended
延伸
Used for Ethernet VLANs.
用於乙太網路 VLAN。

VLANs 1 and 1002–1005 are automatically created by the switch while the others have to be created manually.

VLAN 1 與 1002–1005 是由交換器自動建立,其他 VLAN 則必須手動建立。

VLAN Trunking Protocol (VTP) is a Cisco proprietary Layer 2 Messaging protocol that maintains VLAN configuration consistency by managing the addition, deletion, and renaming of VLANs on a networkwide basis. It reduces administration overhead in a switched network. The switch supports VLANs in VTP client, server, and transparent modes.

VLAN 中繼協定(VTP)是一種 Cisco 專屬的第 2 層訊息協定,透過在整個網路範圍內管理 VLAN 的新增、刪除與重新命名,以維持 VLAN 設定的一致性。它能降低交換式網路中的管理負擔。此交換器支援 VTP 用戶端、伺服器及透通模式下的 VLAN。

The configurations of VIDs 1 to 1005 are always saved in the VLAN database (vlan.dat file), which is stored in flash memory. If the VTP mode is transparent, they are also stored in the switch running configuration file, and you can save the configuration in the startup configuration file.

VID 1 到 1005 的設定一律儲存在 VLAN 資料庫(vlan.dat 檔案)中,該檔案儲存於快閃記憶體中。若 VTP 模式為透通模式,這些設定也會儲存在交換器的執行中設定檔案中,你也可以將設定儲存到啟動設定檔案中。

In VTP versions 1 and 2, the switch must be in VTP transparent mode when you create extended VLANs (VIDs 1006 to 4094). These VLANs are not stored in the VLAN database but because VTP mode is transparent, they are stored in the switch running (and if saved in startup) configuration file. However, extended-range VLANs created in VTP version 3 are stored in the VLAN database, and can be propagated by VTP. Thus, VTP version 3 supports extended VLANs creation and modification in server and transparent modes.

在 VTP 版本 1 與版本 2 中,建立延伸 VLAN(VID 1006 到 4094)時,交換器必須處於 VTP 透通模式。這些 VLAN 不會儲存在 VLAN 資料庫中,但由於 VTP 模式為透通模式,它們會儲存在交換器的執行中設定檔案(若有儲存則也會存在啟動設定檔案)中。不過,在 VTP 版本 3 中建立的延伸範圍 VLAN 會儲存在 VLAN 資料庫中,並可透過 VTP 傳播。因此,VTP 版本 3 支援在伺服器與透通模式下建立及修改延伸 VLAN。

To create an Ethernet VLAN, you must specify at least a VLAN number. If you do not enter a name for the VLAN, the default is to append the VLAN number to the vlan command. For example, VLAN0004 would be the default name for VLAN 4 if you don't specify a name.

要建立乙太網路 VLAN,你至少必須指定一個 VLAN 編號。若你未輸入 VLAN 名稱,預設會將 VLAN 編號附加到 vlan 指令之後。例如,若你未指定名稱,VLAN 4 的預設名稱會是 VLAN0004。

What is the default range for normal Ethernet VLANs that is supported on all switches?"所有交換器都支援的一般乙太網路 VLAN 預設範圍為何?"
Which Cisco IOS command should you use to create a VLAN?應使用哪個 Cisco IOS 指令來建立 VLAN?