Skip to content

vrrp master switchover lead to disconnection of tcp connections #2254

@maryoho

Description

@maryoho

Describe the bug

On my network experiment,I runned keepalived on two nat device to implement high availability. when master changed to another,
a script will be executed to commit nat sessions to kernel.
The sequence of actions:

  1. set vip to new master network interface
  2. send gratuitous ARP
  3. execute script
    The third step will take some time, it will lead to connection reset if client or server send packet before it's nat session not synced at this time.
    image

Expected behavior
tcp connection not be resetted

Keepalived version

Keepalived v2.1.5 (07/13,2020)

Configuration file:

node1:
global_defs {
    router_id 172.18.0.2
    vrrp_skip_check_adv_addr
    vrrp_garp_master_refresh 60
    vrrp_garp_master_refresh_repeat 2
    vrrp_garp_master_repeat 5
    vrrp_garp_interval 0.001
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51

    unicast_src_ip 172.18.0.2

    unicast_peer {
        172.18.0.3
    }

    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }

    virtual_ipaddress {
        172.18.0.254
    }
    notify_master "/etc/conntrackd/primary-backup.sh primary"
    notify_backup "/etc/conntrackd/primary-backup.sh backup"
    notify_fault "/etc/conntrackd/primary-backup.sh fault"
}

node2:
global_defs {
    router_id 172.18.0.3
    vrrp_skip_check_adv_addr
    vrrp_garp_master_refresh 60
    vrrp_garp_master_refresh_repeat 2
    vrrp_garp_master_repeat 5
    vrrp_garp_interval 0.001
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51

    unicast_src_ip 172.18.0.3

    unicast_peer {
        172.18.0.2
    }

    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }

    virtual_ipaddress {
        172.18.0.254
    }
    notify_master "/etc/conntrackd/primary-backup.sh primary"
    notify_backup "/etc/conntrackd/primary-backup.sh backup"
    notify_fault "/etc/conntrackd/primary-backup.sh fault"
}

Notify and track scripts

https://github.com/vyos/conntrack-tools/blob/current/doc/sync/primary-backup.sh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions