天天看點

CCNA實驗一配置STP與VTP

<b>環境:三台交換機,形成一個全互連結構,都為</b><b>為</b><b>2950</b><b>;</b><b></b>

<b>要求:設定</b><b>sw3</b><b>為</b><b>VTP server,</b><b>設定</b><b>sw1</b><b>和</b><b>sw2</b><b>為</b><b>VTP client,</b><b>域名為</b><b>cisco</b><b>,密碼為:</b><b>cisco</b><b>,在</b><b>server</b><b>建立</b><b>vlan 10(name:aa)</b><b>和</b><b>vlan20(name:bb);</b><b>設定</b><b>sw3</b><b>為</b><b>vlan1</b><b>的根橋,</b><b>sw1</b><b>為</b><b>vlan10</b><b>的根橋,</b><b>sw2</b><b>為</b><b>vlan20</b><b>的根橋;</b>

初始化配置:

Switch#show vlan

Switch#delete vlan.dat  清除vlan資訊

Delete filename [vlan1.dat]?y 

Delete flash:/y? [confirm]y%Error deleting flash:/y (No such file or directory)

Switch#show startup-config 顯示配置資訊

Switch#erase startup-config  清除配置資訊

Switch#reload 重新開機

Switch&gt;en 

Switch#conf t  

Switch(config)#hostname SW1 修改交換機名稱

SW1(config)#NO IP DOMAin-lookup  關閉域名動态解析

SW1(config)#LINE CONSole 0 

SW1(config-line)#LOGGing SYNChronous 

SW1(config-line)#EXEC-timeout 0 0 設定逾時為不逾時

步驟一、配置VTP

sw3的配置: 

sw3(config)#vtp mode server        在sw3上啟用vtp server 

Device mode already VTP SERVER. 

sw3(config)#vtp domain cisco        設定域名 

Changing VTP domain name from NULL to cisco 

sw3(config)#vtp password cisco       設定密碼 

Setting device VLAN database password to cisco

sw1的配置: 

sw1#vlan database          進入vlan資料庫 

sw1(vlan)#vtp client         啟用VTP client模式 

Setting device to VTP CLIENT mode. 

sw1(vlan)#vtp domain cisco   作用到cisco域中 

sw1(vlan)#vtp password cisco      設定密碼與server端相同 

Setting device VLAN database password to cisco. 

sw1(vlan)#exit              使配置生效 

In CLIENT state, no apply attempted. 

Exiting....

sw2的配置: 

sw2#vlan database 

sw2(vlan)#vtp client 

sw2(vlan)#vtp domain cisco 

sw2(vlan)#vtp password cisco 

sw2(vlan)#exit 

sw2#

步驟二、啟用幹道端口

sw3(config)#interface fa0/23 

sw3(config-if)#switchport mode trunk    啟用trunk端口 

sw3(config-if)#interface fa0/24 

sw3(config-if)#switchport mode trunk       

sw1的配置: 

sw1(config)#interface fa0/23 

sw1(config-if)#switchport trunk encapsulation dot1q  封裝幹道協定 

sw1(config-if)#switchport mode trunk             啟用trunk模式 

sw1(config-if)# 

sw1(config)#interface fa0/24 

sw1(config-if)#switchport trunk encapsulation dot1q 

sw1(config-if)#switchport mode trunk

sw2的配置: 

sw2(config)#interface fa0/23 

sw2(config-if)#switchport trunk encapsulation dot1q 

sw2(config-if)#switchport mode trunk

sw2(config)#interface fa0/24 

步驟三、測試vtp狀态及建立vlan

sw3的狀态: 

sw3#show vtp status         顯示vtp狀态 

VTP Version                     : 2 

Configuration Revision          : 0         配置修訂号 

Maximum VLANs supported locally : 254 最大支援vlan數

Number of existing VLANs        : 5        

VTP Operating Mode              : server  vtp模式 

VTP Domain Name                 : cisco  vtp域名 

VTP Pruning Mode                : Disabled 

VTP V2 Mode                     : Disabled 

VTP Traps Generation            : Disabled 

MD5 digest                    : 0x3F 0x17 0xC8 0xB8 0x5A 0xE3 0x01 0x66 

Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00

建立vlan: 

sw3(config)#vlan 10      建立VLAN10 

sw3(config-vlan)#name aa 命名為aa 

sw3(config-vlan)#exit    應用配置 

sw3(config)#vlan 20      建立VLAN20 

sw3(config-vlan)#name bb 命名為bb 

sw3(config-vlan)#exit 

sw3(config)#

sw3#show vtp status                    在sw3顯示vtp的狀态 

Configuration Revision          : 2    server的修訂号 

Maximum VLANs supported locally : 254 

Number of existing VLANs        : 7   vlan也已經增加 

VTP Operating Mode              : server 

VTP Domain Name                 : cisco 

MD5 digest                      : 0x98 0x31 0xCF 0xA0 0xA7 0x17 0x73 0x66 

Configuration last modified by 0.0.0.0 at 3-1-93 00:52:05

sw2的狀态: 

sw2#show vtp status 

Configuration Revision          : 2      已經同步了信号

Number of existing VLANs        : 7 

VTP Operating Mode              : Client  vtp模式為用戶端模式

sw1的vlan資訊: 

sw1#show vlan           顯示vlan資訊

VLAN Name                             Status    Ports 

---- -------------------------------- --------- ------------------------------- 

1    default                          active    Fa0/1, 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, Fa0/16, 

                                                Fa0/17, Fa0/18, Fa0/19, Fa0/20, 

                                                Fa0/21, Fa0/22, Fa0/23, Fa0/24 

10  aa                             active      

20  bb                             active

步驟四、配置PVST 

sw3(config)#spanning-tree vlan 1 root primary  設定為vlan1的根橋

Sw1(config)#spanning-tree vlan 10 priority 4096 設定為vlan10的根橋

Sw2(config)#spanning-tree vlan 20 priority 4096 設定為vlan20的根橋

步驟五、顯示STP的資訊

sw1的生成樹資訊: 

sw1#show spanning-tree brief   顯示每VLAN生成樹資訊

VLAN1 

  Spanning tree enabled protocol IEEE 

  ROOT ID    Priority 24577 

             Address 0007.eb06.1740           

             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32768 

             Address     0030.803d.f640  

             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec 

VLAN10 

  ROOT ID    Priority 4096 

             Address 0030.803d.f641        

             This bridge is the root 

  Bridge ID  Priority    4096 

             Address     0030.803d.f641    

VLAN20 

             Address 00b0.645f.34c2           

             Address     0030.803d.f642 

sw2的生成樹資訊: 

sw2#show spanning-tree brief   顯示每vlan生成樹配置

  Spanning tree enabled protocol IEEE     

             Address 0007.eb06.1740 

             Address     00b0.645f.34c0 

  Spanning tree enabled protocol IEEE    

  ROOT ID    Priority 4096           

             Address 0030.803d.f641 

             Address     00b0.645f.34c1 

  ROOT ID    Priority 4096         

             Address 00b0.645f.34c2 

             Address     00b0.645f.34c2 

sw3的生成樹資訊: 

sw3#show spanning-tree

VLAN0001 

  Spanning tree enabled protocol ieee     

  Root ID    Priority    24577       為vlan1的根橋 

             Address     0007.eb06.1740 

  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1) 

             Aging Time 300

VLAN0010 

  Spanning tree enabled protocol ieee    

  Root ID    Priority    4096       

             Address     0030.803d.f641 

             Cost        19 

             Port        24 (FastEthernet0/24) 

  Bridge ID  Priority    32779  (priority 32768 sys-id-ext 11) 

VLAN0020 

  Root ID    Priority    4096          

             Port        23 (FastEthernet0/23) 

  Bridge ID  Priority    32780  (priority 32768 sys-id-ext 12) 

Interface        Role Sts Cost      Prio.Nbr Type 

---------------- ---- --- --------- -------- -------------------------------- 

Fa0/23           Root FWD 19        128.23   P2p 

Fa0/24           Altn BLK 19        128.24   P2p

步驟六、顯示目前配置結果

Sw1的配置結果: 

sw1#show running-config       顯示目前配置結果

hostname sw1 

spanning-tree vlan 10 priority 4096 

! 

no ip domain-lookup 

interface FastEthernet0/23 

switchport trunk encapsulation dot1q 

switchport mode trunk 

interface FastEthernet0/24 

end

sw2的配置結果: 

sw2#show running-config     顯示目前配置結果

hostname sw2 

spanning-tree vlan 20 priority 4096 

switchport mode trunk

sw3的配置結果: 

sw3#show running-config    顯示目前配置結果

hostname sw3 

spanning-tree vlan 1 priority 24576 

End

     本文轉自 珏石頭 51CTO部落格,原文連結:http://blog.51cto.com/gavinshaw/134655,如需轉載請自行聯系原作者

上一篇: 初始化