0% found this document useful (0 votes)
3 views

Lecture # 18

The document provides an overview of the network layer and logical addressing, focusing on IPv4 addressing, which is a 32-bit unique identifier for devices on the internet. It discusses classful and classless addressing, including the types of classes (A, B, C, D, E), their characteristics, and the issues of address depletion. Additionally, it covers subnetting, super-netting, and the hierarchical structure of IP addresses, along with examples of address conversion and allocation.

Uploaded by

Hammad Younas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Lecture # 18

The document provides an overview of the network layer and logical addressing, focusing on IPv4 addressing, which is a 32-bit unique identifier for devices on the internet. It discusses classful and classless addressing, including the types of classes (A, B, C, D, E), their characteristics, and the issues of address depletion. Additionally, it covers subnetting, super-netting, and the hierarchical structure of IP addresses, along with examples of address conversion and allocation.

Uploaded by

Hammad Younas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 48

NETWORK LAYER

LOGICAL ADDRESSING

LECTURE # 18
Computer Communications and Networking EE-
423

ENGR. DR. MUHAMMAD AQEEL ASLAM


ASSISTANT PROFESSOR
ELECTRICAL ENGINEERING DEPARTMENT
SCHOOL OF ENGINEERING AND APPLIED SCIENCES
GIFT UNIVERSITY, GUJRANWALA, PAKISTAN
2
IPv4 Addresses

 An IPv4 is a 32-bit address that uniquely and universally defines the


connection of a device (For example, a computer or router) to the
internet.

An IPv4 address is 32 – bits long.


The IPv4 addresses are unique and universal.
The address space of IPv4 is 232 or
4,296,967,296.

10000000 00001011 00000011


00011111
3
Example

 Change the following IP addresses from binary to dotted-decimal


notations.
i. 10000001 00001011 00001011 11101111
ii. 11000001 10000011 00011011 11111111
 Change the following IP addresses from dotted-decimal to binary
notations.
i. 111.56.45.78
ii. 221.34.7.82
4
Example

 Find error, if any, in the following IPv4 addresses


i. 111.56.045.78
ii. 221.34.7.8.20
iii. 75.45.301.14
iv. 11100010.23.14.67
5
Types of Addressing

 There are two types of addressing:


 Classful Addressing
 Classless Addressing

In classful addressing, the


addresses space is divided into
five classes; A, B, C, D, E
Finding the classes in binary and dotted-decimal
notation
7
Example

 Find the class of each address.


 00000001 00001011 00001011 11101111
 11000001 10000011 00011011 11111111
 14.23.120.8
 252.5.15.111
8
Classful Addressing

 Class A addresses: designed for large organizations


with a large number of attached hosts or routers.
(wasted and not used)
 Class B addresses: designed for midsize organizations
with tens of thousands of attached hosts or routers (too
large for many organizations)
 Class C addresses: designed for small organizations
with a small number of attached hosts or routers (too
small for many organizations)
9
Classful Addressing

 Class D addresses: designed for multicasting (waste of


addresses)
 Class E addresses: reserved for future use (waste of
addresses)
10
Classful Addressing

 The
following IP addresses ranges belong to
GOOGLE.
64.233.160.0 – 64.233.191.255
66.102.0.0 – 66.102.15.255
66.249.64.0 – 66.249.95.255
72.14.192.0 – 72.14.255.255
74.125.0.0 – 74.125.255.255
209.85.128.0 – 209.85.255.255
216.239.32.0 – 216.239.63.255
11
Classful Addressing

 NETID and HOSTID


 The addresses is divided into NETID & HOSTID.
 These parts are of varying lengths, depending on the class.
Byte 1 Byte 2 Byte 3 Byte 4
CLASS A NETID HOSTID
CLASS B NETID HOSTID
CLASS C NETID HOSTID
CLASS D MUKLTICASTING
CLASS E RESERVED FOR FUTURE USE
12
Classful Addressing

In classful addressing, a large part


of the available addresses were
wasted.
13
Classes and Blocks

 One problem with classful addressing is that each


class is divided into a fixed number of blocks with
each block having a fixed size as shown in Table:
Class Number of Blocks Block Size Application
A 128 16,777,216 Unicast
B 16,384 65,536 Unicast
C 2,097,152 256 Unicast
D 1 268,435,456 Multicast
E 1 268,435,456 Reserved
14
Masking

 It helps us to find the NETID and HOSTID.


 It is 32-bit number made of contiguous 1s followed by contiguous 0s.
Class Binary Dotted- CID
Decimal R
A 11111111 00000000 00000000 255.0.0.0 /8
00000000
B 11111111 11111111 00000000 255.255.0.0 /16
00000000
C 11111111 11111111 11111111 255.255.255. /24
00000000 0
15
Masking

 CIDR: Classless Interdomain Routing) or slash


notation
Itis used to show the mask in the form /n (n=8,
16, 24)
Inclassful addressing, a large part of the available
addresses are wasted.
16
Subnetting

 Ifan organization was granted a large block in Class


A, B could it divide the addresses into several
contiguous groups and assign each group to smaller
networks.
 It increases the number of 1s in the mask.
17
Super-netting

 Although class A and B addresses are almost depleted,


class C addresses are still available (Size Block = 256, so
addresses do not satisfy the needs)
 In super-netting, an organization can combine several C
blocks to create a larger range of addresses.
 Several networks are combined to create a super network
(super net). E.g. organization needs 1000 addresses can
be granted 4 contiguous class C blocks. Create one
super network, it decreases the number of 1s in the mask.
18
Address Depletion

 Class C block is too small for most mid size


organizations. So, the solution is Classless
addressing.
 Classful addressing, which is almost obsolete, is
replaced with classless addressing.
19
Classless Addressing

 To overcome address depletion, and give more


organizations access to the internet, classless
addressing was designed.
 There are no classes, but the address are still
granted in blocks.
20
Classless Addressing

 The size of the block varies based on the nature and


size of the entity.
 Household : 2 addresses
 Large organizations : thousands of addresses
 ISP : thousands or hundreds of thousands based on
the number of customers it may serve
An organization granted 16 - addresses
A Block of 16 addresses granted to a small
organization
23
Classless Addressing

In IPv4 addressing, a block of addresses can be


defined as x.y.z.t/n, here x.y.z.t defines one of the
addresses and the /n defines the mask.

The first address in the block can be found


by setting the rightmost 32-n bits to 0s.
24
Example

A block of addresses is granted to a small organization. We


know that one of the addresses is 205.16.37.39/28. What is
the first address in the block?
 The binary representation of the given address is 11001101
00010000 00100101 00100111.. If we set 32 - 28 rightmost
bits to 0, we get 11001101 000010000 0100101 0010000 or
205.16.37.32.
 Last Address The last address in the block can be found by
setting the 32 - n rightmost bits in the binary notation of the
address to Is.
25
Example

 Find the last address for the block in the last


Example:
 The binary representation of the given address is
11001101 000100000010010100100111. If we set
32 - 28 rightmost bits to 1, we get 11001101
00010000 001001010010 1111 or 205.16.37.47.
 The number of addresses in the block can be found
by using the formula 232-n
26
Example

 Find the number of addresses in last Example


 The value of n is 28, which means that number of
addresses is 232- 28 or 16.
27
Example

 Another way to find the first address, the last address, and the number
of addresses is to represent the mask as a 32-bit binary (or 8-digit
hexadecimal) number. This is particularly useful when we are writing
a program to find these pieces of information. In last Example /28 can
be represented as 11111111 11111111 11111111 11110000 (twenty-
eight Is and four 0s). Find:
 The first address
 The last address
 The number of addresses
28
Example

 The first address can be found by ANDing the given


addresses with the mask. ANDing is here done bit by
bit. The result of ANDing 2 bits is 1 if both bits are
1s; the result is 0 otherwise.
First Address
Address 11001101 00010000 00100101 00100111
Mask 11111111 11111111 11111111 11110000
First 11001101 00010000 00100101 00100000
Address
29
Example

 The last address can be found by ORing the given


addresses with the complement of the mask. ORing
here is done bit by bit. The result of ORing 2 bits is
0 if both bits are 0s, the result is 1 otherwise.
Last Address
Address 11001101 00010000 00100101 00100111
Mask 00000000 00000000 00000000 00001111
Last 11001101 00010000 00100101 00100111
Address
30
Example

 The number of addresses can be found by


complementing the mask, interpreting it as a decimal
number, and adding 1 to it.
Total Addresses
Mask 00000000 00000000 00000000 00001111
Number of Address 15+1 = 16
31
Network Address

A very important concept in IP addressing is the network


address.
 When an organization is given a block of addresses, the
organization is free to allocate the addresses to the devices
that need to be connected to the Internet.
 Thefirst address in the class, however, is normally (not
always) treated as a special address.
 The first address is called the network address and defines
the organization network.
32
Network Address

 It defines the organization itself to the rest of the world.


 The first address is the one that is used by routers to direct
the message sent to the organization from the outside.
33
Network Address

 The organization network is connected to the Internet via a


router.
 The router has two addresses. One belongs to the granted
block; the other belongs to the network that is at the other
side of the router.
34
Hierarchy

 IP addresses, like other addresses or identifiers we encounter


these days, have levels of hierarchy.
 For example, a telephone network in Pakistan has three
levels of hierarchy.
 The leftmost three digits define the area code, the next three
digits define the exchange, the last four digits define the
connection of the local loop to the central office.
35
Two Levels - Hierarchy

 An IP address can define only two levels of hierarchy when


not subnetted.
 The n leftmost bits of the address x.y.z.tJn define the
network (organization network); the 32 – n rightmost bits
define the particular host (computer or router) to the
network.
 The two common terms are prefix and suffix.
 The part of the address that defines the network is called the
prefix; the part that defines the host is called the suffix
36
Two Levels - Hierarchy

Each address in the block can be considered as a two-level


hierarchical structure: the leftmost n bits (prefix) define the
network; the rightmost 32 - n bits define the host.
37
Three Levels - Hierarchy

 An organization that is granted a large block of addresses


may want to create clusters of networks (called subnets) and
divide the addresses between the different subnets.
 Therest of the world still sees the organization as one entity;
however, internally there are several subnets.
 All messages are sent to the router address that connects the
organization to the rest of the Internet; the router routes the
message to the appropriate subnets.
38
Three Levels - Hierarchy

 The organization, however, needs to create small subblocks


of addresses, each assigned to specific subnets.
 Theorganization has its own mask; each subnet must also
have its own.
39
Example

 Suppose an organization is given the block 17.12.40.0/26,


which contains 64 addresses. The organization has three
offices and needs to divide the addresses into three
subblocks of 32, 16, and 16 addresses. We can find the new
masks by using the following arguments:
40
Example

 Suppose the mask for the first subnet is n1, then 2 32- n1
must
be 32, which means that n1 =27.
 Suppose the mask for the second subnet is n2, then 2 32- n2

must be 16, which means that n2 = 28.


 Suppose the mask for the third subnet is n3, then 2 32- n3

must be 16, which means that n3 =28.


Organization end addresses in a subneted network
42
Example

 In subnet 1, the address 17.12.14.29/27 can give


us the subnet address if we use the mask /27
because

Host: 00010001 00001100 00001110 00011101


Mask /27
Subnet 00010001 00001100 00001110 00000000
Three Level Hierarchy in IPv4
44
Example

 An ISP is granted a block of addresses starting with


190.100.0.0/16 (65,536 addresses). The ISP needs to
distribute these addresses to three groups of customers as
follows:
a. The first group has 64 customers; each needs 256
addresses.
b. The second group has 128 customers; each needs 128
addresses
c. The third group has 128 customers; each needs 64
addresses.
45
Example

 Group 1
 For this group, each customer needs 256 addresses. This
means that 8 (log2 256) bits are needed to define each host.
The prefix length is then 32 - 8 =24. The addresses are
1st Customer: 190.100.0.0/24 190.100.0.255/24
2nd Customer: 190.100.1.0/24
190.100.1.255/24
64th Customer: 190.100.63.0/24
190.100.63.255/24
46
Example

 Group 2
 For this group, each customer needs 128 addresses. This
means that 7 (log2 128) bits are needed to define each host.
The prefix length is then 32 - 7 =25. The addresses are
1st Customer: 190.100.64.0/25
190.100.64.127/25
2nd Customer: 190.100.64.128/25
190.100.64.255/25
128th Customer: 190.100.127.128/25
47
Example

 Group 3
 For this group, each customer needs 64 addresses. This means
that 6 (log2 64) bits are needed to each host. The prefix length is
then 32 - 6 =26. The addresses are
1st Customer: 190.100.128.0/26
190.100.128.63/26
2nd Customer: 190.100.128.64/26
190.100.128.127/26
128 th Customer: 190.100.159.192/26 190.100.159.255/26
48
Example

Number of granted addresses to the ISP:


65,536
 Number of allocated addresses by the ISP:
40,960
 Number of available addresses: 24,576

You might also like