Skip to main content

IP Addressing


Internet Protocol (IP) address is a unique number used to identify a computer and communicate with each other on a network. The IP address is a 32-bit value which is divided into four 8 bit fields called octet. An IP address consists of two parts, a network address and a host address. The numbers in the IP addresses range from 1.0.0.0 to 255.255.255.255. This is known as dotted decimal notation.

The two parts of address are:

1.      Network Address
2.      Host Address
Network Address
Network Address is the first part of the IP address which is used to uniquely identify the network in a large TCP/IP Network environment. Each network must know its own address on the Internet and that of the other network which it communicates. The organization requires a unique network number, which it can requests from Network Information Center (NIC). This unique network number is added to packet, which is sent from the network onto the Internet.

Host Address
The Host Address is used to uniquely identify the host in the particular network identified by Network portion of the IP address.
In addition to network address or number, information is required to identify which specific host or machine in a network is sending or receiving a message. Therefore, IP address needs unique network number and a host number.

Why IP Addressing?
Every host on a TCP/IP network needs to have a unique address to send the data from one host to another. Every data packet contains addressing information in the header, and the IP address in the header is used to route packets. IP addresses are unique on each network to identify the appropriate host. IP addressing is basically addressing configuring each TCP/IP host with a valid IP address. In order to access the Internet, a host must have an IP address that identifies not only the host address but also identifies the network address. An administrator needs to be aware of proper addressing techniques so that the hosts on the network will function correctly.
IP addresses are mainly used to deliver the data packets across the network for which the source and destination IP address remains constant as the data packet traverses. Each time a packet travels through a router; the router will refer to its routing table to see if it can match the network number of the destination IP address with an entry in its routing table. If a match found, the packet is forwarded to the next hop router for the destination network in question. If a match is not found, the packet may be forwarded to the router defined as the default gateway, or the router may drop the packet.

IP Address Classes
An IP Address is given to a system to identify the system uniquely on the Network. The IP address is made of 32 Bits and has two portions namely the Network portion and the Host portion. The 32 Bits are divided into four octets each octet having 8 bits. The binary digits are converted into the decimal and they are represented in dotted decimal format. The value of each octet can vary from 0 to 255.
IP address is mainly categorized onto five classes:


Class
Value of first byte
Value of first bits
No.of networks/No.of bits for N/W
No.of Hosts/No.of bits for Hosts
Purpose
A
1-126
0
126/8
16,777,214/24
Large network with many devices
B
128-191
10
16,384/16
65,534/16
Medium sized to Large Sized network
C
192-223
110
2,097,152/24
254/8
Small networks used for LAN
D
224-239
1110
----
---
Used for Multicasting
E
240-254
1111
---
---
Reserved for Future use


The different classes of IP address is represented as follows:
N – Network Address
H – Host Address




Note: Class D and Class E addresses are reserved for multicast traffic and experimental purpose respectively.
Exactly where the network part ends and the host part begins is calculated by routers, using a so-called subnet mask as a deciphering key.

Representation of Class A
Classes A addresses are used for large networks with many devices. Class A comprises networks 1.0.0.0 through 127.0.0.0. The first octet is only used to identify the network number; the next three are used to identify the hosts on the network. The class A address ranges from 1-126.
Network.Host.Host.Host
Example: The address 10.2.6.1 is a Class A address as the first octet is between 1 and 126. Therefore, the network is 10 and 2.6.1 is a host on that network.
The Class A address starts from 1 to 27 and the first bit on the first octet should have 0 in the column. Therefore first possible network in Class A is 1.


128
64
32
16
8
4
2
1
0
0
0
0
0
0
0
1


In Class A, 127 cannot be used because 127.0.0.1 is reserved and is used for troubleshooting. This means that it is used by host computer to send message back to itself.


128
64
32
16
8
4
2
1
0
1
1
1
1
1
1
1


Host number in Class A start with one 10.0.0.1 is the first host number. The binary form of this host number is as follows:
00001010.00000000.00000000.00000001
Second host or binary form of 10.0.0.2 is as follows:
00001010.00000000.00000000.00000010
You can see that 10.255.255.255 is not used. This is because all the binary values in the host part of the address are 1 which indicates that it is a broadcast.

Representation of Class B
Class B addresses is used for medium sized networks. Class B comprises networks 128.0.0.0 through 191.255.0.0. In Class B networks the first bit value in the first octet is 1 and second bit value is 0.
Example: The address 172.16.52.63 is a Class B address, because the first octet is 172, which is between 128 and 191.


128
64
32
16
8
4
2
1
1
0
0
0
0
0
0
0


In Class B, the first network number is 128


128
64
32
16
8
4
2
1
1
0
1
1
1
1
1
1


The last network number is 191.
In Class B, the network number is the first two octets. The other two octets are used to identify each host. The first two bits of the first octet cannot be used because they are reserved for large organizations. So the remaining is 6 + 8 = 14 bits. Therefore the total numbers of possible networks are 214 – 2 = 16384. In the host part, two full octets are used, so the total number of bits is 8 + 8 = 16, which gives 216 – 2 = 65534 hosts per network.

Representation of Class C
Class C addresses are used for small networks. The Class C has the first bit value 110, which is split as first bit value is 1, second bit value is 1 and third bit value is 0 in the first octet. It contains networks 192.0.0.0 through 223.255.255.0. The network number is in the first three octets and last octet is used to identify host. In Class C, the (221 – 2) Class C networks each with 254 (28 – 2) hosts.
Example: The address 192.168.123.132 is a Class C address, because the first octet is 192, which is between 192 to 223.


128
64
32
16
8
4
2
1
1
1
0
0
0
0
0
0


The first network number in Class C is 192


128
64
32
16
8
4
2
1
1
1
0
1
1
1
1
1


The last network is 223.

Class D
Class D addresses are multicast addresses. It has first bit value of 1, second bit value of 1, third bit value of 1 and fourth bit value of 0. The other 28 bits are used to identify the group of computers to which multicast messages are intended for.
Class E
Class E addresses are reserved; it cannot be used on IP networks. Some research organizations use Class E addresses for experimental purpose. It has first bit value of 1, second bit value of 1, third bit value of 1 and fourth bit value of 1.

SUBNET
Subnet is a physical segment of a network which allows the flow of network that is connected to the network by means of a network devices like routers. When creating a network it is essential to create Host ID and Network ID to enable you to exactly locate the host in the network. Matching the Network ID can identify the hosts in the same subnet. Subnetting allows you to create the multiple logical networks that exists within a single class A, B, or C. When a network is divided into subnets it is essential to have a unique ID for each subnet. Hence, the host part is divided into subnet ID and Host ID. Subnetting is a technique that allows a network administrator to divide one physical network into smaller logical networks and, thus, control the flow of traffic for security or efficiency reasons.

A broadcast is the process where the message is transmitted to all the physical devices within the same physical Network segment. Routers present in each subnet do not allow the network traffic to be broadcasted to other segments of the Network. Thus, Subnetting a network indirectly influences the Network traffic being transmitted to other physical network segments. Broadcasts consume a large amount of Network resources like bandwith. Therefore, it is well suited for small organization which connects all their machines to one single network. But it lacks flexibility for large organization that contains many subnetworksor subnets. So the IP addressing scheme was improved through a technique known as subnet addressing or subnetting, which divides one large network into many small networks .There are many reasons to perform subnetting. Some of the advantages of subnetting include the following.

Advantages of using Subnet
·         By organizing hosts into logical groups, subnetting can improve network security and performance.
·         Network traffic can be controlled by reducing the number of broadcast that is sent to each segment in the network.
·         A subnet allows the flow of network traffic between hosts to be separated based on the network configuration.
·         It is easier to identify the network problems in smaller connected networks than within one large network.
·         The administrator has the flexibility to organize additional subnets without obtaining a new network.
·         Subnets can isolate internal networks so they are not visible from external networks.

In subnetting, IP address must be divided into three elements instead of two. Leaving the network part of the IP address and dividing the host ID into subnet ID and host ID do this. The subnet ID is used to identify the each subnet in a network. This means that dividing the host ID into subnet ID and host ID reduces the size, if the host ID portion because the number of bits in the IP address is fixed at 32.

Netmask
Netmask is the boundary between net ID and host ID. To identify the network ID and host ID in the IP address, Netmask can be used. This is 32 bit value in which one bits (255s) identify network ID and the zero bits (0s) identify host ID. Using netmask value, you can easily determine number of bits assigned for the net ID and number of bits reserved for the host ID. In other words, by identifying the netmask value, you can easily identify the Class to which an IP address belongs.
Example: Network Address: 16.0.0.5 and netmask 255.0.0.0
In the above example, you can see that the netmask has value 255.0.0.0 which means the first octet contains all one bits and last three octets contains all zero bits, which indicates the first octet is the net ID and last three are reserved for the host ID. Therefore, the IP address 16.0.0.5 is a Class A address with 16 being the net ID and 0.0.5 being the host ID.

Subnet Mask
Subnet mask is the boundary between net ID and subnet ID. Just like Netmask, subnet mask is also made up of 32 bit value, in which one bit identify network ID and subnet ID while zero bits identify host ID. Subnet mask can be used for identifying the numbers of bits that are assigned for the network ID, host ID and subnet ID.
To understand the Subnet Mask, let’s consider the IP address, Netmask and Subnet mask to be as follows:

IP address: 200.23.34.77, Netmask: 255.255.0.0 and Subnet mask: 255.255.255.0. According to the Netmask value, the first two octets are reserved for the network ID and last two octets are reserved for the host ID. Therefore, 200.23.34.77 can be broken as follows:
Net ID: 200.23
Host ID: 34.77
But this IP address has subnet mask of 255.255.255.0 which means that first three octets are used for the network ID and subnet ID and last octet is used for the host ID. According to this, 200.23.34.77 can be broken as follows:
Net ID and Subnet ID: 200.23.34
Host ID: 77
But, we determine that the network ID is 200.23. By combining all the above information, the IP address 200.23.34.77 is divided as follows:
Net ID: 200.23
Subnet ID: 34
Host ID: 77

Default Subnet Masks

Class
Representation
Default Subnet Mask
First Byte Value
Class A
N:H:H:H
255.0.0.0
1 – 126
Class B
N:N:H:H
255.255.0.0
128 – 191
Class C
N:N:N:H
255.255.255.0
192 – 223



Private Addressing
The IP Address that is used internally and not made known to others is called Private IP Address. In private addressing you can have both a Public and a Private IP address and is also you would be sharing your Public IP Address with others on your internal network, but your Private IP Address would be unique within your network.

The Private IP Addresses are in three ranges that are reserved for use by private and non-Internet connected networks as shown in the table below.


Address Block
Classes of networks
Number of IP addresses
10.0.0.0 – 10.255.255.255
A
16,777,216
172.16.0.0 – 172.31.255.255
B
1,048,576
192.168.0.0 – 192.168.255.255
C
256


The address blocks given in this table can be used in any network at any time. However, devices that use these addresses will not be able to communicate with other devices or nodes on the Internet without some form of address translation.

The multiple computers on a network need to be uniquely identified. Hence each system on the network is given a unique IP Address. Registered Public IP address are given to systems that need to be directly accessible over the Internet though it is possible to access the Internet with the private IP address through Proxy server or NAT. If network is limited to one organization then there is no need of registered IP address. So using public address externally and private address internally is very important while configuring a network. Private IP addresses are used on private network but computers that use these addresses cannot connect to the Internet.

Public Addressing
Public IP Address is also known as Static IP Addresses that are visible to the public. The public IP address allows other people to access the system, like a Web server. Public IP address is directly connected to the Internet.

The table below differentiates the Private IP Address and Public Address:


Private IP Addressing
Public IP Addressing
Can be used on private networks and not directly accessible over the Internet.
Computers that directly use the Internet need a Public IP Address
The IP address is assigned by the system Administrator and no registration of IP Address is required.
The IP Address is assigned by the Internet Assigned Numbers Authority (IANA) or ISP.
Private IP Addresses are not given to public machines and hence duplication of IP Address is not possible.
Public IP Addresses are limited in numbers.
Information sent over Private IP address can travel only through the local Network.
Information sent to a public IP address transmits over the Internet.


Resource Used:
1. Networking (IIHT) 
2. Tanenbaum

Comments

Popular posts from this blog

Characteristics of a Good Programming Language

Till now there are many high level languages which are very popular, and there are others, which could not become so popular in-spite of being very powerful. There might be many reasons for the success of a language, but one obvious reason is the characteristics of the language. Several characteristics believed to be important with respect to making a programming language good are briefly discussed below. Simplicity A good programming language must be simple and easy to learn and use. For example, BASIC is liked by many programmers only because of its simplicity. Thus, a good programming language should provide a programmer with a clear, simple and unified set of concepts which can be easily grasped. It is also easy to develop and implement a compiler or an interpreter for a programming language that is simple. However, the power needed for the language should not be sacrificed for simplicity. The overall simplicity of a programming language strongly affects the readability of the pr...

Angular 4 and Firebase Authentication: Setup

If you have come to this article, it means you are keen to learn new technology and that too Firebase. I love Firebase because it provides all basic but important features of any web application. Take for example, authentication, which is cumbersome and risky if not implemented with utmost care. And when we have the integration of Angular and Firebase, it becomes a lot easier for a developer to build such crucial modules in less time with minimal efforts. In this article we will create a simple Angular application using Firebase. I am going ahead with the understanding that you know the benefits of Firebase and have little knowledge about it. There are plenty of posts out on the web if you are behind. Step 1: Install Angular CLI (if not installed). npm install -g angular-cli Step 2: Create new Angular 4 project. By default now angular CLI will create Angular 4 project so you need not fret. ng new firebase-authentication Step 3: Check whether the ne...

Switch-case, simple calculator . . .

11.      Write a program to perform some mathematic functions with the help of “switch-case” statement. #include<stdio.h> #include<conio.h> void main() { int a,b,ans; char c; clrscr(); printf("\ Enter a and b:"); scanf("%d%d",&a,&b); printf("\n Enter operator:"); fflush(stdin); scanf("%c",&c); switch(c) { case'+':ans=a+b;       break; case'-':ans=a-b;       break; case'*':ans=a*b;       break; case'/':ans=a/b;       break; } printf("\n ans %d",ans); getch(); } 12.      Print the Fibonacci series #include<stdio.h> #include<conio.h> void main() { int a=1,b=1,s=3,c,ch; clrscr(); printf("how many steps="); scanf("%d",&ch); printf("%5d%5d",a,b); for(s=3;s<=ch;s++) {       c=a+b;       printf("%5d",c);       a=b;    ...