Calculate the number of subnets and other comprehensive instances

Source: Internet
Author: User
Known 172.31.128.255/18, trial calculation:

1. Number of subnets,

2. network number,

3. host number,

4. broadcast address,

5. start and end ranges of allocable IP addresses

Solution:

1. count the number of subnets

First, replace/18 with our customary Notation:

The value of 11111111.1111.11000000.000000 is decimal, that is, 201710000192.0. We can see that the two sections on the left of the mask are consistent with the default mask of Class B, so the mask is within the range of the default mask of Class B, this means that we will divide the Class B network into subnets. The Class B mask uses 16 bits (16 zeros) to represent the IP addresses that can be allocated. The mask in this question adds two more netmasks to the Class B default mask to indicate the 1 of the network number, this means that the class B network is divided into (11) two-digit subnets, and (11) two-digit conversion to decimal is 4, therefore, in this question, the Class B network is divided into four subnets.

2. Calculate the network number

Use the formula: perform the "and" Operation on the binary IP address and the subnet mask. The result is the network number. The rule of "and operation" is 1 and 1 get 1, 0 and 1 get 0 and 0 get 0.

Convert 172.31.128.255 to binary: 10101100.000111.0000000.11111111, mask: 11111111.11111111.11000000.00000000

Therefore:

10101100.00011111.0000000.111111

11111111.111111.111111600.00000000

10101100.00011111.0000000.00000000

Set 10101100.00011111.0000000.00000000

The network number is 172.31.128.0 in decimal format.

3. host number calculation

Also, use the formula: Use the binary of the IP address and the inverse code of the binary of the subnet mask to perform the "and" operation. The result is the host number. The reverse code is to change the original value of 0 to 1, and the original value of 1 to 0. Because the mask is 11111111.111111.1111600.00000000

Therefore, the anti-code is represented as zookeeper .00000000.00111111.11111111. Then, the bitcode representation of the IP address and the mask is used for the "and" Operation:

10101100.00011111.0000000.111111

201710000.00000000.00111111.111111

201710000.00000000.00000000.11111111

Set the ingress. ingress. 11111111

To convert the IP address to 0.0.0.255 in decimal format, we remove the 0 value on the left and leave only the number on the right. Therefore, the host number of this IP address is 255. The host number indicates that the IP address is added to the network number plus 255.

4. Calculate the broadcast address

Also, use the formula: Based on the obtained network number, fill in 1 for all the binary bits of the host that represents the IP address on the right of the network number, then convert the binary number to the decimal number to obtain the broadcast address. Because the subnetmask in this question is 11111111.111111.11000000.00000000, and the network number occupies 18 bits, it indicates that the binary position of the host part of the IP address is 14 bits. We will set the network number 172.31.128.0, convert to the binary value 10101100.000111.0000000.00000000. Then, replace all the 14 zeros with 1 (10101100.000111.10111111.111111) from the number on the right. This is the binary representation of the broadcast address of this subnet. Convert the binary broadcast address to 172.31.191.255 in decimal format.

5. Calculate the available IP address range

Because the network number is 172.31.128.0 and the broadcast address is 172.31.191.255, the available IP address range in the subnet is from network number + 1 to broadcast address-1, therefore, the available IP address range in the subnet is from 172.31.128.1-172.31.191.254.

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.