About subnet mask calculation

xiaoxiao2021-03-06  38

About subnet mask calculation

The IP address is 32-bit binary values ​​for taught the address of each computer in the TCP / IP Communication protocol. Usually we use a dot decimal, such as 192.168.0.5, and more. Each IP address can be divided into two parts. That is, the network number section and the host number section: The network number indicates the network segment number thereof, and the host number indicates the address number of the host in the network segment. According to the size of the network, the IP address can be divided into five categoriescent A, B, C, D, E, where A, B, C class are three main types of addresses, and the D-class is available for multi-purpose addresses. And class E is used to extend the standby address. A, B, and C three type IP addresses are valid for the following table:

Category Network / Placard Most Number / Place Number A 1 ~ 126/8 0 ~ 255 0 ~ 255 1 ~ 254/24 National B 128 ~ 191 0 ~ 255/16 0 ~ 255 1 ~ 254/16 Accross the organization C 192 ~ 223 0 ~ 255 0 ~ 255/24 1 ~ 254/8 Enterprise Organization

With the continuous expansion of interconnection network applications, the prior IPv4's drawbacks are gradually exposed, that is, there are too many network numbers, and the host number is too small, so the host address that it can provide is increasingly scarce. In addition to using NAT In addition to the retention address self-assignment in the enterprise, a high catei IP address is usually divided to form a plurality of subnets, providing a user base for different sizes. Here, it is mainly to effectively utilize the IP address in the case of network segmentation, and the subnet number is taken as a subnet number in the high portion of the host number, and the subnet mask is expanded or compressed from the usual network bit boundary. More subnets. However, when you create more subnets, the number of available host addresses on each subnet will be reduced. The subnet mask is the two IP addresses that belong to one subnet, and the 32-bit binary address, each of which means that the bit is a network bit, which represents the host bit. It is also the same as the IP address is also expressed. If the two IP addresses are the same as the result of the subnet mask, it indicates that they belong to the same subnet. When calculating the subnet mask, we should pay attention to the retention address in the IP address, "0" address and broadcast address, which refers to the IP address when the host address or network address is "0" or "1", which Represents this network address and broadcast address, generally cannot be calculated.

The algorithm of the subnet mask is to the example: For IP addresses that do not need to be divided into subnets, their subnet mask is very simple, that is, according to their definition, it will be written: such as a Class B IP address is 10.12.3.0, no need to divide the subnet, the subnet mask of the IP address is 255.255.0.0. If it is a C class address, its subnet mask is 255.255.255.0. Other types of push, no more detailed. Below we are the key to introducing an IP address, but also need to use its high host bits as a divided subnet number, and the remaining is the host number of each subnet. How to make a mask for each subnet Calculate. First, use the number of subnets to calculate the number of subnets to be divided before asking the subnet mask, and the number of desired hosts in each subnet. 1) Transform the number of subnets into binary to represent 2) A subnet mask of the binary bits, N3) acquire the subnet mask of the IP address, derived the previous N position 1 of the host address portion Address division subnet mask. If you want to divide the Class B IP address 168.195.0.0 into 27 subnets: 1) 27 = 110112) This binary is five digits, n = 53) Popular 555.255.0.0 host address 55555.0.0 Location 1, 55.255.248.0 is a subnet mask of Class B IP address 168.195.0.0 into 27 subnets. Second, using the host number to calculate 1) Convert the number of hosts to binary to represent 2) If the number of hosts is less than or equal to 254 (pay attention to the two IP addresses of the reserved), the number of binary bits of the host will be obtained, which is n, here Affirm n <8. If it is greater than 254, n> 8, this means that the host address will occupy more than 8 bits. 3) Use 255.255.255.255 to set all of the host address bits of this class of IP addresses, and then all from the backward n-bit to 0, that is, the subnet mask value. If you want to divide the Class B IP address 168.195.0.0 into a number of subnets, there are 700 hosts in each subnet: 1) 700 = 10101111002) This binary is ten digits, n = 103) Subnet of the B class address Mask 255.255.0.0 Host set 1, resulting in 255.255.255.255 and then then the rear 10 position is 0, ie: 1111111.1111111.1111100.00000000, 255.255.252.0. This is the subnet mask that should be divided into 700 B-class IP addresses 168.195.0.0.

The following is listed below all subnets that can be divided by various IP addresses. The number of hosts and subnets, as well as the number of hosts and subnets (maximum), pay attention to the reserved IP address (ie, there are hosts after dividing The bit or subnet is all "0" or all "1"): Class A IP address: subnet / host seat subnet mask net largest number / host maximum number 2/22 255.192.0.0 2/4194302 3 / 21 255.224.0.0 6/2097150 4/20 255.240.0.0 14/104874 5/19 255.248.0.0 30/524286 6/18 255.252.0.0 62/262142 7/17 255.254.0 126/131070 8/16 255.255.0.0 2545.255.128.0 510/32766 10/14 255.255.192.0 1022/16382 11/13 255.255.42455.255.240.0 4094/4094 13/11 255.255.248.0 8190/2046 14 / 10 255.255.252.0 16382/1022 15/9 255.255.254.0 32766/510 16/8 255.255.255.0 65536/254 17/7 255.255.255.128 131070/126 18/6 255.255.255.192 262142/62 19/5 255.255.255.224 524286 / 30 20/4 255.255.255.240 1048574/14 21/3 255.255.255.248 2097150/6 22/2 255.255.255.252 4194302/2 class B IP address: subnet / host position subnet mask subnet maximum number / host maximum number 2/14 255.255.192.0 2/16382 3/13 255.245.4255.255.240.0 14/45.248.0 30/2046 6/10 255.255.252.0 62/1022 7/9 255.255. 24.0 126/510 8/8 255.254 9/7 255.255.255.128 510/126 10/6 255.255. 1025.255.255.255.2455.255.255.2455.255.245.245.255.255.248 8190/6 14/2 255.255.255.252 16382/2 Class C ip address: subnet / host The largest number of seats / hosts in the net mask is 2/6 255.255.255.255.255.224 6/30 4/4 255.255.255.240 14/14 5/3 255.255.255.248 30/6 6/2 255.255.255.252 62/2 Further, according to the questions in CCNA, give you an example: First, let's take a look at the topic of the exam: a host's IP address is 202.112.14.137, the mask is 255.255.255.224, requirement Calculate the network address and broadcast address of the network where the host is located.

A conventional approach is to convert this host address and subnet mask into binary numbers, and the network can get the network address after logic and operation. In fact, everyone can get another way to get another method: 255.255.255.224 The IP address accommodated by 256-224 = 32 (including network addresses and broadcast addresses), then the network address with this mask must be It is a multiple of 32. The network address is the beginning of the subnet IP address, the broadcast address is end, and the host address that can be used is within this range, so only 128 of the multiple of 32 and 32, so the network address is 202.12.14.128. The broadcast address is a network address of the next network. The next 32 multiples are 160, so the broadcast address can be obtained as 202.112.14.159. This example can be understood with reference to the table below. Subcomb 2 feed subnet network Domain 2 Enter the range of host domains 2 Binary host domain Number of range 1 Submine 000 00000 ThRU 11111.0 ThRU.31 2nd subunter 001 00000 ThRU 11111.32 thru. 63 3rd net 010 00000 ThRU 11111.64 thru.95 4th child 011 00000 thru 11111.96 thru.127 5th network 100 00000 ThRU 11111.128 thru.159 6th sub-network 101 00000 ThRU 11111.160 Thru.191 7th network 110 00000 thru 1111.192 thru.223 8th network 111 00000 ThRU 11111.124 thru.255

In the CCNA test, there is also a type, you want you to make subnet addresses and calculate subnet masks based on the number of hosts of each network. This can also be calculated as described above. For example, a subnet has 10 hosts, then the IP address required for this subnet is:

10 1 1 1 = 13

Note: The first 1 refers to the gateway address required for this network connection, and then the two 1 refer to the network address and the broadcast address, respectively. Since 13 is less than 16 (16 equal to 2), the host is 4 digits. and

256-16 = 240

So the subnet mask is 255.255.255.240.

If a subnet has 14 hosts, many mistakes are: still assigned a subnet with 16 address space, and forget to assign an address to the gateway. This is wrong because:

14 1 1 1 = 17

17 is greater than 16, so we can only assign subnets with 32 addresses (32 equal to 2) space. At this time, the subnet mask is: 255.255.255.224.

转载请注明原文地址:https://www.9cbs.com/read-77864.html

New Post(0)