IPv4 vs. IPv6? What are their differences? What are their advantages and disadvantages?
IPv4 is the most common and widely used Internet Protocol version for now. Although it is still what holds the Internet together, IPv6 (its newer version) is slowly gaining interest.
In this post, we’ll go through both IP protocols. We will explain their differences with a profound technical explanation. Then we’ll describe their 11 key differences.
Table of Contents.
- What is IPv4?
- What is IPv6?
- 11 Key Differences: IPv4 vs. IPv6.
- The number of address combinations.
- Different address notations.
- Shortening techniques.
- Address types and scopes are different.
- Global unique addresses vs. public addresses.
- Different local address assignments.
- Differences in headers (Control bits)
- Who needs NAT (Network Address Translation)?
- IPSec implementation
- Broadcasts, multicasts, and anycast.
- IPv4 and IPv6 in Speed. Which one is faster?
- IPv6 vs. IPv4: Differences Chart.
- IPv4 vs. IPv6 FAQ.
1. What is IPv4?
The IPv4 (Internet Protocol version 4) is the dominant internetworking protocol that makes the entire Internet work. It is described in RFC 791 from 1981. The IPv4 gives a unique identifier to each device connected to a network (including the Internet).
The size of an IPv4 packet may vary in bits due to the Options and Data fields. The minimum size of an IPv4 packet can be from 20 bytes (for the control) to a maximum of 60 bytes. An IP packet contains control (header) and data planes (payload).
The first four bits of a packet (Version) indicate the IP version. The arrow indicates the first bits in the packet header where the protocol’s version is displayed.
Knowing what an IPv4 carries in its control fields will help you understand the crucial differences between IPv4 vs. IPv6.
So let’s define what these packet fields are:
- Version (bits 4): Specifies the version of the packet.
- IHL (bits 4): Internet Header Length (IHL) specifies the header’s length.
- 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 – 8 bits): 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 (Wireshark). With an IP packet capture, you can identify what control parameters are used for a particular packet. As shown in the arrow (picture below), this IP packet is version 4. Below is the Hex number (45) representing the version and the packet length.
Interesting Fact! So, what happened to IPv1, IPv2, IPv3, and IPv5? It took the IEEE and scientists three versions (IPv1, IPv2, and IPv3) to experiment until they came out with the fully operational IP addressing scheme: the IPv4. And when IPv5 came, it was used as an experiment for a Stream Protocol (SP), so the IP scientists decided to change the name to IPv6 to avoid confusion with the experimentation.
b. The IPv4 address format.
Computers talk in hexadecimal numbers. But since hexadecimal is not easily digestible for humans, IPv4 addresses use decimal notation. IPv4 addresses are written in decimal notation separating their four octets (32 bits/4 = 8) by dots. Each octet (8 bits) may range in decimal from 0 – 255. The address is divided into the network identifier and host identifier that varies in length according to the IPv4 address class (A, B, or C) and a few reserved bits (which define the class).
As an example, the picture below shows class B, IPv4 address 172.16.254.1, a 32-bit address divided by four (8-bit) sections.
Interesting Fact! The total possible combination of IPv4 addresses is about 4 billion—almost one IP address for every two humans in the world. But despite this massive high number of combinations, there are still not enough IPs to provide worldwide communications. There are many reasons for this depletion, including IoT devices, virtualization, the cloud, and especially, the improper allocation of IPv4.
2. What is IPv6?
IPv6 technology is defined under RFC 2460 with the proper updates and revisions. The IPv6 address uses a 128-bit address space, which results in 2^128 addresses, as opposed to 32-bits in IPv4, which results in 2^32. The combination of 128 bits results in binary-notation addresses that would be too difficult to memorize for humans, so IPv6 is written in hexadecimal notation.
Let’s look at the picture with an example below. The length of the IPV6 address (0123:4567:89ab:cdef:0123:4567:89ab:cdef) is 16 bytes (or 128 bits). It comprises eight groups of 16 bits separated by colons (:). The total of 8 x 16 = 128 bits.
IPv6 addresses like 2001:0db8:0000:0000:0000:ff00:0042:8329 can be quite challenging to manage, memorize, and use. So, IPv6 introduced rules like omitting leading and consecutive sections of zeros to help shorten. For instance, the former address can be shortened to 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 a routing prefix on the Internet. In the other half (n-128), 64 bits of the least significant side (rightmost) represent the Interface identifier— and are used for hosts within the local networks.
a. The IPv6 packet.
IPv6 and IPv4 packet formats are very similar. IPv6 also comes with 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.
When you look at the IPv6 packet format, you’ll instantly notice that it is much simpler than IPv4’s. It is simpler but much larger!
The IPv6 fixed control packet is composed of 320 bits (40 bytes) within this:
- Version (4 bits): The first four bits of an IPv4 or IPv6 packet are similar; they will determine the IP version.
- 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 following header.
- Hop Limit (8 bits): Time to Live limits the maximum number of hops (links) between two IPv6 nodes.
- Source Address (128 bits): Where the packet comes from (the source may be IPv4 or IPv6 in dual-stack environments).
- Destination Address (128 bits): Where the packet is going (it may be IPv4 or IPv6 in dual-stack environments).
The IPv6 control packet can also be extended to contain detailed information for packets, like fragmentation, routing, or security (IPSec). The last extension, IPSec, widely used today as the primary VPN protocol, was built-in in IPv6.
The 11 Key Differences: IPv4 vs. IPv6.
Below are the eleven key differences between IPv4 and IPv6.
1. IPv6 provides a mind-blowing number of addresses.
IPv6 was introduced to address the depletion of IPv4 addresses. IPv4’s address size is 32 bits, while IPv6’s address size is 128 bits. IPv6’s format can support a mind-boggling high number of network address combinations. While Ipv4 results in around 4 billion addresses, IPv6 can give around 340 trillion trillion trillion IP addresses. From the day of IPv6 development until today, the IPv6 protocol has addressed the IPv4 exhaustion problem and provides additional benefits and services.
2. IPv4 and IPv6 have different address notations.
The IPv4 address uses decimal notation, while the IPv6 address uses hexadecimal notation, which is the most efficient way to read and memorize them. Due to the smaller size of IPv4s (32 bits), it is possible to write and memorize them using decimal notation, which results in four decimal numbers. But it would be impossible to use the IPv6 (128 bits) with decimals, so IPv6 addresses use hexadecimal numbers. Each hex number is formed by 4 bits, which results in 32 hexadecimal numbers.
3. IPv6 comes with shortening techniques— IPv4 doesn’t.
The IPv6 format helps expand addressing capabilities. The IPv6 address can be abbreviated using double colons and omitting leading zeros. The double semicolon can omit entire sections of the IPv6 address. For instance, the IPv6 address ff06:0:0:0:0:0:0:c3 can be written as ff06::c3. This abbreviation was done to simplify IPv6 address notation. Also keep in mind that the double colon (::) can only be used once to omit consecutive sections of zeros in an IPv6 address. This is to avoid ambiguity.
4. IPv6 and IPv4’s address types and scopes are different.
IPv6 has three types of addresses: Global Unicast Address, Unique Local, and Link-Local. The IPv6 global unicast address serves the same purpose as the IPv4 public address —routed on the Internet. Internet authorities allocate these addresses to ISPs or LIRs, which assign them through leases or sales. The difference between IPv4 and IPv6 is with the internal local addresses or private address space. IPv4 uses internal addresses with reserved number ranges (class A, B, and C), which are not publicly routed on the Internet. However, IPv6 uses two types of internal addresses: unique and link-local. Unique addresses are routed on an internal network or VPN, while link locals are used for a single network domain and not routed externally or internally.
5. IPv6’s Global Unique addresses differ from IPv4’s Public addresses.
IPv4 and IPv6 address formats are split into network and host, plus a third part that results from subnetting. But still, IPv6s had to be designed with additional tweaks to help deal with their larger size. IPv6s can omit entire host prefixes. A feature that can help reduce the size of routing tables and make faster and more efficient routing across the Internet. For instance, IPv6’s network prefixes (upper 64 bits) can be grouped into single prefixes (/48 or /64, for example), while the host prefix can be entirely omitted.
6. Different local address assignments (DHCP vs. self-assigned).
In IPv4, the local address is assigned via a third-party DHCP server or manual configuration, and in a few cases, self-assign a link-local IP within the subnet: 169.254.0.0/16. For IPv6 local addresses, dynamic assignment via DHCPv6 is also possible but not mandatory. IPv6 addresses can be dynamically assigned using two types of autoconfiguration (stateful and stateless). IPv6 stateful autoconfiguration or DHCPv6 is similar to DHCP’s IPv4, while stateless autoconfiguration is different and now the default mode in IPv6 environments. In IPv6’s stateless autoconfiguration, the lower 64-bits (interface ID) are derived from physical address (MAC) using the guidelines of the Extended Unique Identifier (EUI-64) format.
7. IPv6 has leaner headers than IPv4.
In IPv4, the header length is limited to 60 bytes, while in IPv6, its maximum is 40 bytes. One of the reasons is that IPv6’s header doesn’t use the checksum field as IPv4 packets would. The checksum field is redundant in IP since error checking is performed by other layers, like TCP. Checking and recalculating checksums at two or three layers makes routing inefficient. The fragmentation field is another example. Fragmentation must be provided by layers below IPv6 and by the sender. In IPv6, the fragmentation field was moved from mandatory to optional.
8. IPv4 needs NAT; IPv6 doesn’t.
In the IPv4 world, Network Address Translation (NAT) is the protocol needed to reuse IP address space. NAT maps public to private IP addresses, making networks more secure and saving addressing space. Still, a bad NAT implementation can make networks slower and more complex. IPv6 has no address shortage, so it does not need NAT. The additional address space provided by NAT wouldn’t compare to the massive address space possible with the IPv6 addressing scope. In fact, new network implementations that want to use IPv6 are advised to stay away from NAT.
9. In IPv4, IPSec must be implemented, while in IPv6, it is built-in.
Internet Protocol Security (IPsec) is a network protocol that provides data packet authentication and encryption mechanisms. IPSec is a popular security protocol in Virtual Private Networks (VPNs). In IPv4, IPSec is an optional field; in IPv6, it is built-in— always available. Although it is still optional (meaning that you can disable it), any new implementation of IPv6 comes with IPSec support. Even though IPSec is built-in IPv6, it doesn’t mean it is automatically more secure than IPv4. A bad implementation of IPSec is as insecure as having no security at all.
10. IPv4 broadcasts, while IPv6 multicasts and anycast.
Broadcast messages are available on IPv4. With broadcast messages, any device can send a packet to all connected nodes. Still, broadcast messages in IPv4 must be limited due to performance issues. The concept of broadcasting in IPv6 is long gone. IPv6 relies on other techniques like multicasting or anycasting to provide similar functionalities. Multicasts are messages sent to a particular domain defined by a specific group. In addition, IPv6 introduced the new concept of anycast, which are messages sent to anyone member of a group of devices.
11. IPv4 vs. IPv6 Speed. Which one is faster?
Regarding speed, there are only slight differences between the two protocols. In theory, IPv6 is supposed to be slightly faster since it doesn’t need NAT (Network Address Translate) to map an IP address to another. However, IPv6 has longer data packets, so theoretically, it should be slower than IPv4. As shown in the previous section, IPv6 uses 128 bits compared to IPv4, which uses 32 bits.
So, what are IPv4 vs. IPv6 speed differences in reality? For now, what makes a difference in speed between these two, is that IPv4 (including all underlying infrastructure, software, etc.) is far more well-established, supported, and optimized than IPv6. But since IPv6 lacks NAT and relies on multicasting technology is faster when testing in a direct connection. So as IPv6 technology matures more, its speed will get faster. An example of an application that is far better regarding speed is IPv6 proxies.
4. IPv6 vs. IPv4: Differences Chart.
So, now that you understand each IP version, let’s define their fundamental differences. We will do this with a vs. chart. The following table will help you compare the differences between IPv4 vs. IPv6 addresses.
IPv4 | IPv6 | |
Year Deployed. | 1981 | 1999 |
Address Size (in bits) | 32 bits | 128 bits |
Notation. | Four binary octets are represented in decimals. | Eight binary quartets are represented in hexadecimal. |
Format. | 192.168.0.0/24 | 2001:db8::/48 |
Packet Size | 576 bytes (Requiring fragmentation) | 1280 bytes (Without fragmentation) |
Number of Addresses | 2^32 ≈ 4 Billion | 2^128 ≈ 340 trillion trillion trillion |
Payload (data) | Payload-length field 16-bit long (data) | Payload-length field 16-bit long (for data) |
Loopback Address | 120.0.0.1 | ::1 |
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 are available. | No broadcast. (But uses multicast for similar functionality) |
IPSec | Optional | Built-in. Always Available. |
L3-L2 Resolution | ARP Broadcast | Multicast Neighbor Solicitation. |
Router Discovery | Optional | Mandatory |
Flow Identification | Not available | Available in IPv6 |
Checksum | Available in IPv4 | Not needed. |
الأمان | Not mandatory | IPSec built-in |
5. IPv4 vs IPv6 FAQ.
a. What is IPv6 used for?
IPv6 was designed to address the IPv4 address exhaustion problem. It does the same as IPv4, providing addressing and identification to devices on a network but on a much larger scale. IPv6 will help address the incoming growth in IoT devices, virtualization, and the cloud.
b. Which is faster: IPv4 or IPv6?
No mechanism is faster than the other. The IPv6 does provide a leaner and simpler header, which could result in more efficient routing and packet handling. In addition to the freedom from NAT. But a bad IPv6 implementation can still result in a much slower IPv4 network.
c. Which is more secure: IPv6 vs. IPv4?
The difference between ipv4 and ipv6 in terms of security depends on the implementation. This is because IPv6 and IPv4 have different security features and vulnerabilities. However, IPv6 was designed with security in mind, including several security features not present in IPv4. For example, IPv6 includes IPsec (Internet Protocol Security) (VPN protocol) as a mandatory feature, which provides encryption and authentication for network traffic. Additionally, IPv6 supports larger packet sizes, making it more difficult for attackers to carry out certain types of attacks, such as fragmentation attacks. IPv4, on the other hand, is an older protocol- not designed with security as a primary concern. While IPv4 also supports IPsec, it is not a mandatory feature, and many devices and networks do not use it.
d. IPv4 vs IPv6 for VPN?
Both can be used for VPNs, but there are some things you need to consider. IPv4 is the older and more widely used protocol. And so, many VPNs still rely exclusively on IPv4. However, IPv6 has some advantages over IPv4, regarding VPNs. IPv6 can offer better performance and security for VPN connections by using built-in IPsec encryption and authentication. IPv6 can also avoid some issues with NAT, which can cause problems for VPNs that rely on IPv4. But unfortunately, IPv6 is not yet as widely adopted as IPv4. Many organizations and service providers have not yet fully transitioned to IPv6. And the same goes for VPNs which may still not support IPv6 VPN connections.
d. IPv6 vs. IPv4 for gaming?
IP provides you with addressing and identification; it will not affect your application. But still, there are some differences between using IPv4 and IPv6 when gaming. The main difference is that IPv4 depends on NAT, which can delay the gaming experience (FPS) when the packet goes through multiple NATs.
e. How do I know if I have IPv4 or IPv6?
The easiest way to find out whether you are currently using IPv4 or IPv6 is to do a quick online test such as test-my-IPv6 or ipv6-test.com. You can also open “command prompt” on Windows or “terminal” on macOS or Linux and type “ipconfig” or “ifconfig”. There you’ll find a summary of your interface IP addresses.
f. Will IPv6 run out eventually?
Although the number is not infinite, IPv6 was designed with an almost endless pool. There are 340 trillion, trillion, trillion IPv6 addresses, which is more than enough to support trillions of trillions of devices connecting to the Internet. IPv6 will virtually not exhaust anytime soon.
g. When will IPv4 be phased out?
It is a fact that we are running out of IPv4s, and this is precisely why IPv6 is relevant. It solves the IPv4 address exhaustion problem and also opens many doors for innovation and services. Although it has been a slow upgrade to IPv6, about ten years since IPv6 has been around, IPv6 is still not widely deployed. But still, IPv6’s adoption rates are increasing steadily.
h. ipv6 vs. ipv4 in gaming. Which one is better?
The fact that all new video consoles support IPv6 makes the need for transition evident. Video gaming companies know about the differences between ipv6 vs. ipv4 gaming. Although IPv4 is a well-established and mature technology, the performance, speed, and security outcome are much better in IPv6. First, IPv6 does not need any port forwarding, UPnP, or NAT-PMP, so this makes a massive difference in speed and performance. In addition, Since IPv6-enabled devices auto-configure their address, the gamer experience is also highly enhanced.
i. Is IPv6 classified in classes as IPv4 is?
IPv6 is not classified into classes like IPv4. In IPv4, IP addresses are divided into class A, B, C, D, and E. The class is based on the number of bits used to represent the network and host portions of the address. This classification system allowed for the allocation of IP addresses hierarchically. So, instead of organizing by class, IPv6 uses a simpler addressing scheme where the address is divided into two parts: the prefix and the interface ID.
j. IPv4 time to live vs. IPv6 time to live?
In IPv4 and IPv6, the Time to Live (TTL) field is used to limit the network packets’ lifespan. Although it has the same goal in both protocols, there are some strong differences. In IPv4, the TTL field is a 1-byte field, meaning the maximum TTL value is 255. In contrast, the TTL field in IPv6 is a 2-byte field, which allows for a much larger maximum value of 65,535. With IPv6, the packets can potentially take more hops before being discarded, which can be helpful for very large or complex networks.
Bonjour,
dans votre article très intéressant, vous précisez que les adresses IPv6 peuvent être abrégés par des “doubles points-virgules“ hors dans votre exemple, li est fait usage de doubles points “:” il y a donc une confusion avec la réalité.
” Le format IPv6 permet d’étendre les capacités d’adressage. Les adresses IPv6 peuvent être abrégées à l’aide de doubles points-virgules et en omettant les zéros initiaux. Un double point-virgule permet d’omettre des sections entières de l’adresse IPv6. Ainsi, l’adresse IPv6 ff06:0:0:0:0:0:0:c3 peut s’écrire ff06::c3. Cette abréviation a été créée pour réduire la taille des adresses IPv6.”
Merci pour cet article bien fait et instructif.
Tu as tout à fait raison, Alex, merci pour ton observation. En effet, il y avait une faute de frappe dans le texte. Le terme correct est “double deux-points” (::), et non “double point-virgule.” De plus, l’abréviation permet de simplifier la notation des adresses IPv6 mais ne réduit pas nécessairement leur taille… Tout est maintenant corrigé. Salut