Network Address-IP protocol specifies the network address protocol, which is called IP protocol. The address defined by it is called an IP address. Currently, IPv4 is widely used in the fourth version of the IP protocol. This version requires that the network address is composed of 32 binary digits. Traditionally, the IP address is represented in four decimal segments, from 0.0.0.0 to 255.255.255.255.255. Each computer on the internet is assigned an IP address. This address is divided into two parts, the first part represents the network, and the last part represents the host. For example, if the IP address 172.16.254.1 is a 32-bit address and its network part is the first 24 bits (172.16.254), the host part is the last 8 bits (the last one ). For computers in the same subnet, the IP addresses of these computers must be the same, that is, 172.16.254.2 and 172.16.254.1 must be in the same subnet. However, the problem is that we cannot determine the network part from the IP address alone. Take 172.16.254.1 as an example. Whether the network part is the first 24 bits, the first 16 bits, or even the first 28 BITs cannot be seen from the IP address. So how can we determine whether two computers belong to the same subnet from the IP address? This requires another parameter "subnet mask" (subnet mask ). The so-called "subnet mask" is a parameter that represents a sub-network feature. It is equivalent to an IP address and also a 32-bit binary number. Its Network part is all 1 and the host part is all 0. For example, if the IP address 172.16.254.1 is known to be the first 24 bits and the host part is the last 8 bits, then the sub-network mask is 11111111.111111.111111.00000000, which is written as decimal limit 255.0. Knowing the "subnet mask", we can determine whether any two IP addresses are in the same subnet. The method is to perform the AND operation on the two IP addresses AND subnet masks respectively (the two digits are both 1, AND the calculation result is 1, otherwise 0), AND then compare whether the results are the same. If yes, it indicates that they are in the same sub-network, otherwise they are not. For example, the subnet masks of IP addresses 172.16.254.1 and 172.16.254.233 are both 255.255.255.0. Are they in the same subnet? The two AND the subnet mask perform the AND operation respectively, AND the result is 172.16.254.0. Therefore, they are in the same subnetwork. To sum up, the IP protocol has two main functions: one is to assign an IP address to each computer, and the other is to determine which addresses are in the same subnet.