Ipv Addresses: Bashir. M. Elkharraz
Ipv Addresses: Bashir. M. Elkharraz
Ipv Addresses: Bashir. M. Elkharraz
IPv4 Addresses
Bashir. M. Elkharraz
Lecture 4
1
IPv4 Addresses
At the network layer, we need to uniquely identify each device
on the Internet to allow global communication between all
devices.
• The identifier used in the network layer to identify each
device connected to the Internet is called the Internet address
or IP address.
• An IPv4 address is a 32-bit address that uniquely and
universally defines the connection of a host or a router to the
Internet; an IP address is the address of the interface.
• Two devices on the Internet can never have the same address
at the same time.
2
Address Space
• An address space is the total number of addresses used by the
protocol.
• If a protocol uses b bits to define an address, the address
space is 2𝒃 because each bit can have two different values (0
or 1).
• IPv4 uses 32-bit addresses, which means that the address
space is 2𝟑𝟐 or 4,294,967,296 (more than four billion).
Theoretically, if there were no restrictions, more than 4 billion
devices could be connected to the Internet.
3
Notation
• There are three common notations to show an IPv4 address:
binary notation (base 2), dotted-decimal notation (base 256),
and hexadecimal notation (base 16). The most prevalent,
however, is base 256.
• Binary Notation: Base 2
4
CLASSFUL ADDRESSING
• IP addresses, when started a few decades ago, used the
concept of classes.
• This architecture is called classful addressing.
• In the mid-1990s, a new architecture, called classless
addressing, was introduced that supersedes the original
architecture.
• In this section, we introduce classful addressing because it
paves the way for understanding classless addressing and
justifies the rationale for moving to the new architecture.
Classless addressing is discussed in the next section
5
Classes
• In classful addressing, the IP address space is divided into five
classes: A, B, C, D, and E. Each class occupies some part of the
whole address space.
6
Recognizing Classes
• We can find the class of an address when the address is given
either in binary or dotted decimal notation.
• In the binary notation, the first few bits can immediately tell
us the class of the address;
• in the dotted-decimal notation, the value of the first byte can
give the class of an address.
7
• Example
8
Netid and Hostid
• In classful addressing, an IP address in classes A, B, and C is
divided into netid and hostid.
9
Classes and Blocks
• Each class is divided into a fixed number of blocks with each
block having a fixed size.
❑ Class A
• Since only 1 byte in class A defines the netid and the leftmost
bit should be 0, the next 7 bits can be changed to find the
number of blocks in this class.
• class A is divided into 27 = 128 blocks that can be assigned to
128 organizations (the number is less because some blocks
were reserved as special blocks).
• each block in this class contains 16,777,216 addresses, which
means the organization should be a really large one to use all
these addresses. Many addresses are wasted in this class.
10
11
Extracting Information in a Block
12
Example An address in a block is given as 73.22.17.25. Find the number of
addresses in the block, the first address, and the last address.
Solution
• Since 73 is between 0 and 127, the class of the address is A. The value of n
for class A is 8.
13
• Example An address in a block is given as 200.11.8.45. Find
the number of addresses in the block, the first address, and
the last address.
• Solution Since 200 is between 192 and 223, the class of the
address is C. The value of n for class C is 24.
14
k
15
Network Mask
• Network address, is particularly important because it is used in
routing a packet to its destination network.
• When a packet arrives at the router from any source host, the
router needs to know to which network the packet should be sent;
the router needs to know from which interface the packet should
be sent out.
• A network mask or a default mask in classful addressing is a 32-bit
number with n leftmost bits all set to 1s and (32 − n) rightmost bits
all set to 0s.
16
17
• Example A router receives a packet with the destination
address 201.24.67.32. Show how the router finds the network
address of the packet.
255
67
18
Three-Level Addressing: Subnetting
• As we discussed before, the IP addresses were originally designed
with two levels of addressing.
• It soon became clear that we need more than two hierarchical
levels, for two reasons.
• First, an organization that was granted a block in class A or B
needed to divide its large network into several subnetworks for
better security and management.
• Second, since the blocks in class A and B were almost depleted and
the blocks in class C were smaller than the needs of most
organizations
• In subnetting, a network is divided into several smaller
subnetworks (subnets) with each subnetwork having its own
subnetwork address.
19
Example
• Figure 5.23 shows a network using class B addresses before
subnetting. We have just one network with almost 216 hosts.
The whole network is connected, through one single
connection, to one of the routers in the Internet. Note that
we have shown /16 to show the length of the netid (class B).
20
• The whole network is still connected to the Internet through the
same router. the network has used a private router to divide the
network into four subnetworks. internally the network is made of
four subnetworks. Each subnetwork can now have almost 214 .
• The network can belong to a university campus with four different
schools (buildings).
• After subnetting, each school has its own subnetworks, but still the
whole campus is one network for the rest of the Internet. Note that
/16 and /18 show the length of the netid and subnetids.
21
Subnet Mask
• The network mask is used when a network is not subnetted. When
we divide a network to several subnetworks, we need to create a
subnetwork mask (or subnet mask) for each subnetwork.
• Subnetting increases the length of the netid and decreases the
length of hostid.
22
Example
23