In this video, were going to be looking at IP addresses.
Were going down the TCP/IP model as if we were sending data. In the last videos, we saw how data can be sent using TCP and UDP. We also saw how data gets to a particular application using port numbers. Now, we’re moving down to the network layer to see how that data gets to the destination.
This layer is responsible for adding IP addresses.
So, what is an IP address? An IP address is A unique identifier assigned to each device connected to a computer network.
The most common analogy for an IP address is the postal service. For the postal service to work, every house needs to have its own, unique address.
You need to write the destination address on the envelope. That way, when you send your letter, the postman knows exactly where to deliver it.
Now, the addresses must be unique, otherwise, 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 well.
Computers work in the same way. Each computer in a network needs to have a unique address, called an IP address. When sending data to a computer, just like letters, we need to add the destination address. We also need to include a return address, so they know where to reply.
So let’s take a look at an IP address.
This is an IPv4 address, which, at the time of making this video, and probably for a long time after, is the most common.
So, an IPv4 address is 32-bits in length. Which means it contains 32 binary digits. We’ll look at this more when we go over subnetting.
It contains 4 sections, which are called octets. These octets are separated by periods. Each octet can, in theory, contain any number between 0 – 255
Network and Host
The address itself is separated into two parts. The first part represents the network and the second part represents the host.
To know which part of an IP address represents the network, we used to rely on the first few binary bits, but since the early 90s, we have something called a subnet mask.
A subnet mask is paired with an IP address to identify the network and the host section of the address.
In its simplest form, wherever you see 255. this is the network part of the address. Wherever you see a zero, this is the host part of the address. It can get a bit more complicated than that, but we will look at this later on down the line.
When learning about networks and hosts, its good to think of it like your address.
You share the same street names as your neighbours, 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 with computer networks.
Instead of the street address, you have the network number and instead of the house number, you have the host number.
Back in the early days of IP, it was decided to split all of the available addresses into groups called classes. The idea was to make address allocation scalable.
The main classes are class A, Class B, and Class C. There is a class D for something called multicast addresses and class E which is reserved for experimental use.
Each class has a range of IP addresses.
- Class A – 18.104.22.168 to 22.214.171.124
- Class B – 126.96.36.199 to 188.8.131.52
- Class C – 192.0.0.0 – 184.108.40.206
But there’s a problem.
The problem is that no one could have predicted the massive explosion of computers and the internet. In fact, there are no more unallocated IPv4 addresses left. This is why the new Ipv6 has been designed to give us more than enough IP addresses for everyone.
Private IP Addresses
But fear not! There is a solution to help prolong the life of IPv4. The solution is to carve out a small section from all three classes and call them private IP addresses. All other addresses are known public addresses.
Private IP addresses still use the same subnet mask for that class and they can still have the same number of hosts.
The difference is, where public IP addresses need to be unique, private addresses can be used over and over and over again, thus, saving millions or billions of public IP addresses.
This is how it works.
Let’s say this is your house. You have a pc, a phone, and a printer. You can choose any private IP range you want to use. In this case, we will choose class C 192.168.1.0 and assign our IP addresses.
All our devices can talk to each other with no problem at all. The beauty of private IP addresses is they can be used by anyone. Your neighbour might also be using the same IP addresses as you are, and that’s fine
There is a catch though. Private IP addresses cannot be used over the internet! Otherwise, we would have duplicate IP addresses everywhere, and data would never end up getting to the correct places.
For that reason, only public IP addresses can be used over the internet. These must be unique.
When you sign up to 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.
This helps prolong the life of Ipv4 because instead of using 6 IP addresses for every device, we are only using 2 public addresses.
We’ll explore this more as we move forward but I think that’s enough for now.