登录站点

用户名

密码

VTP VLAN中继协议

4已有 3777 次阅读  2012-05-14 09:25   标签blank  server  局域网 
VTP VLAN中继协议
VTP(VLAN Trunking Protocol):是VLAN中继协议,也被称为虚拟局域网干道协议。它是思科私有协议。作用是十几台交换机在企业网中,配置VLAN工作量大,可以使用VTP协议,把一台交换机配置成VTP Server, 其余交换机配置成VTP Client,这样他们可以自动学习到server 上的VLAN 信息。
  • 步骤一: 将sw1与sw2与sw3的端口指定为trunk工作模式。

SW(config)#interface fastEthernet 0/1 //进入对应的接口
SW(config-if)#switchport mode trunk

  • 步骤二: 配置VTP协议 (VLAN中继协议)

SW1(vlan)#vtp domain cisco //必须在相同的域才可以学习VLAN 的配置。
Changing VTP domain name from NULL to cisco
SW1(vlan)#vtp password cisco //密码也当然需要一直才能学习到的。
Setting device VLAN database password to cisco
SW1(vlan)#vtp server  //设置交换机的工作模式
Device mode already VTP SERVER.
SW1(vlan)#exit  //和VLAN一样,需要退出后配置才会生效
APPLY completed.
Exiting….
SW1#

SW2#vlan database
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.

SW2(vlan)#vtp domain cisco
Domain name already set to cisco.
SW2(vlan)#vtp password cisco
Setting device VLAN database password to cisco
SW2(vlan)#vtp client
Setting device to VTP CLIENT mode.
SW2(vlan)#exit
APPLY completed.
Exiting….
SW2#

SW2#vlan database
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.

SW3(vlan)#vtp domain cisco
Domain name already set to cisco.
SW3(vlan)#vtp password cisco
Setting device VLAN database password to cisco
SW3(vlan)#vtp client
Setting device to VTP CLIENT mode.
SW3(vlan)#exit
APPLY completed.
Exiting….
SW3#

  • 步骤三:查看VTP的状态

SW3#show vtp status
VTP Version                     : 2
Configuration Revision          : 0
Maximum VLANs supported locally : 255
Number of existing VLANs        : 5
VTP Operating Mode              : Client
VTP Domain Name                 : cisco
VTP Pruning Mode                : Disabled
VTP V2 Mode                     : Disabled
VTP Traps Generation            : Disabled
MD5 digest                      : 0xAA 0xB9 0x0C 0xCD 0xD7 0xE8 0xA6 0xE0
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00

  • 步骤四:在SW1上创建三个vlan10, 20, 30,然后到sw2和sw3上show vlan查看。结果是同步的。

SW1#vlan database
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.

SW1(vlan)#vlan 10 name test
VLAN 10 added:
    Name: test
SW1(vlan)#exit
APPLY completed.
Exiting….
SW1#show vlan

VLAN Name                             Status    Ports
—- ——————————– ——— ——————————-
1    default                          active    Fa0/2, Fa0/3, Fa0/4, Fa0/5
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Fa0/20, Fa0/21
                                                Fa0/22, Fa0/23, Fa0/24, Gig1/1
                                                Gig1/2
10   test                             active   
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
—- —– ———- —– —— —— ——– —- ——– —— ——
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0  
1003 tr    101003     1500  -      -      -        -    -        0      0  
1004 fdnet 101004     1500  -      -      -        ieee -        0      0  
1005 trnet 101005     1500  -      -      -        ibm  -        0      0  

Remote SPAN VLANs
——————————————————————————
Primary Secondary Type              Ports
——- ——— —————– ——————————————
SW1#

SW2#show vlan

VLAN Name                             Status    Ports
—- ——————————– ——— ——————————-
1    default                          active    Fa0/3, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24, Gig1/1, Gig1/2
10   test                             active   
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
—- —– ———- —– —— —— ——– —- ——– —— ——
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0  
1003 tr    101003     1500  -      -      -        -    -        0      0  
1004 fdnet 101004     1500  -      -      -        ieee -        0      0  
1005 trnet 101005     1500  -      -      -        ibm  -        0      0  

Remote SPAN VLANs
——————————————————————————
Primary Secondary Type              Ports
——- ——— —————– ——————————————
SW2#

SW3#show vlan

VLAN Name                             Status    Ports
—- ——————————– ——— ——————————-
1    default                          active    Fa0/3, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24, Gig1/1, Gig1/2
10   test                             active   
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
—- —– ———- —– —— —— ——– —- ——– —— ——
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0  
1003 tr    101003     1500  -      -      -        -    -        0      0  
1004 fdnet 101004     1500  -      -      -        ieee -        0      0  
1005 trnet 101005     1500  -      -      -        ibm  -        0      0  

Remote SPAN VLANs
——————————————————————————
Primary Secondary Type              Ports
——- ——— —————– ——————————————
SW3#

  • 配置VTP修剪CCNA中為可选内容,但作用却非常大)

SW#vlan database
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.
SW(vlan)#vtp pruning

  • 可选步骤:如果在SW2、SW3上未学习到SW1上的VLAN信息,通过show vtp status命令来确认当前交换机是工作在Client模式下,如果不是请参考 步骤二 配置后,关闭Trunk链路,通过clear vtp counters 来清除当前 VTP的状态后再打开互联的Trunk链路,即可学习到。

 

  • 故障排查详细步骤:

很多时候按照常规配置完毕后,并不能学习到VLAN信息,通过show vtp status命来查看往前设备与VTP Server脚色的交换机对比,请重点排查以下点:

SW#show vtp status
VTP Version : 2 //VTP的版本是否一致,如果不一直需配置一下
Configuration Revision : 0
Maximum VLANs supported locally : 255
Number of existing VLANs : 5
VTP Operating Mode : Client //确认当前交换机的工作脚色
VTP Domain Name : cisco //交换机所在域是否和Server模式的交换机一致
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0xAA 0xB9 0x0C 0xCD 0xD7 0xE8 0xA6 0xE0 //交换机密码是否与Server模式的交换机一致,如果不一致请确认后重新配置
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00

确认以上信息一致后,再确认交换机之间的互联链路是否为Trunk模式,通过命令来查看:

SW#show int trunk
Port Mode Encapsulation Status Native vlan
Fa0/1 on 802.1q trunking 1

Port Vlans allowed on trunk
Fa0/1 1-1005

Port Vlans allowed and active in management domain
Fa0/1 1

Port Vlans in spanning tree forwarding state and not pruned
Fa0/1 none
SW#

如果异常请用一下命令来配置:

SW#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW(config)#int f0/1
SW(config-if)#sw mo trunk
SW(config-if)#exit
SW(config)#

至此,仍然不能学习到VLAN信息,请首先关闭互联的Trunk链路

SW#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW(config)#int f0/1
SW(config-if)#shutdown

清理VTP同步计数:

Switch#clear vtp counters

再打开互联的Trunk链路,即可正常学习到VLAN信息。

分享 举报

发表评论 评论 (6 个评论)

涂鸦板