VLAN劃分與VLAN TRUNK的配置

2021-10-04 22:18:13 字數 3006 閱讀 5693

一、vlan劃分實驗

1.建立vlan

switch>enable

switch#configure terminal

enter configuration commands, one per line. end with cntl/z.

switch(config)#vlan 10 //建立vlan 10

switch(config-vlan)#name test1 //將vlan10 命名為test1

switch(config-vlan)#exit

switch(config)#vlan 20

switch(config-vlan)#name test2

switch(config-vlan)#end

switch#show vlan //檢視vlan劃分情況

switch#configure terminal

switch(config)#inte***ce fastethernet 0/1 //進入fastethernet 0/1的埠配置模式

switch(config-if)#switchport mode access // 將fastethernet 0/1埠設定為接入模式

switch(config-if)#switchport access vlan 10 // 將fastethernet 0/1埠加入vlan10中

switch(config-if)#exit

switch(config)#inte***ce fastethernet 1/1

switch(config-if)#switchport mode access

switch(config-if)#switchport access vlan 20

switch(config-if)#end

switch#configure terminal

enter configuration commands, one per line. end with cntl/z.

switch(config)#inte***ce fastethernet 2/1

switch(config-if)#switchport mode access

switch(config-if)#switchport access vlan 10

switch(config-if)#end

switch#show vlan

2.實驗除錯:三個pc機互相ping一下,檢視能否ping通。

3.注意事項:

(1).vlan1屬於系統預設的vlan,不可以被刪除

(2).刪除某個vlan,使用no命令。如:switch(config)#no vlan 10

(3).刪除當前某一vlan時,注意先將屬於該vlan的埠加入其他vlan,再刪除該vlan,否則此埠不屬於任何vlan。

二、trunk配置實驗

1.建立vlan

switch>enable

switch#configure terminal

enter configuration commands, one per line. end with cntl/z.

switch(config)#vlan 10 //建立vlan 10

switch(config-vlan)#name test1 //將vlan10 命名為test1

switch(config-vlan)#exit

switch(config)#vlan 20

switch(config-vlan)#name test2

2.安排埠到相應的vlan中

switch1#configure terminal

switch1(config)#inte***ce fastethernet 0/1

switch1(config-if)#switchport mode access

switch1(config-if)#switchport access vlan 10

switch1(config-if)#exit

switch1(config)#inte***ce fastethernet 0/2

switch1(config-if)#switchport mode access

switch1(config-if)#switchport access vlan 20

switch1(config-if)#end

switch2#:步驟同switch1#

3.建立trunk

switch1#configure terminal

switch1(config)#inte***ce fastethernet 0/24

switch1(config-if)#switchport mode trunk

switch2#configure terminal

switch2(config)#inte***ce fastethernet 0/24

switch2(config-if)#switchport mode trunk

4.從trunk中刪除某個vlan

switch1(config)#inte***ce fa0/24

switch1(config-if)#switchport trunk allowed vlan remove 10

switch1#show running-config 檢視fa0/24介面的trunk配置

測試同一vlan機器的連通性

5.從trunk中刪新增某個vlan

switch1(config)#inte***ce fa0/24

switch1(config-if)#switchport trunk allowed vlan add 10

測試同一vlan機器的連通性

VLAN劃分與子網劃分的區別

vlan劃分與子網劃分的區別 vlan是乙太網中常用的一種網路隔離技術,工作在osi參考模型中的資料鏈路層,是交換機的基本功能之一。使用vlan技術的最主要原因是為了限制廣播域。利用vlan可以自由設計廣播域的構成,提高網路設計的自由度。子網劃分是為了充分利用ip位址,防止浪費,提高網路效率的一 種...

如何劃分vlan

本次實驗的目標是為 pc1 pc3劃分為vlan2 pc2 pc4劃分為vlan3 使pc1能夠和pc3通訊但是不能和pc2 pc4通訊 pc2能和pc4通訊 但是不能和pc1 pc3通訊 1.如圖所示 為pc1到pc4分配同網段ip位址 然後進入sw1 system view進入系統檢視 vlan...

VLAN的劃分與子網的劃分的區別

vlan的劃分與子網的劃分的區別 1 網路劃分 1 子網劃分,對乙個網路進行子網劃分時,基本上就是將它分成小的網路。比如,當一組ip位址指定給乙個公司時,公司可能將該網路 分割成 小的網路,每個部門乙個。2 虛擬區域網 vlan 是一組邏輯上的裝置和使用者,裝置和使用者並不受物理位置的限制,可以根據...