GeoIP module breaks for IPv4 when IPv6 is enabled

Matthias Saou thias at
Fri May 13 19:05:02 MSD 2011


I just enabled IPv6 on some web servers running nginx, and the $geoip_*
variables all broke for existing IPv4 traffic.

This seems to be because when not changing the net.ipv6.bindv6only
sysctl value to 1 on Linux, choosing to "listen [::]:80" has nginx
automatically work for IPv4 connections, but receiving source IP
addresses as IPv4-Mapped IPv6 addresses :

Before the listen change :
After the listen change : ::ffff:

Lots of details are in rfc4291, rfc4038 (and surely others), but I
think that this configuration should be gracefully handled by the GeoIP

This was tested with nginx 1.0.2 on Red Hat Enterprise Linux 5 x86_64.

A workaround is to change net.ipv6.bindv6only to 1 and have two
different listen directives as "80" and "[::]:80" for all "server"
sections, but that would be best avoided just to fix this.


Clean custom Red Hat Linux rpm packages :
Fedora release 14 (Laughlin) - Linux kernel
Load : 0.00 0.01 0.12

More information about the nginx-devel mailing list