vrrp_instance DHCP_VIP { state MASTER interface eth00 virtual_router_id 5 priority 150 advert_int 1 max_auto_priority 255 authentication { auth_type PASS auth_pass 12345 } virtual_ipaddress { 192.168.16.5 # DHCP 服务器的 VIP } track_script { chk_dhcp } garp_master_delay 1 garp_master_repeat 5 # 发送 5 次 GARP notify_fault "/etc/keepalived/failover.sh" # 触发切换 notify_master "/etc/keepalived/notify_master.sh" # 触发恢复 notify_backup "/etc/keepalived/notify_backup.sh" } vrrp_script chk_dhcp { script "/etc/keepalived/chk_dhcp.sh" interval 2 #weight -50 # 进程挂掉,降低 50 优先级,触发 VIP 迁移 weight -30 # 进程挂掉,降低 50 优先级,触发 VIP 迁移 fall 2 # 2 次失败后触发 rise 2 # 2 次检测成功后恢复 }