IPv4 vs. IPv6? What are their differences, their pros, and their cons?
IPv4 is the most common and widely used Internet Protocol version for now. Although IPv4 is still what holds the Internet together, IPv6 is slowly gaining interest. IPv6 is newer, more daunting, and sophisticated. IPv6 was designed with one purpose in mind— to replace IPv4.
In this post, we’ll go through both IP protocols— a deep technical explanation of both protocols. Then we’ll describe their ten key differences.
Table of Contents.
- What is IPv4?
- What is IPv6?
- 10 Key Differences: IPv4 vs IPv6.
- IPv6 provides a mind-blowing number of address combinations.
- IPv4 and IPv6 have different address notation.
- IPv6 uses shortening techniques, IPv4 doesn’t.
- Address types and scopes are different.
- IPv6’s Global unique addresses are different from IPv4’s public addresses.
- Different local address assignment (DHCP vs self-assigned).
- IPv6 uses learner headers (control bits).
- IPv4 needs NAT, IPv6 doesn’t.
- In IPv4, IPSec must be implemented, while in IPv6 it is built-in.
- IPv4 broadcasts, while IPv6 multicasts and anycasts.
- 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. Version number 4 of IP is described in RFC 791 from 1981. IPv4 gives a unique identifier to each device connected to a network (including the Internet).
The IP packets consist of control and data planes. The control plane is also known as the header, while the data plane contains the payload. 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 (which is control or header) to a maximum of 60 bytes.
The first four bits of a packet header (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 header 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 like Wireshark. With an IPv4 packet capture, you can identify what control parameters are being used for a particular packet. As shown in the arrow (picture below), this IP packet is version 4. Below is the Hex number (45) that represents the version and the header length.
Interesting Fact! So you may ask, what happened to IPv1, IPv2, IPv3, and IPv5? It took the IEEE and scientists three versions (IPv1, IPv2, and IPv3) for experimenting 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 version.
b. The IPv4 address format.
Computers talk in hexadecimal numbers, but since this 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 IPv4 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 the 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 sums up to about 4 billion—almost one IP address for every two humans in the entire world. But despite this massive high number of combinations, there are still not enough IPv4s 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 the 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 is composed of 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 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. For instance, 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 a 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 hosts within the local networks.
a. The IPv6 packet.
IPv6 and IPv4 packet formats are very similar. 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 simpler but is much larger!
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 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 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).
The IPv6 header can also be extended to contain particular 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 built-in in IPv6.
The 10 Key Differences: IPv4 vs IPv6.
Below are the ten 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 not only addresses the IPv4 exhaustion problem but also provides new additional benefits and services.
2. IPv4 and IPv6 have different address notation.
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 uses shortening techniques— IPv4 doesn’t.
The IPv6 format helps expand addressing capabilities. The IPv6 address can be abbreviated using double-semicolons and omitting leading zeros. The double semicolon can be used to 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 reduce the size of IPv6s.
4. IPv6 and IPv4’s address types and scopes are different.
IPv6 uses 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 —they are routed on the Internet. Internet authorities allocate these addresses to ISPs or LIRs, which in turn 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 are different from IPv4’s Public addresses.
Both IPv4 and IPv6 address formats are split into two parts: 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 IPv4, 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 uses learner headers than IPv4.
The IPv6 packet header is simpler and leaner 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 on the process. 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 used 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 anycasts.
Broadcast messages are available in IPv4. With broadcast messages, any device can send a packet to all connected nodes. Still, broadcast messages in IPv4 need to be limited due to performance issues. The concept of broadcasting in IPv6 is long gone. IPv6 uses 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.
4. IPv6 vs IPv4: Differences Chart.
So, now that you understand each of the IP versions, what is IPv4 vs. IPv6, and their key differences, let’s summarize with a chart. The following table will help you compare the differences between IPv4 vs. IPv6 addresses.
|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||2^32 ≈ 4 Billion||2^128 ≈ 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.|
5. IPv4 vs IPv6 FAQ.
a. What are IPv4 and IPv6?
The Internet Protocol (IP) belongs to a suite of protocols that interconnect networks such as 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 to transport data and control units. IPv4 and IPv6 are the fully operational versions of IP.
b. What is the difference between ipv4 and ipv6?
Both protocols use different formats and notations that result in a different number of combinations of IP addresses.
c. What is IPv6 used for?
IPv6 was designed to address the IPv4 address exhaustion problem. It does the same as IPv4, provides 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.
d. 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 still, a bad IPv6 implementation can result in a much slower IPv4 network.
e. Which is more secure: IPv6 vs. IPv4?
The fact that IPv6 comes with IPSec makes it easier to implement security. However, the way they are implemented can make a protocol more secure than the other. The difference between ipv4 and ipv6 in terms of security depends on the implementation itself.
f. 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 or 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.
g. 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.
h. 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.
i. When will IPv4 be phased out?
It is a fact that we are running out of IPv4s, and this is exactly 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 is around, IPv6 is still not widely deployed. But still, IPv6’s adoption rates are increasing steadily.