CCNA系列六之VTP协议

来源:互联网 发布:windows10 mysql 启动 编辑:程序博客网 时间:2024/05/24 00:01

0x00 前言

        VTP(VLAN Trunking Protocol):是VLAN中继协议,也被称为虚拟局域网干道协议。它是思科私有协议。作用是十几台交换机在企业网中,配置VLAN工作量大,可以使用VTP协议,把一台交换机配置成VTP Server, 其余交换机配置成VTP Client,这样他们可以自动学习到server 上的VLAN 信息。


0x01 VTP 基本配置 

1、部署 VTP 技术,整个 VTP 管理域为 PingingLab,密码为 Cisco,其中
SW1 为 Server,其他交换机为 Client
    SW1#vlan database 
    SW1(vlan)#vtp server//定义 VTP 模式,全局模式方式
    SW1(vlan)#vtp domain PingingLab 
    SW1(vlan)#vtp password Cisco
SW2#vlan database 
SW2(vlan)#vtp client 
SW2(vlan)#vtp domain PingingLab 
SW2(vlan)#vtp password Cisco 
   SW3配置和R2类似
此时查看 VTP 信息#show vtp status 
VTP Version  : 2 
Configuration Revision  : 0//此时 Server 端未创建 VLAN,默认配置版本号都为 0。
2、为了使得全网都能学习到 VLAN10/20/30,需要在 Server 创建
SW1(vlan)#vlan 10 name VLAN_10 
SW1(vlan)#vlan 20 name VLAN_20 
SW1(vlan)#vlan 30 name VLAN_30
SW1#show vtp status 
VTP Version  : 2 //由于 VLAN 信息出现变动,VTP 版本号增加,
此时查看其他 Client 端信息 
SW2#show vtp status 
VTP Version  : 2 
Configuration Revision  : 1 可以看到,由于 Server 端版本号较高,Client 端已经从 Server 端同步 VLAN 信息
查看 VLAN 信息,如下: 
    #show vlan-switch brief  
   可以看到,通过部署 VTP 技术,此时 VLAN 信息全局同步。 
3、修改 SW2 和 SW3 的管理域或者密码,并在 SW1 修改 VLAN 信息,查看 VTP 同步效果
   SW2 上修改域名: 
   SW2(vlan)#vtp domain PL 
   Changing VTP domain name from PingingLab to PL 
   SW3 上修改密码: 
   SW3(vlan)#vtp password PL 
   Setting device VLAN database password to PL. 
 SW1 上修改 VLAN: 
 SW1#vlan database 
 SW1(vlan)#vlan 10 name TEST 
 SW1(vlan)#no vlan 20 
此时查看 SW1 上 VLAN 信息: 
SW1#show vlan-switch brief 
 再次观察 SW2 和 SW3 的 VLAN 信息:
  #show vlan-switch brief 
 可以看到,由于域名和密码的不一致,所以导致 VTP 信息无法同步。


0x02 VTP 进阶配置 

1.依据图中拓扑部署 VTP 技术,其中 SW1 为 Server,SW2 和 SW3 为 Client,SW3 模拟加入的交换机,要求 SW3 作为 Client 端,将其传递到全网,配置如下: 
    SW1#vlan database 
    SW1(vlan)#vtp domain PingingLab 
    SW1(vlan)#vtp password Cisco 
    SW1(vlan)#vlan 10 
    VLAN 10 added: 
      Name: VLAN0010 
   SW1(vlan)#vlan 20 
   VLAN 20 added: 
     Name: VLAN0020 
   SW1(vlan)#vlan 30 
   VLAN 30 added: 
     Name: VLAN0030 
   SW2#vlan database 
   SW2(vlan)#vtp client 
   SW2(vlan)#vtp domain PingingLab 
   SW2(vlan)#vtp password Cisco 
   查看 VTP 信息,如下: 
   SW1#show vtp status 
由于版本号低的会向版本号高的同步 VLAN 信息,所以,SW2 上: 
   SW2#show vlan-switch brief 
2、SW3 模拟新加入的交换机,为了使得其他交换机学习本地信息,保证本地的版本号够高,配置如下: 
①先将本地接口关闭 
    SW3(config)#int range f0/1 - 2 
    SW3(config-if-range)#sh 
②将 SW3 定义为 Server 模式,以便修改 VLAN 信息,增加版本号 
    SW3#vlan database 
    SW3(vlan)#vtp domain PingingLab 
    SW3(vlan)#vtp password Cisco 
③在 SW3 上不断修改 VLAN 信息,并查看版本号 
    SW3#vlan database 
    SW3(vlan)#vlan 100 
    VLAN 100 added: 
      Name: VLAN0100
VLAN database模式每次进和出使版本号加 1此时 SW3#show vtp status 
    VTP Version  : 2 
    Configuration Revision  : 3 
为保证版本号够大,可以不断进入 database 里面,创建和删除 VLAN
 再次查看 SW3 的 VTP 信息: 
    SW3#show vtp status 
    VTP Version  : 2 
    Configuration Revision  : 5 
④此时将 SW3 从 Server 模式切换到 Client 模式,并打开本地接口 
    SW3#vlan database 
    SW3(vlan)#vtp client
    SW3(config)#int range f0/1 - 2 
    SW3(config-if-range)#no sh 
⑤当打开接口后,相当于新加入一台 Client,但此 Client 的版本号比全局其他交换机都高,此时交换机之间会通过汇总通告、通告请求和子集通告等信息进行 VTP 同步,再次查
看 SW1 和 SW2 的 VTP 信息,如下: 
  #show vtp status 
  #show vlan-switch brief 
VTP 信息会向版本号最高的同步,不管是 Server 还是 Client
模式,这样的话,对于新加入的交换机就有必要将其版本号减低,否则,一旦原网络的 VLAN信息被“冲洗”,则整个网络会进入瘫痪状态! 
3、将 SW3 部署为透明模式,并观察其 VTP 信息,如下: 
SW3#vlan database 
    SW3(vlan)#vtp transparent 
    SW3(vlan)#exit 
    SW3#show vtp status 
    可以看到,当 VTP 为透明模式时,配置版本号自动归零,在整个网络中“话语权”最
此时就无法对网络造成影响。一般网络新添加交换机之前,都强烈建议先部署为透明模式,后接入网络。 
4、部署 VTP 修剪,修剪不必要的流量,优化网络,如下: 
   SW1(vlan)#vtp pruning 
   Pruning switched ON 
   SW1(vlan)#exit 
SW1#show vtp status 
     可以看到,此时 VTP 修剪模式从 disable 切换成 enabled 状态;VTP 修剪只需要在 Server端部署,查看 SW2 的 VTP 信息,如下: 
SW2#show vtp status 


欢迎大家分享更好的思路,热切期待^^_^^ !


0 0
原创粉丝点击