global_defs {
    router_id ${ROUTER_ID_NAME}
}

vrrp_script chk_pihole_web {
    script "grep -qi ':${PIHOLE_WEB_PORT_HEX}' /proc/net/tcp /proc/net/tcp6"
    interval 2
    fall 2
    rise 2
}

vrrp_instance VI_DNS {
    state ${KEEPALIVED_STATE}
    interface ${LAN_INTERFACE}
    virtual_router_id ${KEEPALIVED_ROUTER_ID}
    priority ${KEEPALIVED_PRIORITY}
    advert_int 1
${NOPREEMPT_LINE}

    authentication {
        auth_type PASS
        auth_pass ${KEEPALIVED_PASSWORD}
    }

    virtual_ipaddress {
        ${VIP_CIDR}
    }

    track_script {
        chk_pihole_web
    }
}
