Linux-Networking
Keepalived 定期發送免費 ARP
有沒有辦法讓keepalived定期發送免費ARP?
我們有以下情況:
- 交換機故障(VLAN 設置)
- keepalived 故障轉移到備份實例
- 備份實例發送了免費 ARP,但 Cisco ASA 設備沒有收到(因為交換機故障)
- 當交換機恢復時(幾分鐘後)無法訪問 VIP 原因 ASA 未刷新 ARP 表(ARP 表到期時間設置為 4h)
- 由於 ASA 已經擁有來自先前活動節點的 MAC,因此它沒有發送 ARP 請求
- 在我們重新啟動啟動新 GARP 的 keepalived 實例之前,無法訪問 VIP
因此,我們認為我們可以通過定期 GARP 來避免這種情況。這是一個好方法嗎?有沒有辦法在keepalived中做到這一點?
有什麼其他建議可以避免此類問題嗎?
保活配置:
global_defs { notification_email { email@address.com } notification_email_from SERVER_1 smtp_server smtp.server.local smtp_connect_timeout 30 router_id SERVER_1 } vrrp_instance V1 { state BACKUP nopreempt interface eth0 lvs_sync_daemon_interface eth0 virtual_router_id 150 priority 120 advert_int 1 persistence_timeout 0 smtp_alert authentication { auth_type PASS auth_pass xxx } virtual_ipaddress { 10.xxx.xxx.xxx } }
keepalived 1.2.20 及以上版本支持以下有關免費 ARP 的配置設置,我需要的是 vrrp_garp_master_refresh。
# delay for second set of gratuitous ARPs after transition to MASTER vrrp_garp_master_delay 10 # seconds, default 5, 0 for no second set # number of gratuitous ARP messages to send at a time after transition to MASTER vrrp_garp_master_repeat 1 # default 5 # delay for second set of gratuitous ARPs after lower priority advert received when MASTER vrrp_garp_lower_prio_delay 10 # number of gratuitous ARP messages to send at a time after lower priority advert received when MASTER vrrp_garp_lower_prio_repeat 1 # minimum time interval for refreshing gratuitous ARPs while MASTER vrrp_garp_master_refresh 60 # secs, default 0 (no refreshing) # number of gratuitous ARP messages to send at a time while MASTER vrrp_garp_master_refresh_repeat 2 # default 1 # Delay in ms between gratuitous ARP messages sent on an interface vrrp_garp_interval 0.001 # decimal, seconds (resolution usecs). Default 0. # Delay in ms between unsolicited NA messages sent on an interface vrrp_gna_interval 0.000001 # decimal, seconds (resolution usecs). Default 0.