IPv4 vs IPv6? IPv4 is the most common Internet Protocol, for now. Many people connect to the Internet with IPv4. IPv6 on the other hand is new, large, and more sophisticated. But IPv6 was created for one purpose— to replace IPv4… and sooner or later, it will.
On 3 February 2011, the IANA (Internet Assigned Numbers Authority) allocated the last five /8 (with exactly 16.7 Million) reserved IPv4 to the five RIRs (Regional Internet Registry). This news was very significant because it meant that the “free, unallocated” IPv4 addresses available from the top authority, were finished. So, now (as of Oct 2020), everything is up to each region to intelligently allocate their last /8 IPv4 space to ISPs, businesses, network operators, etc.
Sixteen million IPv4 is a lot. Yes, but let’s look at real data.
The graphic below shows the daily assignment rate per each RIR. APNIC (Asian RIR) was assigning an average of 400K IPv4 addresses on their lowest days back from 2007 to 2011. But it seems the rate of allocation dropped significantly when APNIC changed their strategy… most likely switching efforts to IPv6 migration.
RIRs still have IPv4 space. But IPv4 addresses are becoming expensive and hard to obtain. Many ISPs are already performing wide-scale NATs to save some space. But this solution is inefficient in countries with broad populations, like India. Other countries from the APNIC like Japan, China, and South Korea have started the transition to IPv6, especially since the end of 2011.
IPv6 does not only solve the IPv4 exhaustion problem; it also opens the door to many new opportunities for innovation.
Table Of Contents.
- The IPv4. What is it and why it is still important?
- Welcoming IPv6
- Key Differences between IPv4 and IPv6.
- What are the Benefits of Supporting IPv6?
- Why We Need To Migrate To IPv6 Now!
- Key Takeaways.
1. The IPv4. What is it and why it is still important?
The Internet Protocol (IP) belongs to a suite of protocols that run the Internet. IP works at layer 3 (or Network layer) of the OSI model. Any protocol in this layer, whether IPv4, IPv6, ICMP, IGMP, OSPF, OSPFv3, etc., uses packets as a data/control unit. Without Layer 3 packets, the Internet wouldn’t exist. Packets move the control information and user’s data.
An IP packet is encapsulated with other information from other protocols (TCP or UDP, for example). The most common protocol stack is TCP/IP (TCP packet encapsulated in the IP packet’s data).
IP at the network layer becomes the unique identifier of whatever is attempting to connect to a network.
a. What is IPv4?
The IPv4 (Internet Protocol version 4) is the dominant internetworking protocol that makes the entire Internet work. The version number 4 of IP is described in RFC 791 from 1981. IPv4 gives an addressable identifier to each device connected to a network.
To identify the IPv4, you can take a look at the first bits of a packet header. Below is a picture of an IPv4 header. The arrow indicates the first bits in the packet header where the protocol’s version is displayed.
IP addresses are built on bits— the language of computers.
As mentioned earlier, the IP (whether IPv4 or IPv6) packets consist of control and data. The control bits in a packet are also known as the header. An IPv4 address (or IPv6 address also) information is contained in an IP packet. When a routing device, or software opens up an IP packet, it will look into the destination IP to forward it (or perform other functions).
The IPv4 header always uses 32 bits (or 4 bytes) in length. But the size of an IPv4 packet may vary in bits, due to the optional/data fields. The minimum size of an IPv4 packet can be from 20 bytes to a maximum of 60 bytes.
Interesting Fact! So you may ask, what happened to IPv1, IPv2, IPv3, and IPv5? It took the IEEE and scientists three versions for experimenting until they came out with the IPv4. Later IP version 5 was also used as an experiment for a Stream Protocol (SP), so they decided to change the name to IPv6 to avoid confusion with the experimental version.
b. The IPv4 Packet Header.
Knowing what an IPv4 carries in its control header will help you understand crucial differences with IPv6. So let’s define what these identifiers are:
- Version (bits 4): Specifies the version of the packet.
- IHL (bits 4): Internet Header Length (IHL), specifies the length of the header.
- Type of Service (TOS – 8 bits): Specifies how the datagram is handled.
- Total Length (16 bits): Length of the datagram.
- Identification (16 bits): Identifies fragments of other datagrams.
- Flags (3 bits): Fragment, No fragment, or more fragment.
- Fragment Offset (13 bits): To assemble fragments.
- Time to Live (TTL – 8bits): Identifies the life of the datagram.
- Protocol (8 bits): This field specifies the next encapsulated protocol.
- Header Checksum (16 bits): Helps detect corrupted packets.
- Source Address ( 32 bits): IP address of the source (sender)
- Destination Address ( 32 bits): IP address of the destination (receiver)
- Options (variable bits): Optional parameters.
- Data (up to 524,120 bits or 65 Kbytes): Carries IP data (if any) to be sent to the receiver.
Below is a picture of how an IPv4 packet would look from a packet sniffer like WireShark (real life). With an IPv4 captured packet, you can quickly identify what control parameters are being used for a particular packet. As shown in the arrow, this IP packet is version 4. Below is a Hex number (45) representing the version and the header length.
Simply put, for a networking device to find the next hop — it just needs to find the “destination address” along the 20 bytes (minimum) packet header.
IPv4 addresses are commonly written in decimal notation separating its four octets (32 bits/4 = 8) by dots.
IPv4 addresses may also be represented in hexadecimal numbers or octal-byte numbers, but it is not common for humans. Each octet (8 bits) may range in decimal from 0 – 255. For example, the picture above shows the IPv4 address 172.16.254.1, a 32-bit address divided by four (8 bit) sections. The total number of combinations in this 32-bit space (known as the IP address space) is 4294967296 (232) addresses.
Interesting Fact! The total possible combination of IPv4 addresses sums up to about 4 billion—almost one IP address for every two humans in the entire world.
c. The Future of IPv4.
So, if there are 4 billion IPv4 addresses in the IP pool, why are we running out of IPs?
There are many factors for this rapid and painful exhaustion of IPv4 addresses. Of course, the main reasons being, the rapid increase in IP-hungry technology, the rise of IoT, software-defined networks, virtualization, ephemeral containers, cloud-native services, and the list goes on.
But one of the most significant factors has been the improper allocation of IPv4.
An excellent strategy for allocation has been, separating IPs into public and private usage and employing NAT for translation. Private IPs are reserved, and anyone behind a NAT can use them.
Public IPv4 addresses are the ones used across the Internet, so they must be unique. IANA (Internet Assigned Numbers Authority) fairly allocates public IP address ranges to different regions in the world or Regional Internet Registry (RIR). But as stated in the intro, IANA allocated the last free /8 address spaces (/8 is the CIDR notation for 16 Million addresses) in 2011 to all RIRs (IPv4 CIDR chart). RIPE NCC started using its last /8 free space in 2012… By Nov 2019 RIPE NCC allocated the last free /22 space (1K addresses).
It has been slow but it is true … We are running out of IPv4 addresses!
Interesting Fact! IPv4 has been relying on the NAT protocol to maximize IP addressing space. Without NAT, we would have run out of IPv4 addresses a very long time ago. NAT provided both an opportunity to use a large space reserved for the private space while providing an excellent level of inherited privacy. Now, IPv6 doesn’t need NAT; there are way too many addresses that there is no need to reserve space for private usage.
2. Welcoming IPv6.
The previous statement, “We are running out of IPv4 addresses!” is nothing new… In fact, it is anticipation from the late 1980s to the early 90s, when the Internet started growing unexpectedly. The IPv6 and other technologies like NAT and CIDR were born out of this anticipation.
Transitioning to IPv6 is vital. It is the only proper and efficient way to give everybody Internet addressing.
As mentioned before, it took from 2011 to 2019 for all RIRs (APNIC, RIPE NCC, ARIN, LACNIC, and AfriNIC) to deplete their free IPv4 pools. But this doesn’t mean we’re entirely out of IPv4s; there are still those needed to transition to IPv6 and other addresses such as recovered and those reserved for special purposes.
Interesting Fact! Although you could be hearing about IPv6 a lot these days, the protocol was introduced back in 1995! At its development stage, IPv6 was designed to address one problem: the IPv4 depletion! Its format can support a mindblowing combination of network addresses, to summarize: 3.4×1038, this number equals to something like 340 trillion trillion trillion IP addresses.
Of course, from 1995 (development of IPv6) until today, the protocol has evolved so much that it not only increases the amount of IP addresses but provides countless more benefits!.
a. Reading IPv6s.
IPv6 technology is defined under the RFC 2460 from 1998, with the proper revisions. To increase addressing space, IPv6 uses a 128-bit address space, or as stated before, 3.4×1038. Having that enormous size would be too difficult for humans to use every day and memorize them, so IPv6 is written in hexadecimal notation.
Let’s look at the picture below. The length of the IPV6 address (0123:4567:89ab:cdef:0123:4567:89ab:cdef) is 16 bytes (or 128 bits). The address is separated by eight (8) groups of 16 bits by colons (:). The total of 8 x 16 = 128 bits.
The IPv6 address uses the Hexadecimal notation, which is the most efficient way to read it.
Still, IPv6 addresses like 2001:0db8:0000:0000:0000:ff00:0042:8329 can be quite difficult to manage, memorize, and use. So, IPv6 introduced some rules (like omitting leading sections of zeros and consecutive sections of zeros )to help shorten and clarify. The former address can be shortened as 2001:db8::ff00:42:8329, after applying these rules.
IPv6 addresses are divided in half. The most significant bits (leftmost) 64 bits represent the Network— used as routing prefix on the Internet. The other half (n-128) 64 bits of the least significant side (rightmost) represent the Interface identifier— and are used for a host within the local networks.
b. The IPv6 packet.
IPv6 and IPv4 packet formats are very similar (but not the same). IPv6 also uses a “data” space known as the payload— used for transporting data, and the “control” space known as the header. The minimum size of the entire IPv6 packet with header and payload is 1280 bytes— a fixed 40 bytes for header and an “optional payload” of 1240 bytes.
When you look at the IPv6 header format, you’ll instantly notice that it is so much simpler than IPv4’s header. It is indeed, simpler but holds much larger in size!
The IPv6 fixed header is composed of 320 bits (40 bytes), within this:
- Version (4 bits): The first four bits of either an IPv4 or IPv6 packet are similar; they will determine its version; thus, the receiving end knows what to expect.
- Traffic Class (8 bits): Determines the priority of the packet.
- Flow Label (20 bits): Determines the QoS (Quality of Service.)
- Payload Length (16 bits): Indicates the length reserved for the data.
- Next Header (8 bits): This field indicates the header, following this header.
- Hop Limit (8 bits): Time to Live, puts a limit on the maximum number of hops (links) between two IPv6 nodes.
- Source Address (128 bits): Where the packet is coming from (the source may be IPv4 or IPv6 in dual-stack environments).
- Destination Address (128 bits): Where the packet is going to (it may be IPv4 or IPv6 in dual-stack environments).
Of course, the IPv6 header can be extended. IPv6 extension headers can contain particular purposes information for packets, like fragmentation, routing, or security (IPSec). The last extension, IPSec, which is widely used today as the primary protocol for VPNs, was initially designed explicitly for IPv6. Today, IPSec is optional for IPv4, but it is mandatory in IPv6.
c. Migrating to IPv6.
Migration from IPv4 to IPv6 is already underway. As mentioned before, migration started with the dual-stack (IPv4 and IPv6) network approach, where computers using either version can communicate.
Regions and countries with an alarming shortage of IPv4 addresses are even making IPv6 mandatory. This is the case, for countries in Asia, like China and India.
Other countries are looking at migration as a necessity for innovation and avoiding later chaos. For example, Belarus is the first country in the world to make IPv6 support for ISPs mandatory by law. Of course, this is only the beginning. The early adopters, such as Belarus, are ahead, but the absolute majority will catch up soon.
Migration is not a next-day transition. It has been slow, and it is still slow, but we might soon see a spike in IPv6 usage, especially from service providers and network operators.
3. Key Differences Between IPv4 and IPv6.
So, now that you understand each of the IP versions, and its importance of migration, let’s summarize their key differences. The following table will help you compare Pv4 vs IPv6 and put them in contrast.
IPv4 vs IPv6 Comparison Chart.
|Address Size (in bits)||32 bits||128 bits|
|Notation.||Four binary octets are represented in decimal.||Eight binary quartets are represented in hexadecimal.|
|Packet Size||576 bytes (Requiring fragmentation)||1280 bytes (Without fragmentation)|
|Number of Addresses||232 ≈ 4 Billion||2128 ≈ 340 trillion trillion trillion|
|Header||Variable length header.||Fixed length header.|
|Dynamic Addressing||DHCP||DHCPv6 or SLAAC.|
|Fragmentation.||Routers and sending hosts.||Only by the sender.|
|Broadcast||Broadcast messages available.||No broadcast. (But uses multicast for similar functionality)|
|IPSec||Optional||Built-in. Always Available.|
|L3-L2 Resolution||ARP Broadcast||Multicast Neighbor Solicitation.|
|Flow Identification||Not available||Available in IPv6 header.|
|Checksum||Available in IPv4 header.||Not needed.|
4. What are the Benefits of Supporting IPv6?
As mentioned in the beginning, the main reason for coming up with IPv6 was to solve the IPv4 address pool exhaustion problem. As researchers predicted very early, the depletion of IPv4 address depletion would be an inevitable problem.
We can’t say this is an advantage of IPv6, but rather a necessity. Now we have a real scalable network with a massive IPv6 address space. From 4 billion IPv4 addresses to 340 trillion trillion trillion IPv6… we are never going to run out of IPv6 addresses (at least in the predictable future). We could assign permanent IP addresses to every single device on the planet.
But IPv6 addresses are not just longer IPv4s; there are more subtleties and complexities underneath that make it a completely different protocol.
Let’s define other benefits.
a. Improved Routing Efficiency.
The leftmost field (interface identifier) of the IPv6 address contains the prefix used for routing on the Internet. The benefit here is that these IPv6 prefixes can be grouped into single prefix groups (for example, a /48), making the routing tables a lot smaller and more efficient.
Let’s say from the picture below, that Site N has received local prefix: 2001:0200:FFF::/48 subnetted from the ISP 1’s prefix (2001:0200::/32). That means the ISP 1 would only need to announce this single prefix to the Internet, making its routing table a lot smaller and routing more efficient.
b. Better Packet Handling.
You might remember from previous sections that the IPv6 packet header is simpler than IPv4’s. One of the most notable distinctions from this simplicity is that IPv6 doesn’t use a Checksum field. It was removed from the header because it was redundant, as error checking in TCP/IP communications is made at other layers (Layer 2— i.e., CRC and Layer 4 — i.e., TCP). The old IPv4 approach made every router check and recalculate the checksum was inefficient.
Another field that was simplified is fragmentation. It is still available in the header (in options) but since it is not handled by routers (as it was for IPv4), but by the sender, routing can be more efficient.
c. Support for Novel and Optimized Services.
Since IPv6 doesn’t use NAT, a unique end-to-end IP connection is instead established between source and destination. This single IP connection will allow better services and new support. For example, P2P, gaming, and streaming networks will be easier to create and be more stable. Services like VoIP and QoS will also be more reliable.
For now, many services like IPv4 management (SNMP) will need to keep up with IPv4, until they are replaced by something novel.
d. Better Security with Built-in IPSec and Larger Address Space.
The built-in IPSec does not automatically make IPv6 more secure than IPv4. Although the IPSec field (which provides encryption and authentication) is mandatory in the IPv6 header, it is not mandatory to use. But implementing IPSec in IPv6 guarantees encryption and authentication, which can make networks more secure than IPv4.
Another advantage of IPv6 security is that hackers can’t simply scan IPv6 networks the way they did with IPv4. Scanning large IPv6 subnets, with randomly allocated addresses, becomes impossible.
e. Save Bandwidth with Direct Flows: Multicasting.
The traditional IPv4 uses broadcast messages that force every listening device in the same network to stop and read the packets. Broadcasting every device in an extensive network for different purposes like ARP can make things easier, but it can hurt performance and threaten security. IPv4 came with multicast addresses to address this problem, but it never performed well.
IPv6 does not support broadcast— instead, it focuses on multicast messages. Multicasting allows packet flows with intensive bandwidth to be sent to multiple simultaneous destinations within a group. The non-target devices on the same network do not have to stop and process every single packet.
f. Improved IP configuration.
IPv6 allows network configuration via a stateless or stateful method. A new procedure referred to as Stateless Address Auto Configuration (SLAAC) requires minimal (if not any) manual IP configuration in networking devices. Stateless means that the device can generate its own address without relying on a third-party server. SLAAC uses the host’s MAC converted as EUI 64-bit format, to create a unique address. The local router makes it “routable” by announcing the prefix of the local link.
On the other hand, the stateful or DHCPv6 works similarly to DHCPv4 — it depends on a server. The advantage of DHCPv6 is that the DHCP server does not need to advertise subnet masks; the local router does it.
g. Mobility Support in IPv6.
Defined in the RFC 3775, IPv6 allows devices to move freely around an IPv6 Internet and remain connected. Each device moving across the network is always identified by a home address, regardless of what current point it is currently using to attach. While IPv4 also supported mobility, IPV6 improves this feature with route optimization, better neighbor discovery, and much lower overhead.
5. Why We Need To Migrate To IPv6 Now!
IPv4 vs IPv6 for compatibility? IPv4 has a clear advantage over IPv6 … for now. IPv4 has been around for a much longer time, and it is supported by the entire Internet, its connecting devices, endpoints, etc. For now, IPv4 makes the world wide web go round.
IANA is already out of free IPv4s, and when there are no more IPv4 addresses available from RIRs or ISPs, the IPv4 will still make the Internet talk. But all new services, devices, apps, endpoints, or whatever needs an IP, will need to use IPv6.
This is where it gets interesting…
IPv4 and IPv6 will need to co-exist for many years and provide dual-stack functionality. There are still many bugs and vulnerabilities in these IPv4/IPv6 networks, but dual-stack is already becoming a new norm, especially in areas without free IPv4 space, like Asia, and soon Europe and North America.
Today (as of Oct 2020) almost all new devices and OSs, have IPv6 compatibility, whether they are deployed in an IPv6 network, is a different question. It is certain that your computer has an IPv6 address, and you might not even be aware, and it is probably that your ISP is using a dual-stack network (depending on the region).
IPv6 is built-in many modern devices.
For example, a quick look into a macOS Catalina v10.15’s network properties. You’ll see that IPv6 is configured by default, the same goes to many Linux, Windows, Unix, and even mobile platforms.
And, in fact, a quick look into the terminal, with the “ifconfig” command, will show you the IPv6 address. Remember, IPv6 is configured with (network id + interface id), so that means my same IPv6 is used privately (in my home) and outside on the Internet. So I shouldn’t be needing any NAT to convert private to public. My IPv6 is both public and private (as there are 340 trillion, trillion, trillions).
Of course, using the same IPv6 for public communications and without any NAT can make things triple vulnerable! But no worries, scanning trillions of addresses is still science fiction, plus there is IPSec, to encrypt and make things secure.
The 80’s scientists were right, it was only a matter of time, but we are really running out of IPv4 addresses. They are quickly becoming more expensive and harder to obtain. Even IP allocation authorities like the IANA and RIRs are pushing everyone away from IPv4 and making people deploy IPv6, at least a dual-stack network until the IPv6 support strengthens.
But IPv6 is slowly catching up, almost all new devices support both IP versions. It will take time, but dual-stack networks (IPv4 and IPv6) will soon take over.
There is really no winner between IPv4 vs IPv6. We need both protocols to tie the Internet together. But eventually, when IPv6 is fully deployed, it will rule out IPv4.