十六、VTP实验
VTP简介:1VLAN中继协议(VTPVLAN TRUNKING PROTOCOL)是CISCO
                    专用协议,大多数交换机都支持该协议.VTP负责在VTP域内同步
            VLAN信息,这样就不必在每个交换上配置相同的VLAN信息.
          2VTP模式有3种,分别是:
             2.1、服务器模式(SERVER 缺省)
                    VTP服务器控制着它们所在域中VALN的生成和修改.所有的VTP
                    信息都被通告在本域中的其他交换机,而且,所有这些VTP信息都
             是被其他交换机同步接收的.
             2.2、客户机模式(CLIENT
                     VTP客户机不允许管理员创建、修改或删除VLAN。它们监听本域
             中其他交换机的VTP通告,并相应修改它们的VTP配置情况。
             2.3、透明模式(TRANSPARENT
                     VTP透明模式中的交换机不参与VTP.当交换机处于透明模式时,
            它不通告其VLAN配置信息.而且,它的VLAN数据库更新与收到的
            通告也不保持同步.但它可以创建和删除本地的VLAN.不过,这
            VLAN的变更不会传播到其他任何交换机上.各种运行模式的状态
实验要求:在S1上启动vtp服务作为server,S2\S3\S4上启动vtp服务
          作为client,S1上建立vlan2,使得client能学习到vlan2;
          然后PC2\PC3\PC4加入vlan2使得彼此能ping通;
实验目的:对vtp协议做一个简单的了解;学习一下vtp在cisco交换机中的配
         置,进而印证一下vtp的作用。
实验拓扑
 十六、VTP实验_ccna
1、ip地址表:
PC2                       192.168.0.2/24
PC3                       192.168.0.3/24
PC4                       192.168.0.4/24
 
2、
S1的配置:
S1(config)#vtp mode server //启动vtp server服务
S1(config)#vtp domain domainname //建立vtp域,域名domainname
S1(config)#interface f0/1
S1(config-if)#switch mode trunk
S1(config-if)#switchport trunk allowed vlan all //为了pc互ping建立trunk,与vtp无关
S1(config-if)#exit
S1(config)#interface fa0/2
S1(config-if)#switchport mode trunk
S1(config-if)#switchport trunk allowed vlan all//为了pc互ping建立trunk
S1(config-if)#exit
S1(config)#vlan 2//server上建立vlan2
S2的配置:
S2(config)#vtp mode client//启动vtp client服务
S2(config)#vtp domain domainname //加入vtp域,域名domainname
S2(config)#interface fa0/1
S2(config-if)#switchport mode trunk
S2(config-if)#switchport trunk allow vla all//为了pc互ping建立trunk
S2(config-if)#exit
S2(config)#interface fa0/2
S2(config-if)#switchport mode trunk
S2(config-if)#switchport trunk allow vlan all//为了pc互ping建立trunk
验证:S2#show vlan可以看出client已经学习到server中的vlan2
S2#show vlan
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    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
2    VLAN0002                         active    Fa0/3
S2(config)#interface fastEthernet 0/3
S2(config-if)#switchport access vlan 2//PC2对应交换机上的端口加入vlan2
 
S3的配置:
S3(config)#vtp mode client
S3(config)#vtp domain domainname
验证:S3#show vlan可以看出client已经学习到server中的vlan2
S3#show vlan
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    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
2    VLAN0002                         active    Fa0/2
S3(config)#interface f0/1
S3(config-if)#switchport mode trunk
S3(config-if)#switchport trunk allowed vlan all//为了pc互ping建立trunk
S3(config)#inter f0/2
S3(config-if)#switchport acc vla 2//PC3对应交换机上的端口加入vlan2
S4的配置:
S4(config)#vtp mode client
S4(config)#vtp domain domainname
验证:S4#show vlan可以看出client已经学习到server中的vlan2
S4#show vlan
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    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
2    VLAN0002                         active    Fa0/2
S4(config)#interface fa0/1
S4(config-if)#switchport mode trunk
S4(config-if)#switchport trunk allow vlan all//PC2对应交换机上的端口加入vlan2
S4(config-if)#interface fa0/2
S4(config-if)#switchport access vlan 2//PC4对应交换机上的端口加入vlan2
 
验证PC互ping:
pc2 ping pc3
PC>ping 192.168.0.3
Pinging 192.168.0.3 with 32 bytes of data:
Reply from 192.168.0.3: bytes=32 time=172ms TTL=128
pc2 ping pc4
PC>ping 192.168.0.4
Pinging 192.168.0.4 with 32 bytes of data:
Reply from 192.168.0.4: bytes=32 time=141ms TTL=128
pc3 ping pc4
PC>ping 192.168.0.4
Pinging 192.168.0.4 with 32 bytes of data:
Reply from 192.168.0.4: bytes=32 time=141ms TTL=128
 
总结:上面的实验是用模拟器做的,不知哪里有不正确的还望高手指教,我好学习学习,谢了!