IP addresses related calculations

IP addresses related calculations

Prior to 2:00 computing power of each number from 0 to 8, we should be familiar with. As follows:
Results 1286432168421 
powers of 2 76,543,210


as the number of divisions of sub-division, such as to divide four subnets, each of the hosts 58, which can select a host six bit address of a class C, since the 6 th power of 2 as 64, the closest 58, so you can use the network for the remaining 28 bits,


for an IP address with a subnet mask network address calculation, calculation should be done phase binary and binary forms the subnet mask of the IP address, i.e., the result is to change the network address of the subnet address is located. Such as:
the IP address 192.168.0.1
Subnet Mask 255.255.255.0
the AND operation
conversions binary operation:
the IP address 11010000.10101000.00000000.00000001
subnet mask 11111111.11111111.11111111.00000000
the AND operation
     11000000.10101000.00000000.00000000
after conversion to decimal:
      192.168.0.0
i.e. 192.168 .0.1 255.255.255.0 subnet address is 192.168.0.0 where the


calculated number of subnet mask and subnet host:

When you know the number of a network address and requirements of subnetting, you can determine the number of bits that the network location, and then the number of bits that the host bits of the network from the median position, so that we can further draw each the number of hosts in the network, since all bits are multiples of 2, so the host number of each subnet may be cumulative, illustrated:

Example 1:

Known network address 211.134.12.0, have four subnets, subnet mask, and each host request block.
4 seen from subnets, the minimum size of the network should be 8 bits, because if the network and remove all 0 all 1 bits is 4, only two subnets are available, does not meet the requirements. Network 8-bit bit size bit means that the network 3, to address 211.134.12.0, it is a Class C address, and that the remaining bits of the host should be 8-3 = 5. Mathematically, i.e., five times a power of 2, a total of 32 host, which is the number of hosts on each subnet, but remove all 0 and the local network broadcast address of each subnet hosts may allocate a 30 hours. For the number of subnets, a total of 3 times a power of 2 minus 2, 6 subnets, each subnet if we put eight identified with 0 to 7, 0 to 255 with the host identifier found at:

subnet Code host range block range network host bits subnet
subnet 000000000000 ~ 000,111,110 ~ 31 (local network, should be removed)
subnet 100100100000 0011111132 ~ 63 ~
sub ~ 201001000000 0101111164 ~ 95
subnet 301101100000 0111111196 ~ 127 ~
sub ~ 410010000000 10011111128 to 159
subnets 510110100000 10111111160 ~ 191 ~
sub ~ 611011000000 11011111 from 192 to 223
subnets 711111100000 11111111224 ~ ~ 255 (subnet broadcast, should be removed)


is removed and the host network bit bit all-zero and all-one address, the actual address may be applied are:


subnet network Code host range block host bits subnet range
Subnet 100100100001 0011111033 ~ 62 ~
subnet 201001000001 0101111065 ~ 94 ~
subnet 301101100001 0111111097 ~ 126 ~
sub ~ 410010000001 10011110129 to 158
subnets 510110100001 10111110161 ~ 190 ~
sub ~ 611011000001 11011110193 ~ 222


we found that according to the definition of the subnet mask, which is used to effect division of subnets, the subnet mask can be expressed as 211.134.12.X, wherein X is a bit size of the network, i.e., 111 in binary, decimal 224, the subnet mask is 211.134.12.224. In fact, we are 256 known from the size of each group of bits, minus the value of the number of hosts per subnet (host block) to obtain the mask 256. In this example, 256 is subtracted 224 to yield 32.


Can be obtained by summarizing the relationship of the above relationship indicates:
(1) = IP address of the subnet mask block size assignment each subnet 256-
(2) IP subnet address block size for each assignable = 256 / subnet may be allocated block size
(3) may be assigned sub block size = 256 / I, each subnet assigned IP address block size
(. 4) the number of IP addresses per subnet = actual allocation can be assigned to each subnet IP address block size -2
(5) can be assigned a subnet number of allocatable sub-block size = -2
In fact, from the above example we can know the network address of each subnet that the host range of the block in the first subnet of the host, the subnet broadcast address of each block is the host range of subnet last host addresses, such as sub-network 3, which is 96 bits network address is the host address of the host, while the subnet broadcast address bit which is the host subnet 127 is the host address. Of course, when we use the actual calculation may be calculated using the nature of the addition of a multiple of 2. As we have calculated the number of hosts each subnet is 32, known to the first subnet range is from 0 to 31; The first host 32 is the second subnet, and the last is the last in the first subnet a host on the basis of 31 plus 32, i.e. 31 + 32 = 63, i.e. second subnet range is 32 to 63; the first third of the subnet host 64, and the last one is the first subnet Finally, a host 32 coupled on the base 63, i.e., 63 + 32 = 95, the third sub-range, i.e. 64 to 95. And so on, the host range of the fourth, fifth · · · · · · And thus calculated subnet not be used, because the first block of each subnet host and the last address should be removed , i.e. the first subnet is 0 and 31, 32 and the second subnet 63, the third 95 and the subnet 64, wherein the front of the small local network address, followed by a large local broadcast address.
In fact, the local network address of each subnet must be an even number (due to the all-0, the last one to determine this value is 0 is an even number), the local broadcast address for each subnet must be an odd number (due to the full 1, 1 is determined to be the last bit value is odd); while the first available address for each subnet which is the network address plus 1 (because the network address is even, so that the first available address must is an odd number), the last available address in each subnet broadcast address of its minus 1 (because the broadcast address is odd, so it will be the last available address is even), and they must two adjacent, i.e. the first network address of the n-1 subnet - a subnet of the n-1 first available address of the n-1 ......... subnet last available address - the n-1 subnet broadcast address - of network address subnets n - n-th first available subnet address ...... ... n-th last available subnet address - the broadcast address of the n-th sub - n + 1-th sub-network address - n + 1, the first subnets ......... first available address n + 1 subnet address last available - the n + a subnet broadcast address ......
Example 2:

A company has 530 computers form a peer local area network, the number of subnet mask set up the most appropriate?
  First of all, no doubt, 530 computer using the most appropriate class B IP (A Class Needless to say, too, C class and not enough, certainly Class B), but the default class B subnet mask 255.255.0.0, can accommodate 60,000 computers, is clearly not appropriate, then set the subnet mask how much better? Let's take a column formulas.
  M = 560-th power of 2
  First, we must be greater than 2 determines the power of 8, because we know that the 8th power is 256, i.e. the maximum number of Class C IP receiving computer, from the 9 th a a test 2 512 9 th, 10 th 560,2 is less than 1024, it seems most appropriate power of 2, 10 of. A total of 32 bits subnet mask, it has been determined back 10 is 0, that is in front of the 22 1, the subnet mask is the most appropriate: 11111111.11111111.11111100.00000000, converted to decimal, that is 255.255. 252.0.

Guess you like

Origin www.cnblogs.com/yzr9/p/11949300.html