Network segment, subnet mask, network ID, IP address Division

Source: Internet
Author: User

Network Segment

Encyclopedia business cards


A cidr Block refers to the part in a computer network that uses the same physical layer device (transport medium, repeater, hub, and so on) for direct communication. From one IP address to another, it is like a network segment from to



Network Segment

The subnet mask assigned by the IP address is only 255 or 0 in each segment by default.

Class A default subnet mask a subnet can accommodate up to 16.77 million computers


Default subnet mask of type B a subnet can accommodate a maximum of 60 thousand computers


Class C default subnet mask a subnet can accommodate a maximum of 254 computers


If you want to be in the same network segment, as long as the network ID is the same, what should you do with the network ID? The first thing to do is to convert the IP address of each segment to binary. (Some people say that I won't change it. It doesn't matter. We can use the built-in calculator in windows. Open the calculator, click "View"> "programmer", enter a decimal number, and click "binary" to switch to binary .)


After switching the subnet mask to binary, we will find that all the subnet masks are composed of a string of consecutive 1 and a string of consecutive 0 (a total of 4 segments, each segment of 8 bits, 32 digits in total ). 11111111.20..00000000.000000000000 11111111.111111.


201710000255.0 11111111.11111111.111111.00000000


This is the binary form of the default subnet mask of Class A/B/C. In fact, there are many subnet masks, as long as it is a string of continuous 1 and a string of continuous 0 (each segment is 8 bits ). For example, 11111111.111111.11111000.00000000, which is also a valid subnet mask. The subnet mask determines the number of computers in a subnet. The computer formula is 2 to the power of M. In this formula, we can regard m as the number of computers following 0. For example, when is converted to a binary value, it is 11111111.1111.1111.00000000. There are 8 digits behind it, and m is 8. The subnet mask can accommodate 2 Power 8 computers, that is, 256 machines, but two IP addresses are not available, that is, the last segment cannot be 0 or 255. If the two IP addresses are subtracted, the number is 254.


Calculation Method

00 converts it to a four-digit binary number (each segment is 8 bits. If it is 0, it can be written as 8 zeros, that is, 00000000)




Then, there are several zeros behind the number, and there are 11 in total, that is, the power of 2, equal to 2048, this subnet mask can accommodate up to (2048-2) = 2046 computers.


Let's take a look at the Class B IP address changed to the default subnet mask.


For example, IP Address:,, all subnet masks are set to Are they in the same network segment?


First convert these to binary

IP (a) 10111100.10111100.20.20.1101111


IP (B) 10111100.10111100.00000101.11011010


Mask 201710000254.0 11111111.111111.11111110.00000000 is composed of 23 1 s, that is, a 23-bit mask. Simply put, after converting the decimal IP address into binary format from left to right, if the first 23 bits and 1 are the same, the IP address belongs to the same network segment, the one after the 24-bit path changes randomly and belongs to the same network segment. In this example, the IP address (a) is in the range of ~, which belongs to the same network segment only. The IP address range of IP (B) In the same network segment is ~ The range of is obviously not in the range of IP (a), so IP (A) and IP (B) are not in the same network segment.


Calculate and separately.






The network IDs are different, that is, they are not in the same CIDR block.


Ip cidr Block and subnet mask

Today's enterprises are growing in size, ranging from dozens to dozens, and now hundreds. The number of IP addresses is also increasing. We all know that the number of IP addresses in a network segment is 0-255. Apart from 0 and 255, there are only 254 computers. If there are more than 254 computers, we need to add IP addresses. How can we add IP addresses, therefore, the subnet mask is required.


Currently, an IP address is composed of four digits (which will be expanded and changed later) and is usually divided into three types:


Class A: to


Class B: to


Class C: to


Subnet Mask:

In the same CIDR Block, the network ID must be the same. The network ID uses the binary data of the IP address and the subnet mask as the "and" operations (the Windows Calculator can be used as the binary data), so the results are the same, it indicates that the IP address is in the same CIDR block. When calculating the network ID, Class a ip is regarded as the first segment, Class B is regarded as the first and second segments, and class C IP is regarded as the first, second, and third segments.


For example, the network ID of is 112.1600.10101000.20.0000.00000001


201710000255.0: 11111111.11111111.111111.00000000







The subnet mask determines the number of computers in a subnet. A simple algorithm is 2 to the power of M. M indicates the number of zeros after the subnet mask of the binary.




Binary: 11111111.111111.1111111111.00000000


There are eight 0 s behind, and m is 8. This subnet mask can accommodate two eight power computers, that is, 256 computers. Remove 0 and 255, that is, 254 computers.


Example: A company has 530 computers and forms an equivalent network. How can I set the subnet mask? How do I set an IP address?


Subnet Mask:

2 to the power of M = 530, M = 10


The last subnet mask is 10 0, so 11111111.11111111.1111111100.00000000.


In decimal format:


Let's look at the IP address. Let's select a Class B IP address, for example, 188. 188. ×. ×.


You can set the first two segments according to the B type. The key is the third segment. If the network ID is the same, it can be in the same network segment. Let's first look at the network ID: 11111111.11111111.111100.00000000


188. 188. ×. ×: 10111100.10111100 .?????? ××. ××××××××


Network ID: 10111100.10111100 .?????? 00.00000000


No matter the number x above is set to 0 or 1, the result is 0.


? Fill in 0 and 1 are the same, we fill in 0, the result is IP is:


10111100.10111100.000000 ××. ××××××× this IP address has a total of 530 computers. The last segment of the IP address is allocated to 254 computers. The total segment is 530/254 = 2.086. The first segment is divided into three segments, therefore, the IP address 000000 × can be divided into three different data types, for example, 20170001,00000010, 00000011, respectively, 1, 2, 3, so that the IP address is determined by 188.188.1. ×, 188.188.2. ×, 188.188.3. ×.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.