Keepalived with ipv6

Version 1.2.20 and later,keepalived no longer supports mixing IPv4 and IPv6 addresses in one VRRP instance (virtual_ipaddress block), because that violates the  VRRP standard.
There are two ways to configure dual‑stack HA with VRRP:
 

Add the virtual_ipaddress_excluded block with the addresses of one family.

vrrp_instance VI_1 {
    ...
    unicast_src_ip 192.168.100.100

    unicast_peer {
        192.168.100.101
    }

    virtual_ipaddress {
        192.168.100.150
    }
    ...

    virtual_ipaddress_excluded {
        1234:5678:9abc:def::1
    }
    ...
}
The addresses are excluded from VRRP advertisements, but are still managed by keepalived and added or removed when there is a state change.

Add another VRRP instance for IPv6 addresses.

The VRRP configuration for IPv6 addresses on the master node is:

vrrp_instance VI_2 {
    interface         eth0
    priority          101
    virtual_router_id 51
    advert_int        1
    accept
    unicast_src_ip    1234:5678:9abc:def::3

    unicast_peer {
        1234:5678:9abc:def::2
    }

    virtual_ipaddress {
        1234:5678:9abc:def::1
    }

    track_script {
        chk_nginx_service
        chk_manual_failover
    }

    notify "/usr/libexec/keepalived/nginx-ha-notify"
}
Note that VRRP instances can both use the same virtual_router_id since the VRRP IPv4 and IPv6 instances are completely independent of each other.

猜你喜欢

转载自www.cnblogs.com/sunwanglin/p/12438661.html