I’m studying for the MS 70-411 test now, and it includes some IPv6 routing and transition technology. It also includes some remote connection technologies like Direct Access and VPN. Studying made me realize that I didn’t actually know that much about IPv4. Here’s the scoop.
Things an Admin Should Know Regarding IPv4
- How to convert a CIDR network address into an IP + subnet mask.
- How to convert from an IP + Subnet notation into CIDR notation.
- How to calculate the starting and ending addresses of a network.
CIDR into an Subnet Mask
To convert CIDR into an IP range, do the following:
- Take the number after the slash. This is the network prefix. Write out a string of the character ‘1’ until you’ve written the same number of characters as the prefix is. Put a period (dot) every 8 characters.
- Finish off the line with “zero’s” until you have a total of 32 characters.
- Convert the line of “one’s” from binary into decimal. This is your subnet mask.
For the network 192.168.111.240/29:
Step 1 – write 29 “one’s”
Step 2 – fill the line with “zero’s” until we reach 32 characters:
Step 3 – Convert to decimal.
11111111 = 255
11111000 = 248
The subnet mask for 192.168.111.240/29 is 255.255.255.248.
Subnet Mask into CIDR
To convert a subnet mask into CIDR slash notation, we just run the process backwards.
- Convert the subnet mask into binary.
- Count the number of “one” characters. This is your CIDR slash number.
address 192.168.111.240, subnet mask 255.255.255.248
Step 1 – convert the subnet mask to binary:
Step 2 – count the “one’s”.
There are 29 one’s. Therefore, our CIDR address is 192.168.111.240/29.
Calculating the Starting and Ending Addresses
Finding the starting and ending addresses of the network:
- Write out the network address in binary.
- Look the number CIDR address. After the ‘/’ is a number. Write a ‘1’ under each character of the binary network address, until they add up to the number after the ‘/’.
- Perform an ‘And’ operation between the binary network address and the line of “one’s”, and then convert the result from binary to decimal. This is your starting address.
- Perform an ‘Or’ operation between the binary network address, and the inverse of the line of “one’s”, and then convert from binary to decimal. This is your ending address.
Let’s calculate the IP Range for the network 192.168.111.240/29.
Write out the network address in binary:
192 = 11000000
168 = 10101000
111 = 01101111
240 = 11110000
Take the number after the ‘/’ in the CIDR address, and add that many “1’s” beneath the binary address:
Calculate the starting address with an ‘And’ bitwise operation.
An ‘and’ operation can be thought of as vertical multiplication. Only 1 * 1 = 1. All else is zero:
Convert to decimal:
Our starting address is: 192.168.111.240
Calculate the ending address with an ‘Or’ bitwise operation.
The ‘or’ operation takes the highest number. If both characters are ‘0’, then the result is ‘0’. Otherwise, the result is ‘1’. Before performing the ‘Or’, we need to invert the line of “one’s”.
Binary Starting Address: 11000000.10101000.01101111.11110000
Line of One’s: 11111111.11111111.11111111.11111000
Inverted line of One’s: 00000000.00000000.00000000.00000111
Now, let’s do the Or.
Convert to decimal.
Our ending address is: 192.168.111.255
We learned that the network address 192.168.111.240/29 is equilavent to 192.168.111.240-192.168.111.255.
I realize that this is IP basics, but everyone starts somewhere. I actually had difficulty finding this information online in a concise format. Hopefully this helps.
For practice, see this awesome site: