運用STP VTP HSRP 構建冗餘的網絡

STP(生成樹協議)詳解

  二層管理協議。在一個擴展的局域網中參與STP的所有交換機之間通過交換橋協議數據單元BPDU(Bridge Protocol Data Unit)來實現;爲穩定的生成樹拓撲結構選擇一個根橋;爲每個交換網段選擇一臺指定交換機;將冗餘路徑上的交換機置爲Blocking,來消除網絡中的環路。

  IEEE 802.1d是最早關於STP的標準,它提供了網絡的動態冗餘切換機制。STP使您能在網絡設計中部署備份線路,並且保證:

  在主線路正常工作時,備份線路是關閉的。

  當主線路出現故障時自動使能備份線路,切換數據流。

  VTP:思科VLAN中繼協議(VTP:Cisco VLAN Trunking Protocol)

  VLAN 中繼協議(VTP)是思科第2層信息傳送協議,主要控制網絡範圍內 VLANs 的添加、刪除和重命名。VTP 減少了交換網絡中的管理事務。當用戶要爲 VTP 服務器配置新 VLAN 時,可以通過域內所有交換機分配 VLAN,這樣可以避免到處配置相同的 VLAN.VTP 是思科私有協議,它支持大多數的 Cisco Catalyst 系列產品。

  通過 VTP,其域內的所有交換機都清楚所有的 VLANs 情況,但當 VTP 可以建立多餘流量時情況例外。這時,所有未知的單播(Unicasts)和廣播在整個 VLAN 內進行擴散,使得網絡中的所有交換機接收到所有廣播,即使 VLAN 中沒有連接用戶,情況也不例外。而 VTP Pruning 技術正可以消除該多餘流量。

  缺省方式下,所有Cisco Catalyst交換機都被配置爲 VTP 服務器。這種情形適用於 VLAN 信息量小且易存儲於任意交換機(NVRAM)上的小型網絡。對於大型網絡,由於每臺交換機都會進行 NVRAM 存儲操作,但該操作對於某些點是多餘的,所以在這些點必須設置一個“判決呼叫”(Judgment Call)。基於此,網絡管理員所使用的 VTP 服務器應該採用配置較好的交換機,其它交換機則作爲客戶機使用。此外需要有某些 VTP 服務器能提供網絡所需的一定量的冗餘。

  到目前爲止,VTP 具有三種版本。其中 VTP v2 與 VTP v1 區別不大,主要不同在於:VTP v2 支持令牌環 VLANs,而 VTP v1 不支持。通常只有在使用 Token Ring VLANs 時,纔會使用到 VTP v2,否則一般情況下並不使用 VTP v2.

  VTPv3 不能直接處理 VLANs 事務,它只負責管理域(Administrative Domain)內不透明數據庫的分配任務。與前兩版相比,VTP v3 具有以下改進:

  * 支持擴展 VLANs.

  * 支持專用 VLANs 的創建和廣告。

  * 提供服務器認證性能。

  * 避免“錯誤”數據庫進入 VTP 域。

  * 與 VTP v1 和 VTP v2 交互作用。

  * 支持每端口(On a Per-Port Basis)配置。

  * 支持傳播VLAN數據庫和其它數據庫類型。

  HSRP:熱備份路由器協議(HSRP:Hot Standby Router Protocol)

  熱備份路由器協議(HSRP)的設計目標是支持特定情況下 IP 流量失敗轉移不會引起混亂、並允許主機使用單路由器,以及即使在實際第一跳路由器使用失敗的情形下仍能維護路由器間的連通性。換句話說,當源主機不能動態知道第一跳路由器的 IP 地址時,HSRP 協議能夠保護第一跳路由器不出故障。該協議中含有多種路由器,對應一個虛擬路由器。HSRP 協議只支持一個路由器代表虛擬路由器實現數據包轉發過程。終端主機將它們各自的數據包轉發到該虛擬路由器上。

  負責轉發數據包的路由器稱之爲主動路由器(Active Router)。一旦主動路由器出現故障,HSRP 將激活備份路由器(Standby Routers)取代主動路由器。HSRP 協議提供了一種決定使用主動路由器還是備份路由器的機制,並指定一個虛擬的 IP 地址作爲網絡系統的缺省網關地址。如果主動路由器出現故障,備份路由器(Standby Routers)承接主動路由器的所有任務,並且不會導致主機連通中斷現象。

  HSRP 運行在 UDP 上,採用端口號1985.路由器轉發協議數據包的源地址使用的是實際 IP 地址,而並非虛擬地址,正是基於這一點,HSRP 路由器間能相互識別。

  備註:
  使用的是2950.所以在交換機SW1 SW2 的f 0/5 沒有封裝 dot1q(默認)。
  R3 沒有靜態路由。這個拓撲只保障了到網關的負載均衡與冗餘備份。沒有寫連接外網。
  網絡拓撲:



  配置指令:
  SW1
switch > enable
switch # configure terminal
switch (config) # hostname sw1
sw1 (config) # vtp domain cisco
sw1 (config) # vtp mode server
sw1 (config) # vtp password cisco
sw1 (config) # exit
sw1 # vlan database
sw1 (vlan) # vlan 2
sw1 (vlan) # vlan 3
sw1 (vlan) # exit
sw1 # configure terminal
sw1 (config) # interface range fastethernet 0/1 - 5
sw1 (config-if) # switchport mode trunk
sw1 (config-if) # no shutdown
sw1 (config-if) # interface range fastethernet 0/3 - 4
sw1 (config-if) # channel-group 1 mode on
sw1 (config-if) # exit
sw1 (config) # spanning-tree vlan 2 root primary
sw1 (config) # spanning-tree vlan 3 root secondby
sw1 (config) # exit
sw1 #
  SW2
switch > enable
switch # configure terminal
switch (config) # hostname sw 2
sw2 (config) # vtp domain cisco
sw2 (config) # vtp mode server
sw2 (config) # vtp password cisco
sw2 (config) # interface range fastethernet 0/1 - 5
sw2 (config-if) # switchport mode trunk
sw2 (config-if) # no shutdown
sw2 (config-if) # interface range fastethernet 0/3 - 4
sw2 (config-if) # channel-group 1 mode on
sw2 (config-if) # exit
sw2 (config) # spanning-tree vlan 3 root primary
sw2 (config)# spanning-tree vlan 2 root secondby
sw2 (config) # exit
sw2 #
  SW3
switch > enable
switch # configure terminal
switch (config) # hostname sw 3
sw3 (config) # vtp domain cisco
sw3 (config) # vtp mode client
sw3 (config) # vtp password cisco
sw3 (config) # interface range fastethernet 0/1 - 2
sw3 (config-if) # switchport mode trunk
sw3 (config-if) # no shutdown
sw3 (config-if) # interface fastethernet 0/3
sw3 (config-if) # switchport mode access
sw3 (config-if) # switchport access vlan 2
sw3 (config-if) # spanning-tree portfast
sw3 (config-if) # interface fastethernet 0/4
sw3 (config-if) # switchport mode access
sw3 (config-if) # switchport access vlan 3
sw3 (config-if) # spanning-tree portfast
sw3 (config-if) # exit
sw3 (config) # spanning-tree uplinkfast
sw3 (config) # spanning-tree vlan3
sw3 (config) # spanning-tree vlan2
sw3 (config) # exit
sw3 #
  SW4
switch > enable
switch # configure terminal
switch (config) # hostname sw 4
sw4 (config) # vtp domain cisco
sw4 (config) # vtp mode client
sw4 (config) # vtp password cisco
sw4 (config) # interface range fastethernet 0/1 - 2
sw4 (config-if) # switchport mode trunk
sw4 (config-if) # no shutdown
sw4 (config-if) # interface fastethernet 0/3
sw4 (config-if) # switchport mode access
sw4 (config-if) # switchport access vlan 2
sw4 (config-if) # spanning-tree portfast
sw4 (config-if) # interface fastethernet 0/4
sw4 (config-if) # switchport mode access
sw4 (config-if) # switchport access vlan 3
sw4 (config-if) # spanning 每tree portfast
sw4 (config-if) # exit
sw4 (config) # spanning-tree uplinkfast
sw4 (config) # spanning-tree vlan3
sw4 (config) # spanning-tree vlan2
sw4 (config) # exit
sw4 #
  R1
router > enable
router # configure terminal
router (config) # hostname r1
r1 (config) # interface fastethernet 0/0.1
r1 (config-subif) # ip add 192.168.2.254 255.255.255.0
r1 (config-subif) # encapsulation dot1q 2
r1 (config-subif) # standby 2 ip 192.168.2.1
r1 (config-subif) # standby 2 priority 105
r1 (config-subif) # standby 2 preempet
r1 (config-subif) # standby 2 track fastethernet 0/1
r1 (config-subif) # interface fastethernet 0/0.2
r1 (config-subif) # ip add 192.168.3.254 255.255.255.0
r1 (config-subif) # encapsulation dot1q 3
r1 (config-subif) # standby 3 ip 192.168.3.1
r1 (config-subif) # standby 3 preempet
r1 (config-subif) # standby 3 track fastethernet 0/1
r1 (config-if) # interface fastethernet 0/0
r1 (config-if) # no shutdown
r1 (config-if) # interface fastethernet 0/1
r1 (config-if) # ip add 192.168.4.2 255.255.255.0
r1 (config-if) # no shutdown
r1 (config-if) # exit
r1 (config) # exit
r1 #
  R2
router > enable
router # configure terminal
router (config) # hostname r2
r2 (config) # interface fastethernet 0/0.1
r2 (config-subif) # ip add 192.168.2.253 255.255.255.0
r2 (config-subif) # encapsulation dot1q 2
r2 (config-subif) # standby 2 ip 192.168.2.1
r2 (config-subif) # standby 2 preempet
r2 (config-subif) # standby 2 track fastethernet 0/1
r2 (config-subif) # interface fastethernet 0/0.2
r2 (config-subif) # ip add 192.168.3.253 255.255.255.0
r2 (config-subif) # encapsulation dot1q 3
r2 (config-subif) # standby 3 priority 105
r2 (config-subif) # standby 3 preempet
r2 (config-subif) # standby 3 ip 192.168.3.1
r2 (config-subif) # standby 3 track fastethernet 0/1
r2 (config-if) # interface fastethernet 0/0
r2 (config-if) # no shutdown
r2 (config-if) # interface fastethernet 0/1
r2 (config-if) # ip add 192.168.5.2 255.255.255.0
r2 (config-if) # no shutdown
r2 (config-if) # exit
r2 (config) # exit
r2 #
R3
router > enable
router # configure terminal
router (config) # hostname r3
r3 (config) # interface thernet 0/0
r3 (config-if) # ip add 192.168.4.1 255.255.255.0
r3 (config-if) # no shutdown
r3 (config) # interface ethernet 0/1
r3 (config-if) # ip add 192.168.5.1 255.255.255.0
r3 (config-if) # no shutdown
r3 (config-if) # exit
r3 (config) # exit
r3 #
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章