Network Layer
Network Layer
IPv4 ADDRESSES
Solution
We replace each group of 8 bits with its equivalent
decimal number and add dots for separation.
Change the following IPv4 addresses from dotted-decimal
notation to binary notation.
Solution
We replace each decimal number with its binary
equivalent (see Appendix B).
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.
In classful addressing, the address
space is divided into five classes:
A, B, C, D, and E.
Finding the classes in binary and dotted-decimal notation
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111
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
In classful addressing, a large part of the
available addresses were wasted.
Default masks for classful addressing
Classful addressing, which is almost
obsolete, is replaced with classless
addressing.
Figure shows a block of addresses, in both binary and
dotted-decimal notation, granted to a small business that
needs 16 addresses.
A block of 16 addresses granted to a small organization
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 0010000
or
205.16.37.32.
The last address in the block can be
found by setting the rightmost
32 − n bits to 1s.
Find the last address for the block in Example.
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
The number of addresses in the block
can be found by using the formula
232−n.
Find the number of addresses in Example.
Solution
The value of n is 28, which means that number
of addresses is 2 32−28 or 16.
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 Example the /28 can be
represented as
11111111 11111111 11111111 11110000
(twenty-eight 1s and four 0s).
Find
a. The first address
b. The last address
c. The number of addresses.
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.
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.
c. The number of addresses can be found by
complementing the mask, interpreting it as a decimal
number, and adding 1 to it.
A network configuration for the block 205.16.37.32/28
The first address in a block is
normally not assigned to any device;
it is used as the network address that
represents the organization
to the rest of the world.
Two levels of hierarchy in an IPv4 address
A frame in a character-oriented protocol
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.
Configuration and addresses in a subnetted network
Three-level hierarchy in an IPv4 address
Example
19.47
19-2 IPv6 ADDRESSES
19.48
Note
19.49
Figure 19.14 IPv6 address in binary and hexadecimal colon notation
19.50
Figure 19.15 Abbreviated IPv6 addresses
19.51
Example 19.11
Solution
We first need to align the left side of the double colon to
the left of the original pattern and the right side of the
double colon to the right of the original pattern to find
how many 0s we need to replace the double colon.
19.52
Table 19.5 Type prefixes for IPv6 addresses
19.53
Table 19.5 Type prefixes for IPv6 addresses (continued)
19.54
Figure 19.16 Prefixes for provider-based unicast address
19.55
Figure 19.17 Multicast address in IPv6
19.56
Reserved addresses in IPv6
Local addresses in IPv6