About 192.168.0.0/24 with CIDR

In fact, this is a network segment, or subnet, expressed in the form of CIDR (Classless and Subnet Address Extensions and Supernetting).

    We know that to determine a subnet, we need to know the host address and subnet mask, but in the form of CIDR, we can simply get two values. For example, "192.168.0.0/24" means that the IP address of this network segment starts from 192.168.0.1 and ends at 192.168.0.254 (192.168.0.0 and 192.168.0.255 have special meanings and cannot be used as IP addresses); The subnet mask is 255.255.255.0.

 

Where did the above subnet mask come from? In fact, the key lies in the "24". We know that IP addresses are composed of four decimal numbers, which are equivalent to 32-bit binary. In CIDR representation, the latter number divides the 32 bits (take 24 as an example): the first 24 bits are represented by "1", and the last 8 bits are represented by 0, resulting in a binary number:

 

11111111 11111111 11111111 00000000。

Convert it to decimal, that is: 255.255.255.0

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326403484&siteId=291194637