.vrrp01任務的配置

1.vrrp01任務的配置
組網需求
• • Host A 需要訪問 Internet 上的 Host B,Host A 的缺省網關爲 10.1.1.111/24;
• • 當 Switch A 正常工作時,Host A 發送給 Host B 的報文通過 Switch A 轉發;當 Switch A 出現
故障時,Host A 發送給 Host B 的報文通過 Switch B 轉發。

3.配置步驟
注:IntranetSwitch僅起交換作用,在這個例子裏不用做配置
(1) 配置 Switch A
#配置 VLAN2。
<SwitchA> system-view
[SwitchA] vlan 2
[SwitchA-vlan2] port gigabitethernet 1/0/11
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 10.1.1.1 255.255.255.0
[SwitchA-Vlan-interface2]quit
[SwitchA] vlan 3
[SwitchA-vlan3] port gigabitethernet 1/0/13
[SwitchA-vlan3] quit
[SwitchA] interface vlan-interface 3
[SwitchA-Vlan-interface3] ip address 10.1.3.1 255.255.255.0
[SwitchA-Vlan-interface3]quit
[SwitchA]ip route-static 0.0.0.0 0 10.1.3.2
#創建備份組 1,並配置備份組 1 的虛擬 IP 地址爲 10.1.1.111。
[SwitchA]inter vlan 2
[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.111
#設置 Switch A 在備份組 1 中的優先級爲 110,高於 Switch B 的優先級 100,以保證 Switch A 成
爲 Master 負責轉發流量。
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 110
#設置 Switch A 工作在搶佔方式,以保證 Switch A 故障恢復後,能再次搶佔成爲 Master,即只要
Switch A 正常工作,就由 Switch A 負責轉發流量。爲了避免頻繁地進行狀態切換,配置搶佔延遲時
間爲 5 秒。
[SwitchA-Vlan-interface2] vrrp vrid 1 preempt-mode delay 500

(2) 配置 Switch B
#配置 VLAN2。
<SwitchB> system-view
[SwitchB] vlan 2
[SwitchB-Vlan2] port gigabitethernet 1/0/12
[SwitchB-vlan2] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ip address 10.1.1.2 255.255.255.0
[SwitchB-Vlan-interface2]quit
[SwitchB] vlan 3
[SwitchB-vlan3] port gigabitethernet 1/0/14
[SwitchB-vlan3] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] ip address 10.1.4.1 255.255.255.0
[SwitchB-Vlan-interface3]quit
[SwitchB]ip route-static 0.0.0.0 0 10.1.4.2
#創建備份組 1,並配置備份組 1 的虛擬 IP 地址爲 10.1.1.111。
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.111
#設置 Switch B 在備份組 1 中的優先級爲 100。
[SwitchB-Vlan-interface2] vrrp vrid 1 priority 100
#設置 Switch B 工作在搶佔方式,搶佔延遲時間爲 5 秒。
[SwitchB-Vlan-interface2] vrrp vrid 1 preempt-mode delay 500

(3) 配置 Switch C
#配置 VLAN2。
<SwitchC> system-view
[SwitchC] inter g 1/0/13
[SwitchC-GigabitEthernet1/0/13]port link-mode route
[SwitchC-GigabitEthernet1/0/13]ip add 10.1.3.2 24
[SwitchC-GigabitEthernet1/0/13]undo shut
[SwitchC-GigabitEthernet1/0/13]quit
[SwitchC] inter g 1/0/14
[SwitchC-GigabitEthernet1/0/14]port link-mode route
[SwitchC-GigabitEthernet1/0/14]ip add 10.1.4.2 24
[SwitchC-GigabitEthernet1/0/14]undo shut
[SwitchC-GigabitEthernet1/0/14]quit
[SwitchC] vlan 2
[SwitchC-Vlan2] port gigabitethernet 1/0/1
[SwitchC-vlan2] quit
[SwitchC] interface vlan-interface 2
[SwitchC-Vlan-interface2] ip address 10.1.2.2 255.255.255.0
[SwitchC-Vlan-interface2]quit
[SwitchC]ip route 10.1.1.0 24 10.1.3.1
[SwitchC]ip route 10.1.1.0 24 10.1.4.1

驗證配置
配置完成後,在 Host A上可以 ping通 Host B。通過 display vrrp verbose 命令查看配置後的結果。
#顯示 Switch A 上備份組 1 的詳細信息。
測試是否能ping通

2.vrrp02任務的配置
組網需求
• • VLAN 2 內主機的缺省網關爲 10.1.1.100/25;VLAN 3 內主機的缺省網關爲 10.1.1.200/25;
• • Switch A 和 Switch B 同時屬於虛擬 IP 地址爲 10.1.1.100/25 的備份組 1 和虛擬 IP 地址爲
10.1.1.200/25 的備份組 2;
• • 在備份組 1中 Switch A的優先級高於Switch B,在備份組 2中 Switch B的優先級高於 Switch
A,從而保證 VLAN 2 和 VLAN 3 內的主機分別通過 Switch A 和 Switch B 通信,當 Switch A
或 Switch B 出現故障時,主機可以通過另一臺設備繼續通信,避免通信中斷。

3.配置步驟
(1) 配置 Switch A
<H3C> system-view
[H3C]hostname SwitchA
[SwitchA]inter range g 1/0/21 to g 1/0/24
[SwitchA-if-range]port link-type trunk
[SwitchA-if-range]port trunk per vlan all
[SwitchA-if-range]quit
#配置 VLAN 2。
[SwitchA] vlan 2
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 10.1.1.1 255.255.255.128
#創建備份組 1,並配置備份組 1 的虛擬 IP 地址爲 10.1.1.100。
[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.100
#設置 Switch A 在備份組 1 中的優先級爲 110,高於 Switch B 的優先級 100,以保證在備份組 1
中 Switch A 成爲 Master 負責轉發流量。
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 110
[SwitchA-Vlan-interface2] quit
#配置 VLAN 3。
[SwitchA] vlan 3
[SwitchA-vlan3] quit
[SwitchA] interface vlan-interface 3
[SwitchA-Vlan-interface3] ip address 10.1.1.130 255.255.255.128
#創建備份組 2,並配置備份組 2 的虛擬 IP 地址爲 10.1.1.200。
[SwitchA-Vlan-interface3] vrrp vrid 2 virtual-ip 10.1.1.200
[SwitchA-Vlan-interface3]quit
[SwitchA]inter g 1/0/1
[SwitchA-GigabitEthernet1/0/1]port link-m r
[SwitchA-GigabitEthernet1/0/1]ip add 10.1.3.1 24
[SwitchA-GigabitEthernet1/0/1]undo shut
[SwitchA-GigabitEthernet1/0/1]quit
[SwitchA]ip route-static 0.0.0.0 0 10.1.3.2

(2) 配置 Switch B
<H3C> system-view
[H3C]hostname SwitchB
[SwitchB]inter range g 1/0/21 to g 1/0/24
[SwitchB-if-range]port link-type trunk
[SwitchB-if-range]port trunk per vlan all
[SwitchB-if-range]quit
#配置 VLAN 2。
[SwitchB] vlan 2
[SwitchB-vlan2] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ip address 10.1.1.2 255.255.255.128
#創建備份組 1,並配置備份組 1 的虛擬 IP 地址爲 10.1.1.100。
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.100
[SwitchB-Vlan-interface2] quit
#配置 VLAN 3。
[SwitchB] vlan 3
[SwitchB-vlan3] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] ip address 10.1.1.131 255.255.255.128
#創建備份組 2,並配置備份組 2 的虛擬 IP 地址爲 10.1.1.200。
[SwitchB-Vlan-interface3] vrrp vrid 2 virtual-ip 10.1.1.200
#設置 Switch B 在備份組 2 中的優先級爲 110,高於 Switch A 的優先級 100,以保證在備份組 2
中 Switch B 成爲 Master 負責轉發流量。
[SwitchB-Vlan-interface3] vrrp vrid 2 priority 110
[SwitchA-Vlan-interface3]quit
[SwitchA]inter g 1/0/2
[SwitchA-GigabitEthernet1/0/2]port link-m r
[SwitchA-GigabitEthernet1/0/2]ip add 10.1.4.1 24
[SwitchA-GigabitEthernet1/0/2]undo shut
[SwitchA-GigabitEthernet1/0/2]quit
[SwitchA]ip route-static 0.0.0.0 0 10.1.4.2

(3)配置SwitchC
<H3C> system-view
[H3C]hostname SwitchC
[H3C]vlan 2
[H3C-vlan2]port g 1/0/1 to g 1/0/10
[H3C-vlan2]quit
[H3C]vlan 3
[H3C-vlan3]port g 1/0/11 to g 1/0/20
[H3C-vlan3]quit
[SwitchC]inter range g 1/0/21 to g 1/0/24
[SwitchC-if-range]port link-type trunk
[SwitchC-if-range]port trunk per vlan all
[SwitchC-if-range]quit

(4)配置SwitchD
<H3C> system-view
[H3C]hostname SwitchD
[SwitchD]inter g 1/0/1
[SwitchD-GigabitEthernet1/0/1]port link-m r
[SwitchD-GigabitEthernet1/0/1]ip add 10.1.3.2 24
[SwitchD-GigabitEthernet1/0/1]undo shut
[SwitchD-GigabitEthernet1/0/1]quit
[SwitchD]inter g 1/0/2
[SwitchD-GigabitEthernet1/0/2]port link-m r
[SwitchD-GigabitEthernet1/0/2]ip add 10.1.4.2 24
[SwitchD-GigabitEthernet1/0/2]undo shut
[SwitchD-GigabitEthernet1/0/2]quit
[SwitchD]inter g 1/0/11
[SwitchD-GigabitEthernet1/0/11]port link-m r
[SwitchD-GigabitEthernet1/0/11]ip add 10.1.2.1 24
[SwitchD-GigabitEthernet1/0/11]undo shut
[SwitchD-GigabitEthernet1/0/11]quit
[SwitchD]ip route-s 10.1.1.0 24 10.1.3.1
[SwitchD]ip route-s 10.1.1.0 24 10.1.4.1

測試是否能夠ping通

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