Cannot assign requested address
berni at birkenwald.de
Fri May 1 17:43:36 CEST 2009
> We are trying to set up services using home-brewed scripts to set-up
> ipv6 adresses and bind services to them, just as we do this for ipv4.
> Using a fairly recent linux kernel (18.104.22.168), or any other linux
> kernel I can get my hands on, the following scripts fails:
> ip -f inet6 a add ::2/128 dev eth0 && nc -l ::2 1234
> nc: Cannot assign requested address
> An EADDRNOTAVAIL is issued.
> Basically, we set up an ipv6 address and let nc listen on it.
> Introducing a 2 sec. sleep between setting up the interface and
> bind()'ing to it, seems to be the only workaround I have found.
You are most probably hit by Duplicate Address Detection as defined in
RFC2462 Section 5.4. You will probably see the address being "tentative"
in ip -6 addr while the DAD is run.
You can disable DAD on the interface setting the sysctl variable
net.ipv6.conf.et0.dad_transmits to 0, or enable the optimistic DAD
support (RFC4429) in recent Linux kernels.
More information about the ipv6-ops