How to determine whether two IP addresses are in the same CIDR Block? To determine whether two IP addresses are in the same CIDR Block, perform and calculate the IP addresses and subnet masks respectively. The result 1 is displayed, if the network numbers are the same, they are in the same subnet. Otherwise, they are not in the same subnet. For example, if the subnet mask 255.255.254.0 is selected, the two IP addresses and the mask are respectively used and calculated as follows: www.2cto.com 211.95.165.24 11010011 01011111 10100101 00011000255.255.254.0 11111111 11111111 111111110 00000000 and the result is: 11010011 01011111 10100100 201710000211.95.164.78 11010011 01011111 10100100 0100111000000000254.0 11111111 11111111 111111110 00000000 and the result is: 11010011 01011111 10100100 00000000
We can see that the obtained results (the result is the network address) are the same, so we can determine that the two IP addresses are in the same subnet. For example, if a class C address is 192.9.200.13 and its default subnet mask is 255.255.255.0, the network number and host number can be obtained as follows:
Step 1: Convert the IP address 192.9.200.13 to binary 1st 11000000 00001001 11001000 Step 2. Convert the subnet mask 255.255.255.0 to binary 00001101 2nd 11111111 11111111 step 11111111, perform the AND operation on the preceding two binary numbers, AND the result is the network part. "11000000 00001001 11001000 00001101 11111111" and "11111111 11111111 00000000 11000000" are computed with "00001001 11001000 00000000", that is, "192.9.200.0". This is the network number of the IP address, or "network address ". In step 3 of www.2cto.com, the binary value of the subnet mask is reversed, AND then the IP address is used for the AND operation. The result is the host part. For example, if "00000000 00000000 00000000 11111111 (subnet mask value)" and "11000000 00001001 11001000 00001101" are reversed, and the calculation result is "00000000 00000000 00000000 00001101", that is, "0.0.0.13 ", this is the host number of the IP address (which can be simplified to "13 "). Three of the host bits are classified as "network ID". Because the network ID number should be "1", the corresponding byte segment of the host number is "11100000 ". Convert to 224 in decimal format, which is the final subnet mask. For A class-C network, the subnet mask is 255.255.255.255.255.255.255.255.255.224.0. For A class-A network, the subnet mask is 255.255.224.0.0.