Welcome! Log In Create A New Profile

Advanced

Listen and IPV6 behaviour ?

Jérôme Loyet
November 09, 2009 01:20PM
Hi all,

How to use the nginx listen diective to listen on all interface (ipv4
and ipv6) and on port 80 ?

I thought "listen [::]:80;" would be enought but it seems that I have
to use both "listen 80;" and "listen [::]:80;"

Is it the normal behaviour or a bug ?

++ Jerome

OS: OpenBSD 4.5 and linux 2.6.28
Im' using nginx 0.8.22
I've enable ipv6 support at compile time with --with-ipv6
I use the default nginx conf file (just the port has been changed to 81)
My server is fully ipv6 compliant.

If I start nginx, it listens on ipv4 only :
listen 81;

root@wild:~/nginx-0.8.22# lsof -i :81
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
nginx 18224 root 6u IPv6 26577575 TCP *:81 (LISTEN)
nginx 18225 nobody 6u IPv6 26577575 TCP *:81 (LISTEN)

If I changed the listen directive to:
listen [::]:81;

root@wild:~/nginx-0.8.22# lsof -i :81
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
nginx 18224 root 6u IPv6 26577575 TCP *:81 (LISTEN)
nginx 18361 nobody 6u IPv6 26577575 TCP *:81 (LISTEN)

If I use both:
listen [::]:81;
listen 81;

root@raptor> lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 23184 nobody 10u IPv6 0xd639be40 TCP *:81 (LISTEN)
nginx 23184 nobody 11u IPv4 0xd639b990 TCP *:81 (LISTEN)
nginx 23235 root 10u IPv6 0xd639be40 TCP *:81 (LISTEN)
nginx 23235 root 11u IPv4 0xd639b990 TCP *:81 (LISTEN)
Subject Author Posted

Listen and IPV6 behaviour ?

Jérôme Loyet November 09, 2009 01:20PM

Re: Listen and IPV6 behaviour ?

Igor Sysoev November 09, 2009 01:42PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 215
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready