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的封装类型兼容

相关文章
相关标签/搜索