
trunk
“trunk”在网路用语中一般译为:“主干线、中继线、长途线” ,不过一般不用译意,直接使用英文。在路由/交换网路中,trunk通常被称为“中继(透传)”。在语音级套用的线路中,trunk一般指“主干网路、电话干线”,即两个交换局或交换机之间的连线电路或信道,它为两端设备之间进行转接,作为信令和终端设备数据的传输链路。
基本介绍
- 中文名:主干线、中继线、长途线
- 外文名:trunk
- 别称:中继(透传)
- 简称:trunk
基本词义
英音:[trʌŋk]美音:[trʌŋk] 名词 n. [C]
1. 树干
The trunk of this tree is four meters thick.
这棵树的树干有四米粗。
2. (旅行用)大皮箱;汽车车尾的行李箱
Let me put your baggage in the trunk.
我来把你的行李放在汽车后部的行李箱内。
3. 象鼻;昆虫等的长嘴
4. 躯干,身躯
The athlete has a powerful trunk.
那个运动员身躯强壮有力。
5. (铁路,公路等的)干线
6. 大血管,神经乾
7. 男用运动短裤;男用泳裤(尤指性感或情趣类)[P]
8. 【矿】洗矿槽
及物动词 vt.
1. 槽内洗选(矿砂)
套用
在路由/交换领域,VLAN的中继连线埠叫做trunk。trunk技术用在交换机之间互连,使不同VLAN通过共享链路与其它交换机中的相同VLAN通信。交换机之间互连的连线埠就称为trunk连线埠。trunk是基于OSI第二层数据链路层(DataLinkLayer)的技术。两台交换机上分别创建了多个VLAN(VLAN是基于Layer 2的),在两台交换机上相同的VLAN(比如VLAN10)要通信,需要将交换机A上属于VLAN10的一个连线埠与交换机B上属于VLAN10的一个连线埠互连;如果这两台交换机其它相同VLAN间需要通信,那幺交换机之间需要更多的互连线,连线埠利用率就太低了。 交换机通过trunk功能,事情就简单了,只需要两台交换机之间有一条互连线,将互连线的两个连线埠设定为trunk模式,这样就可以使交换机上不同VLAN共享这条线路。
trunk不能实现不同VLAN间通信,需要通过三层设备(路由/三层交换机)来实现。
划分
交换连线埠两种模式:access和trunk。连线终端(如PC)用access模式,设备级连线用trunk模式。把access连线埠加入到某个VLAN,那幺这个连线埠就只将这个VLAN的数据转发给PC,PC传送的数据通过这个连线埠后会打上这个VLAN的ID,转发到相同VLAN。(这里为了简单表述,混杂模式连线埠不做讨论;将PC用access模式,其他情况不做讨论。)
配置
Cisco默认的trunk封装协定为dot1q(802.1q)。
配置方法:
Switch(config)#interface gigabitEthernet 1/1
Switch(config-if)#switchport trunk encapsulation dot1q //默认封装,该命令可以省略,特殊情况:配置单臂路由,必须敲这条命令。
Switch(config-if)#switchport mode trunk //协定变化,连线埠协定会down /up转换一次。
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/1, changedState to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/1, changedState to up
Switch(config-if)#switchport trunk allowed vlan 10,20 // VLAN 修剪,add/remove 参数增减
Switch(config-if)#exit
验证方法:
Switch#show interfaces trunk // show interswitchport 命令也可以。
Port Mode Encapsulation Status Native vlan
Gig1/1 on 802.1q trunking 1
Port Vlans allowed on trunk
Gig1/1 10,20
Port Vlans allowed and active in management domain
Gig1/1 none
Port Vlans in spanning tree forwarding state and not pruned
Gig1/1 none
或
Switch#show interfaces gigabitEthernet 1/1 switchport // show running inter [interface] 验证方法其实很多的;
Name: Gig1/1
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
Protected: false
Appliance trust: none