So dhcpcd has supported a shared IP address for a long time. It did this by removing the address from the non preferrred interface and then adding it to the preferred interface.
But this came with some issues:
- There is a window where the IP address doesn’t exist, and the kernel may wipe out the subnet route at that point also.
- DHCP renews didn’t come through to the right interface.
- Some kernels didn’t like the address moving interfaces.
Still, to the best of my knowledge, no other product has this feature and for the most part, it did work well allowing almost seamless switching of wired-> wireless and back again with both using the same IP address. But that wasn’t good enough - I was challenged to do better!
So I took up the bat and changed the behaviour to this:
- Each applicable interface will have the shared ip address.
- Whenever the address is added, the most preferred address will be ARP announced.
And lo - IT WORKS!!! The changeover when plugging/removing the wired interface is 100% seamless for me. ssh, ping, etc get zero interuption. Of course, YMMV ;)
But there are some costs:
- Thanks to ARP, only the primary interface will receive DHCP unicast messages for other interfaces.
As such we need to re-direct them to the correct interface by examining
This means we have to relax the BPF filters to allow more through.
- Kernels supporting RFC5227 will double ARP announce the address.
- NetBSD-8 kernels needed some love to get it to work and there’s still an issue with it not working when an address is deleted from the interface.
Only the last bullet is really important, which is mainly why the changeset hasn’t hit the master branch yet. But that should be fixed soon. The other points can be fixed as and when.