0% found this document useful (0 votes)
2 views13 pages

module 3

Module-3 covers logical addressing in networking, focusing on IPv4 addresses, their unique characteristics, and the address space of 4,294,967,296. It explains the notations for IPv4 addresses, classful addressing with its classes A, B, C, D, and E, and introduces subnetting and supernetting to manage address allocation. The module also discusses the transition to classless addressing to combat address depletion and the use of Network Address Translation (NAT) for efficient address management in private networks.

Uploaded by

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

module 3

Module-3 covers logical addressing in networking, focusing on IPv4 addresses, their unique characteristics, and the address space of 4,294,967,296. It explains the notations for IPv4 addresses, classful addressing with its classes A, B, C, D, and E, and introduces subnetting and supernetting to manage address allocation. The module also discusses the transition to classless addressing to combat address depletion and the use of Network Address Translation (NAT) for efficient address management in private networks.

Uploaded by

aishukokatnoor
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module-3 Logical Addressing

[Module -3

Network Layer

IPv4 ADDRESSES
An IPv4addressis a 32-bitaddress that uniquely and universally defines the connection of a device (for
example, a computer or a router) to the Internet.

IPv4 addresses are unique. They are unique in the sense that each address defines one, and only one,
connection to the Internet. Two devices on the Internet can never have the same address at the same
time.

Address Space

A protocol such as IPv4 that defines addresses has an address space. An address space is the total
number of addresses used by the protocol. Ifa protocol uses N bits to define an address; the address
space is 2N because each bit can have two different values (0 or 1) and N bits can have 2N values. IPv4
uses 32-bit addresses, which means that the address space is 232 or 4,294,967,296 (more than 4
billion).

Notations

There are two prevalent notations to show an IPv4 address: binary notation and dotted decimal
notation.

Binary Notation

In binary notation, the IPv4 address is displayed as 32 bits. Each octet is often referred to as a byte. So
itis common to hear an IPv4 address referred to as a 32-bit address or a 4-byte address. The following
is an example ofan IPv4 address in binary notation:

01110101 10010101 00011101 00000010

Dotted-Decimal Notation

To make the IPv4 address more compact and easier to read, Internet addresses are usually written in
decimal form with a decimal point (dot) separating the bytes. The following is the Dotted-decimal
notation of the above address:

[Link]

Example

1. Change the following IPv4 addresses from binary notation to dotted-decimal notation.

Dept. of MCA Page 1 of 13


Module-3 Logical Addressing

a. 10000001 00001011 00001011 11101111

b. 11000001 10000011 00011011 11111111

Solution

We replace each group of 8 bits with its equivalent decimal number and add dots for separation.

a. [Link] b. [Link]

2. Change the following IPv4 addresses from dotted-decimal notation to binary notation.

a. [Link]

b. [Link]

Solution We replace each decimal number with its binary equivalent

a. 01101111 00111000 00101101 01001110

b. 11011101 00100010 00000111 01010010

Classful Addressing
In classful addressing, the address space is divided into five classes: A, B, C, D, and E. Each class
occupies some part of the address space.

Find the class of each address.


a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. [Link]
d. [Link]
Solution
a. The first bit is O. This is a class A address.

Dept. of MCA Page 2 of 13


Module-3 Logical Addressing

b. The first 2 bits are 1; the third bit is O. This is a class C address.
c. The first byte is 14 (between 0 and 127); the class is A.
d. The first byte is 252 (between 240 and 255); the class is E.
Classes and Blocks

A block in class A address is too large for almost any organization. This means most of the
addresses in class A were wasted and were not used. A block in class B is also very large,
probably too large for many of the organizations that received a class B block. A block in class
C is probably too small for many organizations. Class D addresses were designed for
multicasting as we will see in a later chapter. Each address in this class is used to define one
group of hosts on the Internet. The Internet authorities wrongly predicted a need for
268,435,456 groups. This never happened and many addresses were wasted here too. And
lastly, the class E addresses were reserved for future use; only a few were used, resulting in
another waste of addresses.
Netid and Hostid
In classful addressing, an IP address in class A, B, or C is divided into netid and hostid. These
parts are of varying lengths, depending on the class of the address. Figure 19.2 shows some
netid and hostid bytes. The netid is in Color, the hostid is in white. Note that the concept does
not apply to classes D and E. In class A, one byte defines the netid and three bytes define the
hostid. In class B, two bytes define the netid and two bytes define the hostid. In class C, three
bytes define the netid and one byte defines the hostid.

Mask
Although the length of the netid and hostid (in bits) is predetermined in classful addressing,
we can also use a mask (also called the default mask), a 32-bit number made of contiguous Is

Dept. of MCA Page 3 of 13


Module-3 Logical Addressing

followed by contiguous as. The mask can help us to find the netid and the hostid. For example,
the mask for a class A address has eight 1s, which means the first 8 bits of any address in class
A define the netid; the next 24 bits define the hostid.
Subnetting
During the era of classful addressing, subnetting was introduced. Ifan organization was
granted a large block in class A or B, it could divide the addresses into several contiguous
groups and assign each group to smaller networks (called subnets) or, in rare cases, share part
of the addresses with neighbors.
Supernetting
The time came when most of the class A and class B addresses were depleted; however, there
was still a huge demand for midsize blocks. The size of a class C block with a maximum number
of256 addresses did not satisfy the needs of most organizations. Even a midsize organization
needed more addresses. One solution was supernetting. In supernetting, an organization can
combine several class C blocks to create a larger range of addresses. In other words, several
networks are combined to create a super network or a super net. An organization can apply
for a set of class C blocks instead of just one. For example, an organization that needs 1000
addresses can be granted four contiguous class C blocks. The organization can then use these
addresses to create one super network. Supernetting decreases the number of Is in the mask.
For example, if an organization is given four class C addresses, the mask changes from /24 to
/22.
Address Depletion
The flaws in classful addressing scheme combined with the fast growth of the Internet led to
the near depletion of the available addresses. Yet the number of devices on the Internet is
much less than the 232address space.
Classless Addressing
To overcome address depletion and give more organizations access to the Internet, classless
addressing was designed and implemented.
Address Blocks
In classless addressing, when an entity, small or large, needs to be connected to the Internet,
it is granted a block (range) of addresses. The size of the block (the number of addresses)
varies based on the nature and size of the entity. For example, a household may be given only
two addresses; a large organization may be given thousands of addresses. An ISP, as the
Internet service provider, may be given thousands or hundreds of thousands based on the
number of customers it may serve. Restriction To simplify the handling of addresses, the
Internet authorities impose three restrictions on classless address blocks:
1. The addresses in a block must be contiguous, one after another.
2. The number of addresses in a block must be a power of2 (I, 2, 4, 8, ... ).

Dept. of MCA Page 4 of 13


Module-3 Logical Addressing

3. The first address must be evenly divisible by the number of addresses.

The addresses are contiguous. The number of addresses is a power of2 (16 = 24), and the first
address is divisible by 16. The first address, when converted to a decimal number, is
3,440,387,360, which when divided by 16 results in 215,024,210.
Example
A block of addresses is granted to a small organization. We know that one of the addresses is
[Link]/28. What is the first address in the block?
Solution The binary representation of the given address is 11001101 00010000 00100101
00100I11. If we set 32- 28 rightmost bits to 0, we get 11001101 000100000100101 0010000
or [Link].
Last Address
The last address in the block can be found by setting the 32- n right most bits in the binary
notation of the address to Is.
Number of Addresses The number of addresses in the block is the difference between the last
and first address. It can easily be found using the formula 232-n .
Another way to find the first address, the last address, and the number of addresses is to
represent
themaskasa32-bit binary(or8-digit hexadecimal )number. This is particularly useful when we
are writing a program to find these pieces of information. InExample19.5the/28canberepre
sented as11111111111111111111111111110000(twenty-eight Is and four Os). Find

a. The first address


h. The last address
c. The number of addresses
Solution

a. [Link] here is

Dept. of MCA Page 5 of 13


Module-3 Logical Addressing

done bit by bit. The result of ANDing 2bits is 1 if both bits are Is; the result is 0 otherwise.
Address:
Mask:
First address:

11001101 00010000 00100101 00100111


11111111 11111111 11111111 11110000
11001101 00010000 00100101 00100000
b. 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 2bits is0 if both bits are Os; the
result is [Link] isfoundbychangingeach1to0and

each0to1.
Address:
Mask complement:
Last address:
11001101 00010000 00100101 00100111
0000000000000000 0000000000001111
11001101 0001000000100101 00101111

c. The number of addresses can be found by complementing them ask, interpreting it as a


decimal number, and adding 1to it.
Mask complement:
Number of addresses:
000000000 0000000000000000 00001111

15+1=16
Network Addresses
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. The first 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.

Dept. of MCA Page 6 of 13


Module-3 Logical Addressing

Hierarchy
IP addresses, like other addresses or identifiers we encounter these days, have levels of
hierarchy.

Two-Level Hierarchy: No Subnetting


An IP address can define only two levels of hierarchy when not sub netted. The n left most bits
of the address [Link] 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.

Dept. of MCA Page 7 of 13


Module-3 Logical Addressing

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.
Three-Levels of Hierarchy: Subnetting
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. The rest
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. The organization,
however, needs to create small subblocks of addresses, each assigned to specific subnets. The
organization has its own mask; each subnet must also have its own.
The organization has three offices and needs to divide the

addresses into three subblocks of32, 16, and 16 addresses. We can find the new masks
by using the following arguments:
1. Suppose the mask for the first subnet is n1, then 232- n1 must be 32, which means
that n1 =27.
2. Suppose the mask for the second subnet is n2, then 232-n2 must be 16, which
means that n2 = 28.
3. Suppose the mask for the third subnet is n3, then 232-n3 must be 16, which means
that n3 =28.

This means that we have the masks 27, 28, 28 with the organization mask being 26.

Dept. of MCA Page 8 of 13


Module-3 Logical Addressing

Let us checkto see ifwe can find the subnet addresses from one ofthe addresses in
the subnet.
a. In subnet 1, the address [Link]/27 can give us the subnet address ifwe use the
mask /27 because

Host:
Mask:
Subnet:
00010001 00001100 00001110 00011101

/27
00010001 00001100 00001110 00000000 ..... ([Link])
b. In subnet 2, the address [Link]/28 can give us the subnet address ifwe use the
mask /28 because

Host:
Mask:
00010001 00001100 00001110 00101101
/28

Subnet: 00010001 00001100 00001110 00100000 .... ([Link])

Dept. of MCA Page 9 of 13


Module-3 Logical Addressing

c. In subnet 3, the address [Link]/28 can give us the subnet address ifwe use the
mask/28 because
Host:
Mask:

00010001 00001100 00001110 00110010


/28
Subnet: 00010001 00001100 00001110 00110000. ... ([Link])

Network Address Translation(NAT)


The number of home users and small businesses that want to use the Internet is ever
increasing. In the beginning, a user was connected to the Internet with a dial-upline, which
means that she was connected for a specific period of time. An ISP with a block of addresses
could dynamically assign an address to this user. An address was given to a user when it was
needed. But the situation is different today. Home users and small businesses can be

Dept. of MCA Page 10 of 13


Module-3 Logical Addressing

connected by an ADSL line or cable modem. With the shortage of addresses, this is a serious
problem. A quick solution to this problem is called network address translation (NAT).
NAT enables a user to have a large set of addresses internally and one address, or a small Set
off addresses, externally. The traffic inside can use the large set; the traffic outside, the Small
set. To separate the addresses used inside the home or business and the ones used for the
Internet, the Internet authorities have reserved three sets of addresses as private addresses,
shown inTable19.3.

Dept. of MCA Page 11 of 13


Module-3 Logical Addressing

In this strategy, communication must always be initiated by the private network.


The NAT mechanism described requires that the private network start the communication.
As we will see, NAT is used mostly by ISPs which assign one single address to a customer. The
customer, however, may be a member of a private network that has many private addresses.
In this case, communication with the Internet is always initiated from the customer site, using
a client program such as HTTP, TELNET, or FTP to access the corresponding server program.
For example, when e-mail that originates from a non-customer site is received by the ISP e-
mail server, the e-mail is stored in the mailbox of the customer until retrieved. A private
network cannot run a server program for clients outside of its network if it is using NAT
technology.
Using a Pool of IP Addresses Since the NAT router has only one global address, only one
private network host can access the same external host. To remove this restriction, the NAT
router uses a pool of global addresses. For example, instead of using only one global address
([Link]), the NAT router can use four addresses ([Link], [Link], [Link], and
[Link]). In this case, four private network hosts can communicate with the same
external host at the same time because each pair of addresses defines a connection. However,
there are still some drawbacks. In this example, no more than four connections can be made
to the same destination. Also, no private-network host can access two external server
programs (e.g., HTTP and FfP) at the same time.
Using Both IP Addresses and Port Numbers To allow a many-to-many relationship between
private-network hosts and external server programs, we need more information in the
translation table. For example, suppose two hosts with addresses [Link] and [Link]
inside a private network need to access the HTTP server on external host.
[Link]. If the translation table has five columns, instead of two, that include the source and
destination port numbers of the transport layer protocol, the ambiguity is eliminated.

Dept. of MCA Page 12 of 13


Module-3 Logical Addressing

Dept. of MCA Page 13 of 13

You might also like