IPv4 Addresses: Classes, Public IPs, Private IPs and Special IP Addresses

neotam Avatar

IPv4 Addresses: Classes, Public IPs, Private IPs and Special IP Addresses
Posted on :

IPv4 address is binary string of 32 bits, it is used to identify each computer or device connected to internet or intranet uniquely. It is necessary to have IP address assigned to a device to participate in communication in a network of computers or devices.

There are different categories of IP address, some are special IP address and some are reserved IP address. Let’s see what are those

Total IPv4 address available are 2 ^ 32 = 4294967296 .

These 4 Billion IP addresses are not enough if each address is assigned to every device or computer on this planet. To overcome this limited set of IP’s we have, we use them sparingly and effectively by making use of LAN, NAT and subnetting .

IPv4 address which is 32 bit string, is represented in dot-decimal notation by breaking 32 bits into 8-bit segments called octets. Each octet is represented by a decimal equivalent number ranging from 0 to 255. IPv4 address contains 4 octets, each octet separated by dot or decimal point(.)

Example of IP address: 192.168.1.32

IPv4 Address Classes

IP Address classes or classful networks is a classification of IP address into 4 groups called classes which are A, B, C, D and E. With “Classful IP Addressing” Routers determines class of IP address for routing classful IP address which has it’s own limitations. Classful IP address were used till CIDR (classless Inter-Domain Routing) in 1993 was introduced.

IPv4 Address Classes

ClassLeading BitsFirst Octet Range# Network Bits# Host BitsDefault Subnet Mask
(Dotted Decimal)
Subnet Mask
(Prefix Notation
)
# of Netowrks # Addresses Per Netowrk Totals # address
A00-127*824255.0.0.0/82^7 = 1282 ^ 24 = 16, 777, 216
B10128-1911616255.255.0.0/16 214  = 16, 384216  = 65,536
C110192-223248255.255.255.0/24221 =2097152 28  = 256
D1110224-239N/A N/A N/A N/A N/A N/A 268,435,456
E1111240-255 N/A N/A N/A N/A N/A N/A 268,435,456

Number of networks for class A is 2 ^ 7 = 128 since first bit must be 0 . For class B number of networks or blocks is 2 ^ 14 = 16,384 where left most two bits must be 10 for class B so it is 2 ^ 14 instead of 2 ^ 16. Class C is divided into 2 ^ 21 = 2,097,152 blocks where left most 3 bits are fixed 110.

Before classless addressing architecture was introduced each organization used to get block assigned form A, B or C based on its size

In classful network portion is determined by class of IP address. But, in classless addressing network portion is determined by subnet mask

In classful routing, class of destination is determined by performing right shift operation by 28 bits on a copy of destination address extracted from packet. Which results in 4-bit string. Class of destination address based on resulting 4-bits is determined as follows

Decimal RangeClass
0 to 7Class A
8 to 11Class B
12 to 13Class C
14Class D
15Class E
Class of destination address based on first 4 bits in classful address forwarding

Classful addressing was used in between 1981 and 1993 where “Classless Inter-Domain Routing” known as CIDR was introduced in 1993

Initially IP addresses were separated into groups called Classes. But, no longer classes are used because it’s wasteful of IP addresses. Originally it wasn’t envisioned about scarcity of IP addresses.

Default subnetmask is also called classful mask or natural mask in classful network architecture

Class D IP addresses are reserved for “Multicasting”
Class E IP addresses are reserved for experimental & research purposes

Address TypeIPv4 Address RangeTotal Number of AddressesLeading BitsClass
Multicast Addresses244.0.0.0 – 239.255.255.255 2 ^ 28 =  268,435,456 1110D
Experimental240.0.0.0 – 255.255.255.2542 ^ 28 =  268,435,456 1111E

Only class A, B and C addresses were used for hosts for very large, large and small networks respectively

Further Reading: RFC 790 , RFC 1700 , RFC 3330

Private IPv4 address

Private IP address are not routable on public internet, they are only routable with in the local network or private network. Since these IP addresses are local to private network, different private networks can make use of same IP addresses as result these private IP addresses are not uniquely identified globally.

Usually, computers and devices in factories or home are connected to private network behind router. These computers communicate with public internet using mechanism called “Network Address Translation” (NAT)

These addresses are also called RFC 1918 addresses since they were first defined in RFC 1918

Block NameDefault subnet maskCIDR NotationAddress Range# of Networks# of Hosts per NetworkAddress Class
24-bit block255.0.0.010/810.0.0.0-10.255.255.25512616777214A
20-bit block255.255.0.0172.16/12172.16.0.0 – 172.31.255.2551048574B
16-bit block255.255.255.0192.168/16192.168.0.0 – 192.168.255.25565534C

Link-local IP Addresses

If given computer or device is not able to obtain a IP address, it will be assigned a special IP address called link-local IP using protocol Automatic Private IP Addressing (APIPA). Link-local IP address is not routable neither publicly nor in private network. These link-local addresses are also referred as APIPA addresses

Block NameDefault subnet maskCIDR NotationAddress Range# of AddressesAddress Class
Link-local addresses255.255.0.0169.254.0.0/16
169.254.0.0–169.254.255.255 65536 B

Link-local IP address helps two or more hosts on single link/same network segment to communicate when no IP’s valid local or public IP’s are assigned to them.

APIPA was created by Microsoft for Windows to assign IP to interface if it not able to acquire IP. Later it became a standard

Loopback IP Addresses

Block NameDefault subnet maskCIDR NotationAddress Range# of AddressesAddress Class
Loopback addresses255.255.0.0127.0.0.0/8
127.0.0.1 – 127.255.255.255 16 777 216B

Reserved IP Addresses

Leave a Reply

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