IP Address version 4

IPv4 address

An IP address is a logical address used at the Network Layer of TCP/IP protocol suite. We will discuss IP address version 4 in this article. An Internet Protocol (IP) version 4 address is a 32-bit address assigned to each device connected to a network, which uniquely identifies the device.

The newer version of the IP address is IP version 6, which I will discuss in another post IP address ver 6.

What is IP address version 4

An IP address is an identifier used at the network layer of the TCP/IP protocol suite, which distinguishes every host connected to a network.

It is the address assigned to the Interfaces of all devices connected to a network. May it is a TCP/IP based Local area network or a worldwide network like the Internet, the IP address is unique.

They are unique in such a way that a single IP address defines a single interface throughout the Internet. A device may have more than one interface, so more than one IP address too. But the two devices on the Internet cannot have the same IP address.

IP version 4 is a 32-bit address, hence the address space in it is 232, which is roughly 4.2 billion. So, 4.2 billion devices can be connected using it, provided there is no any limitation. We shall discuss the restrictions in the next sections.

Representation of IP address

The IP address expressed mainly by binary notation or dotted decimal notation. Between each octet (8 bits), a dot inserted to make it more readable. So, the IP address expressed as four octets separated by a dot between them.

In binary notation, it is expressed as 32 bits 0,1 stream. Each group of 8 bits (1 octet) separated by a dot. It looks like :
11000000 10101000 00000001 00000001
In dotted-decimal notation, it is a group of decimal numbers separated by a dot. The dot inserted between each byte (8 bits) to make it more readable. So, the IP address expressed as four octets separated by a dot between them. Each byte or octet can have a decimal value 0 to 255. The above IP address in dotted-decimal representation looks like:-
192.168.1.1

IP address Version 4

Classful and Classless Addressing

At the start, the IP address introduced as a Classful address. We shall discuss a classful address only because we need to know the classful scheme to understand the classless. The classless address is a prevailing standard of the present day. To read about the classless addresses, Please click the link: Classless IP address.

Classful Address

There are five classes in Classful IP addressing. They are Class A, B, C, D, and E. The distribution of address space by each IP class shown in the figure below.

IP V4 Address; Classes

The following table shows the comparison of all classes.

IP CLASSFirst Octet in BinaryFirst Octet in decimalNetwork-Host DistributionDefault Mask or Network MaskNetwork and addressesUse
Class A0xxxxxxx*0-127N.H.H.H255.0.0.0128** networks,
16,777,216 *** addresses in each network
For large Network
Class B10xxxxxx128-191N.N.H.H255.255.0.016,384 networks, 65,536 addresses in each networkFor medium Network
Class C110xxxxx192-223N.N.N.H255.255.255.02,097,152 networks, 256 addresses in each networkFor small Network
CLass D1110xxxx224-239Not definedNot definedOne block, 268,435,456 addressesMulticast
Class E1111xxxx240-255Not definedNot definedOne block, 268,435,456 addressesReserved
NOTE:
There are some special and reserved blocks in between them which I will discuss later.
*- x represents binary bit 0 or 1
**- Out of 128 networks
in Class A, a network starting with 0 is invalid so cannot be assigned and 127 is reserved for loopback.
***- The number of addresses in each class contains one Network Address and one Broadcast Address, hence the valid IP in each network
is Number of addresses minus 2.

Explanation of the Table

We define the classes of IP in terms of the value of the first octet. In class A, the first octet value in binary has a restriction of 1st bit as 0, rest 7 bits (represented as x in the table) maybe 0 or 1. Its first octet represents NetworkID and the rest three octets for HostID.

The slash value is CIDR notation, in which the number of Network bits is written after slash(/) character. A slash /8 notation means 8 bits are for Network and 32-8=24 bits are of the host.

The CIDR notation for Class A is /8, for Class B is /16 and for class C it is /24. However, it was not introduced at the time of Classful address, it’s easy to understand it this way. The Network mask was the traditional name in two way addressing, the term Subnet mask of three-way addressing is used alternately nowadays. Also, the term block used in earlier days for a Network block is not the same as the term block used as in block size today. Let’s don’t get confused in those terms.

The CIDR notations and equivalent subnet masks.
/8 —– 255.0.0.0
/16 —– 255.255.0.0
/24 —- 255.255.255.0

CIDR, block size, Subnetting, etc. are explained in next chapter.

Class A

Class A has 8 bits as Network ID, with the first bit fixed as ‘0’. Hence, the number of networks in class A is 27= 128. Again an IP address starting with a zero is undefined and never used. In the same way, network 127.0.0.0/8 is reserved for loopback IP. Hence there are 128-2= 126 usable networks in class A, i.e., networks 1.0.0.0/8, 2.0.0.0/8, and so on up to 126.0.0.0/8.

Each network in Class A will have 224= 16,777,216 addresses since there are 24 bits for hosts in each Network. The first IP of the network is the Network ID, and the last is the Broadcast ID. Both of them are reserved and cannot be used by the hosts. Hence, the valid host addresses (or usable IP address) in each network will be 16,777,216-2= 16,777,214.

The Network mask or the default mask is a 32-bit number that differentiates the network Id and host Id. If the number of network bits is ‘n’ then, the number of host bits will be 32-n. The default mask is obtained by setting leftmost ‘n’ bits as binary one and host bits as binary zero. For class A, the default network mask will be:

11111111.00000000.00000000.00000000
or,
255.0.0.0 – in decimal notation.

Class B

Similarly, Class B has two octets as network bits and two octets as host bits. The first two bits of the first octet reserved as binary ’10’. Therefore, the valid number at the network side is 16-2=14.
The total number of networks = 214=16,384.
Host address per network is = 216=65,536
And valid host address is 65,536-2=65,534

For class B, the default network mask will be:
11111111.11111111.00000000.00000000
or,
255.255.0.0 – in decimal notation.

Class C

A class C address has three octets as network bits and one octet as host bits. The first three bits of the first octet are reserved as binary ‘110’. Therefore, the valid number at the network side is 24-3=21.
The total number of networks is = 221=2,097,152.
The host address per network is = 28=256.
And valid host address is 256-2=254.
For class B, the default network mask will be:-
11111111.11111111.00000000.00000000
or,
255.255.0.0 – in decimal notation.

Class D

Class D address has only one block, and the number of hosts is 268,435,456. This class is a reserve IP class for multicasting. The router uses a multicasting address to send routing updates.

Class E

Class E address also has only one block, and the number of hosts is 268,435,456. This IP class is reserve for experimental purposes.

Example Case

Let’s take an example to understand the addressing in a classful address. It is a two-level addressing mechanism. Initially, this was designed to assign a block/network of IP to an organization. The number of hosts in the network depends on the class of IP address.
Let ‘n ‘ be the number of the network bits, then (32-n) will be the host bits. For class A, n=8, for B it is 16, and for C, n=24. Consequently, the number of host bits are 24,16, and 8 respectively for those classes.

Let’s take an example, 117.0.0.5.
Since it is class A, the first octet represents the Network, and the rest three octets are for the host.
The first IP of the network is – 117.0.0.0 and the last IP is 117.255.255.255.
You can get the first IP by putting binary zero to all the host bits, and the last IP by putting binary one to all the host bits.
So, the first IP, i.e., 117.0.0.0 is the Network ID and the last IP, i.e., 117.255.255.255 is the broadcast ID.

IP Address version 4

Network and Broadcast ID

The network ID is the identifier of the Network. The router stores the network ID as the name of the network. The valid hosts here in example is 16,777,214, from 117.0.0.1 to 117.255.255.254. A router recognizes all of them as one network, i.e., 117.0.0.0. The number of network bits defines the range of the network. Here the number of network bit is 8 since it is class A address.

The network ID followed by a slash and number of network bits defines the network/block completely.

That is : 117.0.0.0/8

The last IP is 170.255.255.255 is a broadcast ID means, anything sent to this address will go to all the hosts and the gateway. That broadcast will not go beyond the router. A valid IP of the same range is assigned to a router interface where the network connects, most probably the first valid IP. The IP assigned at the router interface will be Gateway IP for all hosts.

However, it is not mandatory to assign IP address to the switch. You may do that only for management purpose.

I am going, to sum up, the classful IP address here. For classless IP address, Follow this link.

To read about the IP assigning in a PC , Click here.

Please comment and share.

Take a Quiz on this topic :

Share this article.


Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *