Adventures in IPv6, part 2 (bind AAAA records, and nginx)

After discovering that my work PC has a fully working IPv6 internet connection (and therefore giving me the ability to test it), I decided to get my personal web server to work over IPv6 as well as IPv4.

The first challenge was to create a AAAA record for the domain, as well as the A record. Since I operate my own DNS servers running bind, this was fairly straightforward – simply add AAAA records to the zone file for the web server(s). In my case that meant going from:

www     IN      A


www     IN      A
        IN      AAAA    2001:41d0:801:2000::a65

And then obviously restart/reload bind.


Then to get the webserver working was also pretty simple. I use the current default package version of nginx on a recent version of Ubuntu (18.04) so I mainly had to ensure that in my nginx config files I was always listening on both IPv6 ports as well as IPv4 ports.

It turns out that a

listen 80;

or a

listen 443 ssl;

both only listen on IPv4, but if you add a listen [::]:<port> like so:

listen [::]:80;
listen 80;


listen [::]:443;
listen 443 ssl;

that will listen on both IPv4 and IPv6.

(Some documentation says that only the IPv6 line is required to have it listen on both v4 and v6, although that didn’t seem to work for me).

After making the change, restart nginx.


So far I’ve only changed this for one particular domain and it’s associated nginx configuration, but a quick wget on my work PC shows things are working (in this case including the HTTP -> HTTPS redirect first – both requests were over IPv6):

$ wget
--2018-09-14 13:04:42--
Resolving ( 2001:41d0:801:2000::a65,
Connecting to (|2001:41d0:801:2000::a65|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: [following]
--2018-09-14 13:04:42--
Connecting to (|2001:41d0:801:2000::a65|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 729 [text/html]
Saving to: ‘index.html’

index.html 100%[===================>] 729 --.-KB/s in 0s

2018-09-14 13:04:42 (47.1 MB/s) - ‘index.html’ saved [729/729]



Later posts: configuring IPv6 on my DNS server and my mail server