Computer IP Subnet Mask Algorithm

  
I. Using the Number of Subnets to Calculate Before you can find the subnet mask, you must first figure out the number of subnets to be divided and the number of required hosts in each subnet. 1) Convert the number of subnets into binary to represent 2) Get the number of bits in the binary, which is N 3) Obtain the class subnet mask of the IP address, and get the first N position of the host address part. IP address subnet mask of the subnet. To classify the Class B IP address 168.195.0.0 into 27 subnets: 1) 27=11011 2) The binary is a five-digit number, N = 5 3) The subnet mask of the Class B address is the host address of 255.255.0.0. The first 5 positions are 1, and 255.255.248.0 is obtained, which is the subnet mask of the Class B IP address 168.195.0.0 divided into 27 subnets. Second, use the number of hosts to calculate 1) convert the number of hosts into binary to represent 2) if the number of hosts is less than or equal to 254 (note that the two reserved IP addresses are removed), then the binary digit of the host is obtained, which is N, here Definitely N<8. If it is greater than 254, then N>8, which means that the host address will occupy more than 8 bits. 3) Use 255.255.255.255 to set the number of host address bits of this type of IP address to 1, and then set all N bits from 0 to 0 to be the subnet mask value. If you want to divide the B(c) class IP address 168.195.0.0 into several subnets, there are 700 hosts (17) in each subnet: 1) 700=1010111100 2) The binary is tens digit, N = 10 (1001 3) Set the host address of the subnet mask 255.255.0.0 of the class B address to 1, 255.255.255.255 and then the last 10 bits from the back to the front, which is: 11111111.11111111.11111100.00000000 or 255.255.252.0. This is the subnet mask of the Class B IP address 168.195.0.0 that you want to divide into 700 hosts.
Copyright © Windows knowledge All Rights Reserved