Networking fundamentals tutorial – Internet Protocol, IPv4 part1

In this post I will continue talking about the Internet Protocol address and all the items related to it. Also we will play with some conversion examples.
As you already know, IP addresses are layer3 addresses used by devices to communicate over the network and to uniquely identify machines. Humans are used to write numbers in decimal format, but computers and all networking devices communicate using the binary format ( 0 and 1). I will give you an example:
It is easier to write and understand an IPv4 like than 00001010.00000000.00000000.0000001. We use the dot sign to separate each octet(group of 8 bits) in a IPv4 address, if you would look at the IP address when is transmitted over the medium, you will only see a flow of 0 and 1’s.
Each bit represents a different value, that’s because each position actually is a value of 2 to the power of the position. It doesn’t sound so good, that’s why I’m going to give you an example: let’s take the first 10 from our example written in binary 00001010. From right to left (or from the least significant bit to the most significant bit ) the positions represent different value. So at position 0 the value is 2 at the power of 0, that equals 1; at position 1 the value is 2 at the power of 1, equals 2 and so on.
From left to right these are the values:
2^0 = 1
2^1 = 2
2^2 = 4
2^3 = 8
2^4 = 16
2^5 = 32
2^6 = 64
2^7 = 128
These numbers will help you convert numbers from 10 format to binary format and which is the first step in subnetting. Now let’s take the following example:
let’s convert the following IP address into binary format: 110000.10101000.00000000.00000000
What is important to remember is that when 1 is encountered means that position is used and when 0 is encountered than that position has value 0
I will explain how I converted into binary each octet:
11000000 – we have the value of 1 on the first two positions from the left which means that we have to add values only for those two: the first position represents the value of 2^7=128 and the second 2^6=64. If we add them the result will be 192.
10101000 – We have 1 values in the positions 7 5 and 3 so our numbers are 2^7=128, 2^5=32 and 2^3=8.  If we add the values 128+32+8 the result is our number 168
This is the revert thinking when converting in binary. The easiest way is just to subtract the 2^X from your number until you reach 0. For example let’s take 172:
First let’s test the first position 172-128=44, if we have a positive number than we have a 1 on that position.
Now 44-64=-20, we have a negative number so the value on that position is 0. I will only do the math:
44-32=12 value 1
12-16=-4 value 0
12-8=4 value 1
4-4=0 value 1
and the rest until the 8’th bit are 0. Our number is written like this 10101100
You’ll have to memorize the value of each position, but in time you will convert numbers very easy.

When IPv4 was implemented, three types of addresses were invented:
The network address – this is used to identify the network.
The broadcast address – is is the last address in a subnet, it is used by many protocols and applications to send one message to all devices in the network.
The host address – are addresses used by devices inside a network. A host cannot use the network or the broadcast address.
Now let’s take the next example: with a or /24 mask – this is the network address. is the broadcast address.
192.168.1-254 – host addresses
But how did I end up with this numbers?
Well, we first have to talk about the network mask or the prefix. Well this parameter is used to interpret a network address, it is used to divide the network portion form the host portion. In our example, we used a /24 or mask. By the way /24 prefix reference to how many 1 bits are set in the mask so
/24 = = 11111111.11111111.11111111.00000000. Personally, I prefer to use the prefix form because it helps me understand better where is the demarcation point between the network and the host portion. In our example, the mask tells us that the first 24 bits from the IP address are reserved for the network portion and the last 8 bits for the host portion. We are calculating only in the host portion, so:
the network address is calculated by setting all the host bits 0 which means that or is our network portion
the broadcast address is calculated by setting all the host bits 1 which means that or is our broadcast address
the hosts addresses are between the network and the broadcast address, which in our case are from to or to

When using the IP protocol, device can communicate with each other in three ways:
Unicast – a host sends a packet to a single host
Broadcast – a host sends a packet to all devices in the network. A broadcast domain is limited by a router ( layer3 device).
Multicast – a host sends a packet to a group of devices.

IPv4 address ranges: 
There are three main IPv4 address ranges:
Host addresses to – used to be assigned to hosts
Multicast addresses to 239.555.555.555 – used to be assigned to multicast groups
Experimental addresses to – used by developing companies for future reservation and research
The addresses from above are also called public addresses and are visible from the internet. There are also some private IP ranges, these are called private because they only exist inside a network and are not visible from outside: with mask or /8 with mask or /12 with mask or /16

There are also some special IPv4 that are reserved:
Loopback address – this is used by devices to redirect traffic to themselves.
Default route – which is the default route used by routers to forward packets when no other matches the destination IP. and mask
Link-local address – used to allocate address

An older implementation of IPv4, divided IPs in 5 classes:
A 1-127 with mask or /8
B 128-191 with mask or /16
C 192-223 with mask or /24
D 224-239 reserved for multicast
E 240-255 experimental address


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s