IPv4 Vs IPv6 - Difference Between IPv4 and IPv6

Learn via video courses
Topics Covered

Overview

IP stands for Internet Protocol, and it is a network address that is assigned to each and every device that is connected to the particular network. A device uses the IP address to communicate with the other devices present on the network. The two of the most commonly used IP addresses are namely IPv4 (Internet Protocol version 4) and IPv6 (Internet Protocol version 6). The IPv4 is one of the most commonly used unique addresses for device identification.

The IPv4 consists of 32 bits and it is denoted in a sequence of four numbers separated by . (dots or periods). The period divides the IPv4 address into four octets. We can consider IPv6 as the next generation of IPv4. The IPv6 has a larger address size of 128-bit; due to the larger address size, there can be 340 un-decillion (3.4x10383.4x10^{38}) unique addresses generated by the IPv6. IPv6 uses hexadecimal for address representation, and this hexadecimal is separated using : (colon). Each address field of IPv6 is of 16 bits, also known as segments or blocks.

Networking Layer

Now, let us discuss the network layer briefly so that we can get a better understanding of IPv4 Vs IPv6, as both IPv4 and IPv6 are the most widely used protocols of the network layer.

The Network Layer is the third layer of the OSI model, which provides communication between hosts of different networks. The network layer divides the data received from the transport layer in the form of packets. The network layer provides two ways of communication, namely - connection-oriented and connection-less.

The functions provided by the network layer are as follows:

  • Logical Addressing: The network layer adds the logical address i.e. IP address (Internet Protocol address) if the packet crosses the network boundary.
  • Routing: Routing simply means determining the best (optimal) path out of multiple paths from the source to the destination.
  • If many devices are connected to the same router, then there is a change of packet drop as a router may not be able to handle all the requests.

Refer to the image below to see the basic transmission of data and working of the network layer.

basic transmission of data and working of the network layer

The various protocols used in this layer are:

  • IPv4 (Internet Protocol version 4)
  • IPv6 (Internet Protocol version 6)
  • ICMP (Internet Control Message Protocol) etc.

The various devices used in this layer are:

  • Routers,
  • Brouters, etc.

So, IP stands for Internet Protocol, and it is a network address that is assigned to each and every device that is connected to the particular network. A device uses the IP address to communicate with the other devices present on the network. The IP address helps in identifying the actual device present on the network. In today's world, The IP address protocol is used along with the TCP (Transmission Control Protocol) to virtually connect the source and the destination for data transmission.

Let us look at some of the features of the IP address:

  • The IP address is a numeric value that has been assigned by the network to each and every device present on the particular network.
  • As the IP address is assigned by the network provider or ISP (Internet Service Provider), it can vary from network to network. Hence, the IP address is changeable.
  • A device on a particular network has a unique IP address.
  • An IP address has two parts. The first part contains the network address, and the second part contains the address of the host.
  • The IP address is of two types, namely IPv4 (Internet Protocol version 4), and IPv6 (Internet Protocol version 6).

What is IPv4?

IPv4 stands for Internet Protocol Version 4. The IPv4 is one of the most commonly used unique addresses for device identification. The IPv4 consists of 32 bits, and it is denoted in a sequence of four numbers separated by ". "(dot/period). The period divides the IPv4 address into four octets (an octet is of 8 bits, so 4 octets make up 32 bits). An octet's value ranges from 0 to 255. So, an IPv4 can produce 4,294,967,296 (2322^{32}) possible unique addresses. As a computer can only understand binary digits (0s and 1s), so the IPv4 address is converted into binary digits for further processing.

IPv4 is divided into 5 classes, namely - class A, class B, class C, class D, and class E.

Example of an IPv4 address: 76. 124. 119. 133 .

Refer to the image below for a better understanding.

IPv4 address

There is some drawback to the IPv4 address, which was one of the reasons for the introduction of the IPv6 address.

Let us look at the drawback in brief.

There can be a maximum of 4 billion IPv4 unique addresses. As the population of the planet is growing (currently, it is nearly 7.6 billion), and today everyone has more than one device, so the demand for the unique IPv4 address has surpassed the maximum range of IPv4 addresses. So, only the IPv4 address was not enough to connect all the devices on the planet to the network or the Internet. So this was the major drawback of the IPv4 address, which gave rise to the generation of the IPv6 address. Let us discuss the IPv6 address in detail in the further section.

Note: There were a few techniques generated to overcome the issue of the limited IPv4 address, but they were not enough to complete the overall needs. Some of those techniques were:

  • Network and port address translation
  • Inter-domain translation
  • Variable-length masking, etc.

Features of IPv4

  • IPv4 uses 32-bit addresses, allowing for approximately 4.3 billion unique addresses.
  • IPv4 addresses are written in decimal format (e.g., 192.168.1.1) for easy human readability.
  • IPv4 supports subnetting and Variable Length Subnet Mask (VLSM) for efficient network management.
  • IPv4 allows broadcasting, enabling a single packet to be sent to all devices on a network.
  • NAT is used to conserve IPv4 addresses by allowing multiple devices within a private network to share a single public IP address.

What is IPv6?

IPv6 stands for Internet Protocol Version 6. We can consider IPv6 as the next generation of IPv4. The working of the IPv6 address is the same as the IPv4. Let us briefly discuss IPv4 Vs IPv6. Refer to the next section for more details on IPv4 vs IPv6.

The IPv6 has a larger address size i.e., 128-bit (IPv4 was 32-bit only). Due to the larger address size, there can be 340 un-decillion (3.4x10383.4x10^{38}) unique addresses generated by IPv6. The IPv4 uses the octets for defining the address, but the IPv6 uses alphanumeric (numbers + alphabets) hexadecimal, and these hexadecimal are separated using ": "(colon). Being hexadecimal, each field is of 16 bits, also known as segments or blocks.

Example of an IPv6 address is: 2001 : 0db8 : 85a3 : 0000 : 0000 : 8a2e : 0370 : 7334

Refer to the image below for a better understanding.

IPv6 address

As we can see in the example above, if we have a consecutive group of zeros, then we can combine them and use a double colon (":: ") in place of consecutive zeros. It is a convention used in the case of the IPv6 addresses.

The IPv6 address consists of three parts, namely - site prefix, subnet ID, and an interface ID. The first three fields in an IPv6 address make up the site prefix. The next field represents the subnet ID, and the last four fields are used for the interface ID. The site prefix is the number that is assigned to a site by an ISP. The subnet ID describes the network's site topology. The interface ID is a number that uniquely identifies an individual host on the network.

Features of IPv6

  • The IPv6 has a larger address space, so we can accommodate nearly 340 un-decillion unique addresses.
  • The header field of the IPv6 is simple.
  • The IPv6 provides anycast support.
  • The IPv6 provides end-to-end connectivity, so we do not need any NAT (Network Address Translation) to reach the other host.
  • As the header of the IPv6 address is simple, so it provides fast forwarding of data packets.
  • There is no broadcast in the case of IPv6, but unicast and multicast can be performed using IPv6.

Note: Anycast is a routing method in which the incoming request can be sent or routed to various locations. In the case of broadcasting, the incoming request is transferred to all the devices present on the network.

Differences Between IPv4 and IPv6

Let us now compare IPv4 Vs IPv6.

IPv4IPv6
IPv4 stands for Internet Protocol Version 4.IPv6 stands for Internet Protocol Version 6.
IPv4 uses numeric addressing.IPv6 uses alphanumeric addressing.
IPv4 consists of 32-bits in the form of four octets.IPv6 consists of 128-bits in the form of 8 segments.
IPv4 can generate 4 billion unique addresses.IPv6 can generate over 340 un-decillion (3.4x1038 3.4x10^{38}) unique addresses.
IPv4 uses periods (. ) to separate the octets of the address.IPv6 uses colons (: ) to separate the segments of the address.
IPv4 can perform unicast, broadcast, and multicast.IPv6 can perform unicast, anycast, and multicast. (No broadcasting).
IPv4 is divided into 5 classes ranging from class A to class E.There are no classes in IPv6.
IPv4 header is large and contains 12 fields.IPv6 has a smaller header consisting of 8 fields only.
IPv4 header length is 20-bits.IPv6 header field is 40-bits.
IPv4 header contains checksum field.IPv6 header does not contain the checksum field.
In the case of IPv4, the fragmentation is performed by the sending and forwarding routes.In the case of IPv6, the fragmentation is performed by the sender itself.
IPv4 supports Variable Length Subnet Mask.IPv6 does not support Variable Length Subnet Mask.
In the case of IPv4, the network configuration is done manually or by Dynamic Host Configuration Protocol.In the case of IPv6, the network configuration is done automatically.
We cannot achieve end-to-end connection integrity in IPv4.In IPv6, end-to-end, connection integrity can be achieved.
IPv4 does not provide encryption and authentication facilities.IPv6 provides the encryption and authentication facility.
There is no mechanism for data packet flow identification in IPv4.IPv6 uses the header field's flow label for the data packet flow identification.
The security in IPv4 is controlled by the type of application. The IPv4 is not developed, concentrating on securities.IPsec protocol makes IPv6 more secure than IPv4.
Example of IPv4: "86.124.49.54 ".Example of IPv6: 1851:0000:3238:DEF1:0177:0000:0000:0125
IPv4 addresses are represented in decimal format (e.g., 192.168.1.1).IPv6 addresses are represented in hexadecimal format (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334).
IPv4 addresses include public addresses for internet communication and private addresses for local networks.IPv6 addresses are primarily designed for global communication, eliminating the need for NAT (Network Address Translation) for most devices.
IPv4 has a limited address space, which has led to the adoption of techniques like NAT to conserve addresses.IPv6 provides a vast address space, allowing for an enormous number of unique addresses, which alleviates address exhaustion concerns.

Conclusion

  • IPv4’s 32-bit addressing system is now insufficient due to the proliferation of connected devices, prompting the development of IPv6 with its vastly expanded address space.
  • IPv6’s 128-bit addressing provides an almost limitless pool of unique addresses, eliminating the address scarcity problem that IPv4 faces.
  • IPv4 uses decimal notation (e.g., “192.168.1.1”), while IPv6 employs hexadecimal format (e.g., “2001:0db8:85a3:0000:0000:8a2e:0370:7334”).
  • IPv6 streamlines network configuration by enabling automatic processes, in contrast to IPv4 which often requires manual intervention or DHCP.
  • IPv6 integrates IPsec protocol, ensuring encryption and authentication, resulting in a more inherently secure communication framework compared to IPv4, which relies on application-level security.