VTP工作原理:VTP是一种消息协议,他使用第二层帧,在交换机之间传递vlan信息,被称为VTP通告、有了VTP,就可以在一台交换机上集中修改vlan配置,所做的修改会被自动传播到网络中的其他交换机上,从而实现vlan配置的一致性。

  实现此功能的前提是这些交换机属于同一个VTP域。

 

vtp模式

1)服务器模式

vtp服务器可以创建、删除或修改vlan并向外发送vtp通告,同时vtp服务器也会学习域名相同的vtp通告信息。默认情况下,交换机处于vtp服务器模式。

 

2)客户机模式

不允许管理员创建、删除或修改vlan。他们监听本域中其他交换机的vtp通告,并相应修改他们自己的vtp配置。

 

3)透明模式

VTP透明模式中的交换机不参与VTP。当交换机处于透明模式,它可以创建、删除或修改本地vlan,但他不向外通告自己的vlan配置信息,对收到的VTP通告只转发而不会学习与更改自己的vlan信息。

 

 

 

配置如下所示:

服务器模式配置如下:

Switch(config)#vtp domain shuxue 创建VTP

Switch(config)#vtp mode server 配置VTP模式为服务模式

Switch(config)#vtp password 123 配置VTP口令(密码)

Switch(config)#vtp version 2 配置VTP版本(默认为1

然后创建几个vlan  一会验证是否同步过来了

Switch(config)#vlan 10

Switch(config-vlan)#vlan 20

Switch(config)#interface fastEthernet 0/1 进端口

Switch(config-if)#switchport mode trunk 做中继

 

透明模式配置:

Switch(config)#vtp domain shuxue创建VTP

Switch(config)#vtp mode transparent配置VTP模式为透明模式

Switch(config)#vtp password 123配置VTP口令(密码)

Switch(config)#vtp version 2配置VTP版本(默认为1

 Switch(config)#interface range fastEthernet 0/1 - 2

Switch(config-if)#switchport mode trunk

 

客户模式配置:

Switch(config)#vtp domain shuxue 创建VTP

Switch(config)#vtp mode client配置VTP模式为客户模式

Switch(config)#vtp password 123配置VTP口令(密码)

Switch(config)#vtp version 2

 

至此配置完成。

验证在客户端模式中输入:Switch#show vlan brief

查看是否有 vlan10 vlan20

  有的话  说明成功同步过来了。