11-13 Network Layer
11-13 Network Layer
INT205
Data Communications & Networking by Behrouz A Forouzan. Copyright © The McGraw-Hill Companies, Inc.
IPv4 ADDRESSES
Solution
We replace each group of 8 bits with its equivalent
decimal number and add dots for separation.
Example
Solution
We replace each decimal number with its binary
equivalent.
Example
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.
Note
Class D: multicast
Class E: reserved
Example
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.
Number of blocks and block size in classful IPv4 addressing
Note
We can see that the restrictions are applied to this block. The
addresses are continuous. The number of addresses is a power of 2
(16 = 24). This block of IP addresses is represented by:
205.16.37.32/28
Example
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 00100000
or
205.16.37.32
The block representation is 205.16.37.32/28
Note
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111
or
205.16.37.47
Note
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 previous example, /28
can be represented as
11111111 11111111 11111111 11110000
(twenty-eight 1s and four 0s).
Find
a. The first address
b. The last address
Example (continued)
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.
Example (continued)
Solution
Figure 19.9 shows the situation.
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
Example 19.10 (continued)
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
Example 19.10 (continued)
Group 3
For this group, each customer needs 64 addresses. This
means that 6 (log264) bits are needed to each host. The
prefix length is then 32 − 6 = 26. The addresses are
138.76.29.7 S: 128.119.40.186, 80
D: 10.0.0.1, 3345 4
S: 128.119.40.186, 80
external host 25.8.3.2. If the translation table has five columns, instead
Note
physical address and vice versa. This can be done by using either
ARP can be useful if the ARP reply is cached (kept in cache memory
for a while).
Four cases using ARP
Note
manual or automatic.
DHCP: Dynamic Host Configuration
Protocol
Goal: allow host to dynamically obtain its IP address from
network server when it joins network
Can renew its lease on address in use
Allows reuse of addresses (only hold address while connected an “on”
Support for mobile users who want to join network (more shortly)
DHCP overview:
host broadcasts “DHCP discover” msg
DHCP server responds with “DHCP offer” msg
host requests IP address: “DHCP request” msg
DHCP server sends address: “DHCP ack” msg
DHCP IP allocation
Manual IP allocation – the network administrator
assigns users with IP addresses from the DHCP
server and then the DHCP server communicates
this information to the clients.
Automatic IP allocation – the DHCP server
assigns static IP addresses to clients from a
pool. These addresses do not change unless the
administrator configures it differently.
Dynamic IP allocation – the administrator
configures a pool of addresses which can be
assigned to clients. The clients then request for
IP addresses which are assigned for a particular
time period, and released on time expiry.