cisco vlan 中继协议 vtp

简介:

           cisco vlan 中继协议 vtp

使用条件: 在一个网络上有大量交换机要配置许多相同的vlan的时,可以使用vtp协议

vtp域:一个vtp域由一台或多台互连设备组成,它们共同有一个vtp域名,并且一台交换机只能属于一个vtp

vtp模式:

     1. 服务器(server)

     2.客户端 (client)

     3.透明 (transparent)

1> 服务器(server):一般情况下一个vtp域只能有一个vtp服务器,它主要用来维护vtp域中的vlan信息列表,它可以创建,删除,修改vlan,也有发送和转发vlan更新信息的功能

2> 客户端 (client): 在客户端模式下的交换机不可以创建,删除,修改vlan信息,但是可以转发vlan信息

3> 透明 (transparent): 处于透明模式的vtp交换机可以修改,删除,创建vlan信息,但是它的vlan信息的改变并不会向外界发送,它相当于一个独立的交换机,在域中它只有转发的作用。

   实例配置

      条件:  在某个小型网络中使用vtp协议,switch1vtp服务器,switch2vtp客户端,switch3vtp透明模式,并且创建相同的域domain.com  ,为了保证其安全性,并且不受别处vtp的影响,给这个vtp提供一个密码:domain,.   

拓扑图

       

     配置代码

  首先要先在连接端口中配置trunk口,实现全网互通

   switch1

Switch(config)#int range f0/1-2

Switch(config-if-range)#switchport mode trunk

switchport trunk allowed vlan all

switch2

Switch(config)#int f0/1

Switch(config-if)#switchport mode trunk

Switch(config-if)#switchport trunk allowed vlan all

switch3

Switch(config)#int f0/2

Switch(config-if)#switchport mode trunk

Switch(config-if)#switchport trunk allowed vlan all

因为在一个域中的域名与密码都要相同,所以我们要在三个交换机上都配置相同的vtp域名和密码

   

  Switch(config)#vtp ?

  domain    Set the name of the VTP administrative domain.

  mode      Configure VTP device mode

  password  Set the password for the VTP administrative domain

  version   Set the adminstrative domain to VTP version

Switch(config)#vtp domain ?

  WORD  The ascii name for the VTP administrative domain.

Switch(config)#vtp domain domain.com

Changing VTP domain name from NULL to domain.com

Switch(config)#vtp password domain

Setting device VLAN database password to domain

Switch(config)#vtp version 2

现在开始在每个交换机上配置不同的模式

switch1 (server)

   Switch(config)#vtp mode server

   Device mode already VTP SERVER.  //交换机在默认情况下就是server

switch2 (client)

   Switch(config)#vtp mode client          //配置成client模式

   Setting device to VTP CLIENT mode.

switch3 (transparent)

   Switch(config)#vtp mode transparent

   Setting device to VTP TRANSPARENT mode.

 测试

现在可以在三个交换机中查看一下配置的信息

switch1

 Switch#show vtp status

VTP Version                     : 2    //版本信息

Configuration Revision          : 1      //vlan修改的次数

Maximum VLANs supported locally : 255   //支持最大vlan

Number of existing VLANs        : 5     //现在共有的vlan个数 

VTP Operating Mode              : Server // 交换机的模式为server

VTP Domain Name                 : domain.com  //vtp域名

VTP Pruning Mode                : Disabled      //未启用修剪功能

VTP V2 Mode                     : Enabled

VTP Traps Generation            : Disabled

MD5 digest                      : 0x6E 0x82 0xC8 0xB1 0x1C 0xE1 0x2F 0x2E 

Configuration last modified by 0.0.0.0 at 3-1-93 00:09:25

Local updater ID is 0.0.0.0 (no valid interface found)

switch2

Switch#show vtp status

VTP Version                     : 2

Configuration Revision          : 1

Maximum VLANs supported locally : 255

Number of existing VLANs        : 5

VTP Operating Mode              : Client    //vtp模式为client

VTP Domain Name                 : domain.com

VTP Pruning Mode                : Disabled

VTP V2 Mode                     : Enabled

VTP Traps Generation            : Disabled

MD5 digest                      : 0x5A 0x53 0xB7 0x05 0xE7 0x28 0x7C 0x56 

Configuration last modified by 0.0.0.0 at 3-1-93 00:07:27

switch3

Switch#show vtp status

VTP Version                     : 2

Configuration Revision          : 0

Maximum VLANs supported locally : 255

Number of existing VLANs        : 5

VTP Operating Mode              : Transparent    //vtp模式为transparent

VTP Domain Name                 : domain.com

VTP Pruning Mode                : Disabled

VTP V2 Mode                     : Enabled

VTP Traps Generation            : Disabled

MD5 digest                      : 0xA9 0x73 0x6F 0x83 0xD5 0x09 0x34 0xA6 

Configuration last modified by 0.0.0.0 at 3-1-93 00:13:51

现在可以在switch1添加几个vlan,如vlan 10 vlan 20,查看情况

Switch(config)#vlan 10

Switch(config-vlan)#vlan 20

Switch(config-vlan)#exit

查看 详细情况

Switch#show vtp status

VTP Version                     : 2

Configuration Revision          : 3

Maximum VLANs supported locally : 255

Number of existing VLANs        : 7

VTP Operating Mode              : Server

VTP Domain Name                 : domain.com

VTP Pruning Mode                : Disabled

VTP V2 Mode                     : Enabled

VTP Traps Generation            : Disabled

MD5 digest                      : 0xE3 0x1F 0x98 0x67 0xBB 0x65 0x90 0xA9 

Configuration last modified by 0.0.0.0 at 3-1-93 00:20:43

Local updater ID is 0.0.0.0 (no valid interface found)

switch2下看一下有什么变化

show 一下vlan

Switch#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   VLAN0010                         active    

20   VLAN0020                         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

20   enet  100020     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

可以看出已经学到了在vtp服务器上配置的两个 vlan

现在可以看一下vtp的详细信息

Switch#show vtp status

VTP Version                     : 2

Configuration Revision          : 3       //从这里可以看到vlan已经被修改了两次

Maximum VLANs supported locally : 255

Number of existing VLANs        : 7      //这里变成了7vlan

VTP Operating Mode              : Client

VTP Domain Name                 : domain.com

VTP Pruning Mode                : Disabled

VTP V2 Mode                     : Enabled

VTP Traps Generation            : Disabled

MD5 digest                      : 0xE3 0x1F 0x98 0x67 0xBB 0x65 0x90 0xA9 

Configuration last modified by 0.0.0.0 at 3-1-93 00:20:43

现在查看一下透明模式的变化

Switch#show vlan 

VLAN Name                             Status    Ports

---- -------------------------------- --------- -------------------------------

1    default                          active    Fa0/1, 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

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

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   

vlan 没有发生变化

Switch#show vtp status

VTP Version                     : 2

Configuration Revision          : 0

Maximum VLANs supported locally : 255

Number of existing VLANs        : 5

VTP Operating Mode              : Transparent

VTP Domain Name                 : domain.com

VTP Pruning Mode                : Disabled

VTP V2 Mode                     : Enabled

VTP Traps Generation            : Disabled

MD5 digest                      : 0xA9 0x73 0x6F 0x83 0xD5 0x09 0x34 0xA6 

Configuration last modified by 0.0.0.0 at 3-1-93 00:13:51

也没有增加修改vlan的次数

我们也可以尝试一下在switch2上创建vlan 50,看能否成功

Switch(config)#vlan 50

VTP VLAN configuration not allowed when device is in CLIENT mode.

可以看到在客户端模式下是不允许修改vlan

但是可以在透明模式下修改自己的vlan,可以不会向外界进行发送

switch3

Switch(config)#vlan 100

查看自身结果

Switch#show vlan 

VLAN Name                             Status    Ports

---- -------------------------------- --------- -------------------------------

1    default                          active    Fa0/1, 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

100  VLAN0100                         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

100  enet  100100     1500  -      -      -        -    -        0      0

1002 fddi  101002     1500  -      -      -        -    -        0      0   

1003 tr    101003     1500  -      -      -        -    -        0      0   

可以看出可以增加vlan,但是我们可以看一下 在另外的交换机上有没有变化

1    enet  100001     1500  -      -      -        -    -        0      0

10   enet  100010     1500  -      -      -        -    -        0      0

20   enet  100020     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 

vlan100并没有增加

vtp剪裁功能的实现

   由于默认情况下trunk主链路是允许所以的vlan的数据通过的,这里如果一个一台交换机的所有端口都属于一个vlan的话,那么就没有必要接收另外vlan的数据,这样可以减少网络带宽的开销,这里我们就可以使用vtp剪裁功能来实现。在vtp服务器上开启vtp剪裁功能就可以管理到整个域

  在witch1上来开启vtp剪裁功能

  命令很简单,只有一条:Switch(config)#vtp pruning









本文转自 guodong810 51CTO博客,原文链接:http://blog.51cto.com/guodong810/1074525,如需转载请自行联系原作者
相关实践学习
基于函数计算快速搭建Hexo博客系统
本场景介绍如何使用阿里云函数计算服务命令行工具快速搭建一个Hexo博客。
目录
相关文章
|
10月前
|
负载均衡 网络协议 网络虚拟化
【网络】· VTP虚拟局域网中继
【网络】· VTP虚拟局域网中继
|
数据库 网络虚拟化
Cisco虚拟局域网命令详细(VLAN)
Cisco虚拟局域网命令详细(VLAN)
254 0
|
负载均衡 网络协议 网络虚拟化
VLAN中继协议
交换机不能隔离广播域,因此有了VLAN(虚拟局域网)
231 0
|
安全 数据库 网络虚拟化
|
数据库 网络虚拟化
|
网络虚拟化 数据安全/隐私保护
|
数据库 数据安全/隐私保护 网络虚拟化
|
网络虚拟化 数据安全/隐私保护 网络架构
|
数据库 网络虚拟化 数据安全/隐私保护