代码演示:

首先配置交换机的基本配置:

 
  
  1. en 
  2. conf  t 
  3. no ip domain lo 
  4. enable password chujie 
  5. lin con 0 
  6. password chujie 
  7. exec-t 0 0 
  8. logg  syn 
  9. exit 
  10. line vty 0 4 
  11. password chujie 
  12. exec-t 0 0  
  13. logg syn 
  14. login 
  15. exit 
  16. host  
 
  
  1. host SW1/SW2/SW3/SW4 

其次,

配置SW1

1.关闭与此实验不相关的端口:

 
  
  1. SW1(config)# int ran fa0/9 -10 , fa 0/2 , fa0/6 
  2. SW1(config-if-range)# shut 

2.为接口f0/5 f0/1配置trunk链路。

 
  
  1. SW1(config)# int r fa0/1 , fa0/5  
  2. SW1(config-if-range)#switchport trunk encapsulation dot1q  
  3. SW1(config-if-range)#switchport mode trunk 
  4. SW1(config-if-range)#no shutdown 

3.为SW1配置VTP模式,此版本,只能在此模式下创建。

 
  
  1. SW1#vlan database 
  2. SW1(vlan)#vtp server 
  3. SW1(vlan)#vtp domain vtplabs 
  4. SW1(vlan)#exit 

在vlan database 下创建vlan .此版本的IOS。只能在此模式下创建。

 
  
  1. SW1#vlan database  
  2. SW1(vlan)#vlan 
  3. SW1(vlan)#vlan 20 
  4. VLAN 20 added: 
  5.     Name: VLAN0020 
  6. SW1(vlan)#vlan 10 
  7. VLAN 10 added: 
  8.     Name: VLAN0010 
  9. SW1(vlan)#exit 
  10. APPLY completed. 
  11. Exiting.... 

使用 show vtp status

 
  
  1. SW1#show vtp status  
  2. VTP Version                     : 2 
  3. Configuration Revision          : 2 
  4. Maximum VLANs supported locally : 256 
  5. Number of existing VLANs        : 8 
  6. VTP Operating Mode              : Server 
  7. VTP Domain Name                 : vtplabs 
  8. VTP Pruning Mode                : Disabled 
  9. VTP V2 Mode                     : Disabled 
  10. VTP Traps Generation            : Disabled 
  11. MD5 digest                      : 0x94 0x76 0x54 0x32 0x40 0xAA 0xC2 0x1A  
  12. Configuration last modified by 0.0.0.0 at 3-1-02 03:16:16 
  13. Local updater ID is 0.0.0.0 (no valid interface found) 

使用sho vlan-switch查看vlan的配置信息

 
  
  1. SW1#sho vlan-switch  
  2.  
  3. VLAN Name                             Status    Ports 
  4. ---- -------------------------------- --------- ------------------------------- 
  5. 1    default                          active    Fa0/0, Fa0/1, Fa0/2, Fa0/3 
  6.                                                 Fa0/4, Fa0/6, Fa0/7, Fa0/8 
  7.                                                 Fa0/11, Fa0/12, Fa0/13, Fa0/14 
  8.                                                 Fa0/15 
  9. 10   VLAN0010                         active    Fa0/10 
  10. 20   VLAN0020                         active    Fa0/9 
  11. 1002 fddi-default                     active     
  12. 1003 token-ring-default               active     
  13. 1004 fddinet-default                  active     
  14. 1005 trnet-default                    active     
  15.  
  16. VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2 
  17. ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 
  18. 1    enet  100001     1500  -      -      -        -    -        1002   1003 
  19. 10   enet  100010     1500  -      -      -        -    -        0      0    
  20. 20   enet  100020     1500  -      -      -        -    -        0      0    
  21. 1002 fddi  101002     1500  -      -      -        -    -        1      1003 
  22. 1003 tr    101003     1500  1005   0      -        -    srb      1      1002 
  23. 1004 fdnet 101004     1500  -      -      1        ibm  -        0      0    
  24. 1005 trnet 101005     1500  -      -      1        ibm  -        0      0    

配置SW2,SW3,SW4,与此类似。

 

此文的主要目的,就是在演示,老版本与新版本vlan 和vtp的配置差异性的地方。

最后,送给大家一些总结的小常识。

 
  
  1. VTP默认是使能的。 
  2. show vlan-switch 
  3. show vtp status  
  4.  
  5. 使用VTP架构网络的时候学习不到VLAN配置信息的原因: 
  6. 1.是不是domain配置错了 2. trunk起来了没有 3.?密码 
  7. show interfaces trunk