Opened 12 years ago

Closed 12 years ago

Last modified 18 months ago

#345 closed defect (invalid)

Nginx 1.4.0 is not binding to IPv4 with [::]:80 on Ubuntu 13.04 when net.ipv6.bindv6only is set to false

Reported by: Kasper Hirvikoski Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.3.x
Keywords: ipv4, listen, bind Cc:
uname -a: Linux jannite 3.8.4-linode50 #1 SMP Mon Mar 25 15:50:29 EDT 2013 i686 i686 i686 GNU/Linux
nginx -V: nginx version: nginx/1.4.0
built by gcc 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6

Description

Nginx 1.4.0 is not binding to IPv4 with [::]:80 on Ubuntu 13.04 when net.ipv6.bindv6only is set to false.

server {

    listen [::]:80;
...
}
$ sysctl net.ipv6.bindv6only
net.ipv6.bindv6only = 0
$ sudo netstat -npl | grep nginx
tcp6       0      0 :::80                   :::*                    LISTEN      4265/nginx.conf

I can fix this by explicitly specifying Nginx to bind also to IPv4.

server {

    listen 80;
    listen [::]:80;
...
}

Change History (4)

comment:1 by Maxim Dounin, 12 years ago

Resolution: invalid
Status: newclosed

This is expected behaviour, the ip6only is now consistently set to on, see http://nginx.org/en/CHANGES:

Changes with nginx 1.3.4                                         31 Jul 2012

    *) Change: the "ipv6only" parameter is now turned on by default for
       listening IPv6 sockets.

...

You should either list both IPv6 and IPv4 listen sockets, or explicitly switch off ipv6only for IPv6 sockets.

comment:2 by Kasper Hirvikoski, 12 years ago

Ah, I see. Thank you Maxim! Maybe the wiki page should be updated to reflect this information: http://wiki.nginx.org/HttpCoreModule#listen

in reply to:  2 comment:3 by Ruslan Ermilov, 12 years ago

Replying to Kasper Hirvikoski <kasper@kytkemo.com>:

Ah, I see. Thank you Maxim! Maybe the wiki page should be updated to reflect this information: http://wiki.nginx.org/HttpCoreModule#listen

We do not maintain wiki, please refer to official docs in the future.

comment:4 by Kasper Hirvikoski, 12 years ago

My mistake. Thank you for your kind and helpful responses.

Note: See TracTickets for help on using tickets.