IP Addressing and Subneting

You might also like

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

IP ADDRESSES AND SUBNETTING

Objective
In this lab we will learn about IP addresses and sub netting.
Theory

IP Address
An Internet Protocol (IP) address is a numeric label consisting of a 32 bit number assigned to a
network capable device that uses IP for communication. The address fundamentally serves two
purposes: location addressing and computer host or network interface identification. The address
indicates where the connected device resides with the majority of hosts/devices still using the IPv4
(Internet Protocol Version 4) form of addressing. A significant limitation of the legacy IPv4
addressing is that it supports less than 4.3 billion total addresses. Based on the rapid growth of the
Internet and related technologies, the use of IPv4 is not sustainable for the long term. In the mid-

IPv6 technology continues to be deployed, albeit slowly. The Internet Assigned Numbers
Authority (IANA) is responsible under the IETF for management of the IP address space allocation
globally. Beneath the IANA, there are five regional Internet registries (RIRs) that are responsible
for allocating IP address blocks to Internet service providers (ISPs) and other trusted organizations.

IP Address Classes

There were five IP address classes in use before the majority of industry switched to classless
routing. There were A, B, C, D, and E. Class A addresses were used for networks with a very large
number of total hosts. Class B was designed for use on medium to large networks, and C for small
local area networks (LANs). Class D and E were set aside for multicast and experimental purposes.
In the following table, the four octets that make up an IP address (a, b, c, and d respectfully) are
displayed in how they were distributed in classes A, B, and C.
Classes A, B, and C.

Clas
s IP Address Network ID Host ID

A a.b.c.d A b.c.d

B a.b.c.d a.b c.d

C a.b.c.d a.b.c D

Lab Instructor: Engr. Hina Abrar


Class A IP addresses were used for networks that had a large number of hosts on the network. The
class permitted up to 126 networks by using the first octet of the address for the network
identification. The first bit in this octet was always fixed or set to be zero. The following seven
bits in the octet were then set to one which would complete the network identification. The
remaining octets (24 bits) represented the hosts ID and would allow up to 126 networks with 17
million hosts per network. In a Class A address, the network number values start at the number 1
and end at 127.

Class B IP Address

Class B IP address were assigned to medium to large networks. They allow 16,384 networks by
using the first two octets in the address for the network identification. The first two bits of the first
octet are fixed to 1 0. The next 6 bits along with the following octet then complete the network
identification. The third and fourth octet (16 bits) then represents the host ID. This allows
approximately 65,000 hosts per network. Class B network number values start at 128 and finish at
191.

Class C IP Address

Class C IP addresses were used in small LAN configurations. They allow for approximately 2
million networks by using the first three octets of the address for the network identification. In a
Class C address, the first three bits are fixed to 1 1 0. In the following three octets, 21 bits make
up the network identification. The last octet then represents the host identification. This allows for
254 hosts per network. A Class C network number value starts at 192 and ends at 223.

Class D IP Address

Class D IP addresses were reserved for multicasting purposes. These addresses begin with an octet
in the 224-239 range. They would have leading bits of 1 1 1 0 and includes addresses from
224.0.0.0 to 239.255.255.255.

Lab Instructor: Engr. Hina Abrar


Class E IP Address

Class E IP addresses are reserved for experimental use. The first octet of these addresses ranges
between 240 and 255. This range is reserved by the IETF and similar to Class D networks, should
not be assigned to a host device.

Private IP Addresses

While we are used to writing out streets and house numbers on envelopes, inside your computer
IP Addresses are usually represented in what is known as dotted-decimal format such as
124.62.112.7 as this is the system that is understood by computers. As you can see, the address is
split into 4 sections known as "octets" and each of the four octets can be numbered from 0-255,
providing a total of 4,294,967,296 potentially unique IP Addresses.

Now, while 4.2 Billion might seem like a lot, for many years large amounts of these have been
allocated and used by large network such as backbone providers, ISPs and large Universities that
made up the early Internet While other groups still have been reserved for special purposes and
are not usable, so in practice the real amount is far less than 4.2 billion. The problem that we face
today is that with many homes owning more than one computer and with cell phones, PDAs and
even fridges being enabled for Internet access these days, IP Addresses are running out.

When I mentioned above that some blocks of addresses had been reserved for special purposes,
one of these purposes was for private networking and it is these private addresses that help to
relieve the pressure on the remaining address space and make possible many of the cable and DSL
routers that people have at home today to share their Internet connection amongst many PCs.

Private IP address ranges

The ranges and the amount of usable IP's are as follows:

10.0.0.0 - 10.255.255.255

Addresses: 16,777,216

172.16.0.0 - 172.31.255.255

Addresses: 1,048,576

192.168.0.0 - 192.168.255.255

Addresses: 65,536

Lab Instructor: Engr. Hina Abrar


Classless IP Addressing

After the invention of the Domain Name System (DNS), industry realized that the use of IP
address classes would limit the scalability of the Internet. As a result, the IETF published RC 1518
and 1519 in 1993 to define the classless method of routing IPv4 data packets. The most recent
definition of the standard occurred in 2006 under RFC 4632. Classless IP addressing was
introduced as a more efficient means to make use of the IP address space when compared to
Classful addressing. In classless addressing, the IP address is treated as a 32 bit stream where the
boundary between the network identification and host can be at any of the bit positions. The
network portion of the address is determined by the num
being applied to the address. A subnet mask is used locally on the hosts connected to the network
and are never transmitted in an IPv4 data packet or datagram. All of the hosts on the same network
are configured to use the same subnet mask with the host section of the IP address being unique to
the host. The classless version of address is referred to as Classless Inter-Domain Routing (CIDR)
and allows networks to be divided into different-sized subnets. The system avoids wasting IP
addresses through the use of the subnet mask.

How Does a Subnet Mask Work?


In classless IP address, a subnet mask is used on a network to define how many bits are used for
the network address and how many are used for the host address. The subnet mask is the same for
all users on a specific network. When overlay on a host address, it tells the host or device what
part of the IP address is the network address and which is used for the host. Subnet masks will
typically start with 255.*.*.* with the remaining digits specific to the network. Every subnet
address on a large network will have its own subnet mask which in essence means the specific
subnet has a subnet mask. This allows for the current form of classless IP addressing that has been
in use for IPv4 networks since the 1990s.

The Network and Node ID of each Class


The network Class helps us determine how the 4 byte, or 32 Bit, IP Address is divided between
network and node portions.
The figure below shows you (in binary) how the Network ID and Node ID changes depending on
the Class:
The figure below shows you (in binary) how the Network ID and Node ID changes depending on
the Class:

Lab Instructor: Engr. Hina Abrar


Explanation:

The figure above might seem confusing at first but it's actually very simple. We will take Class
A as an example and analyze it so you can understand exactly what is happening here:
Below you can see all this in pictures:

Subnet Masking
Applying a subnet mask to an IP address allows you to identify the network and node parts of
Lab Instructor: Engr. Hina Abrar
the address. The network bits are represented by the 1s in the mask, and the node bits are
represented by the 0s. Performing a bitwise logical AND operation between the IP address and
the subnet mask results in the Network Address or Number.

For example, using our test IP address and the default Class B subnet mask, we get:

10001100.10110011.11110000.11001000 140.179.240.200 Class B IP Address

11111111.11111111.00000000.00000000 255.255.000.000 Default Class B Subnet Mask

--------------------------------------------------------

10001100.10110011.00000000.00000000 140.179.000.000 Network Address

Default subnet masks:

Class A -255.0.0.0-11111111.00000000.00000000.00000000

Class B - 255.255.0.0- 11111111.11111111.00000000.00000000

Class C - 255.255.255.0- 11111111.11111111.11111111.00000000

Additional bits can be added to the default subnet mask for a given Class to further subnet, or
break down, a network. When a bitwise logical AND operation is performed between the
subnet mask and IP address, the result defines the Subnet Address (also called the Network
Address or Network Number). There are some restrictions on the subnet address. Node
addresses of all "0"s and all "1"s are reserved for specifying the local network (when a host
does not know its network address) and all hosts on the network (broadcast address),
respectively. This also applies to subnets. A subnet address cannot be all "0"s or all "1"s. This
also implies that a 1 bit subnet mask is not allowed. This restriction is required because older
standards enforced this restriction. Recent standards that allow use of these subnets have
superseded these standards, but many "legacy" devices do not support the newer standards. If
you are operating in a controlled environment, such as a lab, you can safely use these restricted
subnets.

To calculate the number of subnets or nodes, use the formula (2n-2) where n = number of bits
in either field, and 2n represents 2 raised to the nth power. Multiplying the number of subnets
by the number ofnodes available per subnet gives you the total number of nodes available for
your class and subnet mask. Also, note that although subnet masks with non-contiguous mask
bits are allowed, they are not recommended.
Example:
10001100.10110011.11011100.1100100
0 140.179.220.200 IP Address
11111111.11111111.11100000.0000000
0 255.255.224.000 Subnet Mask
------------------------------------------------
--------
Lab Instructor: Engr. Hina Abrar
10001100.10110011.11000000.0000000
0 140.179.192.000 Subnet Address
10001100.10110011.11011111.1111111 Broadcast
1 140.179.223.255 Address

In this example a 3 bit subnet mask was used. There are 6 (23-2) subnets available with this size
mask (remember that subnets with all 0's and all 1's are not allowed). Each subnet has 8190 (213-
2) nodes. Each subnet can have nodes assigned to any address between the Subnet address and the
Broadcast address. This gives a total of 49,140 nodes for the entire class B address subnetted this
way. Notice that this is less than the 65,534 nodes an unsubnetted class B address would have.

You can calculate the Subnet Address by performing a bitwise logical AND operation between the IP address
and the subnet mask, then setting all the host bits to 0s. Similarly, you can calculate the Broadcast Address for a
subnet by performing the same logical AND between the IP address and thesubnet mask, then setting all the
host bits to 1s. That is how thesenumbers above.

Subnetting always reduces the number of possible nodes for a given network. There are complete
subnet tables available here for Class A, Class B and Class C. These tables list all the possible
subnet masks for each class, along with calculations of the number of networks, nodes and total
hosts for each subnet.

Here is another, more detailed, example. Say you are assigned a Class C network number of
200.133.175.0 (apologies to anyone who may actually own this domain address). You want to
utilize this network across multiple small groups within an organization. You can do this by
subnetting that network with a subnet address.

We will break this network into 14 subnets of 14 nodes each. This will limit us to 196 nodes on
the network instead of the 254 we would have without subnetting, but gives us the advantages of
traffic isolation and security. To accomplish this, we need to use a subnet mask 4 bits long. Recall
that the default Class C subnet mask is

255.255.255.0 (11111111.11111111.11111111.00000000 binary)

Lab Task

1. Find the class of each address.


a) 00000001 00001011 00001011 11101111
b) 11000001 10000011 00011011 11111111
c) 14.23.120.8
d) 252.5.15.111

2. A block of addresses is granted to a small organization. We know that one of the addresses is
205.16.37.39/28. Find
a) Network Address
Lab Instructor: Engr. Hina Abrar
b) The first usable address
c) The last usable address
d) The broadcast address
e) The number of addresses.

3. Your company would like to break the Class B private IP address range 172.16.0.0 into 60 different
subnets .

Conclusion

__________________________________________________________________
__________________________________________________________________
__________________________________________________________________

_____________________________
(Engr. Hina Abrar)

Lab Instructor: Engr. Hina Abrar

You might also like