Hot Posts


IP address well explained, What does it mean and how it works.

Well explained IP address


So we're going down the tcp/ip model as if we were sending data, so top to bottom in the last Post we saw 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 actually gets to the destination. 

This layer is responsible for IP addresses so what is an IP address? 

An IP address is a unique identifier assigned to each device connect to a computer network the most common analogy for an IP address is the postal service. 

For the postal service too work every house needs to have its own unique address and if you need to send a letter, not that anyone sends letters anymore  you need to write the destination address on the envelope. 

That way when you send the letter the postman knows exactly where to deliver it now the address must be unique. 

Othrewise 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 and 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 look at an IP address. This is an ipv4 address which at the time of making this Post and probably for a long time after is the most common although we are slowly moving over to new IP version 6 that will be covered in another Post. 

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 four sections which are called Octets. 

These octets are separated by dots or periods. Each octet in theory can contain any number between 0 and 2555 why 255? well our 32 bit number is separated into four list of eight, and 255 is the largest number  that can be made from eight bits. 

Now the address itself is separated into two parts, the first represents the network and the second part represents the host. To know which part of the 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 always paired with an IP address and is used to identify the network section and the host section of the address. 

In its simplest 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 more complicated than that but we'll look at that later on down the line. 

When learning about networks and hosts and what they mean, it's good to think of it like your address you shared the same street name 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 street addresses you have network numbers and instead of house numbers you have host numbers. 

Here we have two networks 192. 168. 5.0 and both with a subnet of 255. 255.255. 0. When talking 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. Its common in a network diagram to just show the host section of the address if you already know the network section. In fact these IP addresses would be and so on, 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 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 hopefully that all makes sense so far decided to split all of the available dresses into groups and these groups were called classes. 

The idea was to make address allocation scalable. The main ones being Class A,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 first three. 

Each class has a range of IP addresses Class A addresses are between to 126.255.255 with a the subnet mask of Class B addresses are between to where the subnet mask of and Class C addresses are between to with a subnet mask of 

Phew! to say 255 again!So this was all to control the number of hosts available on each network. Class A has three octets available for host allocation this means we can have 16,777,214 hosts for a single class a network. 

Class B has two available octets for host allocation so we can only have 65,534 hosts to a single Class B network Still a very, very big number! Class C only has 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 this is to memorise the first octet. 

If an IP starts with the number 10 straightaway you know it's a class A network. If an IP starts with the number 10 straightaway you know it's a class A network. 

If an IP starts with 192 you know its 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. In fact there are no more unallocated IP version 4 address left. 

This is why the new IP version 6 has been designed it will give us more than enough ip addresses for absolutely everyone But fear not! there is a solution to help prolong the life of IP version 4. 

The solution is to carveout small sections from all three classes and call them private IP addresses. All other addresses are known as public addresses. They still use same subnet mask for that class and they can still have the same number of hosts. 

The difference is where public IP 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 that you want to use. In this case we will choose class C and we'll assign our IP addresses. 

Remember this is a class C network and the default subnet mask is meaning is 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 neighbours might also be using the same IP addresses as you are. And that's fine, private IP addresses only need to be unique within your own network. 

There is a catch though, private IP addresses can not 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 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 off 65,000 or 254 ....1! 

This helps prolong the life of ipv4 because instead of using an IP address for every one of our six devices we are only using two public addresses. 

The only using two public addresses. The way our devices will communicate to the internet through their publicIP is by using something called Network Address Translation, which again we will cover in a separate video. 

Before we finish this, I will show you how to check your own IP addresses at home on on windows you simply open a command prompt or powerShell type ifconfig to see your interface settings find your interface, you might have more than one if you have wireless, and you'll be able to see your IP address and subnet mask for Linux or Apple computers open a terminal and type ifconfig and you should see the same information to view your public IP address simply open a browser. 

Go to google and type in ''what is my IP'' and it will show you your public IP address so we still have a lot to go over when we're talking about IP addresses. 

We need to cover binary and subnetting but I think that's enough for this. 

Post a Comment