IP Address in Networking
Published: 2023-03-03 03:26:59

## Introduction

In computer networking, an IP address is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol (IP) for communication. The IP address serves two main functions: host or network interface identification and location addressing.

## Structure of an IP Address:

An IP address is a 32-bit number that is divided into four 8-bit sections known as octets. Each octet is separated by a dot, and each octet can have a value between 0 and 255. An example of an IP address is _192.168.1.1._ The first part of the IP address identifies the network to which the device belongs, while the second part identifies the specific device on that network.

## Classes of IP Addresses:

_There are five classes of IP addresses: _

- Class A 
- Class B
- Class C
- Class D
- Class E

Class A addresses have the first octet as the network identifier and the remaining three octets as the host identifier. Class B addresses have the first two octets as the network identifier and the remaining two octets as the host identifier. Class C addresses have the first three octets as the network identifier and the remaining octet as the host identifier. Class D addresses are reserved for multicasting, while Class E addresses are reserved for experimental purposes.

## Public and Private IP Addresses:

Public IP addresses are globally unique and are assigned by the Internet Assigned Numbers Authority (IANA). They are used to identify devices on the Internet and are accessible from anywhere in the world. Private IP addresses, on the other hand, are used for devices that are connected to a local network such as a home or office network. These addresses are not globally unique and cannot be accessed from outside the local network.

## Subnetting:

Subnetting is the process of dividing a larger network into smaller networks or subnets. This is done by borrowing bits from the host identifier and using them to create a subnet identifier. Subnetting is important because it allows for more efficient use of IP addresses and can help to improve network performance.

## Example:

Let's say you have a small office network with five computers connected to a router. Each computer needs to have a unique IP address so that they can communicate with each other on the network and access the Internet.

You decide to use the private IP address range 192.168.0.0/24 for your network. This means that the first three octets of each IP address will be fixed as 192.168.0, while the last octet can vary from 0 to 255.

To assign IP addresses to each computer, you decide to use the following scheme:

Computer 1: 192.168.0.10
Computer 2: 192.168.0.11
Computer 3: 192.168.0.12
Computer 4: 192.168.0.13
Computer 5: 192.168.0.14
In this scheme, the first three octets (192.168.0) serve as the network identifier, while the last octet (10, 11, 12, 13, 14) serves as the host identifier.

You also decide to create two subnets within your network using subnetting. The first subnet will be used for computers 1 and 2, while the second subnet will be used for computers 3, 4, and 5.

To create the first subnet, you borrow one bit from the host identifier, giving you a subnet mask of 255.255.255.128. This means that the first subnet will have the IP address range 192.168.0.0/25, with a broadcast address of 192.168.0.127.

To assign IP addresses within this subnet, you decide to use the following scheme:

Computer 1: 192.168.0.1
Computer 2: 192.168.0.2
In this scheme, the first three octets (192.168.0) still serve as the network identifier, while the last octet (1, 2) serves as the host identifier within the subnet.

To create the second subnet, you borrow two bits from the host identifier, giving you a subnet mask of 255.255.255.192. This means that the second subnet will have the IP address range 192.168.0.128/26, with a broadcast address of 192.168.0.191.

To assign IP addresses within this subnet, you decide to use the following scheme:

Computer 3: 192.168.0.129
Computer 4: 192.168.0.130
Computer 5: 192.168.0.131
In this scheme, the first three octets (192.168.0) still serve as the network identifier, while the last octet (129, 130, 131) serves as the host identifier within the subnet.

By using IP addressing and subnetting in this way, you have created a small office network with unique IP addresses for each device, while also optimizing the use of available IP addresses and improving network performance.