IP Addressing

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

IP Addressing

Two most important functions in a data network are:

1. To uniquely identify each host or computer or device participating in


network. This is called addressing.

2. To be able to connect and move data packets between any devices in a


network. This is often called switching and routing by connecting devices
to switches and routers respectively.

An IP address and Subnet Mask are very basic entities of data network

What is an IP Address?

An IP address is a 32 bit number like 11000000101010000000000100000001 in binary


or 3232235777 in decimal. So it is written in 4 parts like
11000000.10101000.00000001.00000001 in binary form and 192.168.1.1 in decimal
form. This way it is easier to understand.

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.

Similarly in case of IP address, we logically partition an IP address in parts so that we can


reach a computer from anywhere (yes, obviously if the route exists). Also not that logically
partitioning an IP address is different than writing an IP address in 4 parts, that’s just a
notation.

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.

What is a subnet mask?

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.

Why is it called Subnet Mask, why not Network Mask?

“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.

History of Subnet Mask

In 1969:

THERE WAS NO SUBNET MASK!!!

THERE WERE NO NETWORK CLASSES (CLASS A, B, C, D and E)

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:

NETWORK CLASSES WERE INTRODUCED!!!

AGAIN, THERE WAS NO SUBNET MASK!!!

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:

Enough, we require a Subnet Mask now!

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.

From 1993 onwards:

Classless Networking was introduced!

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

Subnetting, Supernetting and Network Address Translation

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.

The lack of inflexibility in the addressing scheme is particulalrly undesirable because


according to many authorities there is a real danger of the Internet running out of
addresses, as a result of several factors which were not envisaged when the Internet
protocols were originally designed, such as :

• take-up by business and domestic users


• increasing demand for "always-on" connections requiring a dedicated IP address,
so that ISPs have less ability to share out a limited number of IP addresses by
reallocating them as customers disconnect
• convergence of computing, communications and entertainment industries could
mean that every TV set, mobile phone, playstation and DVD player will want to
have an IP address.

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 11000000The subnet can then be indentified by ANDing


the complete IP address with the mask giving the result shown below:

00001001 01000011 00100110 00000001 = class A address 9.67.38.1

00001001 01000011 00100110 00000000 = subnet base address 9.67.38.0


Suppose a class C network has the subnet mask

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

11010100 01110010 00010000 01110001 = 212.114.32.113Applying the subnet mask


gives us

11010100 01110010 00010000 01100000 = 212.114.32.96The host ID proper comes out


as 00010001 = 17.

For compatibility, routers include masks for unsubnetted addresses:

• 255.0.0.0
• 255.255.0.0
• 255.255.255.0
• N/A
• N/A

Supernetting and Classless Inter-Domain Routing (CIDR)


CIDR is in a sense the converse of subnetting, in that bits are taken from the network ID
to identify a cluster of network addresses which are to be treated as a single entity. The
main reasons for this are:

• As a consequence of the address exhaustion problem, Class B addresses are only


assigned to organisations that can show a clear need for them: organisations
which do not meet the requirements are instead given a contiguous block of
Class C addresses.
• Having a series fo router table entries for networks which all map onto the same
route is wasteful of space and degrades routing algorithms.
CIDR uses a supernet mask along with the lowest network address in the assigned block
to identify the range of assigned network addresses.

Network Address Translation and IPv6

Network Address Translation is a technique which allows for the composition of a


network to be completely hidden from the outside world, with the entire network
identified by a single IP address. Within the network, hosts and routers have addresses
which are unique to that network, typically taked from the ranges designated as
"private" (see above). In order to make sure that responses get back to the right hosts
when packets are sent out into the Internet, the router will construct a table associating
outgoing packets with private IP addresses; the address of the relevant table entry will
be stored in the packet itself. This technique is controversial however; for one thing the
field in the packet where the index into the table is stored is part of the TCP header,
which violates the principles of modularity and encapsulation on which the "protocol
stack" models are based.

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.

You might also like