Настройки первого хоста
[node-1]% uname -v FreeBSD 11.0-RELEASE-p9 #0
[node-1]% less /etc/rc.conf ifconfig_vmx0="DHCP" ifconfig_vmx0_alias0="inet 10.0.1.123/32 vhid 123 advskew 100 pass Passw0rd"
[node-1]% less /etc/sysctl.conf net.inet.carp.preempt=1
Настройки второго хоста
[node-2]% uname -v FreeBSD 11.0-RELEASE-p9 #0
[node-2]% less /etc/rc.conf ifconfig_vmx0="DHCP" ifconfig_vmx0_alias0="inet 10.0.1.123/32 vhid 123 advskew 200 pass Passw0rd"
[node-2]% less /etc/sysctl.conf net.inet.carp.preempt=1
Если настраиваем CARP под VMware, то необходимо:
1. В настройках порт группы распределённого свича поменять на Accept “Promiscous mode”, “Mac Address Changes”, “Forget Transmits”
2. На ESXi хостах в расширенных настройках установить Net.ReversePathFwdCheckPromisc в значение 1 и перегрузить хост, иначе в логах будет
Jun 8 18:53:20 node-2 kernel: carp: 123@vmx0: MASTER -> BACKUP (more frequent advertisement received)
Jun 8 18:53:20 node-2 kernel: ifa_maintain_loopback_route: deletion failed for interface vmx0: 3
Jun 8 18:53:24 node-2 kernel: carp: 123@vmx0: BACKUP -> MASTER (master timed out)
Jun 8 18:53:24 node-2 kernel: carp: 123@vmx0: MASTER -> BACKUP (more frequent advertisement received)
Jun 8 18:53:24 node-2 kernel: ifa_maintain_loopback_route: deletion failed for interface vmx0: 3
Jun 8 18:53:27 node-2 kernel: carp: 123@vmx0: BACKUP -> MASTER (master timed out)
Jun 8 18:53:27 node-2 kernel: carp: 123@vmx0: MASTER -> BACKUP (more frequent advertisement received)
Jun 8 18:53:27 node-2 kernel: ifa_maintain_loopback_route: deletion failed for interface vmx0: 3