Network Layer Logical Addressing
Network Layer Logical Addressing
Chapter 19
Network Layer
Logical Addressing
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.1
19--1 IPv
19 IPv44 ADDRESSES
An IPv
IPv44 address is a 32
32--bit address that uniquely
and universally defines the connection of a device
(for example, a computer or a router) to the Internet
Internet..
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.2
1
fffffffffffff 10/17/2011
Note
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.3
IPv44 ADDRESSES
IPv
Two devices in the Internet can never have the same
address at the same time.
An address may be assigned to a device for a time period
and then taken away and assigned to another device.
If a device operating at the network layer (e.g. router) has
m connections to the Internet, it needs to have m IP
address.
Note
The IPv4 addresses are unique
and universal.
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.4
2
fffffffffffff 10/17/2011
IPv44 ADDRESSES
IPv
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.5
19..1 IPv
19 IPv44 Addresses: Notations
There are two prevalent notations to show an IPv4 address:
1. Binary notation:
Address is displayed as 32 bits.
Each octet is often referred to as byte.
IPv4 address referred to as 32-bit address or 4-
byte address
Example:
01110101 10010101 00011101 00000010
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.6
3
fffffffffffff 10/17/2011
19..1 IPv
19 IPv44 Addresses: Notations
2. Dotted-decimal notation:
More compact and easier to read
Written in decimal form with a decimal point( dot)
separating the bytes.
Example: 117.149.29.2
Each decimal value range from 0 to 255
Example:
Dotted-decimal notation and binary notation for an IPv4
address
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.7
Example 1
Solution
We replace each group of 8 bits with its equivalent
decimal number (see Appendix B) and add dots for
separation.
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.8
4
fffffffffffff 10/17/2011
Example 2
Solution
We replace each decimal number with its binary
equivalent
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.9
Example 3
Find the error, if any, in the following IPv4 addresses.
Solution
a. There must be no leading zero (045).
b. There 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.
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.10
5
fffffffffffff 10/17/2011
IPv4
IPv 4 Addresses: Classful Addressing
In classful addressing, the address space is divided into five
classes: A, B, C, D, and E.
We can find the class of an address in:
Binary notation: the first few bits define the class
Decimal-dotted notation: the first byte define the class
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.11
Note
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.12
6
fffffffffffff 10/17/2011
Example 4
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.14
7
fffffffffffff 10/17/2011
7 = 24 =
2 2
14 = 16 =
2 2
21 = 8
2 2 =
28
2 =
28
2 =
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.15
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.16
8
fffffffffffff 10/17/2011
Note
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.17
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.18
9
fffffffffffff 10/17/2011
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.19
Example 5
Find the network address for the following:
1. 132.6.17.85
2. 23.56.7.91
Solution
1.1. The
Theclass
classisisB.
A.The
Onlyfirst
the2first
bytesbyte
defines
defines
thethe
Netid.
netid.
WeWecancan
find
find
thethe
network
networkaddress
addressby byreplacing
replacingthe
thehostid
hostidbytes
bytes(17.85)
(56.7.91)
with
with
0s.0s.
Therefore,the
Therefore, thenetwork
networkaddress
addressisis132.6.0.0.
23.0.0.0.
2. The class is A. Only the first byte defines the Netid. We can find the
network address by replacing the hostid bytes (56.7.91) with 0s.
Therefore, the network address is 23.0.0.0.
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.20
10
fffffffffffff 10/17/2011
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.21
Note::
Note
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 22
11
fffffffffffff 10/17/2011
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 23
Addreessing: Subnetting
Classful Addr
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.24
12
fffffffffffff 10/17/2011
Classful Addr
Addreessing: Subnet Mask
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.25
Example 6:
13
fffffffffffff 10/17/2011
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.27
Address Depletion
Near depletion of the available address
because of the fast growth of the Internet.
Run out of classes A and B address.
size organizations.
Solution: Classless addressing
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.28
14
fffffffffffff 10/17/2011
Note
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.29
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.30
15
fffffffffffff 10/17/2011
Restriction
The Internet Authorities impose three
restrictions:
1. The address in a block must be contiguous,
one after another.
2. The number of addresses in a block must be a
power of 2 ( 1,2,4,8,)
3. The first address must be evenly divisible by
the number of addresses.
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.31
Example 8:
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.32
16
fffffffffffff 10/17/2011
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.34
17
fffffffffffff 10/17/2011
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.35
Note
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.36
18
fffffffffffff 10/17/2011
Example 9
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?
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
205.16.37. 0010 0111
If we set 3228 rightmost bits to 0, we get
205.16.37. 0010 0000
or
205.16.37.32.
This is actually the block shown in example 8
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.37
Note
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.38
19
fffffffffffff 10/17/2011
Note
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.39
Example 10
Solution
The address is
205.16.37. 0010 0111
If we set 32 28 = 4 rightmost bits to 1, we get
205.16.37. 0010 1111
or
205.16.37.47
This is actually the block shown in Example 8
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.40
20
fffffffffffff 10/17/2011
Note
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.41
Example 11
Solution
The value of n is 28, which means that number
of addresses is 2 3228 or 16.
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.42
21
fffffffffffff 10/17/2011
TWO Level
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.43
Suffix
22
fffffffffffff 10/17/2011
Note
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.45
Suffix
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.46
23
fffffffffffff 10/17/2011
Example 12
An organization is granted a block of addresses
17.12.40.0/26, which contains 64: (2(32-26)=24 =64) addresses.
The organization has three offices and needs to divide the
addresses into three subblocks (subnets) of 32, 16 and 16
addresses.
Design the subblocks and find the new masks.
Solution
Subnet1:
Mask n1: 232-n1 = 32; n1=27
Subnet2
Mask n2: 232-n2 =16; n2=28
Subnet3
Mask n3: 232-n2 = 16; n3= 28
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition
19.47
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.48
24
fffffffffffff 10/17/2011
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.50
25
fffffffffffff 10/17/2011
Address Allocation
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.51
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.52
26
fffffffffffff 10/17/2011
Private addresses are unique inside the organization , but they are
not unique globally
No router will forward a packet that has one of these addresses as
the destination addresses
The site must have one connection to the global internet through
the router that runs NAT software
The router has uses one private address and one global address
The internet sees only NAT router with global address
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.53
Addresses in a NAT
200.24.5.8
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.54
27
fffffffffffff 10/17/2011
200.24.5.8
Note :
private network must start (initiate ) the communication
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.55
restriction :Since the NAT router has only one global address,
only one private network host can access the same external host
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.56
28
fffffffffffff 10/17/2011
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.57
29
fffffffffffff 10/17/2011
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.59
Host A
2
1
25.8.2.10
Host B NAT
172.18.3.2 200.24.5.8
172.18.3.30 Internet
Web server
S= 25.8.2.10, 80
Host C D=172.18.3.1, 1400 S= 25.8.2.10, 80
D=200.224.5.8, 5000
172.18.3.3
4
3
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.60
30
fffffffffffff 10/17/2011
Dr. Gihan Naguib Behrouz A. Forouzan Data communication and Networking 4th edition 19.61
31