One article talks about those things about IP addresses

2022.05.16
One article talks about those things about IP addresses

New devices cannot access the Internet without IP addresses, and to solve this problem we started to embrace IPv6. The number of IPv6 addresses is 2 times the 96th power of IPv4, so there is no need to worry about the problem of address exhaustion.

IP address is a term that everyone is familiar with. Taking life as an example, the role of IP in the Internet is like the recipient address and sender address when sending a message. The recipient address allows the letter to be delivered correctly, and the sender address allows the recipient to receive the letter. can reply.

As a unique address owned by every Internet device, IP address is essentially a protocol of the network layer in the TCP/IP protocol suite, and is also the core protocol of the TCP/IP protocol suite. Since Jon Postel defined IP for the first time in RFC791 in 1981, IP has been the foundation of today's Internet technology. The protocol suite used by the current global Internet is the TCP/IP protocol suite. IPv4 is the fourth version of the Internet Protocol (IP).

IP address representation

An IPv4 address (hereinafter collectively referred to as an IP address) is an address represented by a 32-bit binary number. Therefore, IPv4 has a total of 2^32-1 addresses, except that the all-zero address is used to represent an invalid, unknown, or unavailable destination. It usually looks like this:

01111111000000000000000000000001
  • 1.

Obviously, showing the full 32-bit IP address directly is neither intuitive nor memorable. So for the convenience of use, we divide the 32-bit binary numbers into groups of eight bits, which are called octets. Each octet is identified in dotted decimal format when written. The value of each octet is 00000000~11111111 (binary number), and the value of decimal number is 0~255. This makes the IP address look like this:

01111111 00000000 00000000 00000001
  • 1.

And because the conversion between binary and decimal is very simple, you only need to multiply each bit of the binary number by the N power of 2, where N is the corresponding bit, starting from the low bit to the high bit to the power of 0, and the binary The result of adding each bit of 1 is the corresponding decimal number.

A 32-bit binary IP address is identified using dotted decimal, except for all zeros, the range is from 000.000.000.001 to 255.255.255.255. Then for further optimization, for example, for 000.000.000.001, in each octet, the high-order 0 may not be written out, that is, 0.0.0.1. This step by step finally made the IP address the one we are most familiar with now, such as 10.0.0.1 and 192.168.33.44.

By the way, after the IP address we used in the example above is converted to dotted decimal, it is the well-known local loopback address. This address is the internal IP address of the foundation. It is mainly used for network software testing and local machine inter-process communication, no matter what Once the program uses the loopback address to send data, the protocol software returns it immediately without any network transmission.

127.0.0.1
  • 1.

The structure of an IP address

Seeing this, everyone will naturally think, in addition to the local address, is there any other IP address? I didn't expect it, it really does. An IP address can be divided into two parts: the network address and the host address.

  • Network address: Indicates the network area where the host is located
  • Host address: The specific logical location of the host in the network area

If we make an analogy between an IP address and a phone number: in the phone number 0571-81020204, 0571 is the area code, representing Hangzhou, Zhejiang, similar to the network address part of the IP address. 81020204 is the exact number of a phone in Hangzhou, which is similar to the host address part of an IP address.

When an IP data packet is transmitted in the network, the router only cares about the network address part of the destination IP address, and performs routing operations for the IP data packet by identifying the network part of the IP address. When the data packet reaches the destination network segment, the specific receiving host is searched through the host part of the IP address.

So, for the IP address, which bits are the network part and which are the host part? This needs to be divided according to the network scale and actual needs.

Classification of IP addresses

IP was designed with five classes of IP addresses (Class A, B, C, D, E). The commonly used IP addresses are A, B, and C, which are applicable to large, medium and small networks respectively. When applying for an IP address, the agency responsible for managing the IP address will assign different levels of IP addresses according to the network scale required by the applicant.

The lengths of the network part and the host part of the A, B, and C classes are different. The shorter the network address, the more host addresses that can be assigned.

Among the A, B, and C class addresses, some are used as private addresses. A private address, also known as a private network address or a fake address, refers to an IP address that is not used on the Internet but is only used on the intranet of an enterprise or organization. Correspondingly, IP addresses that can be used on the Internet are called public addresses or real addresses. The existence of private addresses allows hosts in the LAN not to allocate all available addresses on the Internet, thus saving limited IP address resources.

The future of IP addresses

We mentioned earlier that IPv4 has a total of 2^32-1 addresses. At first glance, this number seems to be a lot, but considering that every mobile phone, every computer, and even every refrigerator will be connected to the Internet and need an IP address, this amount is suddenly insufficient.

On February 3, 2011, IANA (Internet Assigned Numbers Authority) announced that the IPv4 addresses in its address pool have been allocated. On April 15, 2011, the Asia Pacific Internet Network Information Center (APNIC) allocated the last IPv4 block for the European Network Information Center (RIPE NCC) on September 14, 2012, and on June 10, 2014 for Latin America and The Caribbean Sea (LACNIC) allocated the last IPv4 block. IPv4 blocks were allocated for North America on September 24, 2015, and on November 26, 2019, the European RIPE NCC finally ran out of storage.

New devices cannot access the Internet without IP addresses, and to solve this problem we started to embrace IPv6. The number of IPv6 addresses is 2 times the 96th power of IPv4, so there is no need to worry about the problem of address exhaustion. As early as 1998, we started related experimental research on IPv6, but there is a very serious problem before us. That is, the intercommunication between IPv6 and IPv4 requires specialized technology and equipment. To solve this problem, accelerate the deployment and application of IPv6. The Ministry of Industry and Information Technology guided basic telecommunications companies to complete the IPv6 upgrade and transformation of backbone networks, LTE networks, and metropolitan area networks, and achieved IPv6 interconnection between 14 backbone network direct connection points across the country.

Data shows that as of December 2021, the number of active IPv6 users in my country has reached 608 million, accounting for about 60.11% of Chinese netizens. In terms of traffic, the total IPv6 traffic of the metropolitan area network exceeded 44.77 Tbps, accounting for 9.38% of the total network traffic, and the total IPv6 traffic of the LTE core network exceeded 24.43 Tbps, accounting for 35.15% of the total network traffic.