IP - Protocol

The Internet Protocol (IP) is the method or protocol by which data is sent from one computer to another on the Internet. Each computer (known as a host) on the Internet has at least one IP address that uniquely identifies it from all other computers on the Internet.

Types of IP

The two most common versions of IP in use today are Internet Protocol version 4 (IPv4) and Internet Protocol version 6 (IPv6).

IPv4IPv6
Size32-bits (2^32)128-bits (2^128)
IP Address4,294,967,296340,282,366,920,938,463,463,374,607,431,768,211,456
Sample192.168.0.1002001:db8:cd0f:421d:2209:bc:80ba:2095

Each IP address includes a network ID and a host ID.

  • The network ID (also known as a network address) identifies the systems that are located on the same physical network bounded by IP routers. All systems on the same physical network must have the same network ID. The network ID must be unique to the internetwork.

  • The host ID (also known as a host address) identifies a workstation, server, router, or other TCP/IP host within a network. The host address must be unique to the network ID.

IPv4 Address Syntax

An IP address consists of 32 bits. Instead of expressing IPv4 addresses 32 bits at a time using binary notation (Base2), it is standard practice to segment the 32 bits of an IPv4 address into four 8-bit fields called octets. Each octet is converted to a decimal number (base 10) from 0–255 and separated by a period (a dot). This format is called dotted decimal notation.

Binary FormatDotted Decimal Notation
11000000 10101000 00000011 00011000192.168.3.24

IPv4 - Address Class

Internet Protocol hierarchy contains several classes of IP Addresses to be used efficiently in various situations as per the requirement of hosts per network. Broadly, the IPv4 Addressing system is divided into five classes of IP Addresses.

ClassRangeSUMNetwork ID / Host ID1286432168420
Class A1 - 127-N.H.H.H / 800000000
Class B128 - 191128N.N.H.H / 1610000000
Class C192 - 223128 + 64N.N.N.H / 2411000000
Class D224 - 239128 + 64 + 32-11100000
Class E240 - 255128 + 64 + 32 + 16-11110000

IPv4 - Numbers of IPs

When calculating hosts’ IP addresses, 2 IP addresses are decreased because they cannot be assigned to hosts, i.e. the first IP of a network is network number and the last IP is reserved for Broadcast IP

  • Class A => N8.H8.H8.H8 => H(8 * 3 = 24) => 2^24 => 16,277,216 - 2 => 16,277,214
  • Class B => N8.N8.H8.H8 => H(8 * 2 = 16) => 2^16 => 65,536 - 2 => 65,534
  • Class C => N8.N8.N8.H8 => H(8 * 1 = 8) => 2^8 => 256 - 2 => 254
  • Class D => Class D addresses are reserved for IPv4 multicast addresses. The four high-order bits in a class D address are always set to 1110, which makes the address prefix for all class D addresses 224.0.0.0/4 (or 224.0.0.0, 240.0.0.0).
  • Class E => Class E addresses are reserved for experimental use. The high-order bits in a class E address are set to 1111, which makes the address prefix for all class E addresses 240.0.0.0/4 (or 240.0.0.0, 240.0.0.0)