拓朴如下:
主要配置如下:
[S1]
vlan batch 10 20
#
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 10 20
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20
#
[R1]
interface GigabitEthernet0/0/0.10
dot1q termination vid 10
ip address 192.168.10.251 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254
vrrp vrid 1 priority 200
vrrp vrid 1 track bfd-session session-name vrrp reduced 101
arp broadcast enable
#
interface GigabitEthernet0/0/0.20
dot1q termination vid 20
ip address 192.168.20.251 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.254
arp broadcast enable
#
interface GigabitEthernet0/0/1
ip address 13.1.1.1 255.255.255.0
#
bfd vrrp bind peer-ip 13.1.1.3 source-ip 13.1.1.1 auto
commit
#
ospf 1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
#
[R2]
interface GigabitEthernet0/0/0.10
dot1q termination vid 10
ip address 192.168.10.252 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254
arp broadcast enable
#
interface GigabitEthernet0/0/0.20
dot1q termination vid 20
ip address 192.168.20.252 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.254
vrrp vrid 2 priority 200
arp broadcast enable
#
interface GigabitEthernet0/0/1
ip address 23.1.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
#
[R3]
interface GigabitEthernet0/0/0
ip address 13.1.1.3 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 23.1.1.2 255.255.255.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
bfd vrrp bind peer-ip 13.1.1.1 source-ip 13.1.1.3 auto
commit
#
ospf 1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
#
检测:
关闭S2交换机或者关闭上面的接口,查看R1上面的优先级已经由200降为99,此时,R1的VRRP接口状态均变成Backup,R2成为VRRP两个接口的Master