IP Addressing
IP Addressing
IP Addressing
An IP address and Subnet Mask are very basic entities of data network
What is an IP Address?
Now, a unique number is sufficient to identify each host in a network but that alone cannot
help in reaching from one host to another. Imagine if every house in world had a unique
number or some name, but no state, city and country info. Would it be possible to reach
a particular house even if its number is known?
So logically, addresses are made up of parts, like state, city, street and finally house
number. Most of the parts of an address are common to many people, like people living
at same street or city. Generally only the house number and name finally differentiates
between any two similar addresses.
So to keep things simple we generally divide an IP address in two logical parts. One is
network part and the other is host part. Network part is like street, city, state which is
shared by multiple IP addresses. Host part is like house number and name of the person.
Both parts together uniquely identifies a host or computer. We can also partition an IP
address in more than two parts.
Subnet mask is a 32 bit number just like an IP address and is written just like it. But subnet
mask is not used as a 32 bit number. It cannot hold just any value like IP address. Subnet
mask is something which draws a line somewhere is an IP address to help logically
partition an IP address into logical parts. Now again, from logical parts I don’t mean writing
an IP address as four 8 bit numbers, that’s the notation. I mean logical parts like Network,
Sub-network and host, just like state, city and house number.
A subnet mask should only have continuous 1s starting from MSB (Most Significant Bit).
Like 11111111.11111111.00000000.00000000. Which means first 16 bits of an IP
address belongs to network part and rest is host part. A subnet mask can also have non-
contiguous 1s, but that is strictly discouraged and not recommended by RFC 950.
“Subnet” means sub-network. So the purpose of subnet mask was to create another
partition (3rd part) in an IP Address after network part. But then how we defined and
identified the network part of an IP address? Why we required another logical partition of
sub-networks when we already had network part? Now, to understand all this we need to
know a little history of how networks worked in its starting days.
In 1969:
Standard reserved first 8 bits for network part. That meant we could only have 254 distinct
networks and each network can have 16,777,214 IP addresses.
In 1981:
24-bits for host address can hold 16,777,214 IP addresses. Not every organization in
world requires a network of thousands of computers. Rather we required more networks
of smaller size. Also it was clear that different organization have different requirement of
network size. This meant that we will have to partition IP addresses in a way so that we
can have different sizes of network. The different size of network bits created different
classes of network, which we called Class A, Class B and Class C.
But as there was nothing other than IP address, not even subnet mask, we needed a way
to identify what is the network class of a given IP address. Take 12.1.2.3 for an example.
We cannot identify what part of it belongs to network and to host without any other
information given.
In 1981, numbers of networks being used were very less and were limited to 6 LSB (Least
Significant Bits) of Network bits (First 8 bits). You can say if 50 networks existed at that
time then 50 will take a value of 00110010. So by standard we fixed the values of MSBs
of first octet to identify class of an IP address which automatically divided the decimal
value of first octet in ranges. Also we wanted that new scheme should not cause to
change existing IP addresses in use.
For example Class A’s IP address will always have MSB always 0. Which means any
class A address will always be between 0-127 in its first octet.
In 1985:
Finally in RFC 950 Subnetting was introduced. Soon after classes were introduced, as
number of organizations grew at a very past pace, we realized that we needed some way
to further partition a network into Sub-networks of smaller sizes. Here was the subnet
mask introduced. That is why it is called a “subnet” mask, but not network mask. Use
of a subnet mask along with an IP Address also gave the flexibility to define subnets of
various sizes to network administrators.
Network Devices, Operating systems and protocols were updated to accommodate for
subnet mask. Classes still existed. Still we used the MSBs to identify Class of an IP
address. Subnet mask always took value greater than 255.0.0.0 like 255.240.0.0. We
used it to further subnet a Classful network. Subnet mask logically partitioned an IP
address into three parts. This methodology of allocating IP addresses is called Classful
Networking.
Why do we need to divide an IP address in three parts, why not just two? You can just
merge subnet part with network part using a subnet mask or call it a Network Prefix. Why
do we need classes anymore? Nowadays when we enter an IP address 192.168.1.1 in
network card properties, subnet mask 255.255.255.0 will be automatically populated in
subnet mask field. This does not mean that we cannot set subnet mask 255.0.0.0 for an
IP address 192.168.1.1 in case of classless networking. It is just that we are being
compatible with Classful network and respecting private IP range. But technically it will
work with any network prefix. Network devices, operating systems and protocols do not
care about classes anymore.
IP ADDRESS FORMAT
Exclusions
Some address ranges are excluded from the above classes. All addresses of the form 127.xx.yy.xx
are used for diagnostics. The following address ranges are designated as "private": meaning thay
can only be used on networks which are not connected to the global Internet:
10.0.0.0 - 10.255.255.255
172.16.0.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
Examples
Find the class, network and host addresses for:
4.23.145.90
227.34.78.7
246.7.3.8
129.6.8.4
198.76.9.23
The classfull addressing scheme has proved to be too inflexible to accommodate the
demand for IP addresses; specifically, the convention that the part of the address which
identifies a physical network must come on an 8-bit boundary meant that the address
space could not be allocated efficiently and a significant proportion of addresses would
be wasted. For instance, a Class A network can in theory have 16 million host IDs, which
is way more than would be possible for a single physical network (subnet). Many
enterprises have been allocated Class B addresses, giving them a theoretical maximum
of 65,535 hosts, and may have no more than a few hundred hosts or less: under the
classfull scheme the remaining host IDs for that network ID would be unused.
Subnetting
The basic idea behind subnetting is that we take away some bits from the host portion
of the address and use them to identify the subnet. This will only be visible to hosts and
routers on the local network; from the point of view of the Internet at large only the
network ID portion will have any particular meaning. The way this works is that the
network administrator defines a subnet mask, a string of 32 binary digits indicating the
boundary between the subnet and host sections of the "local" portion of an IP address.
Some examples should help make this clear:
Take the Class A address 9.67.38.1, where 9 is the network address and 67.38.1 identifies
a particular host on that network. Suppose the network administrator wants to use bits 8
to 25 to identify the subnet, leaving 26 to 31 for host addresses. This is done by means
of a mask which is all 1's from bits 0 to 25 with the remainder set to 0's:
11111111 11111111 11111111 11100000This means that the first three bits from the
host ID are used to identify the subnet, and the remaining 5 bits indicate the host itself.
Take a host with the IP address
• 255.0.0.0
• 255.255.0.0
• 255.255.255.0
• N/A
• N/A
A longer term solution to the address exhaustion problem is offered by IP version 6 (IPv6) which
among other innovations will support 128-bit addresses.