UNIT - IV
Network Addressing :
Network Addressing is one of the major responsibilities of the network layer. Network
addresses are always logical, i.e., software-based addresses. A host is also known as end system
that has one link to the network. The boundary between the host and link is known as an
interface. Therefore, the host can have only one interface.
A router is different from the host in that it has two or more links that connect to it. When
a router forwards the datagram, then it forwards the packet to one of the links. The boundary
between the router and link is known as an interface, and the router can have multiple
interfaces, one for each of its links. Each interface is capable of sending and receiving the IP
packets, so IP requires each interface to have an address.
Each IP address is 32 bits long, and they are represented in the form of "dot-decimal
notation" where each byte is written in the decimal form, and they are separated by the period.
An IP address would look like 193.32.216.9 where 193 represents the decimal notation of first 8
bits of an address, 32 represents the decimal notation of second 8 bits of an address.
From the above Object, a router has three interfaces labelled as 1, 2 & 3 and each router
interface contains its own IP address.
Each host contains its own interface and IP address.
All the interfaces attached to the LAN 1 is having an IP address in the form of 223.1.1.xxx, and
the interfaces attached to the LAN 2 and LAN 3 have an IP address in the form of 223.1.2.xxx
and 223.1.3.xxx respectively.
Each IP address consists of two parts. The first part (first three bytes in IP address) specifies
the network and second part (last byte of an IP address) specifies the host in the network.
Classful Addressing : An IP address is 32-bit long. An IP address is divided into sub-classes:
Class A
Class B
Class C
Class D
Class E
An ip address is divided into two parts :
Network ID: It represents the number of networks.
Host ID: It represents the number of hosts.
In the above diagram, we observe that each class have a specific range of IP addresses.
The class of IP address is used to determine the number of bits used in a class and number of
networks and hosts available in the class.
Class A : In Class A, an IP address is assigned to those networks that contain a large number of
hosts. Netflix now allows users to 'transfer profiles' amid attempt to clamp down on account
sharing.
The network ID is 8 bits long.
The host ID is 24 bits long.
In Class A, the first bit in higher order bits of the first octet is always set to 0 and the
remaining 7 bits determine the network ID. The 24 bits determine the host ID in any network.
The total number of networks in Class A = 27 = 128 network address
The total number of hosts in Class A = 224 - 2 = 16,777,214 host address
Class B : In Class B, an IP address is assigned to those networks that range from small-sized to
large-sized networks.
The Network ID is 16 bits long.
The Host ID is 16 bits long.
In Class B, the higher order bits of the first octet is always set to 10, and the remaining14 bits
determine the network ID. The other 16 bits determine the Host ID.
The total number of networks in Class B = 214 = 16384 network address
The total number of hosts in Class B = 216 - 2 = 65534 host address
Class C : In Class C, an IP address is assigned to only small-sized networks.
The Network ID is 24 bits long.
The host ID is 8 bits long.
In Class C, the higher order bits of the first octet is always set to 110, and the remaining
21 bits determine the network ID. The 8 bits of the host ID determine the host in a network.
The total number of networks = 221 = 2097152 network address
The total number of hosts = 28 - 2 = 254 host address
Class D : In Class D, an IP address is reserved for multicast addresses. It does not possess
subnetting. The higher order bits of the first octet is always set to 1110, and the remaining bits
determines the host ID in any network.
Class E : In Class E, an IP address is used for the future use or for the research and development
purposes. It does not possess any subnetting. The higher order bits of the first octet is always set
to 1111, and the remaining bits determines the host ID in any network.
Rules for assigning Host ID :
The Host ID is used to determine the host within any network. The Host ID is assigned based on
the following rules :
The Host ID must be unique within any network.
The Host ID in which all the bits are set to 0 cannot be assigned as it is used to represent the
network ID of the IP address.
The Host ID in which all the bits are set to 1 cannot be assigned as it is reserved for the
multicast address.
Rules for assigning Network ID :
If the hosts are located within the same local network, then they are assigned with the same
network ID. The following are the rules for assigning Network ID:
The network ID cannot start with 127 as 127 is used by Class A.
The Network ID in which all the bits are set to 0 cannot be assigned as it is used to specify a
particular host on the local network.
The Network ID in which all the bits are set to 1 cannot be assigned as it is reserved for the
multicast address
TCP/IP Addressing Scheme : TCP/IP uses a 32 bit addressing scheme to identify the devices on
a network. These 32 bits are divided into four octets, of eight bits each. Each of these four octets
is represented in a decimal form, and separated by a dot. For example, 198.172.168.10 is an IP
address. This format of representing IP address is called the dotted decimal format.
The octets in an IP address can take a decimal value from 9 to 255 because the largest
decimal value that can be represented by eight binary bits is 255(11111111 in binary). For
example, the 32 bit binary address 11000110.10101100.1010100.0001010 represents the IP
address 198.172.168.10.
The addressing provided by a network layer protocol to a device is called its network
address. For example, 198.172.168.10 is the network address of a device. This is different from
the MAC address which is the hardware address of the NIC or the device (routers or switch). The
network addresses in a TCP/IP network are also known as IP addresses. Therefore,
198.172.168.10 is also known as the IP address.
Components of IP address : For continence sake we use IP address dotted-decimal notation,
while the computer converts this into binary. However, even though these sets of 32 bits are
considered a single “entity”, they have an internal structure containing two components:
Network Identifier (Network ID) : A certain number of bits, starting from the left-most bit, is
used to identify the network where the host or other network interface is located. This is also
sometimes called the network prefix or even just the prefix. This is the address of the network
itself, and is used by other networks to identify this network.
Host Identifier (Host ID): The remainder of the bits is used to identify the host on the network.
This is the address of the device with in the network. The fundamental division of the bits of an
IP address is into a network ID and host ID. Here, the network ID is 8 bits long and the host ID is
24 bits in length.
IP Address Classes : Internet addresses are allocated by the InterNIC the organization that
administers the internet. These IP addresses are divided into classes. The most common of these
are classes A, B, and C. Classes D and E exist, but are not generally used by end users. Each of the
address classes has a different default subnet mask. You can identify the class of an IP address by
looking at its first octet. Following are the ranges of class A, B and C Internet addresses, each
with an example address:
Class A networks use a default subnet mask of 255.0.0.0 and have 0-127 as their first
octet. The address 10.52.36.11 is a class A address. Its first octet is 10, which is between 1 and
126, inclusive.
Class B networks use a default subnet mask of 255.255.0.0 and have 128-191 as their
first octet. The address 172.16.52.63 is a class B address. Its first octet is 172, which is between
128 and 191, inclusive.
Class C networks use a default subnet mask of 255.255.255.0 and have 192-223 as their
first octet. The address 192.168.123.132 is a class C address. Its first octet is 192, which is
between 192 and 223, inclusive.
IP Subnetting : Subnets are an efficient method for logically dividing a network into segments,
such that the network performance is optimized. Subnets are defined as the segments of a
network that use schemes different from one another but corresponding to the addressing
schemes different from one another but corresponding to the addressing scheme used by the
main network.
Therefore, devices in one subnet cannot directly communicate with devices represented
by 192.168.30.0, in which 192.168.30 represents the network address, and the value in the
fourth octet would represent the host on the network.
For example, the address of a particular host in this network would be 192.168.30.4. The
fourth octet in a Class C address can take a value between 0 and 225, and therefore, this network
can have up to 256 hosts. However, configuring 255 components in a single network would
significantly degrade the performance of the network as well as the network router.
Therefore, the network, 192.168.30.x can be divided into subnets, with each subnet
consisting of, say, 16 computers.
On a network without subnets, a device outside the network can identify a host either the
help of the network and host addresses. On a network with subnets, however, an additional
piece of information, called the subnet mask, is needed to identify a host. The network address
helps determine the network in which is located, whereas the subnet mask responsible for
locating the subnet on the network to which the host belongs. The host address identifies the
individual host.
However, the addressing scheme used by IP has only four octets that can be used to
represent the network address or the host depending on the IP address class. It is not possible to
include information on the subnet in the IP address itself, and therefore, the subnet mask is a
separate 32bit address, accompanying the IP address of a device.
The default subnet mask values for a class A, class B, class C IP addresses are listed.
IP Address Class Default Subnet Mask
Class A 255.0.0.0
Class B 255.255.0.0
Class C 255.255.255.0
The default subnet masks are used when a network does not have any subnets. For
creating subnets, the default values are modified to obtain customized, only the octets that
denote the host address are modified, and not the octet(s) that represent the network address.
For example 255.244.0.0 is a valid subnet mask for a class A network but not 252.124.0.0 in fact,
252.124.0.0 is not a valid subnet mask for a network of any IP address class.
Components of IP Address and Classes : Each network running TCP/IP must have a unique
network number, and every machine on it must have a unique IP address. It is important to
understand how IP addresses are constructed before you register your network and obtain its
network number.
The IP address is a 32-bit number that uniquely identifies a network interface on a
machine. An IP address is typically written in decimal digits, formatted as four 8-bit fields
separated by periods. Each 8-bit field represents a byte of the IP address. This form of
representing the bytes of an IP address is often referred to as the dotted-decimal format.
The bytes of the IP address are further classified into two parts: the network part and the host
part. Figure 3-1 shows the component parts of a typical IP address, 129.144.50.56.
Parts of an IP Address
Network Part : This part specifies the unique number assigned to your network. It also
identifies the class of network assigned. In Figure 3-1, the network part takes up two bytes of the
IP address.
Host Part : This is the part of the IP address that you assign to each host. It uniquely identifies
this machine on your network. Note that for each host on your network, the network part of the
address will be the same, but the host part must be different.
Subnet Number (Optional) : Local networks with large numbers of hosts are sometimes
divided into subnets. If you choose to divide your network into subnets, you need to assign
a subnet number for the subnet. You can maximize the efficiency of the IP address space by using
some of the bits from the host number part of the IP address as a network identifier. When used
as a network identifier, the specified part of the address becomes the subnet number. You create
a subnet number by using a netmask, which is a bit mask that selects the network and subnet
parts of an IP address.
Subnetting : is the practice of dividing a network into two or smaller networks. It increases routing
efficiency, which helps to enhance the security of the network and reduces the size of the broadcast
domain.
IP Subnetting designates high-order bits from the host as part of the network prefix. This method
divides a network into smaller subnets.
It also helps you to reduce the size of the routing tables, which is stored in routers. This method also
helps you to extend the existing IP address base & restructures the IP address.
For Subnet-1: The first bit which is chosen from the host id part is zero and the range will be
from (193.1.2.00000000 till you get all 1’s in the host ID part i.e, 193.1.2.01111111) except for
the first bit which is chosen zero for subnet id part and the . Thus, the range of subnet-1:
193.1.2.0 to 193.1.2.127
Subnet id of Subnet-1 is : 193.1.2.0
Direct Broadcast id of Subnet-1 is : 193.1.2.127
Total number of host possible is : 126 (Out of 128, 2 id’s are used for Subnet id & Direct
Broadcast id)
Subnet mask of Subnet- 1 is : 255.255.255.128
For Subnet-2: The first bit chosen from the host id part is one and the range will be from
(193.1.2.100000000 till you get all 1’s in the host ID part i.e, 193.1.2.11111111). Thus, the
range of subnet-2:
193.1.2.128 to 193.1.2.255
Subnet id of Subnet-2 is : 193.1.2.128
Direct Broadcast id of Subnet-2 is : 193.1.2.255
Total number of host possible is : 126 (Out of 128, 2 id’s are used for Subnet id & Direct
Broadcast id)
Subnet mask of Subnet- 2 is : 255.255.255.192
Finally, after using the subnetting the total number of usable hosts are reduced from 254 to
252.
Internet Protocol Addressing – Ipv4, IPv6 : IP address stands for internet protocol address; it
is an identifying number that is associated with a specific computer or computer network.
When connected to the internet, the IP address allows the computers to send and receive
information.
An IP stands for internet protocol. An IP address is assigned to each device connected to a
network. Each device uses an IP address for communication. It also behaves as an identifier as
this address is used to identify the device on a network. It defines the technical format of the
packets. Mainly, both the networks, i.e., IP and TCP, are combined together, so together, they are
referred to as a TCP/IP. It creates a virtual connection between the source and the destination.
We can also define an IP address as a numeric address assigned to each device on a
network. An IP address is assigned to each device so that the device on a network can be
identified uniquely. To facilitate the routing of packets, TCP/IP protocol uses a 32-bit logical
address known as IPv4(Internet Protocol version 4).
An IP address consists of two parts, i.e., the first one is a network address, and the other one is a
host address. There are two types of IP addresses:
o IPv4
o IPv6
IPv4 : IPv4 is a version 4 of IP. It is a current version and the most commonly used IP address. It
is a 32-bit address written in four numbers separated by 'dot', i.e., periods. This address is
unique for each device. For example, 66.94.29.13
The above example represents the IP address in which each group of numbers separated
by periods is called an Octet. Each number in an octet is in the range from 0-255. This address
can produce 4,294,967,296 possible unique addresses.
In today's computer network world, computers do not understand the IP addresses in the
standard numeric format as the computers understand the numbers in binary form only. The
binary number can be either 1 or 0. The IPv4 consists of four sets, and these sets represent the
octet. The bits in each octet represent a number.
Each bit in an octet can be either 1 or 0. If the bit the 1, then the number it represents will
count, and if the bit is 0, then the number it represents does not count.
Representation of 8 Bit Octet
The above representation shows the structure of 8- bit octet.
Now, we will see how to obtain the binary representation of the above IP address, i.e.,
66.94.29.13
Step 1: First, we find the binary number of 66.
To obtain 66, we put 1 under 64 and 2 as the sum of 64 and 2 is equal to 66 (64+2=66),
and the remaining bits will be zero, as shown above. Therefore, the binary bit version of 66 is
01000010.
Step 2: Now, we calculate the binary number of 94.
To obtain 94, we put 1 under 64, 16, 8, 4, and 2 as the sum of these numbers is equal to
94, and the remaining bits will be zero. Therefore, the binary bit version of 94 is 01011110.
Step 3: The next number is 29.
To obtain 29, we put 1 under 16, 8, 4, and 1 as the sum of these numbers is equal to 29, and the
remaining bits will be zero. Therefore, the binary bit version of 29 is 00011101.
Step 4: The last number is 13.
To obtain 13, we put 1 under 8, 4, and 1 as the sum of these numbers is equal to 13, and the
remaining bits will be zero. Therefore, the binary bit version of 13 is 00001101.
Drawback of IPv4 : Every user is having more than one device connected with the internet, and
private companies also rely on the internet. As we know that IPv4 produces 4 billion
addresses, which are not enough for each device connected to the internet on a planet. Although
the various techniques were invented, such as variable- length mask, network address
translation, port address translation, classes, inter-domain translation, to conserve the
bandwidth of IP address and slow down the depletion of an IP address. In these techniques,
public IP is converted into a private IP due to which the user having public IP can also use the
internet. But still, this was not so efficient, so it gave rise to the development of the next
generation of IP addresses, i.e., IPv6.
IPv6 : IPv4 produces 4 billion addresses, and the developers think that these addresses are
enough, but they were wrong. IPv6 is the next generation of IP addresses. The main difference
between IPv4 and IPv6 is the address size of IP addresses. The IPv4 is a 32-bit address, whereas
IPv6 is a 128-bit hexadecimal address. IPv6 provides a large address space, and it contains a
simple header as compared to IPv4.
It provides transition strategies that convert IPv4 into IPv6, and these strategies are as follows:
Dual stacking: It allows us to have both the versions, i.e., IPv4 and IPv6, on the same device.
Tunneling: In this approach, all the users have IPv6 communicates with an IPv4 network to
reach IPv6.
Network Address Translation: The translation allows the communication between the hosts
having a different version of IP.
This hexadecimal address contains both numbers and alphabets. Due to the usage of both
the numbers and alphabets, IPv6 is capable of producing over 340 undecillion (3.4*10 38)
addresses.
IPv6 is a 128-bit hexadecimal address made up of 8 sets of 16 bits each, and these 8 sets
are separated by a colon. In IPv6, each hexadecimal character represents 4 bits. So, we need to
convert 4 bits to a hexadecimal number at a time
Address format
The address format of IPv4:
The address format of IPv6:
The above diagram shows the address format of IPv4 and IPv6. An IPv4 is a 32-bit
decimal address. It contains 4 octets or fields separated by 'dot', and each field is 8-bit in size.
The number that each field contains should be in the range of 0-255. Whereas an IPv6 is a 128-
bit hexadecimal address. It contains 8 fields separated by a colon, and each field is 16-bit in size.
Differences between IPv4 and IPv6 :
Ipv4 Ipv6
Address length IPv4 is a 32-bit address. IPv6 is a 128-bit address.
Fields IPv4 is a numeric address that IPv6 is an alphanumeric address that
consists of 4 fields which are consists of 8 fields, which are
separated by dot (.). separated by colon.
Classes IPv4 has 5 different classes of IP IPv6 does not contain classes of IP
address that includes Class A, Class addresses.
B, Class C, Class D, and Class E.
Number of IP address IPv4 has a limited number of IP IPv6 has a large number of IP
addresses. addresses.
VLSM It supports VLSM (Virtual Length It does not support VLSM.
Subnet Mask). Here, VLSM means
that Ipv4 converts IP addresses
into a subnet of different sizes.
Address configuration It supports manual and DHCP It supports manual, DHCP, auto-
configuration. configuration, and renumbering.
Address space It generates 4 billion unique It generates 340 undecillion unique
addresses addresses.
End-to-end connection In IPv4, end-to-end connection In the case of IPv6, end-to-end
integrity integrity is unachievable. connection integrity is achievable.
Security features In IPv4, security depends on the In IPv6, IPSEC is developed for
application. This IP address is not security purposes.
developed in keeping the security
feature in mind.
Address representation In IPv4, the IP address is In IPv6, the representation of the IP
represented in decimal. address in hexadecimal.
Fragmentation Fragmentation is done by the Fragmentation is done by the senders
senders and the forwarding only.
routers.
Packet flow It does not provide any mechanism It uses flow label field in the header
identification for packet flow identification. for the packet flow identification.
Checksum field The checksum field is available in The checksum field is not available in
IPv4. IPv6.
Transmission scheme IPv4 is broadcasting. On the other hand, IPv6 is
multicasting, which provides efficient
network operations.
Encryption and It does not provide encryption and It provides encryption and
Authentication authentication. authentication.
Number of octets It consists of 4 octets. It consists of 8 fields, and each field
contains 2 octets. Therefore, the total
number of octets in IPv6 is 16.
Classful Address : The first addressing system to be implemented as part of the Internet
Protocol was Classful Addressing. In the year 1981, the Classful addressing network architecture
was first used on the Internet. The Classful addressing system was superseded by a Classless
addressing scheme with the introduction of Classless Inter-Domain Routing (CIDR) in 1993.
The IP address comprises up of 32 bits and is split into four sections separated by
dots: part 1, part 2, part 3, and part 4.
The IP address is made up of four parts, each of which is eight bits long (1 byte).
Further, the 4 parts of the IP address is divided into parts: a network ID and a Host ID.
Types of Classful Address :
Class A, Class B, Class C, Class D, and Class E are the five varieties of Classful addresses. In
IPv4, this classification is known as Classful addressing or IP address classes.
The first three classes, Class A, B, and C, are used for "public addressing", in which
communication is always one-to-one between source and destination. It implies that when data
is transmitted from a source, it will only be sent to a single network host.
The reserved categories include Class D and Class E, with Class D being utilized for
multicast and Class E being saved for future usage exclusively.
In IPv4, the Network ID is the first part of Class A, B, and C, while the Host ID is the
remaining second portion.
The Host ID always indicates the number of hosts or nodes in a certain network, whereas
the Network ID always identifies the network in a specific place.
In Class A, B, and C, the address space is split into a certain number of IP address blocks. It
also specifies the maximum number of hosts in a network.
Network and Host part in Classful Addressing : The first octet or byte of an IP address is part
of the network ID (short for Net-ID), while the next three octets or three bytes are part of the
host ID in Class A. (in short, host-ID).
The network ID takes up the first two octets or two bytes in Class B, whereas the host ID
takes up the remaining two octets or two bytes.
In Class C, the first three octets or bytes are dedicated to the network ID, while the last
octet or byte is dedicated to the host ID.
Classless Addressing : Classless Inter-Domain Routing (CIDR) is another name for classless
addressing. This addressing type aids in the more efficient allocation of IP addresses. This
technique assigns a block of IP addresses based on specified conditions when the user demands
a specific amount of IP addresses. This block is known as a "CIDR block", and it contains the
necessary number of IP addresses.
When allocating a block, classless addressing is concerned with the following three rules.
Rule 1 – The CIDR block’s IP addresses must all be contiguous.
Rule 2 – The block size must be a power of two to be attractive. Furthermore, the block’s
size is equal to the number of IP addresses in the block.
Rule 3 – The block’s first IP address must be divisible by the block size.
For example, assume the classless address is 192.168.1.35/27.
The network component has a bit count of 27, whereas the host portion has a bit count of
5. (32-27)
The binary representation of the address is: (00100011 . 11000000 . 10101000 .
00000001).
(11000000.10101000.00000001.00100000) is the first IP address (assigns 0 to all host
bits), that is, 192.168.1.32
(11000000.10101000.00000001.00111111) is the most recent IP address (assigns 1 to
all host bits), that is, 192.168.1.63
The IP address range is 192.168.1.32 to 192.168.1.63.
Difference Between Classful and Classless Addressing :
Classful addressing is a technique of allocating IP addresses that divides them into five
categories. Classless addressing is a technique of allocating IP addresses that is intended to
replace classful addressing in order to reduce IP address depletion.
The utility of classful and classless addressing is another distinction. Addressing without
a class is more practical and helpful than addressing with a class.
The network ID and host ID change based on the classes in classful addressing. In
classless addressing, however, there is no distinction between network ID and host ID. As a
result, another distinction between classful and classless addressing may be made.