The basics of IPv4 and IPv6

Last modified: Thursday November 30th, 2023

This text explains some general background information on IPv4 and IPv6.

Introduction

IPv4 is a brilliant protocol that was developed to enable communication between computers on a network. This network would gradually develop into the Internet, the largest network of devices on Earth. The developers of IPv4, however, never imagined that the Internet would grow at the exponential rate that it did. It quickly became apparent that the amount of IPv4 addresses that existed would not suffice for the massive influx of devices that came to be connected with each other. Thus, in the mid 1990s, the development of a new protocol (IPv6) was discussed. In 1998 IPv6 became a Draft Standard from the IEFT (Internet Engineering Task Force) and in 2017 it became an Internet Standard. Since the conception of IPv6, there has been a slow push to transition over to the IPv6 Standard and to deprecate IPv4. Unfortunately, this is not easy since IPv4 has been solidly established on the Internet.

The move over has been slow, but in recent years there has been a much greater push to establish IPv6 on the Internet. IPv6 adoption has gone from about 5% to about 36% in just the last 5 years and doesn’t show any signs of slowing down. But why would someone want to use IPv6? Are there benefits and/or disadvantages to using it over IPv4? How does IPv6 differ to IPv4? How does it work?

I will answer these questions and more. This article assumes that the reader is already aware of how IPv4 works, at least the basics of it.

Why use IPv6?

If you placed an IPv6 address next to an IPv4 address, it would be easy to miss the fact that the one is the successor to the other. They have a completely different notation. They do, however, use the same base system. The only difference is the number system that is used to display the IP address. IPv4 addresses are displayed as four groups of three decimal digits separated with dots, while IPv6 addresses use eight groups of four hexadecimal digits separated by colons.

Hexadecimal IPv6: 2001:db8:ffff:ffff:ffff:ffff:ffff:ffff
Decimal IPv4: 192.0.2.223

If you look at the IPv6 address, it can be daunting just to read it, and it is impractical to memorize it. The developers of IPv6 have, however, implemented some compression tricks that can be applied to IPv6 to shorten the overall length of an address. This can sometimes even make an IPv6 address shorter than an IPv4 address. If we convert the IPv6 address to binary, it can be easier to grasp the basic concept of how it is structured. For example the above IPv6 address in binary is as follows:

0010000000000001:0000110110111000:1111111111111111:1111111111111111:1111111111111111:1111111111111111:1111111111111111:1111111111111111

This may already be ringing a bell for some, as it looks quite similar to and IPv4 binary address, just much bigger. While an IPv4 address consists of 32 bits, an IPv6 address has 128 bits – four times as many. As you may have noticed, this means we can create 2 to the power of 128 IPv6 addresses. That would be about 340 trillion trillion trillion IPv6 addresses! So it is basically impossible for us to ever run out of IPv6 addresses the way we did with IPv4 addresses, which only had 2 to the power of 32 (about 4.2 billion) possible addresses.

IPv6 not only provides a greater amount of available IP addresses, but is also necessary for the long term health and development of the Internet.

Advantages of IPv6

Included in the development of IPv6 was a desire to increase the security of the protocol. IP security (IPsec) provides a safe way to transmit sensitive information over the Internet. The framework consists of open standards developed by the IETF. IPsec provides a number of network security services that are used to secure data. Firstly, data confidentiality is a feature that allows the sender to encrypt packets before sending them across a network. This ensures that only the intended destination device is able to read the packet. Secondly, data integrity validation is possible for the receiver, allowing them to verify the integrity of IPsec packets and see if the data was in any way altered en-route to the destination. Thirdly, data origin authentication allows the receiver to authenticate the source of the packets being sent. These improvements allow information to be sent across a public network without modification, observation, or spoofing.

IPv6 still includes the following benefits:

  • NAT is no longer required but can still be used
  • Auto-configuration
  • No more private address collisions
  • Header format simplification
  • Better multicast routing

I will explain these in greater detail in the following sections.

Disadvantages of IPv6

Even though there are many advantages to IPv6, there are several disadvantages and problems that IPv6 could cause for the end user.

The most obvious disadvantage is the length of IPv6 addresses. As mention earlier, an IPv6 address is comprised of eight groups of four hexadecimal digits. Memorising such a long address or having to type it in on a terminal during administrative work can be painful.

IPv6 routing has to be enabled on many systems before it can be used. This leads to more work for admins, resulting in longer setup times. Tying in with this disadvantage is the fact that many older end user devices are not configured to use IPv6.

Since most of the world is still on IPv4, running IPv6 only systems can lead to less traffic to your system, or your system not being able to communicate with IPv4 systems.

How is an IPv6 address structured?

IPv6, in essence, still serves the same function as IPv4. IPv6 addresses are structured similarly to IPv4 in that they have a network prefix and interface/host identifier. The prefixes in IPv6 are the same as the subnet masks that are used in IPv4 addresses. CIDR (Classless Inter-Domain Routing) notation is used in IPv6 to display the mask, using an integer between 1-128 to represent the network bits.

      Network prefix              Host identifier
XXXX : XXXX : XXXX : XXXX : XXXX : XXXX : XXXX : XXXX

For example, in 2001:db8:85a3:8d3:0000:0000:0000:001a/642001:db8:85a3:8d3::/64 is the network prefix and the possible IPv6 addresses in the range is 2001:db8:85a3:8d3:0000:0000:0000:0001/64 to 2001:db8:85a3:8d3:ffff:ffff:ffff:ffff/64.

( XXXX : XXXX : XXXX ) : XXXX : XXXX : XXXX : XXXX : XXXX

The first 3 fields of an IPv6 address’s network prefix (marked in the brackets) contain the site prefix. The prefix describes the public topology that is usually allocated to your site by an ISP (Internet Service Provider) or RIR (Regional Internet Registry).

XXXX : XXXX : XXXX : ( XXXX ) : XXXX : XXXX : XXXX : XXXX

The following fourth field (marked in the brackets) is the subnet prefix, which defines the internal topology of the network to a router.

Compression of IPv6 Addresses

I mentioned earlier that IPv6 addresses can be compressed to make them shorter and easier to read. Two rules apply to this simplification method. Firstly, leading zeros may be removed by any groups (hextets) in the address. For example,

1001:0005:ffc0:0000:0000:5893:0032:0001

can be simplified to,

1001:5:ffc0:0:0:5893:32:1

We may not remove trailing zeros as the routers will then assume the zero came from the front of the hextet. For example, if we removed the trailing zero from the following hextet,

ffc0

The router would not add the zero back to the end of the hextet when filling in the zeros. Instead the zero would be placed in front of the other digits, like so:

0ffc

Secondly we can remove continuous zeros. In this example we had 2 groups of fours zeros. This can be replaced with,

1001:5:ffc0::5893:32:1

The routers reading this address will automatically fill in the missing zeros. This can, however, only be done once in an address. And thus, our IPv6 address already looks much more readable.

Auto-configuration

IPv6 hosts have the ability to generate their own address, making administration easier and less time-consuming. There are several steps that take place to auto-configure an interface in IPv6. During this process, a link-local address is created. A link-local address is an IPv6 address that allows communication between hosts that reside on the same network. The address can be determined using one of two mechanisms – the stateless and stateful mechanisms.

Stateless address auto-configuration (SLAAC) requires no manual configuration of hosts and no additional configuration of servers. This mechanism enables the host to auto-generate its own addresses. Local information and non-local information that is advertised by routers are used to generate the addresses. Routers advertise prefixes that identify the subnet or subnets that are associated with a link. Hosts generate an interface identifier that uniquely identifies an interface on a subnet. By combining the prefix and the interface identifier, a unique address is formed. A host can generate only link-local addresses if no routers are available.

In the stateful auto-configuration model, hosts obtain interface addresses or configuration information and parameters from a server. This can be compared to the DHCP process from IPv4, and the servers that provide the information are also called DHCPv6 servers. These servers maintain a database that checks which addresses have been assigned to which hosts. The stateful auto-configuration protocol allows hosts to obtain addresses and other configuration information from a server. Stateless and stateful auto-configuration often complement each other. For example, a host could use stateless auto-configuration to configure its own addresses, but use stateful auto-configuration to obtain other information.

Types of IPv6 addresses

There are several types of IPv6 addresses. In this section we will look at each type and briefly explain what they are used for and how they compare to IPv4.

Address Type Prefix Used for
Global unicast 2000::/3 Publicly routable
Unique local fc00::/7 Routable in the LAN
Link local fe80::/10 Not routable
Multicast ff00::/8 Addresses for groups
Anycast 2000::/3 Shared address

global unicast address is a publicly routable address, just like a public IPv4 address. These addresses can be identified by the prefix 2000::/3. This means the first 3 bits will identify a global unicast address.

unique local address is similar to a IPv4 private address and is not globally routable. These addresses have the prefix fc00::/7. Using the first 7 bits, a unique local address will always start with an “f”, followed by either a “c” or a “d”.

Link local addresses can be thought of as quick automatic IP addresses that can be generated without the aid of any other device. These addresses are not routable over a network. As mentioned previously, these addresses are designed to only communicate with other devices on the same local network. They have a prefix of fe80::/10. You may already have noticed the pattern. This indicates that link local addresses will use the first 10 bits to start with “fe”.

Multicast addresses are addresses that are assigned to a group of devices that will listen for that particular multicast address. This type of address is easy to spot as they always start with “ff”.

Lastly, we have anycast addresses. These addresses are interesting in that they can be assigned to multiple devices. The data will then be sent to the closest device with that address. There isn’t a specific IP range for anycast addresses, and they use the same range as global unicast addresses.

IPv4 uses broadcast addresses that allow a device to send out a packet to all devices on a network. This address type has been scrapped in IPv6 and multicast is used instead.

Header format simplification

The IPv6 header has been simplified and drops certain IPv4 header fields. This lowers the bandwidth cost, despite the increased address size. The IPv6 header is only two times the size of the IPv4 header, although the address is four times as long.

IPv6 header
Version Traffic class Flow label
Payload length Next header Hop limit
Source address
Destination address
IPv4 header
Version IHL Type of service Total length
Identification Flags Fragment offset
TTL Protocol Header checksum
Source address
Destination address
Options Padding

As we can see, the simplification of the IPv6 header has caused many IPv4 header fields to fall away. Let’s look at the fields that are no longer present in IPv6 and analyze how IPv6 deals with transferring that information. The fields that are identical are marked with an equals sign.

IPv4-Header IPv6-Header
Version 4 bits = Version 4 bits
IHL (Internet Header Length) 4 bits Does not exist in IPv6
Type of service 8 bits = Traffic class 8 bits
Does not exist in IPv4 Flow label 20 bits
Total length 16 bits = Payload length 16 bits
Identification 16 bits Does not exist in IPv6
Flags 3 bits Does not exist in IPv6
Fragment offset 13 bits Does not exist in IPv6
TTL (Time To Live) 8 bits = Hop limit 8 bits
Protocol 8 bits = Next header 8 bits
Header checksum 16 bits Does not exist in IPv6
Source address 32 bits = Source address 128 bits
Destination address 32 bits = Destination address 128 bits
Options 0-320 bits = Extension headers 0-320 bits
Padding Variable length Does not exist in IPv6

The Traffic class field is an identifier of the packet’s class or priority and serves the same function as the IPv4 Type of service field.

The Flow label field is the only new field in IPv6. It indicates to intermediate devices that a packet belongs to a specific sequence of packets between a source and a destination. This field distinguishes different traffic flow to IPv6 routers.

Payload length is the Total length field equivalent in IPv6 and simply shows the length in bytes of the data portion of a packet.

The Time to live field has been renamed to Hop limit as it more accurately describes the function of the field.

The Protocol field has been renamed Next header and specifies the protocol in the payload such as TCP, UDP or ICMPv6. This field has some additional options compared to the Protocol field in IPv4, such as Generic Routing Encapsulation (GRE), Encapsulating Security Payload (ESP) and Open Shortest Path First (OSPF)

No more NAT

NAT (Network Address Translation) is a protocol that is most often used to map local/private IP addresses to one public IP address and vice versa in order to provide local hosts with Internet access. NAT was specifically developed as a workaround to slow down the inevitable exhaustion of IPv4 addresses. However, the large addressing space of IPv6 changes this, in that there is no longer a need to conserve addresses and every device can easily be given a unique globally routable address. It may no longer be necessary to use NAT in IPv6, but it is still possible to implement it in an IPv6 network. It is mainly used to help translate IPv4 addresses to IPv6 addresses.

Conclusion

At the moment the vast majority of devices on the Internet still use IPv4. It will still take a number of years before IPv4 is truly phased out in favor of IPv6. Adoption of the newer protocol, however, is further advanced in more modern countries around the world such as Germany, USA, Saudi Arabia and Japan, and in countries that have a large population with a growing IT sector, such as India and Brazil. For the foreseeable future, we will, however, live in a world that has both IPv4 and IPv6 and where many systems run on a dual stack IP system. Only once IPv6 has overtaken IPv4 in market share, will we be able to have systems that are IPv6-only.

Sources

Was this article helpful?
Views: 699

10 Years Beehosting!
Celebrate with 70% OFF + FREE Site Transfer.

Facebook Instagram linkedin

Beehosting.pro website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Menu