Chapter 4 P2
Chapter 4 P2
1
Cont.
IPv4 Addressing Scheme and Notations:
Addressing Mapping
They are unique in the sense that each address defines one, and only
Two devices on the Internet can never have the same address at the
same time.
5
Address Space
A protocol such as IPv4 that defines addresses has an address space.
8
Example 1
Solution
We replace each group of 8 bits with its equivalent decimal
number and add dots for separation.
9
Example 2
Solution
We replace each decimal number with its binary equivalent.
10
Example 3
Solution
a. There must be no leading zero (045).
b. They can be no more than four numbers.
c. Each number needs to be less than or equal to 255.
d. A mixture of binary notation and dotted-decimal
notation is not allowed. 11
Classful Addressing
IPv4 addressing, at its inception, used the concept of classes. This
architecture is called 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.
12
Example 4
Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C
address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
13
Network ID and Host ID
In classful addressing, an IPaddress in class
A, B, or C is divided into
network ID and host ID.
These parts are of varying lengths, depending on the
class of the address.
In class A, 1 byte defines the network ID & 3 bytes
define the host ID.
In class B, 2 bytes define the network ID & 2 bytes
define the host ID.
Network Host Host Host
In class C, 3 bytes define the network ID & 1 byte
host ID. Network
defines the Network Host Host
15
Address Depletion
The flaws in classful addressing scheme combined with the fast growth of
Yet the number of devices on the Internet is much less than the
We have run out of class A and B addresses, and a class C block is too
classless addressing.
16
Subnetting
During the era of classful addressing, subnetting was introduced.
divide the addresses into several contiguous groups and assign each group
to smaller networks (called subnets) or, in rare cases, share part of the
Subnetting does NOT give you more hosts, but actually costs you hosts.
17
Contd.
Network Network Host Host
172 16 0 0
You lose two host IP Addresses for each subnet, and perhaps one
for the subnet IP address and one for the subnet broadcast IP
address.
You lose the last subnet and all of it’s hosts’ IP addresses as the
broadcast for that subnet is the same as the broadcast for the
network.
In older networks, you would have lost the first subnet, as the
subnet IP address is the same as the network IP address. (This
subnet can be used in most networks.)
18
Classless Addressing
To overcome address depletion and give more organizations access to the
Internet, classless addressing was designed and implemented.
In this scheme, there are no classes, but the addresses are still granted in
blocks.
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
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.
20
Contd.
The above figure shows a block of addresses, in both binary and
dotted-decimal notation, granted to a small business that needs
16 addresses.
We can see that the restrictions are applied to this block. The
addresses are contiguous. The number of addresses is a power
of 2 (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.
21
Classless addressing Mask
A better way to define a block of addresses is to select any address in the block and
the mask.
As we discussed before, a mask is a 32-bit number in which the n leftmost bits are 1s
and the 32 - n rightmost bits are 0s.
However, in classless addressing the mask for a block can take any value from 0 to
32. It is very convenient to give just the value of n preceded by a slash (CIDR –
Classless Inter Domain Routing notation).
n
Represent number of zeros in subnet mask
The address and the /n notation completely define the whole block (the first address,
IV. 2𝑛 -2 , 24 -2 = 16-2 = 14
III. to find valid host
Q2:Find the number subnet and valid
hostThe given network 150.150.0.0 and subnet
mask
255.255.255.252/30
I. What is the class of the given network?
II. Find the subnet Mask?
III. findvalid host?
Answer
Change in two binary notion
Mask 2𝑛 ,
11111111 11111111 11111111 11111100
IV.
V. Class
to findB subnet
Network
214
=16384
Solution
27
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 the above example the /28 can be
represented as
1111111111111111 11111111 11110000
(twenty-eight 1s and four 0s).
Find
a. The first address
b. The last address
c. The number of addresses.
28
Solution
a. The first address can be found by ANDing the given
addresses with the mask. ANDing here is done bit by
bit. The result of ANDing 2 bits is 1 if both bits are 1s;
the result is 0 otherwise.
29
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 2 bits is 0 if
both bits are 0s; the result is 1 otherwise. The
complement of a number is found by changing each 1 to
0 and each 0 to 1.
30
c. The of addresses can be found by
number
complementing the mask, interpreting it as a decimal
number, and adding 1 to it.
31
Examples
There are three types of Subnetting examples
32
Subnetting when given a required number of networks
Example 1: A service provider has given you the Class C network
range 209.50.1.0. Your company must break the network into 20
separate subnets.
Step 1. Determine the number of subnets and convert to binary
In this example, the binary representation of 20 = 00010100.
Step 2. Reserve required bits in subnet mask and find incremental value
The binary value of 20 subnets tells us that we need at least 5 network bits to
satisfy this requirement (since you cannot get the number 20 with any less than 5
bits – 10100)
Our original subnet mask is 255.255.255.0 (Class C subnet)
The full binary representation of the subnet mask is as follows:
255.255.255.0 = 11111111.11111111.11111111.00000000
33
Cont…
We must “convert” 5 of the client bits (0) to network bits (1) in order
to satisfy the requirements:
New Mask = 11111111.11111111.11111111.11111000
If we convert the mask back to decimal, we now have the subnet mask
that will be used on all the new networks – 255.255.255.248
Our increment bit is the last possible network bit, converted back to a
binary number:
New Mask = 11111111.11111111.11111111.1111(1)000 – bit with the
parenthesis is your increment bit.
If you convert this bit to a decimal number, it becomes the number “8”
34
Cont…
Step 3) Use increment to find network ranges
Start with your given network address and add your increment to the sub
netted octet: 209.50.1.0
209.50.1.8
209.50.1.16 …etc
You can now fill in your end ranges, which is the last possible IP address
before you start the next range. 209.50.1.0 – 209.50.1.7
209.50.1.8 – 209.50.1.15
209.50.1.16 – 209.50.1.23 …etc
You can then assign these ranges to your networks! Remember the first and
last address from each range (network / broadcast IP) are unusable.
35
3
6
?