Is IPv6 Faster?

There’s a bit of debate surrounding this question. On paper, IPv6 should be marginally slower. The header size is much larger, due to IPv6 needing 128 bits for the source and destination addresses compared to IPv4’s 32 bits. Overall, IPv6’s header size is nearly doubled.

This isn’t really an issue in practice though, since IPv6 is not just an increase in address size—it greatly simplifies the handling of traffic, and in some cases can lead to actual performance increases due to bottlenecks in IPv4 infrastructure.

In the past, IPv6 used to be terribly slow, but it’s getting better year by year. According to Facebook in 2015, IPv6 improved TCP connect response times by up to 15%. However, this is on the order of a few milliseconds, which isn’t nothing, but isn’t such a radical speed benefit that would require you turn it on immediately.

In some cases though, IPv6 can actually be a bit slower than IPv4, not to mention the fact that some users may not be able to access IPv6 content.

Verdict: It Doesn’t Hurt to Enable It

The good news is, we don’t need to settle this debate here, since the question doesn’t actually matter. You don’t have to choose one or the other. Most modern browsers will send out TCP handshake requests to both the IPv4 and IPv6 addresses of your web server (as well as any other alternate addresses). Whichever one responds first is chosen to make the full connection.

If an older browser doesn’t support this, it will simply connect to the IPv4 address. This is known as the Happy Eyeballs (or Fast Fallback) algorithm, and it’s the major reason that makes IPv6 adoptable in the first place.

Overall, if you can’t enable IPv6 for some reason, or simply don’t care, you won’t be missing out on much. However, enabling it is very simple, and with potential performance improvements on the table, it’s worth taking a few minutes to turn it on. After all, it can’t hurt.

RELATED: How to Find Your Nginx Configuration Folder

How To Turn On IPv6 in NGINX and Apache

Before you begin, you’ll need to make sure your web server is even accessible over IPv6. This will usually involve you requesting an IPv6 address from your VPS provider. For AWS, IPv6 addresses are created automatically for EC2 instances, and are assigned to the ENI—not the instance itself.

After that, you’ll need to create an AAAA Record (four times IPv4) in your DNS, so that users will know what address to connect to. Your DNS provider should have an option for this. For AWS, you can even create AAAA Alias records, which will map dynamically to an AWS resource over IPv6.

For NGINX, you can enable IPv6 by listening on your server’s available IPv6 addresses, with the following notation:

Optionally, you can listen on a single manual address using listen [ADDRESS]:80, or only enable IPv6 using ipv6only=on.

For Apache, you can turn it on in the same manner using an additional Listen directive in your httpd.conf: