An IP address is a unique identifier assigned to every device connected to a computer network. One most common analogy for an IP address is the postal service.
The postal service to the work every house needs to have its unique address and if you need to send a letter, not that anyone sends letters anymore.
You send the letter the postman knows exactly where to deliver it now the address must be unique unless your post could end up going to somebody else or you could start receiving somebody else’s post and that can sometimes not go so great.
Computer work in the same way each computer in a network needs to have a unique address called an IP address and when sending data to your computer just like us need to add the destination address we also need to include a return address so they know where to reply.
So let’s look at an IP address 192.168.32.152 this is an IP4 address so an IP4 address is 32 bits in length which means it contains 32 binary digits We’ll look at this it contains four sections which are called octets these octets are separated by dots or periods.
Each octet in theory can contain any number within 0 and 255 why 255? Well, our 32-bit number is separated into four lots of eight, and 255 is the largest number that can be made for eight bits.
Now the address itself is separated into two parts, the first part represents the network and the second part represents the host.
To understand which part of the IP address represents the network we used to rely on the first few binary bits but.
After the early 90s, we have something called a subnet mask a subnet mask is always paired with an IP address and is used to identify the network section and the host section of the address.
In its most simplistic form whenever you see 255 this is the network part of the address whenever you see a 0 this is the host part of the address. It can get a bit extra complicated than that but we’ll look at that later on down the line.
When learning about networks and host what they mean, it’s good to think of it as your address.
You shared the same street name as your neighbors but it’s the house number that makes your address unique on the other hand you can also have multiple streets with the same house number and it’s the same by computer networks.
Instead of street addresses, you should network numbers and instead of house numbers, you have host numbers. Here we have two networks 192. 168.5.0 and 192.168.10.0 both with a subnet of 255.255.255.0.
When learning about networks as a whole, you often just use 0 for the host section inside our networks we have our hosts .1 .2 And.3 it’s common in a network diagram to just show the host section of the address if you know the network section.
These IP addresses would be 192.168..1, 192.168.5.2, and so on so with all of that in mind if we have some data to send to 192.168.5.3 with a subnet mask of 255.255.255.0
where would we send it?
Well if we look at the subnet mask we can see that the network is 192.168.5 so we know that three is our host number so we send it over to the host in the network on the left hoping that all make sense so far.
Back in the early days of IP, it was decided to split all of the available addresses into groups and these groups were called classes the idea meant to make address allocation scalable.
The main ones being class a, and class b, and class c. There is also class d for something called multicast addresses and class e which is reserved for experimental use we’re going to focus on the front three each class has a range of IP addresses.
Class addresses are between 188.8.131.52 to 184.108.40.206. with a subnet mask of 255.0.0.0 class b addresses are between 220.127.116.11 to 18.104.22.168 where the subnet mask of 255.255.0.0 and class c addresses are between 192.0.0.0 to 22.214.171.124 with a subnet mask of 255.255.255.0 so this was all to control the number of hosts available.
Class a has three octets available for host allocating this means we can have 16,77,214 hosts for a single class a network. Massive, massive networks!
Class b has two available octets for host allocation so we can simply have 65,534 hosts to a single class b network still a very, very big number!
Class c only one available octet for host allocation so this means we can get 254 hosts per single class c network So you need to be able to look at an IP address and know which class it belongs to the easiest ways to do that is to memorize the first octet.
If an IP starts with the number 10 straight away you know it’s a class a network if it starts with 192 you know it’s class c and so on and so on but there’s a problem.
The problem is no one could have predicted the massive explosion of computers and the internet there is more unallocated IP version 4 addresses left.
This is why the new IP version 6 has been designed it will give us more than enough IP addresses as absolutely everyone but fear not! There is an answer to help prolong the life of IP version 4.
The explication is to carve out a small section from all three classes and call them private IP addresses. All other addresses a know as public addresses they still use the same subnet mask for that class and they can still have the same number of the host.
The difference is where public IP addresses need to be unique, private addresses can be used over and over again, thus saving millions or billions of public IP addresses.
This is how its works. Let’s say this is your house you have a pc a phone and a printer you can choose any private IP range that you want to use.
In that case, we will choose class c 192.168.1.0 and we’ll assign our IP addresses, remember this is a class c network also the default subnet mask is 255.255.255.0 meaning 192.168.1.0 this is our network address and the last number is our host address.
So our network address and the last number is our host address so all of our devices can talk to each other without any problems at all. The beauty of private IP addresses is that they can be used by anyone.
For example, your neighbors might also be using the same IP addresses as you are and that’s fine private IP addresses only want to be unique within your network.
There is a catch though, private IP addresses cannot be used across the internet otherwise we would have duplicate IP addresses everywhere and data would nevermore end up getting to the correct places. For this reason, only public IP addresses can be used across the internet.
There must be unique when you sign up with your internet service provider, they will issue you with a public IP address that you can use over the internet. Usually, they give you just one address not a block of 65,00 or 254….1!
This helps prolong the life of IP4 because instead of using an IP address for every one of our six devices we are only using two public addresses.
The way our devices will communicate on the internet through their public IP is by using something called network address translation.