I am testing CARP in two dedicated server from Hetzner having both servers atached to a vSwitch with IPv4 addresses, this is the what I have in /etc/rc.conf:
I need a VLAN in order to configure the public IPv4 from the vSwitch, I can't set the VIP as an alias to the main NIC.
And in /etc/rc.local (the same on both servers only difference is that server 2 uses advskew 100)
I am using /etc.rc.local, because I need to change the mac address of the VLAN, and in case of rebooting the sever I just want to ping the gateway if CARP is "MASTER", but this is indeed my question/problem. (I had to change the mac address of the VLAN because otherwise the mac address of the main host will advertize into the vSwitch and this is not allowed by Hetzner)
The setup works fine, but after approximately 5 minutes the vSwithh stop routing packets to the server holding the VIP, what I notice is that periodically (cron every minute) I need to advertise the mac address of the server holding the VIP (
Is there a way to periodically advertise the mac address? I tried without luck
In both servers I have also this in /etc/devd/carp.conf
This calls /root/carpcontrol.sh:
It works fine, but the only If I keep using this cron:
Wondering what could be wrong that I need to keep advertising/pinging and if there is a way to prevent this.
Any thoughts?
Code:
cloned_interfaces="vlan0"
create_args_vlan0="vlan 4000 vlandev em0 mtu 1400 fib 1"
ifconfig_vlan0="ether random"
I need a VLAN in order to configure the public IPv4 from the vSwitch, I can't set the VIP as an alias to the main NIC.
And in /etc/rc.local (the same on both servers only difference is that server 2 uses advskew 100)
Code:
ifconfig vlan0 inet 137.23.7.140/29 vhid 1 advskew 0 pass xxxyyyzzz
route add default 137.23.7.137 -fib 1
sleep 3
if `ifconfig vlan0 | grep -q "carp: MASTER"`; then
setfib 1 /usr/local/sbin/arping -i vlan0 -w 3 -U 137.23.7.137
fi
I am using /etc.rc.local, because I need to change the mac address of the VLAN, and in case of rebooting the sever I just want to ping the gateway if CARP is "MASTER", but this is indeed my question/problem. (I had to change the mac address of the VLAN because otherwise the mac address of the main host will advertize into the vSwitch and this is not allowed by Hetzner)
The setup works fine, but after approximately 5 minutes the vSwithh stop routing packets to the server holding the VIP, what I notice is that periodically (cron every minute) I need to advertise the mac address of the server holding the VIP (
arping
) If I don't do this, the vSwitch stops routing packets.Is there a way to periodically advertise the mac address? I tried without luck
Code:
sysctl net.link.ether.inet.max_age=60
In both servers I have also this in /etc/devd/carp.conf
Code:
notify 0 {
match "system" "CARP";
match "subsystem" "[0-9]+@[0-9a-z]+";
match "type" "(MASTER|BACKUP)";
action "/root/carpcontrol.sh $subsystem $type | logger &";
};
This calls /root/carpcontrol.sh:
Code:
if [ $# -lt 2 ]; then
echo 'missing arguments subsystem and (BACKUP|MASTER)'
exit 1
fi
IP_GW="137.23.7.137"
# arping and ping to speed up the switch
if [ $2 = "MASTER" ]; then
setfib 1 /usr/local/sbin/arping -i vlan0 -w 3 -U ${IP_GW}
fi
It works fine, but the only If I keep using this cron:
Code:
*/1 * * * * ifconfig vlan0 | grep -q 'carp: MASTER' && setfib 1 /usr/local/sbin/arping -i vlan0 -w 3 -U 137.23.7.137 > /dev/null 2>&1
Wondering what could be wrong that I need to keep advertising/pinging and if there is a way to prevent this.
Any thoughts?