1.vlan trunk的作用:
用一条链路透传多个vlan信息。
2.因为在trunk链路上可以传输多个vlan的数据,所以在接收方就不能像静态vlan一样通过接收端口判断
该数据属于哪个vlan,此时trunk链路上传输的数据必须带有vlan信息,以便接收方能够根据数据帧中
的vlan信息字段,直接判断出该数据属于哪个vlan
3.vlan信息的表示方法(标记方法):
        i:ISL
            a:cisco私有
            b:采用封装的方法标记vlan信息
        |  26byte ISL header | DA | SA | TYPE | DATA | FCS | 4byte FCS |
        /                     \
               vlan ID
            c:没有native vlan的定义
            d:直接加上CRC
               
        ii:IEEE 802.1q
            a:RFC定义的,公有的标签协议。
            b:采用标签的方法标记vlan信息
         | DA | SA  | TYPE | DATA | FCS |
                   / \
                  |TAG|        = 4byte
                 VLAN ID
            c:有native vlan 的定义,缺省为vlan 1
            d:重算CRC
交换机的链路类型:
        1.access(接入链路):该链路上传输的数据是标准的以太网数据帧。(只能属于某一个vlan)
        2.trunk(中继链路):该链路上传输的数据是带有标签的(对应的端口不属于任何一个vlan)
交换机端口的模式:
        1.access:该接口所连的链路必然为 static access
        2.trunk:该接口所连链路必然为 trunk
        3.dynamic desirable动态企望:dynamic negotiate,主动发起协商过程。(2950系列的交换机接口模式
                                     默认为动态企望)
        4.dynamic auto动态自动:dynamic negotiate,被动允许,能够接收协商请求。
trunk的相关配置:
        1.查看接口的模式
        SW1#show interfaces f0/1 switchport
               
SW1#show interfaces f0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: dynamic auto
Operational Mode: static access
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: native
Negotiation of Trunking: On
Access Mode VLAN: 2 (VLAN0002)
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
        2.改变接口模式
        SW1(config-if)#switchport mode access
                                       trunk
                                       dynamic  desirable
                                       dynamic  auto
SW1#show interfaces g1/1 switchport
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)
        3.关闭DTP(协商)
        SW1(config-if)#switchport nonegotiate
        4.更改trunk端口的native vlan 设置
SW1(config-if)#switchport trunk native vlan 2
        5.配置trunk端口的vlan列表(列表中的vlan数据允许通过,cisco的缺省值为ALL,H3C缺省为NULL)
        SW1(config-if)#switchport trunk allowed vlan remove 2 --> vlan列表移除2
        SW1(config-if)#switchport trunk allowed vlan 1,2,3,6,10-->直接配置vlan列表
        SW1(config-if)#switchport trunk allowed vlan add 2 --> vlan列表添加2

SW1#show interfaces g1/1 switchport
Name: Gig1/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Off
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 2 (VLAN0002)
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
Name: Gig1/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Off
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 2 (VLAN0002)
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
Protected: false
Appliance trust: none
-----------------------------------
VTP( vlan trunk protocol)vlan 中继协议:
        1.vtp domain (VTP域):只有在同一个vtp域中的交换机才能同步vlan信息。如果当前交换机没有配置
                              vtp domain,收到通告后会自动学习vtp 域名
        2.vtp mode (VTP的模式/身份):
                i:server
                        1.能够创建,删除,命名vlan
                        2.每隔5分钟发送VTP通告,或者当VLAN信息更改的时候
                        3.vlan信息改变的时候配置修订号+1,初始情况修订号为0
                ii:client
                        1.不能创建,删除,命名vlan
                        2.只能同步vlan信息。
                        3.收到VTP的通告消息,比较消息中的修订号字段,如果更大(更新),则同步
                iii:transparent(透明)
                        1.能够创建,删除,命名vlan
                        2.不能够主动发送VTP通告,能够转发VTP通告
                        3.不同步vlan信息
       
        3.vtp的修订号:
                1.只有server/transparent能够主动的增加修订号
                2.client同步(只有收到的vtp通告中的修订号更大时才同步)

VTP client同步的条件:
        1.server发送的VTP通告中的 配置修订编号 比当前保存的高
        2.VTP域名一致
        3.交换机之间互联的链路为trunk
        4.配置的口令一致
                配置方法:switch(config)#vtp password 123
VTP相关配置:
        1.vtp domain alading --->修改VTP域名为alading
        2.vtp mode server/client/transparent -->修改VTP模式
        3.vtp password 123 --->设置VTP口令为123
        4.vtp pruning  --->开启VTP裁剪的功能(只需要在server上开启就可以,client自动同步)
        5.show  vtp status ---> 查看VTP的状态信息
SW1#show vtp status
VTP Version                     : 2   --->vtp版本
Configuration Revision          : 12  --->配置修订编号(修改vlan信息+1)
Maximum VLANs supported locally : 255  --->允许最大的本地vlan数量
Number of existing VLANs        : 10   --->当前存在的vlan数量
VTP Operating Mode              : Server  --->vtp的模式
VTP Domain Name                 : ald     --->vtp的域名
VTP Pruning Mode                : enable  --->vtp的裁剪功能是否打开
VTP V2 Mode                     : Disabled  
VTP Traps Generation            : Disabled
MD5 digest                      : 0x28 0x3D 0x7E 0x62 0x68 0x47 0x0B 0x3F
Configuration last modified by 0.0.0.0 at 3-1-93 01:19:32
Local updater ID is 0.0.0.0 (no valid interface found)