cisco VTP协议

当交换机多了的时候,维护每台交换机的vlan,也是挺麻烦的,而且容器出错。

有没有一种办法,只手动维护一台交换机的vlan,然后其他的vlan都自动同步获得其配置的vlan,但每台交换机下接口的划分是不同步的。

cisco 专用的VTP协议可以满足上面的需求。

只能用trunk接口传递vlan

VTP协议要素

实验:把server的vlan同步到client1和transparent

1,设置trunk接口

server:把e0/0和e0/1接口设置成trunk接口

同时修改多个接口:int ran e0/0-1

server(config)#int ran e0/0-1
server(config-if-range)#switchport trunk encapsulation dot1q
server(config-if-range)#sw mo trunk

client1:把e0/0接口设置成trunk接口

client1(config)#int e0/0
client1(config-if)#sw trunk encapsulation dot1q
client1(config-if)#sw mode tr

transparent:把e0/0接口设置成trunk接口

transparent(config)#int e0/0
transparent(config-if)#sw tr en dot1q
transparent(config-if)#sw mo tr

2,给交换机分配vtp模式

查看vtp状态命令:

server#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 1
VTP Domain Name                 :
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc80.0100
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00
Local updater ID is 0.0.0.0 (no valid interface found)

Feature VLAN:
--------------
VTP Operating Mode                : Server
Maximum VLANs supported locally   : 1005
Number of existing VLANs          : 5
Configuration Revision            : 0
MD5 digest                        : 0x57 0xCD 0x40 0x65 0x63 0x59 0x47 0xBD
                                    0x56 0x9D 0x4A 0x3E 0xA5 0x69 0x35 0xBC
  • VTP Operating Mode : Server 交换机默认就是server模式

修改交换机client1的模式为client:

client1(config)#vtp mode client
client1(config)#exit
client1#show vtp statu
Feature VLAN:
--------------
VTP Operating Mode                : Client

修改交换机transparent的模式为transparent:

transparent(config)#vtp mode transparent
Setting device to VTP Transparent mode for VLANS.
transparent#show vtp status
Feature VLAN:
--------------
VTP Operating Mode                : Transparent

在server上建一个vlan,看看能不能同步到另外2台交换机,发现并没有同步。

但有一个重要的变化:

  • Number of existing VLANs : 从5变成了6

  • Configuration Revision : 从0变成了1

    Configuration Revision非常重要。当换了一台server时,原来的vlan信息,只能从client或者别的server获得,但是选项哪个呢,哪个Configuration Revision号大,就选择谁。当新建,修改,删除vlan时Configuration Revision都会增大。

server(config)#vlan 10
server(config-vlan)#exit
server(config)#exit
server#show vlan b

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Et0/2, Et0/3, Et1/0, Et1/1
                                                Et1/2, Et1/3, Et2/0, Et2/1
                                                Et2/2, Et2/3, Et3/0, Et3/1
                                                Et3/2, Et3/3
10   VLAN0010                         active
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

server#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 1
VTP Domain Name                 :
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc80.0100
Configuration last modified by 0.0.0.0 at 1-17-20 14:45:41
Local updater ID is 0.0.0.0 (no valid interface found)

Feature VLAN:
--------------
VTP Operating Mode                : Server
Maximum VLANs supported locally   : 1005
Number of existing VLANs          : 6
Configuration Revision            : 1
MD5 digest                        : 0xB1 0xBE 0x72 0x49 0x96 0x6D 0x99 0xA4
                                    0xB4 0xDC 0x94 0x56 0xD4 0xC2 0x6A 0xBB

为什么没有同步呢?由于server的VTP Domain Name(域名)还没有配置.

3,配置server的VTP Domain Name,一旦配置了VTP Domain Name,server会马上发送自己的域名和vlan信息给所有没有域名的交换机的trunk接口,client接到了server的域名和vlan信息后,更新自己的域名和vlan。

server:每5分钟发送一次vtp。

server(config)#vtp domain d1
Changing VTP domain name from NULL to d1
server#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 1
VTP Domain Name                 : d1
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc80.0100
Configuration last modified by 0.0.0.0 at 1-17-20 14:45:41
Local updater ID is 0.0.0.0 (no valid interface found)

Feature VLAN:
--------------
VTP Operating Mode                : Server
Maximum VLANs supported locally   : 1005
Number of existing VLANs          : 6
Configuration Revision            : 1
MD5 digest                        : 0x28 0x95 0x36 0xD6 0xB7 0x58 0xC1 0xA0
                                    0xCF 0xFB 0xBC 0xF1 0xB0 0x2B 0x7F 0xAA

client:从server获得了域名和vlan10,而且Configuration Revision也和server相同。

client1#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 1
VTP Domain Name                 : d1
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc80.0200
Configuration last modified by 0.0.0.0 at 1-17-20 14:45:41

Feature VLAN:
--------------
VTP Operating Mode                : Client
Maximum VLANs supported locally   : 1005
Number of existing VLANs          : 6
Configuration Revision            : 1
MD5 digest                        : 0x28 0x95 0x36 0xD6 0xB7 0x58 0xC1 0xA0
                                    0xCF 0xFB 0xBC 0xF1 0xB0 0x2B 0x7F 0xAA

client1#show vlan b

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Et0/1, Et0/2, Et0/3, Et1/0
                                                Et1/1, Et1/2, Et1/3, Et2/0
                                                Et2/1, Et2/2, Et2/3, Et3/0
                                                Et3/1, Et3/2, Et3/3
10   VLAN0010                         active
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

transport:完全不同步server的vlan,只是把server的vlan信息,传递出去。

4,再加一台交换机server2,模式是server,设置e0/0为trunk接口,并在的server1上,添加一个vlan 20,server2马上就获得了,server1的vtp信息。

server#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
server(config)#vlan 20

server2#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 1
VTP Domain Name                 : d1
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc80.0400
Configuration last modified by 0.0.0.0 at 1-17-20 15:20:26
Local updater ID is 0.0.0.0 (no valid interface found)

Feature VLAN:
--------------
VTP Operating Mode                : Server
Maximum VLANs supported locally   : 1005
Number of existing VLANs          : 7
Configuration Revision            : 4
MD5 digest                        : 0x89 0x21 0x61 0xDD 0x49 0xED 0x7D 0x89
                                    0x67 0x72 0x75 0xFB 0xDA 0x3A 0x42 0x3E
server2#show vlan b

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Et0/1, Et0/2, Et0/3, Et1/0
                                                Et1/1, Et1/2, Et1/3, Et2/0
                                                Et2/1, Et2/2, Et2/3, Et3/0
                                                Et3/1, Et3/2, Et3/3
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

在server2上,删除vlan20后,server1和client上的vlan20,也被删除了。

设置server的密码

由于有可能多个server,防止某一个人,不知道这台交换机是server,随意修改了一些vlan,导致传播到了所有client和server。所以把server和client的密码设置成一样的;server2不设置密码,然后在server上添加vlan30,发现只同步到了client,而没有同步到server2.原因是server2的密码和它们不同。

结论:只用域名同,密码同,才能够同步。

server(config)#vtp password 123
Setting device VTP password to 123

查看server的密码:

server#show vtp password
VTP Password: 123

client模式:

  • 一旦断电,vlan信息就没了,开机重新同步;server和transparent断电可以保留vlan信息。

  • 不可以在模式为client的交换机下,创建,删除vlan

    client1(config)#vlan 30
    VTP VLAN configuration not allowed when device is in CLIENT mode.
  • client也可以传递vtp。client1可以把vtp传递给client2.

c/c++ 学习互助QQ群:877684253

本人微信:xiaoshitou5854

猜你喜欢

转载自www.cnblogs.com/xiaoshiwang/p/12206145.html
VTP