How to compute IP address and subnet mask _ network

Source: Internet
Author: User

Turn from: http://hi.baidu.com/ww2000e/item/98f7b9f6d396d5b430c1994f


First of all, we look at a CCNA test common problem: The IP address of a host is 202.112.14.137, the mask is 255.255.255.224, requires computing the network address and broadcast address of the host network. 255.255.255.224 masks contain 256-224 = 32 IP addresses (including network address and broadcast address), the network address with this mask must be a multiple of 32. And the network address is the beginning of the subnet IP address, broadcast address is the end, the host address can be used in this range, so slightly less than 137 and is 32 multiples of only 128, so the network address is 202.112.14.128. The broadcast address is the network address of the next network minus 1. The next 32 is a multiple of 160, so you can get a broadcast address of 202.112.14.159.
In the CCNA exam, there is also a type of question that you want to be based on the number of hosts per network subnet address planning and computing subnet mask. This can also be calculated in accordance with the above principles. For example, a subnet has 10 hosts, then for this subnet will need to 10+1+1+1=13 IP address. (Note that the first 1 is the gateway address required for this network connection, and the next two 1 refer to the network address and broadcast address respectively.) 13 is less than 16 (16 equals 2 4), so the host bit is 4 bits. And 256-16=240, so the subnet mask is 255.255.255.240.
If a subnet has 14 hosts, many students often make the mistake is: still allocated 16 address space subnet, and forgot to assign addresses to the gateway. This is wrong, because 14+1+1+1= 17 is greater than 16, so we can only allocate subnets with 32 addresses (32 equals 2 5) space. The subnet mask is: 255.255.255.224.
The host address within the subnet is calculated by: The last byte of the current host's IP address (decimal) minus the last byte of the subnet address of the current host, resulting in the current host's address.
EG: A host's IP is 192.155.12.112, its subnet address is: 0.0.0.96
Therefore its subnet host address is: 112-96=16 namely 0.0.0.16
Fast computing subnet masks and host IP
In order to divide the subnet, we need to compute the subnet mask and allocate the corresponding host block, although using the binary calculation can draw the corresponding conclusion, but it is more convenient to calculate the decimal method. After long-term practice and experience accumulation, the author sums up the subnet mask and host block decimal algorithm.
I. Clear Concepts
Before introducing the decimal algorithm, we need to define some concepts.
Class Scope:
The IP address is often dotted decimal notation x.y.y.y, where x is called a class address within the 1~126 range, and X is called Class B in the 128~191 range, and X is called the C-class address within the 192~223 range. For example, 10.202.52.130, because X is 10, within the 1~126 range, so called a Class A address.
Class default Subnet Mask:
Class A is 255.0.0.0; Class B is 255.255.0.0; Class C is 255.255.255.0. When we want to divide subnets into subnet mask M, the format of the class subnet mask is as follows: Class A is the 255.255.m.0,c class for the 255.m.0.0,b class is 255.255.255.M. M is the corresponding subnet mask, such as 255.255.255.240. The decimal calculation cardinality is 256 (below, all of our decimal calculations are performed with 256来).
Ii. Description of the variable
1. Subnet_block refers to the size of a network block that can be divided into gametes, representing the number of blocks in a subnet mask.
2. Subnet_num is a branch of the number of gametes, the network block can be divided into gametes to remove the first and last two block, is a subnet mask can be allocated in the actual number of subnets. Subnet_num =subnet_block-2.
3. Ip_block refers to the size of the IP address block that each subnet can allocate.
4. Ip_num refers to the number of IP addresses that each subnet can actually allocate. Because the first and last IP address of each subnet must be reserved (one for the network address and one for the broadcast address), it is equal to ip_block-2,ip_num also used to compute the host block.
5. M refers to the subnet mask.
The formula that represents the above variable relationship is as follows:
M=256-ip_block Ip_block=256/subnet_block or Subnet_block=256/ip_block ip_num=ip_block-2 subnet_num=subnet_block-2.
6. A power number of 2. We should be proficient in the 28 (256) within 2 of the power representation of the decimal number (such as 128=2^7, 64=2^6, etc.), so that we can immediately calculate the number of Subnet_block and Ip_block.
Iii. Illustrative examples
Now, by doing some practical examples, you can have a deep understanding of the decimal algorithm of the subnet mask and host block.
1. We know the number of subnets required 12, to find the actual number of subnets.
Here the actual subnet number refers to Subnet_num, because 12 the nearest 2 power is 16 (2^4), that is, subnet_block=16, then subnet_num=16-2=14, so the actual subnet number is 14.
2. For a subnet mask, the number of subnet hosts for a Class B subnet is known to be 60x255 (approximately equivalent to the number of x.y.0.1~x.y.59.254).
First, the power of 60 near 2 is 64 (2^6), i.e. ip_block=64; Second, the subnet mask is m=256-ip_block=256-64=192, and the last subnet mask format Class B is 255.255.m.0, which results in a netmask of 255.255.192.0.
3. If the number of subnets you want is 7, find the subnet mask.
7 The power of the nearest 2 is 8, but 8 subnet_block because to retain the first, the tail 2 subnet block, that is, 8-2=6< 7, and can not achieve the required number of subnets, so should take 2 power to 16, that is, subnet_block=16. Because the ip_block=256/subnet_block= 256/16=16, the subnet mask m=256-ip_block=256-16=240.
4. With a known network address of 211.134.12.0, you must have 4 subnets for subnet masks and host blocks.
Because of the 211. Y.Y.Y is a Class C network, subnet mask format is 255.255.255.M, also know 4 subnets, 4 near 2 power is 8 (2^3), so subnet_block=8,subnet_num=8-2=6,ip_block=256/subnet_ block=256/8=32, subnet mask m =256-ip_block=256-32=224, so the subnet mask is represented as 255.255.255.224. Also because the first and the end of the subnet block two block can not be used, so the allocation of 6 subnets, each subnet has 32 allocated host blocks, namely 32~63, 64~95, 96~127, 128~159, 160~191, 192~223, The first block (0~31) and the tail block (224~255) are not available.
Because the host blocks in each subnet block can be allocated to the first and last two can not be used (one is the subnet network address, one is the subnet broadcast address), so the host blocks are 33~62, 65~94, 97~126, 129~158, 161~190 and 193~222, Therefore, the subnet mask is 255.255.255.224, and the host block has 6 segments, namely 211.134.12.33~211.134.12.62, 211.134.12.65~211.134.12.94, 211.134.12.97~211.134.12.126, 211.134.12.129~211.134.12.158, 211.134.12.161~211.134.12.190 and 211.134.12.193~211.134.12.222. The user can select any of the 4 segments as 4 subnets.
In short, as long as the logical relationship in the formula is understood, the subnet mask can be computed quickly and the allocated host block can be obtained.

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.