VRRP即 虚拟路由冗余协议(Virtual Router Redundancy Protocol),它是为了避免路由器出现单点故障的一种容错协议。
个人理解: 1、把多个运行了vrrp协议的路由器抽象成一个虚拟路由器 2、虚拟路由器通过优先级来选定Master(主)设备和Backup(备)设备,优先级越高越能成为Master设备 3、当Master设备超时或故障down掉的时候,这时就会启用一个抢占机制来把Backup设备顶上;或者Master和Backup通过发送vrrp报文来进行协商,谁做(主)谁做(备) 4、这样一来既分担了主路由器的压力又降低了因为故障带来的影响和损失
拓扑图实验:
LS1:建立vlan10 20,并加入到各access接口中 sys [Huawei]v b 10 20 [Huawei]int e0/0/1 [Huawei-Ethernet0/0/1]p l a [Huawei-Ethernet0/0/1]p d v 10 [Huawei-Ethernet0/0/1]un sh [Huawei-Ethernet0/0/1]int e0/0/2 [Huawei-Ethernet0/0/2]p l a [Huawei-Ethernet0/0/2]p d v 20 [Huawei-Ethernet0/0/2]un sh [Huawei-Ethernet0/0/2]int g0/0/1 [Huawei-GigabitEthernet0/0/1]p l t [Huawei-GigabitEthernet0/0/1]p t a v 10 20 [Huawei-GigabitEthernet0/0/1]un sh [Huawei-GigabitEthernet0/0/1]int g0/0/2 [Huawei-GigabitEthernet0/0/2]p l t [Huawei-GigabitEthernet0/0/2]p t a v 10 20 [Huawei-GigabitEthernet0/0/2]un sh
LS2:双主双备 sys [Huawei]sys LS2 [LS2]v b 10 20 100 #####建立vlan 10 20 100 [LS2]int g0/0/1 [LS2-GigabitEthernet0/0/1]p l a ###设置access口 [LS2-GigabitEthernet0/0/1]p d v 100 [LS2-GigabitEthernet0/0/1]un sh [LS2-GigabitEthernet0/0/1]int g0/0/2 [LS2-GigabitEthernet0/0/2]p l t [LS2-GigabitEthernet0/0/2]p t a v 10 20 [LS2-GigabitEthernet0/0/2]un sh [LS2-GigabitEthernet0/0/2]q [LS2]int vlanif 10 [LS2-Vlanif10]ip add 192.168.10.10 24 [LS2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1######设置vrrp虚拟接口并设置ip [LS2-Vlanif10]vrrp vrid 1 priority 120######设置vrrp优先级 [LS2-Vlanif10]vrrp vrid 1 track int g0/0/1 [LS2-Vlanif10]vrrp vrid 1 track int g0/0/2######设置监测端口g0/0/1和g0/0/2 [LS2-Vlanif10]int vlanif 20 [LS2-Vlanif20]ip add 192.168.20.10 24 [LS2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1######设置vlan20 vrrp虚拟接口并设置ip [LS2-Vlanif20]vrrp vrid 2 priority 115######设置vrrp优先级,因为是备线所以不需要监测 [LS2-Vlanif20]int vlanif 100 [LS2-Vlanif100]ip add 11.0.0.2 30 [LS2-Vlanif100]q [LS2]ip route-static 0.0.0.0 0.0.0.0 11.0.0.1 ########设置默认路由
LS3:双主双备 sys [Huawei]sys LS3 [LS3]v b 10 20 100 [LS3]int vlanif 10 [LS3-Vlanif10]ip add 192.168.10.20 24 [LS3-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1######设置vrrp虚拟端口并设置ip [LS3-Vlanif10]vrrp vrid 1 priority 115######设置vrrp优先级,因为是备线所以不需要监测 [LS3-Vlanif10]int vlanif 20[LS3-Vlanif20]ip add 192.168.20.20 24 [LS3-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1######设置vrrp虚拟端口并设置ip [LS3-Vlanif20]vrrp vrid 2 priority 120######设置vrrp优先级 [LS3-Vlanif20]vrrp vrid 2 track int g0/0/1 [LS3-Vlanif20]vrrp vrid 2 track int g0/0/2######设置监测端口g0/0/1和g0/0/2 [LS3-Vlanif20]int vlanif 100 [LS3-Vlanif100]ip add 12.0.0.2 30 [LS3-Vlanif100]int g0/0/1 [LS3-GigabitEthernet0/0/1]p l a [LS3-GigabitEthernet0/0/1]p d v 100 [LS3-GigabitEthernet0/0/1]un sh [LS3-GigabitEthernet0/0/1]int g0/0/2 [LS3-GigabitEthernet0/0/2]p l t [LS3-GigabitEthernet0/0/2]p t a v 10 20 [LS3-GigabitEthernet0/0/2]un sh [LS3-GigabitEthernet0/0/2]q [LS3]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1
R1:设置循环ip地址loo 0, 设置四条静态路由 sys [Huawei]sys R1 [R1]int g0/0/0 [R1-GigabitEthernet0/0/0]ip add 11.0.0.1 30 [R1-GigabitEthernet0/0/0]un sh [R1-GigabitEthernet0/0/0]int g0/0/1 [R1-GigabitEthernet0/0/1]ip add 12.0.0.1 30 [R1-GigabitEthernet0/0/1]q [R1]ip route-static 192.168.10.0 24 11.0.0.2 [R1]ip route-static 192.168.10.0 24 12.0.0.2 permanent 70 [R1]ip route-static 192.168.20.0 24 11.0.0.2 preference 70 [R1]ip route-static 192.168.20.0 24 12.0.0.2 [R1]int loo 0 [R1-LoopBack0]ip add 1.1.1.1 24
最是ping测试以及抓包测试 OK
觉得不错的话点个赞哈-