Sunday, March 16, 2014

IPv4 Classes in detail, Network and Host components, Types of IP Addresses:



            So far we’ve learnt that IPv4 is classified into five classful networks namely:

Class-A (0.0.0.0 to 127.255.255.255)
Class-B (128.0.0.0 to 191.255.255.255)
Class-C (192.0.0.0 to 223.255.255.255)
Class-D (224.0.0.0 to 239.255.255.255)
Class-E (240.0.0.0 to 255.255.255.255)

What is meant by Network Component and Host component of an IP address?

The network component is used for identifying a network, similar to Street Number.
The Host component is used to identify a specific host (or network device) in a network, similar to House number.

Network and Host portion of each of the classes:

Class-A:

            In this the first 8 bits are defined for network portion and the rest of the 24 bits for host portion.           

For example, in the Class-A IP address: 10.0.1.100
The first octet value: 10 represent the network component and the remaining address: 0.1.100 is the host component.

How many networks are there in Class- A? And how many hosts can be there in a single Class-A network?

To understand we need to do some calculations:
  1. The leading/parity bit in Class-A is ‘0’ (Only one bit).
  2. The size of the network component in Class A is 8 bits.
Now the number of network bits = 2n-2p.
Where n- size of the network component
            p- Number of parity bits
 It means that a single Class-A network consists of 16,777,214 host assignable IP addresses. (The ‘-2’ is for network and broadcast addresses, which we will discuss shortly)


Class-B:

            In this the first 16 bits are defined for network portion and the rest of the 16 bits for host portion.           

For example, in the Class-B IP address: 150.25.10.5
The first two octet values: 150.25 represent the network component and the remaining address: 10.5 is the host component.

How many networks are there in Class- B? And how many hosts can be there in a single Class-B network?

To understand we need to do some calculations:
  1. The leading/parity bit in Class-B is ‘10’ (Two bits).
  2. The size of the network component in Class B is 16 bits.
Now the number of network bits = 2n-2p.
Where n- size of the network component
            p- Number of parity bits

 It means that a single Class-B network consists of 65534 host assignable IP addresses. (The ‘-2’ is for network and broadcast addresses, which we will discuss shortly)

Class-C:

            In this the first 24 bits are defined for network portion and the rest of the 8 bits for host portion.           

For example, in the Class-C IP address: 192.168.10.5
The first three octet values: 192.168.10 represent the network component and the remaining address: .5 is the host component.

How many networks are there in Class- C? And how many hosts can be there in a single Class-C network?

To understand we need to do some calculations:
  1. The leading/parity bit in Class-C is ‘110’ (Three bits).
  2. The size of the network component in Class C is 24 bits.
Now the number of network bits = 2n-2p.
Where n- size of the network component
            p- Number of parity bits
It means that a single Class-C network consists of 254 host assignable IP addresses. (The ‘-2’ is for network and broadcast addresses, which we will discuss shortly).

Class-D:

            The Class-D address range: 224.0.0.0 to 239.255.255.255 is used for multicasting. Multicasting is nothing but sending a single message to group of selected machines.
            For example, the routing protocol: OSPF uses 224.0.0.5 to send hello packets to all OSPF routers on a network segment.

Class-E:

            This range of IP addresses: 240.0.0.0 to 255.255.255.255 are left for future experimental purposes nothing but research and development.

Types of IP addresses:

Network Address/Network ID:
            The IP address with all zeros in the host portion is called a network address. It is used to identify the network/subnet of a host.

For example,

Broadcast Address:

            The IP address with all ones in the host portion is called as a broadcast address. This address is used to send a single piece of information to all the devices on a single network.

For example,

 Reserved Addresses:

            There are few address ranges reserved for some special purposes.

            For example, the Class-A IP address range: 127.0.0.0 to 127.255.255.255 is reserved for loopback addressing which are primarily used for testing whether the NIC card has correctly loaded the Internet Protocol.

            Another example, the Class-B address range: 169.254.0.0 to 169.254.255.255 is reserved for auto configuration of IP address. It means whenever a device is not assigned an IP address or if it is unable to get an IP address from the DHCP (Dynamic Host Configuration Protocol) server then the NIC card will automatically assign one of the IP address from the given address range.
           
Private IP Addresses:

            Computers not connected to the Internet such as factory machines that communicate only within the LAN segment doesn’t need to have a globally unique IP address.
            So three ranges of IP addresses are defined for private networks:

1 (One) Class-A network: 10.0.0.0 to 10.255.255.255
16 Class-B networks: 172.16.0.0 to 172.31.255.255
256 Class-C networks: 192.168.0.0 to 192.168.255.255

Public IP Addresses:

            The IP addresses from the Class-A,B and C other than private IP addresses and reserved IP addresses are considered as public IP addresses.
            Public IP addresses are used by Internet servers such as webservers, DNS servers and routers.
For example the public IP address of the  www.google.com is:


From the above output we can understand that the web-server of google.com is hosted on the server with IP address: 74.125.236.211. If we type this IP address in the address bar of browser than it will take us to google.com page.    

In the next post we will overview the Classful IPv4 addressing and the problems with Classful addressing method and solutions.


IPv4 Addressing and Classes



IP Addressing:

            The second function of the Internet Protocol is to provide logical addressing for the network devices to identify them uniquely. So to understand about the IP addressing and its importance let us take a look at the below simple example:
 From the above picture we can identify any house uniquely just by providing the street number and the house number. This naming structure is provided by the government of that town to easily identify the houses in that town instead of the names of the house owners or anything else.
            If we try to use the names of the building owners then it might be possible that two owners with the same name reside in the same street. In order to maintain the uniqueness the streets and houses are provided with numbering scheme.
            Now if a person is sending a courier to any of the houses, then he just need to simply mention the “Street number and House number”.

            Similarly for the computers to be identified uniquely in a network the Internet Protocol has defined an addressing format:
            “Network number/component . Host number/component”.
            There are two versions of Internet Protocol they are IPv4 (Internet Protocol version4) and IPv6 (Internet Protocol version6). Even today the mostly seen IP version is IPv4 the latter version is emerging rapidly and will soon replace the first version. (We will discuss the difference between versions later).

Internet Protocol version4 (IPv4):
           
            According to the IPv4, an IP address is made up of 32 bits (4 bytes) and is partitioned as two components: Network component and Host component, just like the Street Number and the House Number.

            The 32 bits (4 bytes) are separated by a period for every 8 bits (1 Byte), for example:

Then the 32 binary bits are converted to decimal numbers as shown below, to make it easily read and understood by human beings. (To understand about the binary to decimal conversions, have a look at the post: Number Systems).
 The above decimal format is commonly called dotted-decimal notation.


History/Background Information of IPv4:
           
            In the early stages of the IP addressing the network component was only Most Significant Octet i.e. only the first 8bits from the left hand side and the rest of the 24 bits were for host component.
            Since there were only 8bits to represent a network (Street) the structure was able to support only 256 networks (Street numbers). In the beginning it was fine but later as soon as the users of internet grew (number of streets increased); the Internet Protocol was short of networks (Street numbers).
            Then in 1981, the Internet Protocol was revised to support large number of networks resulting in classful networks.

Classful Networks:

            The revised Internet Protocol increased the number of network bits from 8 to 24 and then classified the IP address space into five classes: Class A, Class B, Class C, Class D and Class E.
            So first we need to understand how the classes are defined.

How the five classes of IPv4 are formed?

            Before we try to understand about the classification, we need recollect our previous knowledge about bits and the values they represent.
            One octet/byte = 8 bits, so the minimum value of an octet is eight zeros and the maximum value is eight ones.
 So now the minimum value of an IPv4 address is 32 zeros and the maximum value of the IPv4 address is 32 ones.
 Now let us take few random values b/w the minimum value of an octet i.e. 0 (00000000) and the maximum value of an octet i.e. 255 (11111111) in binary digits.

Now let us consider the octet to be Most Significant Octet:
 
 

Now if we observe the above table carefully, we can order the randomly chosen numbers from the Most Significant Octet into 5 types:
  1. Numbers beginning with 0.
  2. Number beginning with 10.
  3. Numbers beginning with 110.
  4. Number Beginning with 1110.
  5. Number beginning with 1111.
These bits are called as priority/leading bits and depending on these three bits from the most significant octet the five classes are defined.

Class A:
            The IP addresses beginning with 0 as the leading/parity bit are considered as the Class-A IP address.
 


Class B:
            The IP addresses beginning with 10 as the leading/parity bit are considered as the Class-B IP address. 

Class C:
            The IP addresses beginning with 110 as the leading/parity bit are considered as the Class-C IP address. 

Class D:
            The IP addresses beginning with 1110 as the leading/parity bit are considered as the Class-D IP address. 
 Class E:

            The IP addresses beginning with 1111 as the leading/parity bit are considered as the Class-E IP address. 
 This is how the IPv4 address space is classified into five classes respectively. And the main reason for classifying is to increase the number of networks.

In the next post let us discuss in more detail about the network component/portion and host component/portion of each of the five classes.