What are IPv4 Addresses?

What are IPv4 Addresses?

The Internet (SERIES) - Blog #2

One thing before we start, there are two types of IP addresses IPv4 (older) and IPv6 (newer). This blog will cover IPv4 Addresses, the next one will cover IPv6 Addresses.

Defining IP Address

IP addresses are essentially long identifiers for every device connected to the internet (look at our last blog where we define the internet). Everyone knows that your IP address is based on your location (there are even services that can give you the general location of where an IP address came from). IPv4 Addresses

Consider a situation where there are five different houses, let's say there's also a mailman trying to deliver mail to house one. Each house needs to have a unique address number so that the mailman doesn't deliver the mail to the wrong house.

Situation Above

Computers also work like that.

Computers also work like that

Parts of an IPv4 Address

IP addresses aren't just one digit like "1" or "2" (like diagram above portrays it to be), they look more like "###.###.###.###" (the #'s representing one digit each). So the diagram from above would look more like this.

Computer Diagram remake

Octets

IP address broken up into octets

An IP Address has four visible numbers. These are called octets. Each octet can hold a value ranging from 0 - 255. Why 0 - 255 you may ask? Well, an IPv4 Address is a total of 32 bits. 32 bits divided (equally) into 4 numbers is 8 bits per number and 255 is the largest possible number that can be made from 8 bits.

Subnet Mask

Now for the parts of an IP Address. Every IPv4 Address has two main parts, the network part and the host part. The way to tell what numbers are for the network and what numbers are for the host is with a subnet mask (each IP address is paired with a subnet mask). A 255 in the subnet mask signals that the particular number of the IP address the 255 corresponds to is for the network section, any 0's are for the host section.

IP Address & Subnet Mask

Let's say a subnet mask of "255.255.255.0" is paired with the IP address "192.168.0.1". Since the first number the of the subnet mask ("255.255.255.0") corresponds to the first number of the IP address and is a 255, the first number of the IP address ("192.168.0.1") is for the network section. The same applies for the second and third numbers ("192,168.0.1") of the IP address. But for the fourth number ("192,168.0.1"), it's corresponding subnet mask number is 0, meaning it is for the host section.

To better help you understand the Network and Host sections of a IP Address, let's go back the mailman example.

Mail man example V2

There can be multiple houses in one street, but it's their individual house numbers that make them unique. Now if we have multiple streets then the house numbers can repeat as their street name can identify them seperately. That's basically what the network and host sections are. The streets are the networks, the houses are the hosts.

2 IP networks

The above diagram is called a network diagram. Ina network diagram it's common to to leave the host section as a 0 ("192.168.1.0"). And when you label the devices inside the network, you label the with just their host section (and no other parts of the IP Address). So when you want to mention a specific device you say the network like "192.168.1" and then say the device's host number like ".2". So in total you would say "192,168.1.2" to mention the host device 2 on network 192.168.1.

Classes

When IPv4 was made, it was decided to split the IP Addresses into 5 groups called classes. The main classes were Class A, Class B, and Class C. Class D was for multicasting (don't worry about knowing what that means) and Class E was for experimental purposes.

3 main IPv4 Classes

Class A has IP addresses ranging from 1.0.0.0 to 126.255.255.255 with a subnet mask of 255.0.0.0. Meaning it has three out of the four numbers for host identification. Class B has IP addresses ranging from 128.0.0.0 to 191.255.255.255 with a subnet mask of 255.255.0.0. Meaning it has two out of the four numbers for host identification. And class C has IP addresses ranging from 192.0.0.0 to 223.255.255.255 with a subnet mask of 255.255.255.0. Meaning it had one out of the four numbers for host identification. Class A could support the most amount of hosts out of the three classes (1,000,000+) while Class C could support the least amount of hosts out of the three classes (254).

Public & Private IP Addresses

But the creators of IPv4 didn't predict for the huge boom in internet and computer usage. So as of now, all IPv4 public addresses are allocated. Wait, as you read that sentence you may have noticed I used the word public IP addresses. Yes, there are public and private IP addresses.

Public and Private IP Addresses

To preserve IPv4, what they did was allocate some IP addresses from each of the classes to be that class' private IP addresses (private IP addresses still use the same subnet mask for its particular class). The difference is that public IP addresses need to be unique, private addresses can be used in multiple places. Private IP addresses only need to be unique within your network. For example your neighbor could be using the same private IP addresses as you, and that's fine. When you sign up for network services with your ISP (Internet Service Provider) they give you one public IP address, yes only one for your whole network, and they will give your house a private IP address range too. All your devices will connect to the internet through that one public IP address, and each device will have it's own unique private address in your network. One catch is that private IP addresses can NOT connect to the internet (as if they could, there would be duplicating IP addresses).

Private VS Public IP Addresses

You may wondering, if all the devices one network connect to the internet through one public IP address, and private IP addresses can't be publicly distinguished. If I send and email to a friend, will everyone in house get my email? No, of course not. Using something called Network Address Translation, a topic for a different blog, the router can tell who your email is for and send it to the right person.

ย