VRRP基本概念
vrrp原理
同一组的vrrp中只有一个master。通过优先级进行选举谁是master,优先级相同则通过IP地址进行选举。真正具有转发功能的是master,当master出现故障时,其他的backup会根据优先级重新选举新的master,继续进行转发。中间可能会断开几秒。
拓补图如下:

VRRP配置
R1:
#
interface GigabitEthernet0/0/0
ip address 3.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 4.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 5.1.1.254 255.255.255.0
#
rip 1
version 2
network 3.0.0.0
network 4.0.0.0
network 5.0.0.0
#
LSW1:
#
interface Vlanif10
ip address 1.1.1.252 255.255.255.0
vrrp vrid 1 virtual-ip 1.1.1.254
vrrp vrid 1 priority 150
vrrp vrid 1 track interface GigabitEthernet0/0/4 reduced 100
vrrp vrid 1 authentication-mode md5 admin
#
interface Vlanif20
ip address 2.1.1.252 255.255.255.0
vrrp vrid 2 virtual-ip 2.1.1.254
#
interface Vlanif30
ip address 3.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk pvid vlan 30
port trunk allow-pass vlan 2 to 4094
#
rip 1
version 2
network 1.0.0.0
network 2.0.0.0
network 3.0.0.0
#
LSW2
#
interface Vlanif10
ip address 1.1.1.253 255.255.255.0
vrrp vrid 1 virtual-ip 1.1.1.254
vrrp vrid 1 authentication-mode md5 admin
#
interface Vlanif20
ip address 2.1.1.253 255.255.255.0
vrrp vrid 2 virtual-ip 2.1.1.254
vrrp vrid 2 priority 150
vrrp vrid 2 track interface GigabitEthernet0/0/4 reduced 100
#
interface Vlanif40
ip address 4.1.1.1 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk pvid vlan 40
port trunk allow-pass vlan 2 to 4094
#
#
rip 1
version 2
network 1.0.0.0
network 2.0.0.0
network 4.0.0.0
#
LSW3和LSW4一样
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/232626.html原文链接:https://javaforall.net
