IP-V4 | Classes, Masks, And Private IPs
IPv4 addresses are divided into classes, which are determined by the
first few bits of the address. The classes include:
Class A: The first bit is always 0, and the next 7 bits represent the
network identifier. The remaining 24 bits are used for the host identifier.
Class A addresses are used for very large networks.
Class B: The first two bits are always 10, and the next 14 bits
represent the network identifier. The remaining 16 bits are used for the host
identifier. Class B addresses are used for medium-sized networks.
Class C: The first three bits are always 110, and the next 21 bits
represent the network identifier. The remaining 8 bits are used for the host
identifier. Class C addresses are used for small networks.
Class D: The first four bits are always 1110, and these addresses are
used for multicast traffic.
Class E: The first five bits are always 11110, and these addresses are
reserved for future use.
In addition to the classes, IPv4 addresses can also be divided into two
categories: public and private.
Public IP addresses are unique addresses that are assigned to devices on
the public internet. They are globally routable and can be accessed from
anywhere in the world.
Private IP addresses, on the other hand, are non-unique addresses that
are used for internal networks. They are not routable on the public internet
and are only used within a private network. Private IP addresses are defined in
RFC 1918 and include the following ranges:
10.0.0.0/8: This range includes all addresses from 10.0.0.0 to
10.255.255.255 and is used for large networks.
172.16.0.0/12: This range includes all addresses from 172.16.0.0 to
172.31.255.255 and is used for medium-sized networks.
192.168.0.0/16: This range includes all addresses from 192.168.0.0 to
192.168.255.255 and is used for small networks.
To identify the network and host portions of an IP address, a subnet
mask is used. The subnet mask is a 32-bit number that is used to divide the IP
address into a network and host address. The subnet mask consists of a string
of 1s followed by a string of 0s, with the number of 1s indicating the number
of network bits and the number of 0s indicating the number of host bits.
For example, a Class C address with a subnet mask of 255.255.255.0 would
have the first 24 bits used for the network and the last 8 bits used for the
host.