I have a kea kubernetes pod which we need to redeploy in few scenarios. At rare times I have seen following issue:
2020-07-10 16:11:02.655 WARN [kea-dhcp6.dhcpsrv/1] DHCPSRV_OPEN_SOCKET_FAIL failed to open socket: Failed to open unicast socket on interface bond0, reason: Failed to bind socket 15 to fec0:xxxx:yyy:3::17/port=547: Address not available 2020-07-10 16:11:02.668 INFO [kea-dhcp6.dhcp6/1] DHCP6_STARTED Kea DHCPv6 server version 1.7.3 started
when this issue happens kea is running but since bind failed it will get any incoming DHCP packets.
The "Address not available" maps to binding error EADDRNOTAVAIL. This particular connection is UDP. However, when I look for this error for TCP I got following explanation in one place:
After connection close, Connections will go in TIME_WAIT state for some time.
During this state if any new connections comes with same IP and PORT, if SO_REUSEADDR is not provided during socket creation then socket bind() will fail with error EADDRINUSE.
But even though after providing SO_REUSEADDR also sockect connect() may fail with error EADDRNOTAVAIL if tcp timestamp is not enable on both side.
Solution: Please enable tcp timestamp on both side client and server.
echo 1 > /proc/sys/net/ipv4/tcp_timestamps
However this won't be applicable for us as our scenario is UDP.
Please let me know if there are any inputs to handle this scenario in kea. Some options I can think of and need to explore:
1. Introduce delay in bringing up kea with some value greater than TIME_WAIT. However I need to explore on how to get value of TIME_WAIT
2. Explore tcp equivalent for UDP which if set in OS will ensure that this scenario will not happen
Please let me know your inputs from kea perspective which can solve this problem.
Thanks and Regards,
ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.