Chap 2 - IP (Internet Protocol) V4
Chap 2 - IP (Internet Protocol) V4
IP uses Packets called IP packets to carry information. Every IP packet is a single unit of information and besides data it carries information to determine
where to send the packet. IP determines where to send packets to by looking at the destination IP address.
We need an IP address to uniquely identify each network device on the network. An IP address is just like a phone number (I’m talking about regular
phone numbers, no cellphones). Everyone in a city who has a phone at home has a unique phone number where you can reach them.
An IP address is 32-bit and consists of 2 parts, the network part and the host part:
The IP address is 32-bit but we write it down in 4 blocks of 8 bits. 8 bits is what we call a “byte”. So the IP address will look like this:
The network part will tell us to which “network” the IP address will belong, you can compare this to the city or area code of a phone number. The “host”
part uniquely identifies the network device; these are like the last digits of your phone number.
You probably have seen the IP address 192.168.1.1 before. It’s a very commonly used IP address on local networks. For this IP address the first 3 bytes
are the “network” address and the last byte is the “host” address:
Ok awesome…but why are the first 3 bytes the “network” part and why is the last byte the “host” part? Good question! I only gave you the IP address but
you might remember that if you configure an IP address you also have to specify the subnet mask. Our IP address 192.168.1.1 would come along with
the subnet mask 255.255.255.0.
The subnet mask tells your computer which part is the “network” part and which part is the “host” part. Despite the name it does not “hide” or “mask”
anything. We’ll talk about binary and subnetting calculations later on, for now just hold the thought that your subnet mask tells us which part of the IP
address is the “network” part and which part is for “hosts”.
1/7
IP (Internet Protocol) V4
There are a lot of fields there! Now don’t go look over them and feel puzzled that you have no idea what they are about. For now there are only a few
fields that are interesting to us. The fields we don’t care about are in gray, I want to focus on the red and blue fields.
Protocol: Here you will find which protocol we are using on top of IP, this is how we specify which transport layer protocol we are using. So you’ll
find TCP, UDP or perhaps something else in here.
Source Address: Here you will find the IP address of the device that created this IP packet.
Destination Address: This is the IP address of the device that should receive the IP packet.
Data: this is the actual data that we are trying to get to the other side.
That wasn’t so bad right? No need to worry about the other fields for CCNA. If you ever played with Wireshark you might recognize these fields. Here’s a
screenshot of an IP packet in Wireshark:
192.168.1.1
What do we know about this IP address? First of all we know it’s a 32-bit value, so in binary it will look like this:
2/7
IP (Internet Protocol) V4
Now this is a number that is not very human-friendly so to make our life easier we can at least put this number into “blocks” of 8 bits. 8 bits is also called
a byte or an octet:
Now we can convert each byte into decimal, let’s take the first block and convert it from binary to decimal using the following table:
Bits 128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0
First Byte:
Bits 128 64 32 16 8 4 2 1
1 1 0 0 0 0 0 0
128 + 64 = 192
Second Byte:
Bits 128 64 32 16 8 4 2 1
1 0 1 0 1 0 0 0
128 + 32 + 8 = 168
Third Byte:
Bits 128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 1
Fourth byte:
3/7
IP (Internet Protocol) V4
Bits 128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 1
Excellent so now you know why IP addresses look like this and why we write them down like this, we even did some basic binary to decimal
calculations.
One last thing to look at and that’s the different classes that we have for networks. Maybe you have heard of class A,B or C networks before. Our IP
address that we just used (192.168.1.1) is an example of a class C network.
Class A
Class B
Class C
So what’s the difference between them? The difference between them is how many hosts you can fit in each network, let me show you an example:
The first 3 octets which are in blue are the “network” part of this IP address. The red part is for “hosts”. So we can use the last octet (octet or byte is the
same thing) for our hosts to give them an unique IP address.
192.168.1.1
192.168.1.2
192.168.1.3
A computer with 192.168.2.1 is not in the same network since it’s “network” part is different, it’s 192.168.2.X compared to 192.168.1.X.
What do you think your computer will do when it wants to send an IP packet to another network? You can find the answer on your own computer:
If you are using Windows just hit the start button, type CMD and press enter. Use the ipconfig command to lookup the IP information:
4/7
IP (Internet Protocol) V4
Windows IP Configuration
The computer above is in network 192.168.1.X. When it wants to send something to another network it will use its default gateway. This will be your
router; in the example above the router has IP address 192.168.1.254.
Back to our classes; let me start off by showing you the difference between the classes:
If you use a class A network you can have a LOT of hosts in each network that you create.
If you use a class B you can build more networks, but fewer hosts per network.
And with class C you can build a LOT of networks but only with a few hosts in each network.
I just explained to you that 192.168.1.1 is a class C IP address. How do I know this? It’s because the first bits are “fixed” for the different classes, let me
show you this:
So if you calculate this from binary to decimal you’ll get the following ranges:
5/7
IP (Internet Protocol) V4
If you look closely, do you see a 127.0.0.0 subnet? It’s not in the class A range so what happened to it?
Why does Class C stop at 223.255.255.255?
To answer the first question: Go to your command prompt of your computer and type in “ping 127.0.0.1” and you’ll get a response. This network range is
being used as “loopback”. Your loopback interface is something to check if your IP stack is OK.
To answer the second question I have to tell you that there’s actually a class D range, we don’t use those IP addresses to assign to computers but it’s
being used for “multicast”. It starts with the 224.0.0.0 range.
The last thing I need to tell you about classes is the difference between “private” and “public” IP addresses.
Do you see our 192.168.1.1 example IP address falls within class C and is a private IP address? I like to use this IP address since it’s most common to
people, it’s used a lot on home networks and SOHO (small office home office) routers.
Is there anything else we need to know about IP addresses? Well yes, one last thing! There are 2 IP addresses we cannot use on our network.
Network address.
Broadcast address.
The network address cannot be used on a computer as an IP address because it’s being used to “define” the network.
The broadcast address cannot be used on a computer as an IP address because it’s used by broadcast applications. A broadcast is an IP packet that
will be received by all devices in your network.
So how do we recognize these two IP addresses that we cannot use? Let me give you an example for this:
We need to look at the last octet which is being used for hosts. If we set all the bits to 0 in our “host” part then we have the network address:
6/7
IP (Internet Protocol) V4
So 192.168.1.0 is the network address in this case and we are unable to use this IP address for computers. If we set all the bits to 1 we’ll have a
broadcast IP address and we also cannot use this for computers:
So in summary:
Set all the host bits to 0 gives you the network address.
Set all the host bits to 1 gives you the broadcast address.
These 2 IP addresses we cannot use for computers.
That’s all I have about IP version 4 for now. I hope this has been useful to you! If you enjoyed reading this tutorial, please use the social share buttons
below or leave a comment.
7/7