IPv6 is here! And here is everything you need to know

SSD Nodes IPv6 Ready

Hey, fellow citizens of the InterWebs! Do you know SSDNodes now has IPv6 ? If you want to know more about IPv6 and make your apps future-proof, follow along...

Scarcity of IPv4 addresses

Back in the day when Internet was still in its infancy, and Internet speeds were meaured in Kbps, engineers had it rough. In order to facilitate communication between computers, each computer needed a unique address. However, since this address itself would be part of the message's content it could not be too long. Because long addresses would take up precious bandwidth!

So we all settled on IPv4 addresses which were only 32 bits long, and allowed for roughly 4 billion unique addresses. However, the dawn of 21st century would prove that 4 billion would just not be enough. We have more than 7 billion people on the planet now, and if the economy continues to grow most of us would have more than one device that would connect to the Internet at any given time.

This has lead to a pretty serious shortage of IPv4 addresses and engineers have come up with cool technologies like NAT, to split up home and office networks such that many devices in a building can use the same public IP. Similarly, on the servere-side we have come up with solutions like Reverse Proxy to Host Multiple Sites behind a single IP.

However, these are mere workarounds with obvious short-comings. For example, when building a cellular network it is not easy to make a smartphone a part of a smaller sub-network. A smartphone user can move around an entire city and thus move from the coverage of one physical tower to another. Similarly, reverse-proxies are not scalable enough since they introduce single points of failure.

Enter IPv6!

Trillions upon trillions of IPv6 addresses

While IPv4 was 32 bits long, IPv6 is 128 bits long. With modern infrastructure, the overhead of an additional 128 bit with each packet of data is very small indeed. But the gains in the number of unique addresses is enormous!

A 128 bit address space means we can have roughly 340 trillion trillion trillion IP addresses!

That's enough to allocate 100 IPv6 address for every atom on Earth's surface!!

Our servers are quite a bit larger so each VPS gets over 4 billion IPv6 addresses! That's right, all 4 billion publicly accessible IP addresses for your multitude of apps and websites. If you want to know how to use them, read on...

Testing your ISP

First thing you need to know is whether your ISP provides you with IPv6 support. Having an IPv6 VPS means nothing if the computer on your desk, or anything else on your home network, can't connect to it. So, the easiest way to test that it is not the case is to use https://test-ipv6.com/ . This website will let you know if you can or can't access websites on IPv6.

IPv6 Test Failure

This shows that my current ISP doesn't support IPv6. A very easy workaround for this issue would be to switch to your mobile carrier's data plan because there's a high likelyhood that your 4G LTE uses IPv6. After switching to my mobile hotspot, I got a perfect score for IPv6 readiness.

IPv6 Test Success

Accessing web content

If you want to see web content (like HTML pages) being served on your IPv6 address, try installing Nginx and viewing its default page on your browser:

$ apt install nginx -y;
$ systemctl start nginx;

Now, in your web browser type in the following: http://[2602:ff16:1:0:1:f5:0:1] just replace the 2602:ff16:1:0:1:f5:0:1 with your actual IPv6 address.

You can use ip addr command inside your VPS to know your address.

$ ip addr
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:f3:e8:f7:c7 brd ff:ff:ff:ff:ff:ff
    inet 63.250.55.61/24 brd 63.250.55.255 scope global enp3s0
       valid_lft forever preferred_lft forever
    inet6 2602:ff16:1:0:1:f5:0:1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:f3ff:fee8:f7c7/64 scope link
       valid_lft forever preferred_lft forever

This is a sample output, with the IPv6 address next to inet6 (scope global) just copy that value without the /64 and paste it into your browser. For example, http://[2602:ff16:1:0:1:f5:0:1] shows me the following:

Nginx Default Page

There are two IPv6 addresses on the enp3s0 interface, one with scope link and another with scope global as shown in the out of ip addr command. We wish to use the address within the global scope.

Using additional 4 billion IPs

As previously mentioned, with IPv6 you get a whole range of IP addresses, so how do you use them? Well, for starters let's add one more IP manually to our enp3s0 interface. To do that, first determine your IP address range, I use this site to calculate the range of IPs.

Just plugin your IPv6 address and for prefix length select /96.

IPv6 subnet range.

Now you can pick any IP from this range, I would pick 2602:ff16:1:0:1:f5:0:2 to be added next. To add this we will use the ip command.

$ ip -6 addr add 2602:ff16:1:0:1:f5:0:2/96 dev enp3s0

Just run ip addr command again to verify that the new IP shows up on the interface. Now you are ready to use your new IPs productively.

DNS Settings

Eventually, you would want to point an actual domain name to your website like https://example.com and while doing that you want to be careful and, instead of creating an A record where a domain name points to an IPv4 address, you will have to create an AAAA record where your domain name points to a IPv6 address.

This is it! Now you are ready to delve into the world of IPv6 and not have to worry about running out of IP addresses ever again!