Keepalived : Group VRRP instances2023/10/11 |
To group multiple VRRP instances, it's possible to make them failover in sync when trouble happens on an interface in the group. This example is based on the environment like follows. VIP:10.0.0.30 +----------------------+ | +----------------------+ | [node01.srv.world] |10.0.0.51 | 10.0.0.52| [node02.srv.world] | | Keepalived#1 +------------+------------+ Keepalived#2 | | |192.168.0.51|192.168.0.52| | +----------------------+ | +----------------------+ VIP:192.168.0.30 |
[1] | Configure Keepalived on the Primary Node. |
root@node01:~#
vi /etc/keepalived/keepalived.conf global_defs { router_id node01 } # group setting vrrp_sync_group VG1 { group { INTERNAL EXTERNAL } } # VRRP instance setting vrrp_instance INTERNAL { state MASTER interface enp1s0 virtual_router_id 101 priority 200 advert_int 1 virtual_ipaddress { 10.0.0.30/24 } } # VRRP instance setting vrrp_instance EXTERNAL { state MASTER interface enp9s0 virtual_router_id 201 priority 200 advert_int 1 virtual_ipaddress { 192.168.0.30/24 } }root@node01:~# systemctl restart keepalived
|
[2] | Configure Keepalived on the Backup Node. |
root@node02:~#
vi /etc/keepalived/keepalived.conf global_defs { router_id node02 } # group setting vrrp_sync_group VG1 { group { INTERNAL EXTERNAL } } # VRRP instance setting vrrp_instance INTERNAL { state BACKUP interface enp1s0 virtual_router_id 101 priority 100 advert_int 1 virtual_ipaddress { 10.0.0.30/24 } } # VRRP instance setting vrrp_instance EXTERNAL { state BACKUP interface enp9s0 virtual_router_id 201 priority 100 advert_int 1 virtual_ipaddress { 192.168.0.30/24 } }root@node02:~# systemctl restart keepalived
|
[3] | That's OK. Verify failover. |
root@node01:~# ip address show enp1s0; ip address show enp9s0 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:5b:6d:b6 brd ff:ff:ff:ff:ff:ff inet 10.0.0.51/24 brd 10.0.0.255 scope global enp1s0 valid_lft forever preferred_lft forever inet 10.0.0.30/24 scope global secondary enp1s0 valid_lft forever preferred_lft forever inet6 fe80::5054:ff:fe5b:6db6/64 scope link valid_lft forever preferred_lft forever 3: enp9s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:16:f9:35 brd ff:ff:ff:ff:ff:ff inet 192.168.0.51/24 brd 192.168.0.255 scope global enp9s0 valid_lft forever preferred_lft forever inet 192.168.0.30/24 scope global secondary enp9s0 valid_lft forever preferred_lft forever inet6 fe80::5054:ff:fe16:f935/64 scope link valid_lft forever preferred_lft forever
root@node01:~#
root@node01:~# ip link set down enp1s0
ip address show enp1s0; ip address show enp9s0 2: enp1s0: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000 link/ether 52:54:00:5b:6d:b6 brd ff:ff:ff:ff:ff:ff inet 10.0.0.51/24 brd 10.0.0.255 scope global enp1s0 valid_lft forever preferred_lft forever 3: enp9s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:16:f9:35 brd ff:ff:ff:ff:ff:ff inet 192.168.0.51/24 brd 192.168.0.255 scope global enp9s0 valid_lft forever preferred_lft forever inet6 fe80::5054:ff:fe16:f935/64 scope link valid_lft forever preferred_lft forever |
Sponsored Link |