A comprehensive guide to IP addresses

A comprehensive guide to IP addresses

IP address is a term that everyone is familiar with. For example, the role of IP in the Internet is like the recipient address and sender address when sending a letter. The recipient address allows the letter to be delivered correctly, and the sender address allows the recipient to reply.

IP address is a unique address that every Internet device has. Its essence is the network layer protocol in the TCP/IP protocol suite and is also the core protocol of the TCP/IP protocol suite. Since Jon Postel first defined IP in RFC791 in 1981, IP has become the foundation of today's Internet technology. The protocol suite currently used by the global Internet is the TCP/IP protocol suite. IPv4 is the fourth version of the Internet Protocol (IP).

How IP addresses are represented

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

 01111111000000000000000000000001

Obviously, directly displaying the full 32-bit IP address is neither intuitive nor easy to remember. So for ease of use, we divide the 32-bit binary number into groups of eight, called octets. Each octet is written in dotted decimal format. Each octet has a value of 00000000~11111111 (binary number), and the value is 0~255 when expressed in decimal. This makes the IP address look like this:

 01111111 00000000 00000000 00000001

Because the conversion between binary and decimal is very simple, you only need to multiply each bit of the binary number by 2 to the power of N, where N is the corresponding bit, starting from the low bit to the high bit with 0, and adding the results of each bit of binary that is 1 will get the corresponding decimal number.

The 32-bit binary IP address is represented by dotted decimal, except for all 0s, the range is from 000.000.000.001 to 255.255.255.255. Then further optimization, for example, for 000.000.000.001, the high-order 0 in each octet can be omitted, that is, 0.0.0.1. This step by step finally made the IP address become the most familiar to us today, such as 10.0.0.1, 192.168.33.44 and so on.

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

 127.0.0.1  

The structure of an IP address

Seeing this, you will naturally think, in addition to the local address, does IP have other addresses? Unexpectedly, there are indeed. IP addresses can be divided into two parts: network address and 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 compare IP addresses to telephone numbers, in the telephone 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 telephone in Hangzhou, similar to the host address part of the IP address.

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

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

Classification of IP addresses

When IP was designed, IP addresses were divided into five levels (Class A, B, C, D, E). The three most commonly used IP addresses are Class A, B, and C, which are suitable for large, medium, and small networks respectively. When applying for an IP address, the organization responsible for managing IP addresses will grant IP addresses of different levels according to the network scale required by the applicant.

The network part and host part of classes A, B, and C have different lengths. The shorter the network address, the more corresponding host addresses can be allocated.

Among the A, B, and C class addresses, some are used as private addresses. Private addresses are also called private network addresses or fake addresses. They are IP addresses that are not used on the Internet but only on the internal LAN of an enterprise or organization. Correspondingly, IP addresses that can be used on the Internet are called public network addresses or real addresses. The existence of private addresses means that hosts in the LAN do not need to be allocated all available addresses on the Internet, thereby saving limited IP address resources.

The Future of IP Addresses

We mentioned earlier that IPv4 has a total of 2^32-1 addresses. This number may seem a lot at first glance, but considering that every mobile phone, every computer, and even every refrigerator is connected to the Internet and needs an IP address, this number is not enough.

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

Without IP addresses, new devices cannot access the Internet. To solve this problem, we began to embrace IPv6. The number of IPv6 addresses is 2 to the 96th power of IPv4, so there is no need to worry about address exhaustion. As early as 1998, we began to conduct experimental research on IPv6, but there was a very serious problem before us. That is, the intercommunication between IPv6 and IPv4 requires special technology and equipment. To solve this problem, we accelerated 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 realized IPv6 interconnection and intercommunication of 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 China's Internet users. 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.

<<:  Understand the IP location function of the entire network in one article

>>:  SPI Subsystem SPI Driver

Recommend

How does user-mode Tcpdump capture kernel network packets?

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

Let’s talk about the privacy and security of 5G technology

On March 17, 2022, the European Parliament's ...

Types of Cabling in a Structured Cabling Environment

If you are considering a structured cabling envir...

Some thoughts on the information construction of the financial industry

The rapid development of information technology h...

Want to know about 5G synaesthesia integration? Just read this article

Development Background Synaesthesia integration: ...

Six tips for optimizing network security vendor integration

As the network security situation becomes increas...

Report: Global mobile broadband coverage reaches 95%

The majority of the world’s population – 95% – is...

Building the future: How ICT can help develop livable cities

With the steady acceleration of global urbanizati...

Learn about FTP/FTPS/SFTP file transfer protocols in one article

Introduction to FTP FTP (File Transfer Protocol) ...