Skip to Content [alt-c]
In reply to Beware the IPv6 DAD Race Condition
Here's how I tackle this using zsh without having to disable duplicate address detection:
ip -6 addr add 2001:DB8:1234:f00::2/64 dev eth0 wait_dad=0 until (( ++wait_dad > 100 )) { grep -q 2001:DB8:1234:f00::1 <(ip -6 r l table local) && no_da=1 && break sleep 0.2 } (( no_da )) && ip -6 r a 2001:DB8::/32 via 2001:DB8:1234:f00::ffff dev eth0 src 2001:DB8:1234:f00::2
The trick is; once dad detection has finished and the address is safe to use (no one uses it on the network already), the address is added to the local ipv6 route table. So, we wait max 20 seconds for it (should never be reached) and if we find the address in the local table, we can add the route.
local
The code should be easy enough for people who don't use zsh to read and adapt for their preferred shell.
Hope this helps others.
Reply
Your comment will be public. To contact me privately, email me. Please keep your comment polite, on-topic, and comprehensible. Your comment may be held for moderation before being published.
Your Name: (Optional; will be published)
Your Email Address: (Optional; will not be published)
Your Website: (Optional; will be published)
>
monospaced
Post a Reply
Your comment will be public. To contact me privately, email me. Please keep your comment polite, on-topic, and comprehensible. Your comment may be held for moderation before being published.