Converting IP addresses from decimal to binary with pen and paper. The old fashioned way.

Posted: September 27, 2012. At: 8:32 AM. This was 5 years ago. Post ID: 4641

One important skill in computer networking is converting an IP address to binary from decimal.

Here is an example.

172.124.64.2

This IP address converts into this binary number.

10101100.01111100.01000000.00000010

The way I find is the easiest with pen and paper is to write down this number sequence.

128 – 64 – 32 – 16 – 8 – 4 – 1

Then take the IP address piece by piece and count through each section. You need 128 and 32 to add up part of the IP address in binary, therefore you add a 1 for each section of the number sequence that is needed and a 0 for numbers that you skip from 128 to 1. This really does work. When I was taught this in networking class; this is how I managed to do it on good old fashioned pen and paper. A calculator is handy if you are stuck. Just use a high-school calculator or the bc calculator. Just count from left to right and see which numbers add up to 172 for example and leave out the others. The IP addresses only count up to 255 in each octet. So if you see an IP address in a movie that is higher than 255 it is not correct and therefore not real. The octet is a sequence of eight bits. There are eight bits to a byte; therefore an IP address is four bytes when written in binary.

This IP address:

192.172.8.0

Equals this number in binary.

11000011.10101100.0000100.00000000

And the network mask;

255.255.255.0

Equals this in binary.

11111111.11111111.11111111.00000000

This number;

192.168.0.1

Equals this in binary.

11000000.10101000.00000000.00000001

Once you practice this a few times it becomes clear in your head and you may do this easily. One godsend in modern networking is the advent of DHCP; that allows a DHCP server to give out IP addresses to a client machine when it connects to the network. There is some information on configuring a DHCP server in Linux here: http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch08_:_Configuring_the_DHCP_Server. Before DHCP you would have needed to type in an IP address for your machine manually; that would be a nightmare with a thousand machines. Distantly related to computer networking; here is a page that has a screenshot of the first website ever created. Tim Berners-Lee created the World Wide Web and it would not be possible without computer networking and the DHCP servers that give out IP addresses to all of the computers on the Internet. And the DNS servers that map the domain names to IP addresses; e.g the Google website maps to the IP address 74.125.237.73. Otherwise you would need to remember the IP address for every single website. The Chinese Google website maps to the IP address 173.194.72.160. In binary that is: 10101100.11000010.01001000.10100000. The IP address and the domain name google.cn are easier to remember than that; but easy to calculate.

A web calculator for IP addresses if you are stuck: http://www.subnetmask.info/.

No comments have been made. Use this form to start the conversation :)

Leave a Reply