Trunk配置實例

 Trunk配置實例

 如圖,兩臺交換機SW1和SW2各劃分了三個VLAN,端口配置以下:app

  VLAN 1: F0/1 - F0/3: VLAN 2: F0/4 - F0/10 VLAN 3: F0/11 - F0/23ide

  

兩臺交換機的配置相似,如今以SW1爲例,介紹Trunk配置與驗證的過程orm

1.在交換機上添加vlan
 blog

 

sw1(config)#vlan 2接口

sw1(config-vlan)#exitci

 

sw1(config)#vlan 3rem

sw1(config-vlan)#exitget

 

 

2.將接口添加到相應的VLAN中,命令以下it

sw1(config)#interface range f0/4 - 10io

sw1(config-if)#switchport mode access

sw1(config-if)#switchport access vlan 2

 

 

sw1(config)interface range f0/11 - 23

sw1(config-if)#switchport mode access

sw1(config-if)#switchport access vlan 3

 

 

3.配置交換機之間互聯的端口爲Trunk模式,命令以下

sw1(config)#interface f0/24

sw1(config-if)switchport mode trunk

4.在另外一臺交換機上執行相似的配置,配置完成後,使用show命令進行驗證,命令以下。

 

SW1#show int fa0/24 switchport 

Name: Fa0/24

Switchport: Enabled

Administrative Mode: trunk

Operational Mode: trunk

Administrative Trunking Encapsulation: dot1q

Operational Trunking Encapsulation: dot1q

Negotiation of Trunking: On

Access Mode VLAN: 1 (default)

Trunking Native Mode VLAN: 1 (default)

Voice VLAN: none

Administrative private-vlan host-association: none

Administrative private-vlan mapping: none

Administrative private-vlan trunk native VLAN: none

Administrative private-vlan trunk encapsulation: dot1q

Administrative private-vlan trunk normal VLANs: none

Administrative private-vlan trunk private VLANs: none

Operational private-vlan: none

Trunking VLANs Enabled: ALL

Pruning VLANs Enabled: 2-1001

Capture Mode Disabled

Capture VLANs Allowed: ALL

   在上面的命令輸出中能夠看出,在端口F0/24上配置接口模式爲Trunk,而且工做模式也是Trunk,
   Trunk封裝的協議是802.1Q,Trunk能夠承載全部的VLAN。
 
5.若是不須要在Trunk上傳輸VLAN 2的數據,能夠在Trunk上移除VLAN 2,以下所示
SW1(config)#interface fastEthernet 0/24
SW1(config-if)#switchport trunk allowed vlan remove 2
SW1(config-if)#exit
 

 

SW1#show int fa0/24 switchport 

Name: Fa0/24

Switchport: Enabled

Administrative Mode: trunk

Operational Mode: trunk

Administrative Trunking Encapsulation: dot1q

Operational Trunking Encapsulation: dot1q

Negotiation of Trunking: On

Access Mode VLAN: 1 (default)

Trunking Native Mode VLAN: 1 (default)

Voice VLAN: none

Administrative private-vlan host-association: none

Administrative private-vlan mapping: none

Administrative private-vlan trunk native VLAN: none

Administrative private-vlan trunk encapsulation: dot1q

Administrative private-vlan trunk normal VLANs: none

Administrative private-vlan trunk private VLANs: none

Operational private-vlan: none

Trunking VLANs Enabled: 1,3-1005

Pruning VLANs Enabled: 2-1001

Capture Mode Disabled

Capture VLANs Allowed: ALL

從上面show int fa0/24 switchport 命令的輸出能夠看出,Trunk中已經移除了VLAN2。

Trunk的排錯

  VLAN中常見故障是設備不能跨越Trunk鏈路而創建鏈接。爲了可以對Trunk接口的故障進行排錯,須要驗證下列配置是否正確。

1.接口模式

  要確保至少一則的鏈路的Trunk模式應當是Trunk或desirable。經過使用命令 show interfaces trunk 能夠驗證接口的Trunk配置。

2。封裝類型

確保鏈路兩端的Trunk的封裝類型兼容

相關文章
相關標籤/搜索