Sorry for dredging up such an old thread, but this is the only hit on Google, and it seems silly to start a new thread about the exact same problem.
So in a nutshell, my situation is exactly the same as the original poster. Setting up lighttpd in a jail. The IP is set in the jail config, the host machine has the IP as one of its aliases, nothing else is running on port 80, and "nc -l 80" works fine. Likewise enabled/disabled raw sockets to no effect.
Always get the same error:
Code:
# lighttpd -D -f /usr/local/etc/lighttpd/lighttpd.conf
2017-02-16 23:50:19: (network.c.464) can't bind to port: 0.0.0.0 80 Address already in use
I tried setting the conf to bind to "localhost", "0.0.0.0" and the actual ip (192.168.24.10), to no avail. Always shows exactly the same error.
EDIT:
Interestingly, setting the lighttpd port to 81 works just fine. So it isn't specific to lighttpd not binding, nor to it being in a jail. There is something about port 80. netstat does not show as anything listening on port 80 either, which makes it all the more odd. I checked the jail host, and it is also not binding anything to port 80 on that ip addr.
EDIT2:
So, tried setting up a simple web server using Python, which works fine, and I can connect to it:
Code:
# python2 -m SimpleHTTPServer 80
Serving HTTP on 192.168.24.10 port 80 ...
192.168.42.25 - - [16/Feb/2017 23:59:34] "GET / HTTP/1.1" 200 -
So, seems specific to lighttpd interacting with port 80.
EDIT3:
Running through truss, I find that lighttpd attempts to bind both to the ip and 0.0.0.0, despite the config files request.
Code:
bind(4,{ AF_INET 192.168.24.10:80 },16) = 0 (0x0)
listen(0x4,0x400) = 0 (0x0)
[...]
bind(5,{ AF_INET 0.0.0.0:80 },16) ERR#48 'Address already in use'
2017-02-17 00:07:45: (network.c.464) can't bind to port: 0.0.0.0 80 Address already in use
from what I know, 0.0.0.0 binds to all interfaces. So if it binds once to 192.168.24.10 (and succeeds), then when it next tries to bind to 0.0.0.0 (which includes 192.168.24.10), then it may fail because it is already bound to one of the interfaces.
Not sure if a software bug, or I am just misunderstanding how freeBSD handles network interface binding.