Unit 4
Unit 4
(21CSC302J)
UNIT - II
PARBHAT GUPTA
ASSISTANT PROFESSOR
CSE DEPT.
Unit-II Syllabus
IPV4 Addressing
Address space Network Devices
Classful addressing Hub
Subnet mask Repeaters
FLSM Switch
Classless Addressing Bridge
VLSM Router
NAT
Super netting
IPv4 ADDRESSING
An IPv4 address is a unique number assigned to every device that connects to the internet or a computer
network. It’s like a home address for your computer, smartphone, or any other device, allowing it to
communicate with other devices.
Format: An IPv4 address is written as four numbers separated by periods, like this: 192.168.1.1. Each
number can range from 0 to 255.
The IPv4 address is divided into two parts: Network ID and Host ID.
Purpose: The main purpose of an IPv4 address is to identify devices on a network and ensure that data
sent from one device reaches the correct destination.
Example: When you type a website address into your browser, your device uses the IPv4 address to find
and connect to the server where the website is hosted.
Host ID
Think of an IPv4 address as a phone number for your device. Just as you dial a specific number to reach
a particular person, devices use IPv4 addresses to connect and share information.
There are two notations in which the IP address is written, dotted decimal and hexadecimal
notation.
Hexadecimal Notation
Address Space
An IP address space is a pool of IP addresses that are available for assignment to
devices and machines that access the internet. The size of the IP address space
depends on the version of IP address, IPv4 or IPv6:
IPv4 Address Space : IPv4 addresses are 32 bits long, which means the IPv4 address
space is 4,294,967,296 addresses in size. However, some IP addresses are reserved
for special purposes, such as private networks and multicast addressing, so the total
number of available addresses is less than the total number in the pool.
IPv6 Address Space : IPv6 addresses are 128 bits long, which means the IPv6
address space is 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses
in size.
IPv4 Address Space
The address space of IPv4 (Internet Protocol version 4) is 4,294,967,296 IP
addresses, or 2³². This is because IPv4 addresses are 32-bit integers, and a bit is a
digit in the binary numeral system. IPv4 addresses are often represented in dotted
quad or dotted decimal notation, which is x.x.x.x, where each x can be any value
between 0 and 255. For example, 192.0.2.146 is a valid IPv4 address. In each part of
the address, the numbers represent a group of 8 bits, or an octet.
IPv4 reserves some addresses for special purposes, such as private networks and
multicast addressing:
Private networks: Around 18 million addresses, reserved from the 224, 220, and 216
ranges
Multicast addressing: Around 268 million addresses, reserved from the 228 range
IPv6 & IPv6 Address Space
The address space of IPv4 (Internet Protocol version 4) is 4,294,967,296 IP addresses, or 2³². This is
because IPv4 addresses are 32-bit integers, and a bit is a digit in the binary numeral system. IPv4
addresses are often represented in dotted quad or dotted decimal notation, which is x.x.x.x, where
each x can be any value between 0 and 255. For example, 192.0.2.146 is a valid IPv4 address. In each
part of the address, the numbers represent a group of 8 bits, or an octet.
IPv4 reserves some addresses for special purposes, such as private networks and multicast
addressing:
Private networks: Around 18 million addresses, reserved from the 224, 220, and 216
ranges
Multicast addressing: Around 268 million addresses, reserved from the 228 range
The IPv6 address space is 128-bits (2128) in size, containing
340,282,366,920,938,463,463,374,607,431,768,211,456 IPv6 addresses.
Classful Addressing
Classful IP addressing is a way of organizing and managing IP addresses, which are used to identify devices on a
network. Think of IP addresses like street addresses for houses; each device on a network needs its unique
address to communicate with other devices.
Need For Classful Addressing
Initially in 1980’s IP address was divided into two fixed part i.e., NID(Network ID) = 8bit, and HID(Host ID) =
24bit. So, there are 28 that is 256 total network are created and 224 that is 16M Host per network.
There are one 256 Networks and even a small organization must buy 16M computer(Host) to purchase one
network. That’s why we need classfull addressing.
Classful Addressing
The 32-bit IP address is divided into five sub-classes. These are given below:
• Class A
• Class B
• Class C
• Class D
• Class E
Cont.
Each of these classes has a valid range of IP addresses. Classes D and E are reserved for multicast and
experimental purposes, respectively. The order of bits in the first octet determines the classes of the IP
address.
The class of IP address is used to determine the bits used for network ID and host ID and the number of
total networks and hosts possible in that class. Each ISP or network administrator assigns an IP address to
each device that is connected to its network.
Cont.
IP addresses are globally managed by Internet Assigned Numbers Authority(IANA) and Regional Internet
Registries(RIR).
While finding the total number of host IP addresses, 2 IP addresses are not counted and are therefore,
decreased from the total count because the first IP address of any network is the network number and
whereas the last IP address is reserved for broadcast IP.
Class A IP Address
IP addresses belonging to class A are assigned to the networks that contain a large number of hosts.
The network ID is 8 bits long.
The host ID is 24 bits long.
The higher-order bit of the first octet in class A is always set to 0. The remaining 7 bits in the first octet are
used to determine network ID. The 24 bits of host ID are used to determine the host in any network. The
default subnet mask for Class A is 255.x.x.x. Therefore, class A has a total of:
2^24 – 2 = 16,777,214 host ID
IP addresses belonging to class A ranges from 0.0.0.0 – 127.255.255.255.
Class B IP Address
IP address belonging to class B is assigned to networks that range from medium-sized to large-sized
networks.
The network ID is 14 bits long.
The host ID is 16 bits long.
The higher-order bits of the first octet of IP addresses of class B are always set to 10. The remaining 14 bits
are used to determine the network ID. The 16 bits of host ID are used to determine the host in any network.
The default subnet mask for class B is 255.255.x.x. Class B has a total of:
2^14 = 16384 network address
2^16 – 2 = 65534 host address
IP addresses belonging to class B ranges from 128.0.0.0 – 191.255.255.255.
Class C IP Address
IP addresses belonging to class C are assigned to small-sized networks.
The network ID is 24 bits long.
The host ID is 8 bits long.
The higher-order bits of the first octet of IP addresses of class C is always set to 110. The remaining 21 bits
are used to determine the network ID. The 8 bits of host ID are used to determine the host in any network.
The default subnet mask for class C is 255.255.255.x. Class C has a total of:
2^21 = 2097152 network address
2^8 – 2 = 254 host address
IP addresses belonging to class C range from 192.0.0.0 – 223.255.255.255.
Class D & E IP Address
IP address belonging to class D is reserved for multi-casting. The higher-order bits of the first octet of IP
addresses belonging to class D is always set to 1110. The remaining bits are for the address that interested
hosts recognize.
Class D does not possess any subnet mask. IP addresses belonging to class D range from 224.0.0.0 –
239.255.255.255.
IP addresses belonging to class E are reserved for experimental and research purposes. IP addresses of
class E range from 240.0.0.0 – 255.255.255.255. This class doesn’t have any subnet mask. The higher-
order bits of the first octet of class E are always set to 1111.
Cont.
Rules for Assigning Host ID
Host IDs are used to identify a host within a network. The host ID is assigned based on the
following rules:
• The network ID cannot start with 127 because 127 belongs to the class A address and is
reserved for internal loopback functions.
• All bits of network ID set to 1 are reserved for use as an IP broadcast address and therefore,
cannot be used.
• All bits of network ID set to 0 are used to denote a specific host on the local network and are
not routed and therefore, aren’t used.
Summary of Classful Addressing
In contrast to classful addressing, classless addressing allows for varying prefix lengths. Prefix lengths
that vary from 0 to 32 are possible. The length of the prefix has an inverse relationship with network size.
A smaller network has a large prefix; a larger one has a small prefix.
We must stress that classful addressing is just as easily adaptable to the concept of classless addressing.
Consider an address in class A as a classless address with a prefix length of 8. Class B addresses can be
viewed as classless addresses with the prefix 16 and so on. Putting it another way, classless addressing is
a specific instance of classful addressing.
Prefix Length - Slash Notation
In classless addressing, the first issue that needs to be resolved is how to determine the prefix length if
an address is provided. We must individually provide the prefix length because it is not a property of
the address. The address is inserted in this scenario, followed by a slash, and the prefix length, n. Slash
notation is the colloquial name for the notation, while classless interdomain routing, or CIDR
(pronounced cider) method, is the official name. An address in classless addressing can thus be
expressed as illustrated in the figure below.
To put it another way, we must also provide the prefix length in classless addressing because an address
does not automatically define the block or network to which it belongs.
Extracting Information from an Address
With respect to any given address in the block, we typically like to know three things: the number of addresses in
the block, the start address in the block, and the last address. These three pieces of information, which are depicted
in the picture below, are simple to locate because the prefix length, n, is known.
The block has N = 232n addresses, according to the calculation.
The n leftmost bits are kept, and the (32 - n) rightmost bits are all set to zeroes to determine the first address.
The n leftmost bits are kept, while the (32 - n) rightmost bits are all set to 1s to determine the last address.
Difference Between Classful and
Classless Addressing
IP addresses are divided into five groups using the classful addressing approach
when they are assigned. In order to prevent the depletion of IP addresses, classless
addressing is used. It is a method of IP address allocation that will eventually replace
classful addressing.
A further distinction is the usefulness of classful and classless addressing.
Comparatively speaking, classless addressing is more beneficial and useful than
classful addressing.
In classful addressing, the network ID and host ID are adjusted according to the
classes. However, the distinction between network ID and host ID does not exist
with classless addressing. This opens up the possibility of making yet another
contrast between both addressing.
Subnet Mask
A subnet mask is a 32-bit binary number that's used to determine the destination of a network
packet. It's part of a network address and is always used with an Internet Protocol (IP) address. The
subnet mask separates the network address from the host address, allowing a router to quickly
determine where to forward the packet.
A subnet mask tells the computer which part of the IP address serves as the network portion of the
address and which part identifies the host address range. The ones indicate bits in the address used
for the network prefix and the trailing block of zeros designates that part as being the host identifier.
For example, the typical IPv4 subnet mask is designated 255.255.255.0.
Subnet masks play an important role in ensuring that traffic is contained within the defined subnet.
This helps to avoid network congestion, reduce the network load, and boost overall network
performance and speed.
Subnet masks are also expressed in dot-decimal notation like an IP address. For example, the prefix
198.51.100.0/24 would have the subnet mask 255.255.255.0. Traffic is exchanged between subnets
through routers when the routing prefixes of the source address and the destination address differ.
Function of Subnet Mask
A 32-bit address that distinguishes the network address from the host address makes up the
subnet mask. This indicates which part of the IP address belongs in the host section and
which part belongs in the network section. The number of hosts that can be on the subnet
depends on the values of the subnet mask. This comprises bits that are initialized to 1 for
the network and 0 for the host. Routers and switches use it internally to send packets to the
destination node along the associated local network connection.
Suppose we have a Class A network which means we have 16 million hosts in a network.
The task we must do is:
Maintenance of such a huge network
Security for the network – For example, we have 4 departments in a company and all of the
4 departments need not access the whole network.
For this, we need Subnetting
Subnetting
A subnet, or subnetwork, is a network inside a network. Subnets make networks more efficient.
Through subnetting, network traffic can travel a shorter distance without passing through unnecessary
routers to reach its destination.
When a bigger network is divided into smaller networks, to maintain security, then that is known as
Subnetting. So, maintenance is easier for smaller networks. For example, if we consider a class A
address, the possible number of hosts is 224 for each network, it is obvious that it is difficult to maintain
such a huge number of hosts, but it would be quite easier to maintain if we divide the network into
small parts.
Uses of Subnetting
Subnetting helps in organizing the network in an efficient way which helps in expanding the
technology for large firms and companies.
Subnetting is used for specific staffing structures to reduce traffic and maintain order and efficiency.
Subnetting divides domains of the broadcast so that traffic is routed efficiently, which helps in
improving network performance.
Subnetting is used in increasing network security.
Subnetting
The network can be divided into two parts: To divide a network into two parts, you need to
choose one bit for each Subnet from the host ID part.