[solved] Bind IPv4/IPv6 but not on all interfaces
Added by milipili over 15 years ago
Hi !
I am using lighty for a while but I installed a new box with a valid IPv6 configuration. The box has several IPv4 addresses and several IPv6 addresses as well. Another webserver is listening on a specific address (Apache+SVN actually).
The OS is Gentoo and lighty is the last available via portage (1.4.23) and I would like to bind lighty on two specific IP addresses for my virtual hosts :
- 91.121.43.249
- 2001:41D0:1:F3bc::3
In the config file, I'am using server.bind and server.use-ipv6 but lighty could not start :
/etc/init.d/lighttpd start * Starting lighttpd ... 2009-11-08 00:53:22: (network.c.197) getaddrinfo failed: Address family for hostname not supported ' 91.121.43.249 '
My /etc/conf.d/net :
config_eth0=( "91.121.178.188 netmask 255.255.255.0" "91.121.43.242 netmask 255.255.255.255" "91.121.43.249 netmask 255.255.255.255" "2001:41D0:1:F3bc::1/56" "2001:41D0:1:F3bc::2/56" "2001:41D0:1:F3bc::3/56"
A part of lighttpd.conf :
[...] server.port = 80 server.bind = "91.121.43.249" server.event-handler = "linux-sysepoll" server.use-ipv6 = "enable" $HTTP["host"] =~ "<something like www.example.com, IPv4 and IPv6 addresses>" { server.document-root = "..." } $SERVER["socket"] == "[2001:41d0:0001:f3bc::3]:80" { server.document-root = var.basedir + "/htdocs" accesslog.filename = "/var/log/lighttpd/ipv6.access.log" } [...]
What I am doing wrong ?
Just in case :
www-servers/lighttpd-1.4.23 (uses: bzip2 fastcgi gdbm ipv6 ldap* lua memcache mysql pcre php ssl webdav xattr)
gentoo arch : amd64 (Intel(R) Core(TM)2 Duo CPU)
gcc : 4.3.4
Kernel : Linux 2.6.31.5-xxxx-std-ipv6-64
Replies (4)
RE: Bind IPv4/IPv6 but not on all interfaces - Added by nitrox over 15 years ago
cat /proc/sys/net/ipv6/bindv6only is set to? Else IPv4_mapped_addresses might help.
RE: Bind IPv4/IPv6 but not on all interfaces - Added by milipili over 15 years ago
It is disable
$ cat /proc/sys/net/ipv6/bindv6only 2:07 #176 0
RE: Bind IPv4/IPv6 but not on all interfaces - Added by milipili over 15 years ago
Actually the solution is to put "server.use-ipv6 = "enable" in the configuration for the socket, but it was not so obvious for me :)
RE: RE: Bind IPv4/IPv6 but not on all interfaces - Added by stbuehler about 15 years ago
server.use-ipv6
at all - you just cannot enable it globally when server.bind is an IPv4 address (and you can't enable it in a $SERVER["socket"] block with an IPv4)
@server.use-ipv6
is only useful for
- hostnames
- binding to the "any" address: by default lighty binds to
0.0.0.0
, with use-ipv6 it binds to[::]
(depending on bindv6only this might bind to IPv4 0.0.0.0 too)