一、VRRP基本概述
二、VRRP基本结构
三、VRRP术语
四、Master与Backup路由器
五、VRRP的配置
前言
局域网中的用户终端通常采用配置一个默认网关的形式访问外部网络,如果此时默认网关设备发生故障,将中断所有用户终端的网络访问,这很可能会给用户带来不可预计的损失,所以可以通过部署多个网关的方式来解决单点故障问题,那么如何让多个网关能够协同工作但又不会互相冲突就成了最迫切需要解决的问题。于是VRRP应运而生,它既可以实现网关的备份,又能解决多个网关之间互相冲突的问题。那么VRRP的工作原理是如何实现的?在网络中又该如何配置呢?
单网关的缺陷
当网关路由器RouterA出现故障时,本网段内以该设备为网关的主机都不能与 Internet进行通信。
一、VRRP基本概述
二、VRRP基本结构
三、VRRP术语五、VRRP的配置
配置sw1
1 <Huawei>sys 2 Enter system view, return user view with Ctrl+Z. 3 [Huawei]sys 4 [Huawei]sysname sw1 5 [sw1]undo info-center en 6 [sw1]v b 10 20 100 7 Info: This operation may take a few seconds. Please wait for a moment...done. 8 [sw1]int g0/0/2 9 [sw1-GigabitEthernet0/0/2]p l t 10 [sw1-GigabitEthernet0/0/2]p t a v 10 20 11 [sw1-GigabitEthernet0/0/2]un sh 12 Info: Interface GigabitEthernet0/0/2 is not shutdown. 13 [sw1-GigabitEthernet0/0/2]int g0/0/1 14 [sw1-GigabitEthernet0/0/1]p l a 15 [sw1-GigabitEthernet0/0/1]p d v 100 16 [sw1-GigabitEthernet0/0/1]un sh 17 Info: Interface GigabitEthernet0/0/1 is not shutdown. 18 [sw1-GigabitEthernet0/0/1]q 19 [sw1]int vlanif 10 20 [sw1-Vlanif10]ip add 192.168.10.10 24 21 [sw1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1 ###设置vrrp的I虚拟IP地址 22 [sw1-Vlanif10]vrrp vrid 1 priority 120 ###设置优先级 23 [sw1-Vlanif10]vrrp vrid 1 track int g0/0/2 ###设置监听端口 24 [sw1-Vlanif10]vrrp vrid 1 track int g0/0/1 ###设置监听端口 25 [sw1-Vlanif10]int vlanif 20 26 [sw1-Vlanif20]ip add 192.168.20.10 24 27 [sw1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1 ###设置vrrp的虚拟IP地址 28 [sw1-Vlanif20]vrrp vrid 2 priority 115 ###设置优先级 29 [sw1-Vlanif20]int vlanif 100 30 [sw1-Vlanif100]ip add 11.0.0.2 30 31 [sw1-Vlanif100]un sh 32 Info: Interface Vlanif100 is not shutdown. 33 [sw1-Vlanif100]q 34 [sw1]ip route-static 0.0.0.0 0.0.0.0 11.0.0.1 35 [sw1] User interface con0 is available
配置sw2
1 <Huawei>sys 2 Enter system view, return user view with Ctrl+Z. 3 [Huawei]sysname sw2 4 [sw2]undo info-center en 5 Info: Information center is disabled. 6 [sw2]v b 10 20 100 7 Info: This operation may take a few seconds. Please wait for a moment...done. 8 [sw2]int g0/0/2 9 [sw2-GigabitEthernet0/0/2]p l t 10 [sw2-GigabitEthernet0/0/2]p t a v 10 20 11 [sw2-GigabitEthernet0/0/2]un sh 12 Info: Interface GigabitEthernet0/0/2 is not shutdown. 13 [sw2-GigabitEthernet0/0/2]int g0/0/1 14 [sw2-GigabitEthernet0/0/1]p l a 15 [sw2-GigabitEthernet0/0/1]p d v 100 16 [sw2-GigabitEthernet0/0/1]un sh 17 Info: Interface GigabitEthernet0/0/1 is not shutdown. 18 [sw2-GigabitEthernet0/0/1]q 19 [sw2]int vlanif 10 20 [sw2-Vlanif10]ip add 192.168.10.20 24 21 [sw2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1 ###设置vrrp的虚拟IP地址 22 [sw2-Vlanif10]vrrp vrid 1 priority 115 ###设置优先级 23 [sw2-Vlanif10]int vlanif 20 24 [sw2-Vlanif20]ip add 192.168.20.20 24 25 [sw2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1 ###设置vrrp的虚拟IP地址vlanif20的 26 [sw2-Vlanif20]vrrp vrid 2 priority 120 ###设置优先级 27 [sw2-Vlanif20]vrrp vrid 2 track int g0/0/2 ###设置监听端口 28 [sw2-Vlanif20]vrrp vrid 2 track int g0/0/1 ###设置监听端口 29 [sw2-Vlanif20]int vlanif 100 30 [sw2-Vlanif100]ip add 12.0.0.2 30 31 [sw2-Vlanif100]un sh 32 Info: Interface Vlanif100 is not shutdown. 33 [sw2-Vlanif100]q 34 [sw2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1
配置sw3
<Huawei>sys [Huawei]sys [Huawei]sysname sw3 [sw3]undo info [sw3]undo info-center en [sw3]v b 10 20 [sw3]int e0/0/1 [sw3-Ethernet0/0/1]p l a [sw3-Ethernet0/0/1]p d v 10 [sw3-Ethernet0/0/1]un sh Info: Interface Ethernet0/0/1 is not shutdown. [sw3-Ethernet0/0/1]int e0/0/2 [sw3-Ethernet0/0/2]p l a [sw3-Ethernet0/0/2]p d v 20 [sw3-Ethernet0/0/2]un sh Info: Interface Ethernet0/0/2 is not shutdown. [sw3-Ethernet0/0/2]int g0/0/1 [sw3-GigabitEthernet0/0/1]p l t [sw3-GigabitEthernet0/0/1]p t a v 10 20 [sw3-GigabitEthernet0/0/1]un sh Info: Interface GigabitEthernet0/0/1 is not shutdown. [sw3-GigabitEthernet0/0/1]int g0/0/2 [sw3-GigabitEthernet0/0/2]p l t [sw3-GigabitEthernet0/0/2]p t a v 10 20 [sw3-GigabitEthernet0/0/2]un sh
配置R1
1 <Huawei>sys 2 Enter system view, return user view with Ctrl+Z. 3 [Huawei]sysname R1 4 [R1]undo info-center en 5 Info: Information center is disabled. 6 [R1]int g0/0/0 7 [R1-GigabitEthernet0/0/0]i a 11.0.0.1 30 8 [R1-GigabitEthernet0/0/0]un sh 9 Info: Interface GigabitEthernet0/0/0 is not shutdown. 10 [R1-GigabitEthernet0/0/0]int g0/0/1 11 [R1-GigabitEthernet0/0/1]i a 12.0.0.1 30 12 [R1-GigabitEthernet0/0/1]un sh 13 Info: Interface GigabitEthernet0/0/1 is not shutdown. 14 [R1-GigabitEthernet0/0/1]int loo 0 15 [R1-LoopBack0]i a 1.1.1.1 24 16 [R1-LoopBack0]q 17 [R1]ip route-static 192.168.10.0 24 11.0.0.2 18 [R1]ip route-static 192.168.10.0 24 12.0.0.2 preference 70 ###浮动路由 19 [R1]ip route-static 192.168.20.0 24 12.0.0.2 20 [R1]ip route-static 192.168.20.0 24 11.0.0.2 preference 70 ###浮动路由