Trunk配置實例
如圖,兩臺交換機SW1和SW2各劃分了三個VLAN,端口配置如下:
VLAN 1: F0/1 - F0/3: VLAN 2: F0/4 - F0/10 VLAN 3: F0/11 - F0/23
兩臺交換機的配置類似,現在以SW1爲例,介紹Trunk配置與驗證的過程
1.在交換機上添加vlan
sw1(config)#vlan 2
sw1(config-vlan)#exit
sw1(config)#vlan 3
sw1(config-vlan)#exit
2.將接口添加到相應的VLAN中,命令如下
sw1(config)#interface range f0/4 - 10
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
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的封裝類型兼容