Skip to content

Instantly share code, notes, and snippets.

@lgcosta
Created November 20, 2017 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgcosta/d7dce5aac1f83c64d53d548f5e9f695e to your computer and use it in GitHub Desktop.
Save lgcosta/d7dce5aac1f83c64d53d548f5e9f695e to your computer and use it in GitHub Desktop.
A way to simulate the arp.balance of the carp in freebsd 11.x
#!/bin/sh
if [ "$2" == "MASTER" ]; then
if [ "$(echo $1 | grep em0)" ]; then
ifconfig em0 ether 08:00:27:2c:95:00
fi
if [ "$(echo $1 | grep em1)" ]; then
ifconfig em1 ether 08:00:27:ef:b4:00
fi
fi
if [ "$2" == "BACKUP" ]; then
if [ "$(echo $1 | grep em0)" ]; then
HW="$(ifconfig em0 | sed -n -e '/hwaddr/p' | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}')"
ifconfig em0 ether $HW
fi
if [ "$(echo $1 | grep em1)" ]; then
HW="$(ifconfig em1 | sed -n -e '/hwaddr/p' | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}')"
ifconfig em1 ether $HW
fi
fi
@nbari
Copy link

nbari commented Apr 5, 2020

Hi, could you please elaborate more about this and your setup, I am trying FreeBSD 12 (no hwaddr ) but having lots of messages like:

   arp: 187.23.7.203 moved from 5c:5e:ab:09:81:f0 to 5c:5e:ab:01:c7:f0 on vlan0

My guess is that it could be related to how carp is dealing with the arp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment