Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My web server (Ubuntu, Nginx) have both IPv4 and IPv6 addresses assigned by the host. For my website, shall I bind it to only an IPv6 address? Is it the standard recommended way? Or, shall I use both IPv4 and IPv6 addresses?

share|improve this question
You are asking the wrong question (to the wrong people) -- Ask yourself "Do I need to be able to access this site from IPv4 clients, IPv6 clients, or both?". The answer to that is also the answer to what addresses your web server needs to be listening on. –  voretaq7 Aug 27 '12 at 2:40
Ordinarily, I'd completely agree with a "get your specs first" answer like that, but in this case, oddly, I don't; I agree with Michael. "v6 only" is still, sadly, vanishingly unlikely to be the requirement (though if it is, this comment is wholly wrong). If it's not, then we're down to "mixed stack" and "v4 only". Even if your users all say "v4 only" is right, at this point, it's wrong; mixed-stack is the way to go for future-proofing, no matter what the current user community says. –  MadHatter May 19 '13 at 6:40

2 Answers 2

up vote 23 down vote accepted

Use both IPv4 and IPv6

You should use both IPv4 and IPv6 addresses.

Nearly everyone on the Internet currently has an IPv4 address, or is behind a NAT of some kind, and can access IPv4 resources.

However, only about 2.3% of the Internet is IPv6 capable, but that number is steadily growing as IPv6 begins to roll out worldwide.

In a very few places, ISPs are providing primarily IPv6 or only IPv6 to residential customers and using carrier grade NAT, NAT64 or other such solutions for IPv4 connectivity. This number is expected to grow as IPv4 address space is finally exhausted. These users will typically have better performance over IPv6.

Since IPv6 is where the Internet is going, having your web site IPv6 enabled now puts you ahead of the game and lets you resolve any problems long before they become serious.

Configure nginx

By default with Linux and nginx, you can bind to both IPv4 and IPv6 at the same time by changing your listen directives to:

listen [::]:80 ipv6only=off;

Or, for SSL sites:

listen [::]:443 ipv6only=off ssl;
share|improve this answer
In my Nginx configuration file, I see extra two options default ipv6only=off : 'listen [::]:80 default ipv6only=off;' What does they mean? Shall I keep them like that? –  EApubs Aug 27 '12 at 2:52
ipv6only=off is the default, so I omitted it here. off means bind to both IPv4 and IPv6. default means it's the default virtual host, which isn't relevant to your IPv6 question. You can leave it as-is. –  Michael Hampton Aug 27 '12 at 2:53
That means, if the default option is set, if the server have two websites assigned for 1 ip, the default site will be loaded if we visit the ip? Since I add a special ip in the listen block [::], I can omit it right? –  EApubs Aug 27 '12 at 2:56
That would be a separate question; you should ask it separately. :) –  Michael Hampton Aug 27 '12 at 2:56
Ok thanks... one more question.. Now I have setup the server... In the DNS recurs, I have to put two records A and AAAA (with the host name @) and pointing to the relavant ips? –  EApubs Aug 27 '12 at 2:59

Bind to both!

We had an IIS web site whose code did an internal reference to itself, using the DNS name that the client had used. This process would always fail.

Another symptom was that a browser running locally on the server could not find the web site by the name of the server, only by the IPv4 address. That is, would work, but http://myhost would fail. Using ping myhost would, by default, return the IPv6 address (ping myhost -4 would return the IPv4 address).

The fix was to open IIS and change the Bindings of the web site to bind to the IPv6 address, as well as the IPv4 address.

enter image description here

share|improve this answer
It's not necessary to obfuscate private addresses. Though, you should also bind to your global IPv6 address so that your site can be reached externally via IPv6. –  Michael Hampton Jun 3 at 17:38
The code mentioned was the Winnovative HTML to PDF Converter. –  Glen Little Jun 3 at 17:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.