IPv6 bind() errno 49 in jail

jasonmader at gmail.com jasonmader at gmail.com
Fri Jul 17 21:10:11 UTC 2015

In FreeBSD 10.1 Iʼve encountered an error trying to use IPv6 in a jail. 
When nginx starts with,

listen [2620:10e:6024:f004::141]:443 ssl;

and jail.conf is configured,

 ip6.addr = 2620:10e:6024:f004::141;

It’s the following error,

[emerg] 2124#0: bind() to [2620:10e:6024:f004::141]:443 failed (49: Can't 
assign requested address)

Output from truss shows,

socket(PF_INET6,SOCK_STREAM,0) = 8 (0x8)
setsockopt(0x8,0xffff,0x4,0x7fffffffe854,0x4,0x0) = 0 (0x0)
setsockopt(0x8,0x29,0x1b,0x7fffffffe848,0x4,0x0) = 0 (0x0)
ioctl(8,FIONBIO,0xffffe7fc) = 0 (0x0)
bind(8,{ AF_INET6 [40be:bd00:800:0:9fe8:ffff:100:0]:36096 },28) ERR#49 
'Can't assign requested address'
write(3,"2015/07/17 16:49:24 [emerg] 4760"...,121) = 121 (0x79)
nginx: [emerg] bind() to [2620:10e:6024:f004::141]:443 failed (49: Can't 
assign requested address)

So it’s pretty straight forward that bind() will fail. But where is the 
address [40be:bd00:800:0:9fe8:ffff:100:0]:36096 coming from?

More information about the freebsd-questions mailing list