Network Segment Division

Source: Internet
Author: User

We all know that IP addresses and subnet masks are composed of four digits. Here, first, let's take A look at three common IP Class a ip segments 0.0.0.0 to 127.255.255.255 www.2cto.com Class B IP segments 128.0.0.0 to 191.255.255.255 Class C IP segments 192.0.0.0 to 223.255.255.255 XP default assigned subnet mask each segment only 255 or 0 default subnet mask for category A 255.0.0.0 A subnet can accommodate A maximum of 16.77 million computers. Default subnet mask for Category B 255.255.0.0 A subnet can accommodate A maximum of 60 thousand computers. Default subnet mask for category C 255.255.255.0 a subnet can accommodate a maximum of 254 computers, if you want to put some computers in the same CIDR block, you only need to make the first three paragraphs of the IP address the same. Today, I know that I am wrong. If so, can a single subnet only accommodate 254 computers? It's a joke. Let's take a look at it in detail.
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> science type, enter a decimal number, and then click to switch the subnet mask to binary. We will find that, all subnet masks are composed of 1 of a [red] continuous [/red] and 0 of a [red] continuous [/red] (4 in total, 8 bits per segment, a total of 32 bits ). 255.0.0.0 111111.0000.00000000.000000000000 www.2cto.com 255.255.255.0.0 111111.111111.00000000.00000000 255.255.255.255.0 255.this is A/B/C binary form of the default subnet mask, in fact, there are many kinds of subnet mask, 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. Here, we can see m as the number of digits following 0. For example, when 255.255.255.0 is converted to a binary value, it is 11111111.1111.1111.00000000. There are 8 digits behind it, and m is 8. The 255.255.255.0 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. Let's try again.
201710000248.0 how many computers can this subnet mask accommodate? Calculation method: convert it to a four-digit binary number (each segment is 8 bits, if it is 0, it can be written as 8 0, that is, 00000000) 11111111.11111.111000.00000000 and then, the number is followed by a few zeros. There are 11 in total, that is, the power of 2 to the power of 11, equal to 2048. This subnet mask can accommodate a maximum of 2048 computers. The maximum number of computers that a subnet can accommodate. Let's look at the question of reverse algorithms. A company has 530 computers and forms a peer-to-peer lan. What is the most suitable subnet mask? First of all, it is undoubtedly the most suitable class B ip address for 530 computers (class A, too many, and class C is not enough, it must be Class B ), however, the default subnet mask of Class B is 255.0.0, which can accommodate 60 thousand computers. Obviously, this is not suitable. How many subnet masks are suitable? Let's first list a formula.
2 to the power of m = 560 first, we confirm that 2 must be greater than the power of 8, because we know that the power of 2 is 256, that is, the maximum number of computers allowed by Class c ip addresses, we try to use the power of 9 to the power of 2 to the power of 512, less than 1024, and the power of 10 to 2 is. It seems that the power of 2 is the most suitable. The subnet mask consists of 32 bits. It has been determined that the next 10 bits are 0, and the first 22 bits are 1. The most suitable subnet mask is 11111111.111111.11111100.00000000, which is converted to 10 hexadecimal format, that is 255.255.252.0. Www.2cto.com: allocate and calculate the subnet mask. Next, let's look at the IP address CIDR block. I believe many people share the same relationship with me. I think that the IP address is in the same network segment as long as the first three paragraphs are the same. In fact, this is not the case. Similarly, I convert each segment of the IP address into a binary number, take IP Address: 192.168.0.1, subnet mask: 255.255.255.0 as an example. 192.168.0.1 112.1600.10101000.00000000.00000001 (here, we will describe that, like the subnet mask, each segment has eight bits and less than eight bits. Add 0 to the front .) IP 112.1600.10101000.00000000.00000001 subnet mask 11111111.111111.111111.00000000
Here, I would like to explain how the same network segment is considered. In order to be in the same network segment, the network ID must be the same. How can this problem be solved? The network identification algorithms of various IP addresses are different. Class A is only the first segment. Class B, only the first and second sections. Class C: calculates the first, second, and third sections. The algorithm only needs to set the IP address AND subnet mask each digit AND. AND method: 0 And 1 = 0 0 AND 0 = 0 1 And 1 = 1 such as: AND 192.168.0.1, 255.255.255.0, first converted to binary, then, AND each IP address 11000000.10101000.00000000.00000001 subnet mask between the obtained AND result 11000000.10101000.000000000000.00000000 is converted to the decimal 192.168.0.0, which is the network ID, www.2cto.com
Then, the subnet mask is reversed, that is, the IP address AND the obtained result are 0.0.0.1, which is the host ID. To be in the same network segment, you must have the same network ID. Let's take a look at the B-type IP addresses changed to the default subnet mask, for example, 188.188.0.111, 188.188.5.222, And the subnet mask is set to 255.255.254.0. Are they in the same network segment? First, convert these to binary 188.188.0.111 255.188.188.5.222 255.255.255.255.254.0 11111111.111111.11111110.00000000. The two network IDs are different, that is, they are not in the same network segment. Check whether the IP address is in the same CIDR block. Now, let's look at it.
A company has 530 computers to form a peer-to-peer lan. What is the most suitable subnet mask and IP address? The subnet mask is not mentioned. The previous calculation result is 11111111.111111111100.00000000, Which is 255.255.252.0. We want to determine how to allocate IP addresses. First, select a Class B IP segment. Here we will select 188.188.x.x, the key to determining the first two IP segments is to determine the third segment, as long as the network ID is the same. Let's first determine the network number. (We set? Right up. 0 corresponds to *, as shown in the following figure: 255.255.252.0 11111111.111111.11111100.00000000 188.188.x.x 10111100.10111100 .?????? **. ****** Network ID 10111100.10111100 .?????? 00.00000000 ,? Enter the IP address randomly (only 0 and 1 can be used, not all of which are 0 and 1). Enter 0 in full, and * in this case, our IP address is www.2cto.com.
10111100.101100.000000 **. *********, a total of 530 computers, the last segment of the IP address 1 ~ 254 can be allocated to 254 computers, 530/254 = 2.086, using the method of entering 1, get an integer of 3, so we have determined that the third segment of the IP address should be divided into three different numbers, that is, set ** in 000000 ** to three numbers. You can only enter 1 and 0, and the numbers are different each time. As for what to fill in, it will be convenient, such as 00000011, convert it to binary, which is 1, 2, 3, so that the third segment is also determined. In this way, you can divide the IP address into 188.188.1.y, 188.188.2.y, 188.188.3.y, and y ~ Within the range of 254, And the 530 computers are different from each other's IP addresses. Some people may say that, since the algorithm is so troublesome, simply use the default subnet mask of Class a ip address and Class A. What I want to tell you is, because the number of hosts with A Class a ip address and A default subnet mask is too large, this is undoubtedly A haystack. If the LAN traffic is too frequent or too large, it will affect the efficiency, it is best to set your own IP address and subnet mask ^_^

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: info-contact@alibabacloud.com 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.