Talk: It's time to talk about what IPv4 and IPv6 are

Talk: It's time to talk about what IPv4 and IPv6 are

On November 25, 2019, the RIPE NCC, which is responsible for the allocation of Internet resources in the UK, Europe, the Middle East and parts of Central Asia, announced that its last IPv4 address space reserve pool was completely exhausted at 15:35 UTC + 1 on November 25, and all 4.3 billion IPv4 addresses have been allocated.

In fact, as early as the late 1980s, the world had begun to realize that this problem would occur. The development and deployment of IPv6 is mainly to solve this problem.

What is IPv4?

IPv4 is the abbreviation of Internet Protocol version 4, which is translated into Chinese as the fourth version of Internet Communication Protocol (TCP/IP Protocol), and is usually referred to as Internet Protocol version 4.

[[284595]]

IPv4 uses 32-bit (4-byte) addresses, so there are only 4,294,967,296 (2^32) addresses in the address space.

An IPv4 address can be written in any format that represents a 32-bit integer value, but for ease of human reading and analysis, it is usually written in dotted decimal form, that is, the four bytes are written separately in decimal, separated by dots.

Therefore, the address format of an IPv4 address is usually nnn.nnn.nnn.nnn, such as:

  1. 192.168.1.255

192.168.1.255 is a 4-byte IP address divided into four segments in dotted decimal notation. Each segment has one byte, and one byte has 8 bits. Therefore, the range of numbers that can be represented by 8 bits is 0 - 255.

Therefore, the format of an IPv4 address is nnn.nnn.nnn.nnn, where 0<=nnn<=255 and each n is a decimal number. Leading zeros can be omitted.

IPv4 message format

We know that in the TCP/IP five-layer protocol model, a network request must go through the application layer -> transport layer -> network layer -> data link layer -> physical layer.

During the request process, a request data will also be packaged layer by layer from the application layer to the physical layer. Each layer will package the data message of the previous layer, add a layer of header information, and then pass it to the next layer.

Therefore, as a network layer protocol, IPv4 also includes the IP header and data part in its message structure.

Among them, the IPv4 header length is variable, ranging from 20 to 60 bytes.

First

The IPv4 message header contains 14 fields, 13 of which are required and 1 is optional.

The above picture is the header format of an IPv4 message. You can see that the IPv4 header contains a lot of content, such as version number, header length, identifier, fragment offset, survival time, protocol, etc.

Since this part is not the focus of this article, the message header will not be introduced in detail here. Readers can refer to the above picture to learn on their own.

data

In the message, in addition to the header, there is another most important part, which is the data part. The data field is not part of the header, so it is not included in the header checksum.

As mentioned earlier, the network layer will encapsulate the message from the transport layer into data, add a header, and then pass it to the link layer.

Therefore, the data part of the IPv4 message is the protocol message content of the transport layer, such as TCP, UDP, etc.

Why is IPv4 exhausted?

The global management body for IP addresses is the Internet Assigned Numbers Authority (IANA), which has five local Internet Registries (RIRs) under it.

Theoretically, IPv4 can provide up to 2^32 (about 4.29 billion) IP addresses. However, some addresses are reserved for special purposes, such as about 18 million private networks and about 270 million multicast addresses, which also reduces the number of addresses that can be routed on the Internet.

As addresses continue to be allocated to end users, the problem of IPv4 address exhaustion also arises.

China is the country with the largest number of Internet users in the world, but there are only 0.45 IPv4 addresses per capita. In the IPv4 environment, the Internet addresses of Chinese users need to be dynamically allocated, there is no fixed correspondence between people and addresses, and it is difficult to trace users, which brings potential risks to Internet security and supervision.

So, to solve this problem, IPv6 was born.

What is IPv6?

IPv6 is the abbreviation of Internet Protocol version 6, which is translated into Chinese as Internet Communication Protocol (TCP/IP Protocol) Version 6, usually referred to as Internet Protocol Version 6. IPv6 has a much larger encoding address space than IPv4. It is used to replace IPv4 mainly to solve the problem of IPv4 address exhaustion. At the same time, it also has many improvements on IPv4 in other aspects.

IPv6 has a much larger coded address space than IPv4. This is because IPv6 uses 128-bit addresses, while IPv4 uses 32-bit addresses. Therefore, the newly added address space supports 2^128 addresses, which is 340,282,366,920,938,463,463,374,607,431,768,211,456 (I wonder if anyone can read this number?)

Some people say that the number of IPv6 addresses may be more than the grains of sand in the world, which is enough to solve the current problem of insufficient IPv4 addresses.

IPv6 binary system is 128 bits long, with 16 bits as a group, each group is separated by a colon ":", and can be divided into 8 groups

The IPv6 text format is xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx, where each x is a hexadecimal number representing 4 bits. For example:

2001:0db8:86a3:08d3:1319:8a2e:0370:7344IPv6 message format

Like IPv4, IPv6 messages also contain a header and data part.

Unlike IPv4, the header of an IPv6 message is a fixed length of 40 bytes.

The figure below shows the structure of the IPv6 message header. IPv6 defines a new packet format to minimize the message headers processed by routers.

As can be seen from the figure, compared with IPv4, the IPv6 header content is much less.

As network layer protocols, IPv6, like IPv4, encapsulates the message content of the transport layer as its own data. There is no difference in this point, so we can say that the main difference between IPv6 and IPv4 in terms of messages is the difference in the message header.

IPv4 VS IPv6

After introducing IPv4 and IPv6, let's take a look at the differences between these two protocols as a whole.

1. Address

(1) IPv4 length is 32 bits (4 bytes)

The text format of an IPv4 address is nnn.nnn.nnn.nnn, where 0<=nnn<=255 and each n is a decimal number. Leading zeros can be omitted. The maximum number of printable characters is 15, excluding the mask;

(2) IPv6 length is 128 bits (16 bytes)

The text format of an IPv6 address is xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx, where each x is a hexadecimal digit representing 4 bits. Leading zeros can be omitted. Double colons (::) can be used once in the text format of an address to specify any number of zero bits. For example, ::ffff:10.120.78.40 represents an IPv4-mapped IPv6 address.

2. Address Resolution Protocol

  • IPv4 uses ARP to find the physical address (such as MAC or link address) associated with an IPv4 address;
  • IPv6 embeds these functions into IP itself as part of the stateless autoconfiguration and neighbor discovery algorithm using Internet Control Message Protocol version 6 (ICMPv6). Therefore, there is no such thing as ARP6.

3. IP header

  • IPv4 has a variable length of 20-60 bytes, depending on the IP options provided;
  • The IPv6 header is a fixed length of 40 bytes. There are no IP header options;
  • In general, the IPv6 header is simpler than the IPv4 header.

4. Security

  • IPv6 comes with IPSec by default to improve security;
  • In contrast, IPv4's IPSec needs to be enabled separately.

5. Address Type

  • There are three basic types of IPv4 addresses: unicast addresses, multicast addresses, and broadcast addresses;
  • There are three basic types of IPv6 addresses: unicast addresses, multicast addresses, and anycast addresses. See IPv6 Address Types for a description.

6. Private and public addresses

  • IPv4 except for the three address ranges designated as private by IETF RFC 191810…;
  • All IPv4 addresses are public except 172.16.0.0 to 172.31.255.255 (172.16/12), and 192.168.. (192.168/16). Private address domains are typically used within an organization. Private addresses are not routable over the Internet;
  • IPv6 has a similar concept, but with important differences. Addresses are either public or temporary, previously known as anonymous addresses. See RFC 3041. Unlike IPv4 private addresses, temporary addresses are globally routable;
  • The motivation is also different: IPv6 temporary addresses are intended to mask the identity of the client when it begins communicating (privacy concerns). Temporary addresses have a limited lifetime and do not contain the interface identifier of the link (MAC address). They are generally indistinguishable from public addresses.

7. Compared with IPv4, IPv6 has the following advantages:

  • Larger address space. IPv4 stipulates that the length of an IP address is 32, which means there are 2^32 -1 addresses. In IPv6, the length of an IP address is 128, which means there are 2^128 -1 addresses;
  • Smaller routing table. IPv6 address allocation follows the clustering principle, which enables the router to use one record in the routing table to represent a subnet, greatly reducing the length of the routing table in the router and increasing the speed at which the router forwards data packets;
  • Enhanced multicast support and streaming support. This allows multimedia applications on the network to have a great development opportunity, provides a good network platform for service quality control, and adds support for automatic configuration. This is an improvement and expansion of DHCP, making network management more convenient and faster;
  • Higher security: In a network using IPv6, users can encrypt data at the network layer and verify IP packets, which greatly enhances network security.

Someone made a vivid summary, which is "fast, good and cheap"

Transition from IPv4 to IPv6

On the one hand, due to the exhaustion of IPv4, and on the other hand, due to the "more, faster, better, and cheaper" features of IPv6, more and more companies are beginning to choose to use IPv6.

So, what do you need to do if you want to convert an IPv4 network to an IPv6 network?

First of all, it is clear that IPv6 is not an upgrade of the IPv4 protocol, but a brand new protocol. The two are not compatible with each other.

In order to ensure the smooth evolution from IPv4 to IPv6, the Internet Engineering Task Force (IETF) established a special working group to conduct research and formed three types of technical solutions: dual stack technology, tunnel technology, and protocol conversion technology (NAT-PT).

1. Dual stack technology

IPv4 and IPv6 have network layer protocols with similar functions. They are based on the same hardware platform. The same host runs both IPv4 and IPv6 protocol stacks. Nodes with IPv4/IPv6 dual protocol stacks are called dual stack nodes. These nodes can send and receive both IPv4 and IPv6 packets. They can use IPv4 to communicate with IPv4 nodes, or directly use IPv6 to communicate with IPv6 nodes. Dual stack nodes contain both IPv4 and IPv6 network layers, but the use of transport layer protocols (such as TCP and UDP) is still single.

Advantages of dual stack technology:

  • High processing efficiency and no information loss;
  • Good interoperability and simple network planning;
  • Give full play to all the advantages of IPv6 protocol, such as smaller routing table, higher security, etc.
  • It takes up a lot of resources and the operation and maintenance is complicated.

Disadvantages of dual stack technology:

  • IPv4 and IPv6 cannot communicate with each other;
  • It has high requirements for network equipment, involves a lot of internal network transformation, and has a relatively long cycle.

2. Tunnel technology

Tunneling technology refers to encapsulating the header of another protocol data packet directly in front of the header of the original data packet, so that it can be directly transmitted on networks with different protocols. This mechanism is used to connect IPv6 sites on the IPv4 network. The site can be a host or multiple hosts. Tunneling technology encapsulates IPv6 packets into IPv4 packets, or encapsulates IPv4 packets into IPv6 packets. The encapsulated IPv4 packets will be transmitted through the IPv4 routing system or IPv6 packets.

Advantages of tunnel technology:

  • No information is lost;
  • Network operation and maintenance is relatively simple;
  • It is easy to implement, just make changes at the entrance and exit of the tunnel.

Disadvantages of tunneling technology:

  • Tunnels need to be encapsulated and decapsulated, and forwarding efficiency is low;
  • IPv4 and IPv6 cannot communicate with each other;
  • There is no solution to the IPv4 shortage problem;
  • NAT compatibility is poor.

3. Protocol conversion technology

NAT-PT is a network address translator with a protocol converter. It is a way for pure IPv6 nodes and IPv4 nodes to communicate with each other. All conversion work including addresses and protocols is completed by network devices. NAT-PT includes static and dynamic NAT-PT. Both provide one-to-one mapping of IPv6 addresses and IPv4 addresses. However, dynamic NAT-PT requires an IPv4 address pool for dynamic address conversion.

Advantages of NAT-PT technology:

  • No need to upgrade IPv4 and IPv6 nodes

Disadvantages of NAT-PT technology:

  • The implementation method of IPv4 nodes accessing IPv6 nodes is relatively complex. The processing overhead of network devices for protocol conversion and address conversion is relatively large. It is generally used when other intercommunication methods cannot be used.

Dual stack technology, tunnel technology, and protocol conversion technology cooperate and work together during the transition from IPv4 to IPv6, solving the coexistence and interoperability problems of IPv4 and IPv6 during the transition period and ensuring the smooth evolution from IPv4 to IPv6.

With the above switching methods, switching principles and technical guarantees, and in line with the development trend of the Internet, the country is actively promoting the deployment of IPv6.

The 44th "Statistical Report on the Development of China's Internet" of the China Internet Network Information Center (CNNIC) pointed out that as of June 2019, the number of IPv6 addresses in our country was 50,286 blocks/32, ranking first in the world; the number of active IPv6 users reached 130 million, accounting for approximately 15% of my country's Internet users.

The impact of IPv6 on China

China connected to the Internet 20 years later than developed countries and is a latecomer in the Internet industry. Although we are a major country in Internet products and applications, our operating system is still foreign and we still have gaps in core technologies. If China wants to carry out technological innovation in the IPv4 environment, it has almost no chance.

But when it comes to IPv6, we are at a similar starting point to developed countries, so we do have a chance.

In the IPv4 era, China did not have root servers, and adding new ones was almost impossible. However, the "Snowman Project" initiated by the China Next Generation Internet National Engineering Center has completed the installation of 25 IPv6 root servers around the world, of which 4 are deployed in China, breaking the dilemma of China not having root servers in the past.

In addition, the international Internet has more than 8,000 standards. In the IPv4 era, China only proposed the Chinese encoding standard. But now China has proposed more than 100 standards for IPv6. It can be said that IPv6 has opened up a new innovation space for the development of China's Internet.

Therefore, with the exhaustion of IPv4 and the massive use of IPv6, China's position in the international Internet will become more and more important!

<<:  Want to handle tens of millions of traffic? You should do this!

>>:  Securing the transcript - Deepin Technologies provides cybersecurity support for the 7th CISM Military World Games

Recommend

Fact or fallacy: How smart can you get without 5G?

Smart city development relies on the expansion of...

What is 6G and when can we expect it?

Since 5G networks are still being deployed around...

Stop shouting slogans, how to implement IPv6? Operators give details

IPv6, which is "not fast enough to keep up w...

Emerging 5G technology puts SIM-based IoT devices at greater risk

Downloading a high-definition movie in the blink ...

What to expect from SD-WAN in 2019? Five major trends to watch

There’s probably no hotter topic in networking ci...

HTTP/[0.9 | 1.0 | 1.1 | 2 | 3]

[[379542]] This article is reprinted from the WeC...

The difference between NFV automation and NFV orchestration

NFV automation and NFV orchestration have overlap...

API requests are slow? This time the backend is not to blame

question During the development process, we found...