Why’s THE Design is a series of articles about programming decisions in THE field of computing. In each article, we present a specific question and discuss THE pros and cons of this Design and its impact on implementation from a different perspective. If you have a question you’d like to know more about, leave a comment below.

The network layer protocol undertakes Packet forwarding and routing, and it can provide the upper layer with the responsibility of transporting packets between different hosts. As the network layer protocol, IP protocol can only provide connectionless and unreliable services, but it plays an extremely key role in today’s Internet.

Figure 1 – Internet Protocol cluster

In general, when we want to access the services provided by other hosts, we need to access the target host through the IP address. Only the IP address can be accessed by other hosts on the Internet. IP addresses are like home addresses, and we need to ensure that all host IP addresses are unique so that we can find the correct host.

As IP protocol 1 (1974), the first major version of IPv4 used 32-bit addresses, providing a total of 2^32 (4,294,967,296) IP addresses 2. 4.2 billion IP addresses may seem like a lot, but the number of IPv4 addresses available has been decreasing in recent years, and as early as 2011, all the top IPv4 addresses were allocated 3.

Figure 2-Decimal representation of an IPv4 address

To address the problem of running out of IP addresses, the IETF released draft 4 of the IPv6 protocol in 1998 and formally became the Internet Standard 5 in 2017. IPv6 uses 128-bit IP addresses, representing a total of 2^128 addresses. IPv6 can even assign separate addresses to the sand on earth 6:

The new version of the Internet protocol IPv6 can not only solve the problem of running out of IP addresses once and for all, but also improve the speed and security of network transmission. The designers of the IPv6 protocol initially assumed that the rapid decline of IPv4 addresses would lead to rapid adoption of IPv6. Their initial estimate was that IPv6 would be deployed globally by 2003, but these forecasts are still wildly optimistic from today’s point of view.

The question this paper attempts to analyze is why IPv6 has so many benefits and can solve the IPv4 address shortage, yet it has not been widely adopted for another 17 years, even after the original estimate of 2003. Here are a few reasons why:

  • NAT technology alleviates IPv4 address shortage to a large extent.
  • The compatibility between IPv6 and IPv4 is not considered in the design of IPv6 protocol.
  • Fine-grained IPv4 address management and reclaiming idle resources;

NAT

Network Address Translation (NAT) is a technology that changes the Network Address when IP packets pass through a router. It can map IP addresses in the current Address space to another Address space. NAT technology can avoid changing the IP addresses of all nodes in the network when the network is switched or the ISP upstream changes. NAT technology can be understood as a translation table, which stores the translation relationship between external addresses and ports to internal addresses and ports.

Figure 3 – Network address translation technology

When a packet accesses an external network from the inside, the NAT allocates a port for the current request, overwrites the source address and port in the packet, and stores the address and port information in the local translation table. When a packet enters the network from the outside, the NAT searches for the host and port number of the private network based on the IP address and port number of the packet and overwrites the destination address and port in the packet.

Figure 4-NAT table

With NAT as the middle layer, we can not only protect private networks, but also alleviate the shortage of IP addresses. However, NAT is not only beneficial, it also brings a lot of problems. The host in the NAT network cannot establish a true end-to-end connection with the peer and cannot participate in some Internet protocols 8. In addition, the following problems caused by NAT are also controversial 9:

  1. NAT uses port numbers for process addressing, not host addressing;
  2. As a layer 3 (network layer) device, the NAT router should only handle packets that reach the network layer.
  3. NAT violates the principle that hosts should talk directly to each other;

Although NAT has caused a lot of controversy and problems, NAT has become a widely used technology throughout the Internet, and engineers have tried to solve the problems with various NAT traversal technologies, such as SOCKS, UPnP and ALG. 10.

compatibility

Software and protocols are designed for the present and the foreseeable future, but it’s hard to predict what the future will look like, and the current design will become less and less applicable as the scene changes. All software and protocols need to be updated and iterated. In the process of updating, we need to consider compatibility, which can generally be divided into Forward compatibility and Backward compatibility:

  • Forward compatibility: the old system can receive and process the data generated by the new system;
  • Backward compatibility: the new version system can receive and process the data generated by the old version system;

Figure 5 – System compatibility

If IPv6 is forward compatible with IPv4, the hardware used to process IPv4 can process IPv6 data without updating, but the system without updating cannot enjoy the benefits of IPv6. If IPv6 is backward compatible with IPv4, IPv6 hardware can handle both IPv4 and IPv6 packets, and the entire network can be upgraded seamlessly by replacing IPv4 devices with IPv6 devices.

IPv6 might not have been as complicated if IPv4 and IPv6 had been forward or backward compatible, but IPv6 was not designed for compatibility with earlier versions. Although IPv4 and IPv6 are both IP protocols, they are incompatible, so we can only use dual stack, tunneling technology or NAT64 protocol transition:

Figure 6 – Dual stack

It is understandable that IPv6 protocol wants to get rid of the burden of history and realize completely incompatible design. In the process of applying IP protocol in the past decades, we have encountered a lot of problems. It is not impossible to carry the burden of history and continue to move forward. While the designers of the IP protocol admit that IPv6’s failure to implement forward compatibility is the biggest mistake 11, the authors argue that getting rid of history quickly by incompatibility is a good thing in the long run.

Address control

IPv4 addresses are a scarce resource in general, but as with other scarce resources, the problem of how to allocate resources and provide usage has always been a big one. Internet Assigned Numbers Authority (IANA) and Regional Internet Registries (RIR) are organizations responsible for assigning IP addresses. In addition to some IP addresses reserved for private networks, The remaining addresses are usually allocated by subnet in the form of address blocks.

In the early days of Internet protocol development, subnets were divided by the leftmost 8 bits of IP address, but this allowed only 256 networks to be divided, so it was quickly replaced by Classful Network Architecture in 1981. Classified network architecture includes three types of networks: A, B and C 12:

Class The network number Number of hosts
A 128 16777214
B 16384 65534
C 2097152 254

Class A addresses can only be assigned to 128 different networks that can contain 16 million hosts each, while Class C addresses can be assigned to 2 million organizations that can contain more than 200 hosts. Through IP address classification, we can allocate IP address blocks more reasonably, but although it classifies IP addresses, it is still rough.

Classless Inter-domain Routing (CIDR) proposed by IETF in 1993 replaced the classified network architecture. CIDR is based on variable-length Subnet Masking and VLSM. Its main purpose is 13:

  1. Slow the growth rate of routers forwarding packets on the Internet;
  2. Reduce the rate of IPv4 address exhaustion;

In the classification network architecture, the address division is too ideal, too small address block is often insufficient, but a larger address block will cause a large waste. Unlike classified network architectures, which divide IP address blocks into three categories using only fixed-length subnet masks of 8, 16, and 24, CIDR uses a variable length subnet mask to divide address blocks. In CIDR representations, N represents the prefix length, which can be any value from 0 to 32:

A.B.C.D/N
Copy the code

A.B.C.D/8, A.B.C.D/16, and A.B.C.D/24 can represent the A, B, and C address blocks in the classified network architecture, respectively. Other numbers can also be used to represent subnets with A more flexible number of specific networks and hosts.

In addition to more fine-grained address allocation, reclaiming unused IP resources and reusing them is an important way to extend IPv4’s lifetime, but we won’t expand on that here. From the allocation of IP addresses, we can see that resources have changed from sufficient to scarce, and people’s attitude towards the use of resources has changed. From the rough allocation method at the beginning to the fine-grained control later, sufficient resources are always abused. Only when resources become scarce, do we start to make careful calculation.

conclusion

IPv4 published from 1981 to today nearly forty years have passed, in the past this time, it ACTS as an important protocol in the Internet protocol suite to packet forwarding and routing of the important responsibility, along with the network environment and the terminal equipment is becoming more and more complicated, we also need the IP address of the more meet the needs of today.

Figure 7 – Adoption rate of IPv6 protocol accessing Google 14

IPv6 is moving forward with a lot of historical baggage. Although more and more websites and network devices are supporting IPv6, it will be difficult for IPv6 to completely replace IPv4 for a number of reasons.

  • NAT technology can alleviate IPv4 address shortage to a large extent and protect private internal networks, providing the function of firewall.
  • IPv4 and IPv6 are completely incompatible. We need to introduce dual stack, tunneling or NAT64 to solve the compatibility problem, and these technologies also need additional cost.
  • Fine-grained resource management and reclaiming unused IP addresses can delay the time when IP addresses are exhausted.

Engineers’ imaginations are endless. For the past decade or so, we have tried to keep IPv4 alive in various ways to delay the exhaustion of IP resources, but IPv4 will be replaced by IPv6 in the foreseeable future, and we will have almost unlimited IP addresses. In the end, let’s take a look at some of the more open-ended questions that interested readers can ponder:

  • What does the IPv5 protocol do? Why have you not heard of the IPv5 protocol?
  • How long do you think it will take for IPv6 to overtake IPv4?

If you have questions about the content of this article or want to learn more about the reasons behind some design decisions in software engineering, you can leave a comment below on this blog. The author will respond to the questions in this article and select the appropriate topics for subsequent content.


  1. Wikipedia: Internet Protocol en.wikipedia.org/wiki/Intern… ↩ ︎

  2. Wikipedia: IPv4 en.wikipedia.org/wiki/IPv4 ↩ ︎

  3. Wikipedia: IPv4 address exhaustion en.wikipedia.org/wiki/IPv4_a… ↩ ︎

  4. RFC2460, Internet Protocol Version 6 Specification tools.ietf.org/html/rfc246… ↩ ︎

  5. RFC8200 Internet Protocol Version 6 (IPv6) Specification tools.ietf.org/html/rfc820… ↩ ︎

  6. Can every grain of sand be addressed in IPv6? Skeptics.stackexchange.com/questions/4… ↩ ︎

  7. When will IPv6 replace IPv4 completely on the planet? www.quora.com/When-will-I… ↩ ︎

  8. Issues and limitations en.wikipedia.org/wiki/Networ… ↩ ︎

  9. Computer network (6th edition). James F.K urose, Keith W.R oss. The 2014-10. P225 book.douban.com/subject/261… ↩ ︎

  10. Wikipedia: NAT traversal en.wikipedia.org/wiki/NAT_tr… ↩ ︎

  11. The Biggest mistake for IPv6: It ‘s not backwards compatible, developers admit www.networkworld.com/article/226… ↩ ︎

  12. Wikipedia: Classful network en.wikipedia.org/wiki/Classf… ↩ ︎

  13. Wikipedia: Classless system – Domain Routing en.wikipedia.org/wiki/Classl… ↩ ︎

  14. Google IPv6 Statistics www.google.com/intl/en/ipv… ↩ ︎

Transfer application





Creative Commons Attribution 4.0 International License agreement

The article images

Guide to illustration of technical articles