1. Introduction

The Internet Protocol (IP) is responsible for delivering data packets from a source device to a target device. This protocol has two versions – Internet Protocol Version 4 (IPv4) and Internet Protocol Version 6 (IPv6). Out of these two versions, IPv4 is the oldest and most widely used IP address format. The IPv6 is the successor of IPv4 as the latter has a limitation on the number of IP addresses it can provide.

In this tutorial, we’ll introduce the Internet Protocol, IPv4, and IPv6 address types, and a brief comparison of these two variants.

2. IP Address

An Internet protocol address is known as an IP address, and any device connected to the internet requires an IP address. It lets us identify the device or the network interface and also trace the location of the device connected to the internet. As an analogy, we can compare an IP address to a street address in an area. With an address, one can deliver a letter or reach the location. An IP address in a device performs a similar activity.

2.1. IP Address Resolution

The IP address is a numeric label that is attached to the device once it gets connected to the internet for communication and is unique on a network. The internet uses the Domain Name System (DNS) to let us use words (i.e., domain names) instead of a numeric label as the words are much easier to remember.

One can consider DNS as an internet address book that contains a mapping between the domain names and the IP address. For instance, once we type http://www.baeldung.com in our browser URL, the browser asks the DNS to look up the Baeldung’s IP address. The DNS returns the IP address, and the browser connects to the provided IP address.

2.2. Types of IP Address

There are two approaches to assign an IP address to a device – static and dynamic.

A static IP address is specified explicitly in the device’s network configuration. As the name suggests, a static IP address is configured, and it does not change even if there are changes in the network configurations. A static IP address is useful, while the address to the device needs to be static.

There are several use cases for this. For instance, the external devices, users may need to know the IP address for the device for frequent communication. Besides, there could be a security configuration to whitelist the IP addresses that could be connected through VPN or other remote access mechanisms.

A dynamic IP address is assigned to the device by the network and changes over time. There are several mechanisms to assign an IP address to a device dynamically. One of the most frequently used mechanisms is Dynamic Host Configuration Protocol (DHCP). DHCP automatically assigns an IP address to a device while it is connected to a network. As the name suggests, the dynamic IP address changes over time, and one can notice different IP addresses assigned to the device.

3. IPv4

Internet Protocol Version 4 (IPv4) is the first, oldest, and most widely used IP address. ARPANET used this format of IP address in production in 1983.

3.1. IPv4 Address

It uses a 32-bit addressing scheme to define the IP address. Thus, it allows generating 2^{32} addresses (~ 4 billion). An IPv4 address followed a dotted-decimal notation in XXX.XXX.XXX.XXX to express the address. The XXX could be a value ranging between 0 to 255. For instance, an example of an IPv4 address is 172.16.254.1:

IPV4vsIPV6

The above figure shows the structure of an IPv4 address. Each 8-bits (octets) is separated with a dot and together forms a 32-bit address.

3.2. Fragmentation

While sending data from source to destination, the actual data packet can be fragmented into multiple smaller packets. This fragmentation is done based on the maximum transmission unit (MTU) defined in the network layer. This process of splitting the data packets into smaller chunks is known as IP fragmentation. In the IPV4 addressing scheme, this fragmentation can be done by both the sender and the intermediate routers. The fragmented packets are then assembled by the receiver.

4. IPv6

The Internet Protocol Version 6 (IPv6) is the most recent version of the Internet Protocol.  It is also known as Internet Protocol next generation (IPng). IPv6 is a relatively newer version of IP address, and its use is still not widespread compared to IPv6.

4.1. Need for IPv6

The need to introduce the next version of the IP address is to mitigate the shortcomings of  IPv4. The major issues with IPv4 are the limitation of the number of addresses and the growth of routing tables. The IPv4 uses a 32-bit addressing scheme that is capable of generating 2^32 unique addresses. However, with the ever-increasing need for IP addresses in network communication, this number is simply not sufficient.

4.2. IPv6 Address

IPv6 uses a 128-bit addressing scheme and capable of generating 2^128 unique addresses (3.403×1038). This is a significantly large number and deemed sufficient for the foreseeable future. This large number of IPv6 addresses allows large chunks of addresses to be allocated for various purposes and aggregate for efficient routing:

IPV6

The above figure shows the structure of an IPv6 address. An IPv6 address is 128-bit long. Each 16-bits is separated with a colon(:). Following is the meaning of various sections of the IPv6 address:

  • 2: Global Unicast Address Indicator that refers to sending messages to a single network destination identified by a unique address
  • 001: Region (AFRINIC, APNIC, ARIN, LACNIC, RIPE NCC)
  • 0DB8: Local Internet Registry (LIR) or Internet Service Provider (ISP)
  • AC10: Customer
  • FE01: Subnet
  • 0000:0000:0000:0000: 64-bit Extended Unique Identifier (EUI-64). This unique 64-bit IP Version 6 interface identifier (EUI-64) is assigned directly to the host without any manual configuration or Dynamic Host Configuration Protocol

Although both IPv4 and IPv6 provide IP addresses, they can’t communicate with each other. However, both can co-exists in a network. This is known as a dual-stack. Tunneling is another approach in which a tunnel is created within an IPv4 region that allows encapsulated IPv6 packets are sent.

4.3. Fragmentation

The IPV6 addressing scheme follows a different principle for IP fragmentation. In IPV6, the intermediate routers don’t perform any fragmentation. It is always done by the sender host if at all fragmentation is required. Besides, in IPV6, the fragmentation header is not part of the actual IPV6 header. It is inserted in the data packet as an extension header if there is a need to perform fragmentation.

5. IPv4 vs. IPv6

Let’s now provide a comparison of the IPv4 and IPv6 addresses. The following table summarizes the comparison with various characteristics:

Characteristics IPv4 IPv6
IP Address Size Has a 32-bit address size Has a 128-bit address size
Addressing Type Numeric address type. Octets are separated by a dot Alphanumeric address type. Binary bits are separated by a colon (:)
Fragmentation Performed by the sender and the forwarding routes Performed by the sender
Address configuration Manually or through DHCP Stateless address autoconfiguration through Internet Control Message Protocol version 6 (ICMPv6) or DHCPv6

6. Conclusion

In this article, we’ve introduced and provided a comparison of two different IP address types – IPv4 and IPv6.

We introduced the IP address and its purpose in the network communication between devices. We then introduced to the IPv4, the widely used and dominating IP address type. Subsequently, introduced to IPv6, the successor of IPv4.

Finally, we provided a comparison of these address types based on several characteristics.

Comments are closed on this article!