Internet traffic is sent as a series of Internet protocol, or IP, packets. IP packets contain a destination address that routers use in order to decide where to send the packets. Because there are more than 4 billion possible IP addresses, it is impractical for a router to keep track of how to handle packets addressed to every possible IP address. Instead, routers use the classless inter-domain routing, or CIDR, system, a scheme in which groups of contiguous IP addresses are handled as one manageable unit. A netmask identifies the CIDR subnet to which an IP address belongs.
- Skill level:
- Moderately Challenging
Other People Are Reading
Things you need
- Scientific calculator
Write down the first IP address and the last IP address in the range.
IP addresses are written in "dot decimal" notation; they are four numbers between 0 and 255 separated by periods. For this example, assume that the first and last IP addresses are 220.127.116.11 and 18.104.22.168.
Type the first portion of the first IP address--the first octet--into the scientific calculator.
If the first IP address is 22.214.171.124, you should type "11" into the calculator.
Use the calculator to convert the number from decimal to binary.
For example, 11 in decimal gets converted to 1011 in binary.
Pad the binary number with leading zeroes such that the new binary number is exactly 8 digits long.
If the calculator displays 1011 in binary, write it as 00001011.
Convert the remaining three octets of the first IP address from decimal into binary, padding them to 8 digits.
If the last three octets of the first address are 22, 33, and 44, then write these as 00010110, 00100001, and 00101100, respectively.
Convert all four octets of the last IP address from decimal to binary.
If you are using 126.96.36.199 as the last IP address, then write these octets as 00001011, 00010110, 00100001, and 00110111, respectively.
Write the two IP addresses in binary form such that the last IP address is aligned beneath the first IP address. Use periods to separate the octets from each other.
In the example using 188.8.131.52 and 184.108.40.206 write:
Compare the first two digits in the leftmost column. If these two digits are the same, then keep moving one column to the right until you find a column where the two digits are not the same.
Label the column at which the two digits are not the same. This column is called the "network-host boundary."
Using the example of 220.127.116.11 and 18.104.22.168, the network-host boundary appears after the 27th digit. The boundary is shown below as a space:
Starting in the leftmost column, write a series of "1" digits in a new line aligned below the two binary IP addresses.
If you are following the example, start by writing:
Stop writing "1" digits at the network-host boundary and start writing "0" digits instead.
Your numbers should look like this:
Continue writing "0" digits until all 32 digits are accounted for.
Your finished lines will resemble the following:
Circle the binary number on the last line--it's the netmask.
In this example, the netmask is:
Convert each of the octets of the netmask from binary to decimal.
If you are following this example, your netmask is:
Tips and warnings
- Plenty of free software programs exist that compute subnet masks from IP address ranges.
- An IP address range can be covered by more than one subnet mask. There is no way to find the "ideal" netmask given a range of addresses.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for