实验拓扑图:
实验目的:
掌握VTP的配置,并了解VTP同步规则。
实验过程
1.配置sw1为VTP server,sw2为VTP client
Router#config t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#no ip domain-lookup Router(config)#line console 0 Router(config-line)#no exec-timeout Router(config-line)#loggin syn Router(config-line)#exit Router(config)#host sw1 sw1(config)#interface f0/1 sw1(config-if)#switchport mode trunk //把交换机之间相连的线路配成trunk链路 sw1(config-if)#switchport trunk encapsulation dot1q //trunk封装成802.1Q sw1(config-if)#exit sw1(config)#end sw1#vlan database //进入vlan数据库模式 sw1(vlan)#vtp server //配置sw1为server
Device mode already VTP SERVER. sw1(vlan)#vtp domain cisco //配置VTP域名 Changing VTP domain name from NULL to cisco sw1(vlan)#exit //保存并退出 APPLY completed. Exiting.... |
Router>en Router#config t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#no ip domain-lookup Router(config)#line console 0 Router(config-line)#no exec-timeout Router(config-line)#loggin syn Router(config-line)#exit Router(config)#host sw2 sw2(config)#interface f0/1 sw2(config-if)#switchport mode trunk sw2(config-if)#switchport trunk encapsulation dot1q sw2(config-if)#exit sw2(config)#end sw2#vlan database sw2(vlan)#vtp client //配置sw2为client Setting device to VTP CLIENT mode. sw2(vlan)#vtp domain cisco Changing VTP domain name from NULL to cisco sw2(vlan)#exit In CLIENT state, no apply attempted. Exiting.... |
2.查看sw1的VTP状态
sw1#show vtp status VTP Version : 2 Configuration Revision : 0 //修订号会随着vlan个数增加
Maximum VLANs supported locally : 256 Number of existing VLANs : 5 VTP Operating Mode : Server //sw1为server VTP Domain Name : cisco //sw1域名为cisco VTP Pruning Mode : Disabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0x89 0x5D 0x37 0xD0 0x91 0x71 0xF7 0x96 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) |
3.在sw1上创建vlan10,vlan20,vlan30
sw1#vlan database sw1(vlan)#vlan 10 VLAN 10 added: Name: VLAN0010 sw1(vlan)#exit APPLY completed. Exiting.... sw1#vlan database sw1(vlan)#vlan 20 VLAN 20 added: Name: VLAN0020 sw1(vlan)#exit APPLY completed. Exiting.... sw1#vlan database sw1(vlan)#vlan 30 VLAN 30 added: Name: VLAN0030 sw1(vlan)#exit APPLY completed. Exiting.... |
注意:在vlan数据库模式下创建vlan的时候,每创建一个vlan保存并退出,Revision才会增加1。
4.在sw2上查看是否有vlan信息
sw2#show vlan-switch brief
VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/0, 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 10 VLAN0010 active
20 VLAN0020 active
30 VLAN0030 active //sw2已经学习到了sw1上的vlan 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active |
5.查看sw1的VTP状态信息
sw1#show vtp status VTP Version : 2 Configuration Revision : 3 //配置修订号变成3是因为创建了三个vlan Maximum VLANs supported locally : 256 Number of existing VLANs : 8 VTP Operating Mode : Server
VTP Domain Name : cisco
VTP Pruning Mode : Disabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0x3C 0x26 0xDA 0x69 0xB0 0xE7 0x96 0xB2 Configuration last modified by 0.0.0.0 at 3-1-02 00:17:14 Local updater ID is 0.0.0.0 (no valid interface found) |
未完,接下一个