Subnets and CIDR
Converts a regular subnet mask to binary, the subnet mask is found to be contiguous binary 1 followed by 0, where the subnet mask is 1 in the network ID and the subnet mask is 0 for the host ID. For example, 255.255.0.0 is converted to binary 11111111 11111111 00000000 00000000. In the example cited above, why not use a continuous 1-part representation of the network ID, a continuous 0 part represents the host ID? The answer is yes, the IP addressing technology using this scheme is called non-class inter-domain routing (CIDR). CIDR Technology uses a contiguous 1 portion of the subnet mask to represent the network ID, and a contiguous 0 portion represents the host ID. For example, the network contains 2000 computers, only need to use 11 bits to represent the host ID, with a 21-bit table network ID, the subnet mask is expressed as 11111111.11111111.11100000.00000000, and the conversion to decimal is 255.255.224.0. At this point, the network will contain 2046 computers, neither resulting in a waste of IP addresses or using routers to connect to the network, adding additional administrative maintenance. &NBSP;CIDR means: The number of bits of the IP address/network ID, such as 192.168.23.35/21, which uses 21 bits to represent the network ID. Example 1:192.168.23.35/21 Subnet mask: 11111111 11111111 11111000 00000000 is 255.255.248.0 Network id:192.168.00010111.0 (where the third byte of the red part indicates the network ID, the other represents the host ID, the network ID is the network ID part remains unchanged the host ID all becomes 0) then the network ID is 192.168.16.0 Start IP Address: 192.168.16.1 (host ID cannot be all 0, all 0 means network ID last one is 1) End IP Address: 192.168.00010111.11111110 (host ID cannot be all 1, all 1 means local broadcast) then the end IP address is: 192.168.23.254. Example 2: divides 163.135.0.0 into 16 subnets, computes the network ID, subnet mask, and start and end IP addresses of the first two subnets. 1th Step: 163.135.0.0/20 is represented in CIDR, the subnet mask is 255.255.240 (11110000). 0. 2nd step: First network ID (subnet mask and IP address and operation): 163.135.0.0 First IP address: 163.135.0.1 End IP Address:163.135.15.254; 3rd step: Second network id:163.135.16.0 First IP address: 163.135.16.1 End IP Address: 163.135.31.254. Fast calculation method of subnet mask and network ID The subnet mask of the &NBSP;CIDR is a continuous 1 followed by the 0 representation of the connection, the subnet mask has the following methods: 0000 0000 0 1000 0000 128 1100 0000 128+64=192 1110 0000 128+64+32=224 1111 0000 255-15=240 1111 255-7=248 1111 1100 2 55-3=252 1111 1110 255-1=254 1111 1111 255 Everyone knows that the 11111111 decimal number is 255, then how do we calculate the subnet mask quickly? binary 1=1,11=3,111=7,1111=15; so 1111 1110=255-1,1111 1100=255-3,1111 1000=255-8,1111 0000=255-15 is that so soon? As soon as we determine how many bits in the subnet mask represent the network ID, we can write the subnet mask right away. So how do we calculate for 1000 0000,1100 0000 and 1110 0000? 27=8 is 1000 0000=128,1100 0000=128+64,1110 0000=128+64+32, so we do not need to remember how much each, only need to do a simple addition and subtraction to take care of the subnet mask calculation. Network ID Results We all know that the network ID part is unchanged, the host ID portion becomes 0, then in the calculation of the network ID, first look at how many bits in the subnet mask to represent the network, corresponding to the IP address conversion to binary only the previous few, such as 192.168.176.15/ 19, the network ID altogether 19 bits, then the network ID the first two bytes is 192.168.x.0 to change the third byte. So how do you quickly calculate the value of the X for this change? We know that the third byte has only three bits representing the network ID, the conversionWhen 176>128, 1th bit is 1,176-128=48<64, 2nd bit is 0,48>32 3rd bit is 1, the remaining calculation is meaningless, all to convert to 0, the network ID is 10100000, then the network The ID is 192.168.160.0, so the likelihood of error is very small. eg.200.100.48.0--200.100.55.0 IP for 200.100.48.0/2148=0011 0 the49=0011 0001... ... 55=0011 0111In addition to the red IP bits other as a subnet is 1 then there are 21 themes to turn from (http://www.2cto.com/net/201303/192100.html)
Subnetting with CIDR (slash plus number representation vs. IP) (improved)