STP;VTP交換機配置實例

 

VTP(VLAN Trunking Protocol):虛擬局域網幹道協議
  VTP通過網絡(ISL幀或cisco私有DTP幀)保持VLAN配置統一性。VTP在系統級管理增加,刪除,調整的VLAN,自動地將信息向網絡中其它的交換機廣播。此外,VTP減小了那些可能導致安全問題的配置。便於管理,只要在vtp server做相應設置,vtp client會自動學習vtp server上的vlan信息
  * 當使用多重名字VLAN能變成交叉--連接。
  * 當它們是錯誤地映射在一個和其它局域網,VLAN能變成內部斷開。
  VTP模式
  當交換機是在VTP Server或透明的模式,能在交換機配置VLAN。當交換機配置在VTP Server或透明的模式,使用CLI、控制檯菜單、MIB(當使用SNMP簡單網絡管理協議管理工作站)修改VLAN配置。
  一個配置爲VTP Server模式的交換機向鄰近的交換機廣播VLAN配置,通過它的Trunk從鄰近的交換機學習新的VLAN配置。在Server模式下可以通過MIB,CLI,或者控制檯模式添加、刪除和修改VLAN。
  例如:增加了一個VLAN,VTP將廣播這個新的VLAN,Server和Client機的Trunk網絡端口準備接收信息。
  在交換機自動轉到VTP的Client模式後,它會傳送廣播信息並從廣播中學習新的信息。但是,不能通過MIB、CLI、或者控制檯來增加、刪除、修改VLAN。VTP Client端不能保持VLAN信息在非易失存儲器中。當啓動時,它會通過Trunk網絡端口接受廣播信息,學習配置信息。
  在VTP透明的模式,交換不做廣播或從網絡學習VLAN配置。當一個交換機是在VTP透明的模式,能通過控制檯、CLI、MIB來修改、增加、刪除VLAN。
  爲使每一個VLAN能夠使用,必須使VTP知道。並且包含在Trunk port 的准許列表中,一個快速以太網ISL Trunk自動爲VLAN傳輸數據,並且從一個交換機到另一個交換機。
  需要注意的是如果交換在VTP Server模式接收廣播包含128多個VLAN,交換自動地轉換向VTP Client模式。
  更改交換機從VTP Client模式向VTP透明的模式,交換機保持初始、唯一128VLAN並刪除剩餘的VLAN。
  傳送VTP信息
  每個交換機用VTP廣播Trunk端口的管理域,定義特定的VLAN邊界,它的配置修訂號,已知VLAN和特定參數。在一個VTP管理域登記後交換機才能工作。
  通過Trunk,VTP Server向其它交換機傳輸信息和接收更新。VTP Server也在NVRAM中保存本VTP管理域信息中 VLAN的列表。 VTP能通過統一的名字和內部的列表動態顯示出管理域中的VLAN。
  VTP信息在全部Trunk連接上傳輸,包括ISL、IEEE802.10、LANE。VTP MIB爲VTP提供SNMP工具,並允許瀏覽VTP參數配置。
  VTP建立共用的配置值和分佈下列的共用的配置信息:
  * VLAN IDs(ISL)
  * 仿效LAN的名字(ATM LANE)
  * IEEE802.10 SAID值(FDDI)
  * VLAN中最大的傳輸單元(MTU)大小
  * 幀格式
  VTP協議用來確保配置的一致性,VTP的具體優點如下:
  。保持了VLAN的一致性
  。提供從一個交換機到另一個交換機在整個管理域中增加虛擬局域網的方法
  VTP協議是思科的專用協議,大多數的Catalys交換機都支持該協議,VTP可以減少VLAN的相關管理任務。
  在VTP域中有兩個重要的概念:
  。VTP域:也稱VLAN管理域,由一個以上共享VTP域名的相互連接的交換機組成的。也就是說VTP域是一組域名相同並通過中繼鏈路相互連接的交換機
  。VTP通告:在交換機之間用來傳遞VLAN信息的數據包被成爲VTP數據包。
  創建VTP域命令
  switch(config)#vtp domain DOMAIN_NAME
  配置交換機的VTP模式
  三種模式server client transparent(透明模式)
  switch(config)# vtp mode server | client | transparent
  配置VTP口令
  switch (config) # vtp password PASSWORD


步驟一、交換機和PC機的基本配置

  



 

步驟二、關閉交換機的所有端口,然後啓用接入端口

S1(config)#int range f0/1 - 24

S1(config-if-range)#shutdown

S1(config-if-range)#int range g1/1 - 2

S1(config-if-range)#shutdown

S1(config-if-range)#int f0/6

S1(config-if)#switchport mode access

S1(config-if)#no shut

S1(config-if)#int f0/11

S1(config-if)#switchport mode access

S1(config-if)#no shut

S1(config-if)#int f0/18

S1(config-if)#switchport mode access

S1(config-if)#no shut

(交換機S2、S3配置參考S1)

步驟三、配置中繼鏈路和本徵VLAN

S1(config)#int range f0/1 – 4

S1(config-if-range)#switchport mode trunk

S1(config-if-range)#switchport trunk native vlan 99

S1(config-if-range)#no shut

(交換機S2、S3配置參考S1)

步驟四、配置VTP

S1(config)#vtp mode server

Device mode already VTP SERVER.

S1(config)#vtp domain cisco

Changing VTP domain name from NULL to cisco

S1(config)#vtp password cisco

Setting device VLAN database password to cisco

S2(config)#vtp mode client

Device mode already VTP CLIENT.

S2(config)#vtp domain cisco

Changing VTP domain name from NULL to cisco

S2(config)#vtp password cisco

Setting device VLAN database password to cisco

S3(config)#vtp mode client

Device mode already VTP CLIENT.

S3(config)#vtp domain cisco

Changing VTP domain name from NULL to cisco

S3(config)#vtp password cisco

Setting device VLAN database password to cisco

步驟五、在S1(VTP Server)上配置VLAN

S1(config)#vlan 10

S1(config-vlan)#name staff

S1(config-vlan)#exit

S1(config)#vlan 20

S1(config-vlan)#name students

S1(config-vlan)#exit

S1(config)#vlan 30

S1(config-vlan)#name guest

S1(config-vlan)#exit

S1(config)#vlan 99

S1(config-vlan)#name management

S1(config-vlan)#exit

(配置至此,用#sh vlan brief命令查看S2S3交換機的vlan配置,會看到VTP Server已經將VLAN信息傳播至兩個交換機)

步驟六、爲各個VLAN分配接口

S1(config)#interface range fa0/6 - 10

S1(config-if-range)#switchport access vlan 10

S1(config-if-range)#interface range fa0/11-17

S1(config-if-range)#switchport access vlan 20

S1(config-if-range)#interface range fa0/18-24

S1(config-if-range)#switchport access vlan 30

S1(config-if-range)#exit

(交換機S2、S3配置參考S1)

步驟七、接入層交換機上配置端口安全功能

S1(config)#interface fa0/6

S1(config-if)#switchport port-security

S1(config-if)#switchport port-security maximum 1

S1(config-if)#switchport port-security mac-address sticky

S1(config-if)#interface fa0/11

S1(config-if)#switchport port-security

S1(config-if)#switchport port-security maximum 1

S1(config-if)#switchport port-security mac-address sticky

S1(config-if)#interface fa0/18

S1(config-if)#switchport port-security

S1(config-if)#switchport port-security maximum 1

S1(config-if)#switchport port-security mac-address sticky

S1(config-if)#end

(交換機S2、S3配置參考S1)

注:

interface FastEthernet0/1

switchport mode access

switchport port-security maximum 1 //設置最多隻允許一個MAC地址通過

switchport port-security //啓用端口安全

switchport port-security violation protect //設定破壞規則的動作爲端口保護

switchport port-security mac-address sticky //設定端口的行爲是MAC地址粘貼

switchport port-security mac-address sticky 0012.3f12.cfd6 //指定具體的粘貼MAC地址


說明:其實端口安全的默認設置的maximum是1,如果需要限定幾個MAC,設爲幾就OK了。

步驟八、爲各交換機配置管理VLAN地址和默認網關

S1(config)#ip default-gateway 192.168.1.1

S1(config)#interface vlan99

S1(config-if)#ip address 192.168.99.11 255.255.255.0

S1(config-if)#no shutdown

S2(config)#ip default-gateway 192.168.1.1

S2(config)#interface vlan99

S2(config-if)#ip address 192.168.99.12 255.255.255.0

S2(config-if)#no shutdown

S3(config)#ip default-gateway 192.168.1.1

S3(config)#interface vlan99

S3(config-if)#ip address 192.168.99.13 255.255.255.0

S3(config-if)#no shutdown

步驟九、按下列要求配置並改良STP

S1 成爲 VLAN 10 的根橋(優先級 4096)、VLAN 20 的備用根橋(優先級 16384

S2 成爲 VLAN 20 的根橋(優先級 4096)、VLAN 30 的備用根橋(優先級 16384

S3 成爲 VLAN 30 的根橋(優先級 4096)、VLAN 10 的備用根橋(優先級 16384

S1(config)#spanning-tree vlan 10 priority 4096

S1(config)#spanning-tree vlan 20 priority 16384

S2(config)#spanning-tree vlan 20 priority 4096

S2(config)#spanning-tree vlan 30 priority 16384

S3(config)#spanning-tree vlan 30 priority 4096

S3(config)#spanning-tree vlan 10 priority 16384

1、查看MAC地址       Switch#show mac-address-table

2、查看配置命令         Switch#show running-config

3、查看CDP鄰居信息命令

1)查看CDP全局配置信息      Swintch#show cdp

2)查看某藉口配置信息         Swintch#show cdp interface f0/19

3)顯示有關CDP包的統計信息 Swintch#show cdp traffic

4)列出與本設備相鄰的設備     Swintch#show cdp neighbors

5)顯示詳細的鄰居信息         Swintch#show cdp neighbors detail

6)顯示所有入口項的細節       Swintch#show cdp entry *

4、查看VLAN信息命令          Swintch#show vlan brief

5、查看某個VLAN的信息        Swintch#show vlan 2

6、查看端口的VLAN號           Swintch#show running-config interface f0/2

7、查端口的管理模式和VLAN的情況Swintch#show interfaces f0/2 switchport

8、查看歷史命令                 Swintch#show history

9、查看閃存                     Swintch#dir flash

10、查看VTP配置信息           Swithc#show vtp status  

11、查看生成樹配置              Swithc#show spanning-tree

12、查看VLAN的生成樹詳細信息Swithc#show spanning-tree vlan 2 detail

13、查看FIB表                  Swithc#show ip cef

14、查看鄰居關係表              Swithc#show adjacency detail

15、查看二層以太通道信息        Swithc#show etherchannel 1 summary

注:如果在其它模式查看前面加上 “do”就可以了

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章