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 转发.
配置步骤
注: 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 出现故障时, 主机可以通过另一台设备继续通信, 避免通信中断.
配置步骤
(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 通
来源: http://www.bubuko.com/infodetail-3112666.html