In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Fast subnet mask (IP address) calculation method (full core algorithm)
Since many of my friends told me that I didn't understand this method, I made some updates and added the answers to the questions for the professional title examination over the years. The following instructions may look a little tired, read more questions to understand, so I added a lot of questions. Give me a good comment if you can understand it.
Start with the mask.
We know that there are 256 IP in a Class C IP address field. There are 65536 IP in a Class B address field. The calculation method is 256 '256, then a Class An IP address has 256' 256'IP. The subnet mask is 255.255.255.0255.255.0.0255.0.0.0, respectively.
Whether it is 255.X.0.0 or 255.255.X.0 or 255.255.255.X, we usually only calculate the total number of digits of the X part of X. the total number of digits is divided into 8 digits according to the following method, and the mask part can be ignored. Because the mask part is calculated by adding weights. So just remember the weight. In fact, there is no need to remember the weight. Just remember the rules.
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
We don't care about front and back. There are all 255 in front and all zeros in the back. The bits that need to be calculated are only 8 bits, which is bit X.
The weight of bit X is the number of IP addresses in the network segment. Suppose the sixth bit of the fourth paragraph is calculated (from the previous number), the corresponding weight is 4, and the corresponding mask below is 252. The first three digits of 255.255.255.252 or / 30 are 3'8'24 and then count. If you count to four, you will have 30 places. And the weight adds up to 252. The number of IP for each segment is 4 (weights). If it's the third paragraph. It's the same thing. It's still calculated by four. 255.255.252.0 or / 22 the first three digits are 2'8'16 and the number 4 is 22. The number of IP in each segment is 42561024. The network bit is calculated by dividing it by a weight and taking an integer. For example, an IP is 192.168.1.13. So dividing 13 into 4 is 12. A value of 16 is the next network bit. It's obvious that the broadcast is 15. The IP range is 12-15. All things that need to be calculated when the available IP is 13-14 are generally. Number of IP. Network bits. Broadcast address. Subnet mask.
Subnet aggregation and split are the same principle.
Split can only calculate the number of mask digits. For example, a 24-bit mask can be divided into 2 25-bit, 4 26-bit, 8 27-bit, 16 28-bit networks. Conversely, there is no need to explain the aggregation. Since the subnet mask must be a contiguous 1, the number of bits X is 255Y is the number of digits of X. For example, 2-8-5 means
11111111 11111111 11111000 (5 1s here) 00000000
255.255.248.0
Here are some examples to illustrate:
(1) if the address block assigned by ISP to a company is 199.34.76.64Universe 28, the number of addresses obtained by the company is (54).
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
Answer: 28According to 3 surplus 4, that is, 3 255, what needs to be calculated is this 4 (the fourth from front to back). The weight of this 4 is 16, so the total number of addresses is 16. If you want to ask about the available IP, subtract 2 to 14. If you calculate the subnet mask, you can also use 256 Mask 16 is still equal to 240.
(II) if a company has 2000 hosts, it must be assigned (52) Class C networks. In order for the corporate network to have only one row in the routing table, the subnet mask assigned to it should be (53).
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
Answer: a Class C address has 256 IP. The mask for a Class C address is 255.255.255.0. There are 2048 IP in 8 C to meet 2000. We should move forward. So what we need to calculate is that 255.255.X.0 finds the bit with a weight of 8. The subnet mask is 255.255.248.0
(3) A supernet (supernet) is composed of 16 Class C networks, and the network mask (mask) should be (55).
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
A: it's almost the same as the above question, but it's asked in a different way. Find the weight 16. The subnet mask is 255.255.240.0
(4) if the IP address is 18.250.31.14 and the subnet mask is 255.240.0.0, the subnet address is (56).
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
A: find 240 and the corresponding weight is 16. Explain that every 16 IP can be divided into a segment, and calculate which segment it belongs to according to the given IP, then the IP of 18.250.31.14 must be included between the header of each segment, that is, the network address and the header of the next segment. 18.250.X.X can be simplified a bit. So we round it down to 240 with 250Universe 16. The network address is 18.240.0.0. Reverse authentication. 18.240.0.0-18.255.255.255 are all its addresses. Therefore, 18.250.31.14 is included.
(5) the converged address of the network 172.21.136.0Universe 24 and 172.21.143.0Universe 24 is (51).
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
A: if the gap between 136 and 143 is 8, it may be 8. If 136 is the network address, then it is 8, otherwise you have to carry forward. That's 16. At this point, calculate the smallest address. 136x8x17 is divisible. The network address can be determined to be 136 and then look for the subnet mask corresponding to weight 8 is 248. The number of digits is 5 (the fifth from front to back). Judging from the IP address, the subnet mask should be in the format of 255.255.X.0: 2'8'5'21
The pooled address is 172.21.136.0 Universe 21.
(6) if the subnet 172.6.32.0appo20 is subdivided into 172.6.32.0x26, then the following conclusion is correct (52).
(52) A. divided into 1024 subnets B. there are 64 hosts per subnet
C. there are 62 hosts per subnet D. divided into 2044 subnets
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
Answer: the subnet mask is 255.255.255.192 through 3 "8" 2 "26 (the second from front to back). The weight is 64. Select C there are 62 hosts per subnet. Remove a network address and a host address. )
Another solution to this problem.
Multiples 2 4 8 16 32 64 128256.
Digits 1 1 1...
Use 26-20: 6 to calculate the bit difference of the subnet mask. The sixth from the end of the journey. The multiple is 64. It is concluded that it can be divided into 64 subnets. The number of hosts in any subnet is 2 to the X power minus 2. So the number of hosts can't be 64. The reason why we don't put multiples first is for fear that everyone will get mixed up. It is also because it is not commonly used.
(7) the address belonging to network 112.10.200.0Universe 21 is (48).
(48) A.112. 10. 198. 0 B.112. 10. 206. 0 C.112. 10. 217. 0 D.112. 10. 224. 0
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
Answer: the weight corresponding to the fifth place from the second to the fifth is 8. Then each IP segment should contain eight Class C networks. It is divisible by 200x8x25, so we know that what is given in the question is the network address. Then its IP range should be 112.10.200.0-112.10.207.255, so we get the answer B.
(8) there are the following four routes: 172.18.129.0, 172.18.130.0, 172.18.132.0, and 172.18.133.0. If route aggregation is carried out, the address that can cover these four routes is (49).
(49) A.172.18.128.0 ax 21 B.172.18.128.0 Universe 22 C.172.18.130.0 Universe 22 D.172.18.132.0 Universe 23
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
To aggregate, you must first calculate the IP range. That is, the difference between the maximum IP segment and the minimum IP segment. The title is between 129 and 133. They're all odd numbers. Turn the smallest into an even number first. Make it 128. 128 is divisible by any weight and can be used as a network address. Subtract the network address 128 from the maximum value 133 and add 1 to 5 because 128 itself is one, so we + 1. Only 8 can see that the weight can include 5. Therefore, 8 Cs can meet the requirements. 8 is the fifth. Then the total number of digits is: 2'8'5'21. Obviously, the correct answer is A.
(9) the network 122.21.136.0Accord24 and 122.21.143.0Universe 24 are routed and converged, and the network address is (50).
(50) A.122.21.136.0 *
It is the same as the previous question. The same 8 Class C addresses can meet the requirements. And 136 is divisible by 8 and can be used as a network address. The answer is B.
(10) there are four subnets:
10.1.201.0/24 、
10.1.203.0/24 、
10.1.207.0/24
10.1.199.0Compact 24, the network address obtained after route aggregation is (51).
(51) A.10.1.192.0According 20 B.10.1.192.0According to 21 C.10.1.200.0Placement 21 D.10.1.224.0Universe 20
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
It's still the same. The minimum address is 199 and the largest address is 207. Change 199 to 198. There are 10 C segments in the 198MUR 207, so 10 Class C addresses are required to overwrite them. It can contain a weight of 16. We can get 2-8-4-20. But 198 is not divisible by 16. So we need to find its network address. The network address is 192 by using 198x16x12 and so using 198-6x192. Then use 192-16-208 to still cover the 207 segment, so the answer is A.
(11) the address of a campus network is 202.100.192.0ax 18. To divide the network into 30 subnets, the subnet mask should be (54), and the number of host addresses that can be assigned to each subnet is (55).
(54) A.255.255.200.0 B.255.255.224.0C.255.255.254.0D.255.255.255.0
(55) A. 32 B. 64 C. 510 D. 512
Multiples 2 4 8 16 32 64 128256.
Digits 1 1 1...
From the multiple (from front to back), we can know that 5 times can be divided into 32 subnets to meet the requirements. The difference is 5. Therefore, the number of subnet mask bits is 18 "5" 23 bits.
Calculate the mask for the 23-bit network segment:
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
The 24-bit mask is 255.255.255.0
The 23-bit mask is 255.255.254.0
23-2-8-7, still counting from the back of the trip to 7. The corresponding subnet mask is 254. The number of mask bits for a Class C address is 24. There is a difference between them. You can tell by the multiples. It contains two class C addresses. Therefore, the total number of IP is 512. 510 host addresses can be assigned. The answers are: C and C respectively.
(12) the network address assigned by a user is 192.24.0.0192.24.7.0. This address block can be expressed as (49), in which (50) host addresses can be assigned.
(49) A.192.24.0.0amp 20 B.192.24.0.0Universe 21 C.192.24.0.0Universe 16 D.192.24.0.0Universe 24
(50) A.2032 B.2048 C.2000 D.2056
There are a total of eight Class C network segments between 0muri 7.
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
It's the same as question eight. 16, 5, 21. Only B is 21.
Multiples 2 4 8 16 32 64 128256.
Digits 1 1 1...
The difference between class C address 24 and class C address 24 is 3, so it contains eight Class C addresses. 256 "8" 2048 but it is obvious that after deducting the network address and broadcast address, it should be 2046. The answer is not. So the idea of the author is that each C paragraph will be assigned separately. Then you should subtract 2 from each C paragraph. Subtract a total of 16 IP addresses. 2048-16032. Only A fits.
So the answer is: B, A.
(XIII) the address of a company's network is 200.16.192.0ax 18, which is divided into 16 subnets. In the options below, the addresses that do not belong to these 16 subnets are (52).
(52) A.200.16.236.0ax 22 B.200.16.224.0 Universe 22 C.200.16.208.0 Universe 22 D.200.16.254.0Universe 22
Multiples 2 4 8 16 32 64 128256.
Digits 1 1 1...
Obviously, the answers are all 22. We also use the difference method to get a 22-bit subnet mask.
When it is 4 times, it can be divided into 16 subnets, 18-4-22.
Calculate the network address of the 22-bit network segment
Weight 12864 32 16 8 4 2 1
Digits 1 1 1
Mask 128192224240248252254255
The 22-bit network segment has a weight of 4, so its network address is divisible by 4. 254 in the answer is not divisible by 4, not a network address.
So choose D.
Original download address: http://wenku.baidu.com/view/a9f03b130b4e767f5acfcec7
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.