通过命令show int trunk 可以查看当前的trunk链路,及端口信息,如下所示
JM-C3560-JR#sh int trunk
Port Mode Encapsulation Status Native vlan
Gi0/41 on 802.1q trunking 1
Gi0/42 on 802.1q trunking 1
Gi0/44 on 802.1q trunking 1
Port Vlans allowed on trunk
Gi0/41 1-4094
Gi0/42 1-4094
Gi0/44 1-4094
Port Vlans allowed and active in management domain
Gi0/41 1-10,12
Gi0/42 1-10,12
Gi0/44 1-10,12
Port Vlans in spanning tree forwarding state and not pruned
Gi0/41 1-10,12
Gi0/42 1-10,12
Gi0/44 1-10,12
JM-C3560-JR#
通过show int status 可以查看端口信息列表,也能查看端口的trunk状态,及端口所属vlan,如图
Port Name Status Vlan Duplex Speed Type
Gi0/39 disabled 1 auto auto 10/100/1000BaseTX
Gi0/40 disabled 1 auto auto 10/100/1000BaseTX
Gi0/41 To_F5Q3300 connected trunk a-full a-100 10/100/1000BaseTX
Gi0/42 To_JM--Q2403-2 connected trunk a-full a-100 10/100/1000BaseTX
Gi0/43 disabled 1 auto auto 10/100/1000BaseTX
Gi0/44 To_JM3 connected trunk a-half a-100 10/100/1000BaseTX
Gi0/45 disabled 8 auto auto 10/100/1000BaseTX
思科会有一个CDP的协议(cisco discover protocol)一个私有的协议,默认情况下是开启该功能的,如果用思科设备接PC或者其他接入设备,端口会自动成为access 接口,如果接另外一台思科的交换机,两边通过CDP协议,就有可能协商成为trunk链路。