top of page

How to Subnet: Convert IP address into binary

An IP address is a numeric address that allows users to access a network to share data communications. It identifies a device on a network. Printers, laptops, routers and switches all have IP addresses.


YT

IP addresses use ethernet communication, which is simply the traditional technology used to connect devices so they can communicate with each other. An ethernet cable is used to physically connect devices together.




What is an IPv4 address?

  • IP stands for internet protocol

  • V stands for version

  • 4 stands for the 4th version of the Internet Protocol

  • Outlined by RFC 791 (standard procedure for how IPv4 works)


IP address can be written in 2 ways, BINARY or DECIMAL form.

Computers read IP addresses in BINARY which is broken down into (0's and 1's) while humans reads IP addresses in DECIMAL form which can be any numbers between 0-255.


IPv4 addresses are composed of 32 bits (0's and 1's) , which are divided into 4 sections that are separated by decimals.


IPv4 uses ethernet communication in 5 classes A, B, C, D and E.

  • A - C uses different bit lengths to address the networking host via subnet mask

  • D - is used for multicasting

  • E - is reserved for future use


A subnet mask is a slash-number used to identify the network or "subnet" an IP address belongs to. The subnet mask separates the IP address into the network and host addresses.


IP addresses has 2 parts; network address (which network it belongs) and host address (exact location).

  • The Network ID is the portion of the TCP/IP address used to identify a device on a network.

  • The Host ID is the physical address (MAC address) of one of the hardware components of a machine.

We can identify the network from the host address by looking at the subnet mask.


Since we now know the subnet mask tells us the network part of a IPv4 address, we have to understand binary to know the actual network address; and other addresses like the broadcast address to compute the network and host address.

*Broadcast ID is the address on a network where packets are transmitted to*


We must learn how to convert IP addresses from decimal to binary form using a method called subnetting.

Subnetting is a process that takes one network aka Class A, B or C and divide it into multiple different networks.


Now in decimal numbers, the base is 10 and we know that it is location of the decimal that makes sense out of the digit within the number (example: 10, 1,000, 100,000, etc.). This will be the same instance for binary numbers. Each placement holds a specific value ALWAYS.


Binary numbers has a base of 2 and our possible digits are 0's and 1's. A binary number will be nothing more than a string of numbers where each digit has to be 0 or 1 and its specific placement of the digit will determine the value.


Now that we understand how to calculate these values, we can focus on placement. Since bits are (0's and 1's), we must remember this rule of thumb 1's = ON which means you count that placement and 0's = OFF which means you do not count the placement.



Let's take 84 and turn it into a binary number;

  • Starting with your bit chart, we see that the first bit is 128.

  • Since 84 - 128 gives us a negative number, we will add a place holder of 0 meaning we DO NOT count it.

  • Moving on to the next bit, we see that 84 - 64 = 20 so we would add a place holder of 1 meaning we DO count it.

  • Since 20 - 32 gives us a negative number, we will add a place holder of 0.

  • Continuing on, 20 - 16 = 4, add a place holder of 1.

  • Now that we have a bit of 4 that matches on our chart, you can tell which of the remaining bits will be a 1 or a 0.

1's = ON which means you count that placement

0's = OFF which means you do not count the placement

84 written in binary form is = 01010100.


In order to check your calculations, we will add the bits together that are represented by 1s

64 + 16 + 4 = 84

Follow these same steps for each section of your IP address.

Now that we understand how to convert decimals into binary form, we can find the network ID, broadcast ID and hosts in an IPv4 address.


To find the subnet mask number:

  1. Convert the decimal representation of the subnet mask to a binary representation.

  2. Count each “1” in the subnet mask. The total is the subnet mask number.


So if we take IP address, 84.133.23.65/27 and convert it into binary form it would be 01010100.10000101.0010111.01000001/27

If we count all the 1's using each placeholder as the number given in bits the sum would be, 84.133.23.65/27


Subnetting Example:

Find the Network ID, Broadcast ID and useable hosts range of IP Address; 84.133.23.65/27

  • Convert IP address into binary form ➡️ 01010100.10000101.0010111.01000001/27

  • Convert the subnet mask (the number after the slash) into binary ➡️11111111.11111111.11111111.11100000 = 27 1's

  • The network ID is what is before the 0's start in the subnet mask binary form. Everything stays the same except for the 4th octet ➡️ 84.133.23

  • Now, the 4th octet is converted by adding the only placeholders that are "ON" (three 1's but we only count the "1" that is "ON" which is in the "64" placeholder in this example) ➡️ 64

  • The Network ID is 84.133.23.64 (Keep the number 64 in mind)

  • Then, after the last 27th 1, add the "0's" placeholders. We are basically going to turn the 0's into 1's aka OFF into ON so we can find the host address via the subnet mask. (total sum of placeholder value in in 4th octet 11100000 turn into 00011111 ➡️ 31

  • Add those two numbers together ➡️ 64+31=95

  • The broadcast ID is 84.133.23.95

  • The usable host range is what is between the network ID and the broadcast ID. ➡️ 84.133.23.64 - 84.133.23.95

TIP:

Always remember to add 1 to the network ID and subtract 1 from the broadcast ID. That will be the usable range.


So, the usable host range is 84.133.23.65 - 84.133.23.94




Need more practice? Visit this link https://www.lammle.com/ip-subnet-practice-page/





23 views0 comments

Comments


bottom of page