協定介紹
多生成樹協定(MSTP)簡介:
多生成樹(MST)使用修正的快速生成樹(RSTP)協定,叫做多生成樹協定(MSTP)
MSTP(Multiple Spanning Tree Protocol,多生成樹協定)
将環路網絡修剪成為一個無環的樹型網絡,避免封包在環路網絡中的增生和無限循環,同時還提供了資料轉發的多個備援路徑,在資料轉發過程中實作VLAN 資料的負載均衡。MSTP 相容STP 和RSTP,并且可以彌補STP 和RSTP 的缺陷。它既可以快速收斂,也能使不同VLAN 的流量沿各自的路徑分發,進而為備援鍊路提供了更好的負載分擔機制。
虛拟路由備援協定(VRRP)簡介:
VRRP是一種選擇協定,它可以把一個虛拟路由器的責任動态配置設定到區域網路上的 VRRP 路由器中的一台。控制虛拟路由器 IP 位址的 VRRP 路由器稱為主路由器,它負責轉發資料包到這些虛拟 IP 位址。一旦主路由器不可用,這種選擇過程就提供了動态的故障轉移機制,這就允許虛拟路由器的 IP 位址可以作為終端主機的預設第一跳路由器。是一種LAN接入裝置備份協定。一個區域網路絡内的所有主機都設定預設網關,這樣主機發出的目的位址不在本網段的封包将被通過預設網關發往三層交換機,進而實作了主機和外部網絡的通信。
VRRP是一種路由容錯協定,也可以叫做備份路由協定。一個區域網路絡内的所有主機都設定預設路由,當網内主機發出的目的位址不在本網段時,封包将被通過預設路由發往外部路由器,進而實作了主機與外部網絡的通信。當預設路由器down掉(即端口關閉)之後,内部主機将無法與外部通信,如果路由器設定了VRRP時,那麼這時,虛拟路由将啟用備份路由器,進而實作全網通信。
在VRRP協定中,有兩組重要的概念:VRRP路由器和虛拟路由器,主要路由器和備份路由器。VRRP路由器是指運作VRRP的路由器,是實體實體;虛拟路由器是指VRRP協定建立的,是邏輯概念。一組VRRP路由器協同工作,共同構成一台虛拟路由器。該虛拟路由器對外表現為一個具有唯一固定的IP位址和MAC位址的邏輯路由器。處于同一個VRRP組中的路由器具有兩種互斥的角色:主要路由器和備份路由器,一個VRRP組中有且隻有一台處于主要角色的路由器,可以有一個或者多個處于備份角色的路由器VRRP協定從路由器組中選出一台作為主要路由器,負責ARP解析和轉發IP資料包,組中的其他路由器作為備份的角色并處于待命狀态,當由于某種原因主要路由器發生故障時,其中的一台備份路由器能在瞬間的時延後更新為主要路由器,由于此切換非常迅速而且不用改變IP位址和MAC位址,故對終端使用者系統是透明的。
“MSTP+VRRP”實驗網絡拓撲
實驗目的:
1、保證PC1,PC2均可通路111.111.111.111位址。
2、PC1通路走CORE1進行資料轉發,PC2通路走CORE2進行資料轉發。
一、實驗配置
(1)R1路由器配置:
#
sysname R1
#
interface GigabitEthernet0/0/0
ip address 192.168.56.5 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 11.1.1.1 255.255.255.252
#
interface GigabitEthernet2/0/1
ip address 12.1.1.1 255.255.255.252
#
interface LoopBack0
ip address 111.111.111.111 255.255.255.255
#
ospf 1
import-route direct
area 0.0.0.0
network 11.1.1.0 0.0.0.3
network 12.1.1.0 0.0.0.3
#
(2)CORE1交換機配置:
sysname CORE1
#
vlan batch 10 to 11 20 23
#
stp instance 1 root primary
stp instance 2 root secondary
#
stp region-configuration
region-name LAOWU
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#
interface Vlanif10
ip address 192.168.10.1 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254
vrrp vrid 1 priority 110
#
interface Vlanif11
ip address 11.1.1.2 255.255.255.252
#
interface Vlanif20
ip address 192.168.20.1 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.254
#
interface Vlanif23
ip address 23.1.1.1 255.255.255.252
#
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 11
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/23
eth-trunk 1
#
interface GigabitEthernet0/0/24
eth-trunk 1
#
ospf 1
import-route direct
area 0.0.0.0
network 11.1.1.0 0.0.0.3
network 23.1.1.0 0.0.0.3
#
(3)CORE2交換機配置:
sysname CORE2
#
vlan batch 10 12 20 23
#
stp instance 1 root secondary
stp instance 2 root primary
#
stp region-configuration
region-name LAOWU
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#
interface Vlanif10
ip address 192.168.10.2 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254
#
interface Vlanif12
ip address 12.1.1.2 255.255.255.252
#
interface Vlanif20
ip address 192.168.20.2 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.254
vrrp vrid 2 priority 110
#
interface Vlanif23
ip address 23.1.1.2 255.255.255.252
#
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 12
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/23
eth-trunk 1
#
interface GigabitEthernet0/0/24
eth-trunk 1
#
ospf 1
import-route direct
area 0.0.0.0
network 12.1.1.0 0.0.0.3
network 23.1.1.0 0.0.0.3
#
(4)SW1交換機配置:
sysname SW1
#
vlan batch 10 20
#
stp region-configuration
region-name LAOWU
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 20
#
(5)PC1主機配置:
(6)PC2主機配置:
二、結果驗證
(1)PC1通路111.111.111.111連通情況以及路由情況:
(2)PC2通路111.111.111.111連通情況以及路由情況: