Network Layer: Logical Addressing: Dr. Kunwar Pal Dept. of CSE NIT Jalandhar
Network Layer: Logical Addressing: Dr. Kunwar Pal Dept. of CSE NIT Jalandhar
Network Layer: Logical Addressing: Dr. Kunwar Pal Dept. of CSE NIT Jalandhar
Logical Addressing
19.2
Note
19.3
Note
19.4
Note
19.5
Figure 19.1 Dotted-decimal notation and binary notation for an IPv4 address
19.6
Example 19.1
Solution
We replace each group of 8 bits with its equivalent
decimal number (see Appendix B) and add dots for
separation.
19.7
Example 19.2
a. 111.56.45.78
b. 221.34.7.82
19.8
Note
19.9
Figure 19.2 Finding the classes in binary and dotted-decimal notation
19.10
Example 19.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.
19.11
Table 19.1 Number of blocks and block size in classful IPv4 addressing
19.12
Note
19.13
Table 19.2 Default masks for classful addressing
19.14
Note
19.15
Note
19.16
Note
19.17
Example 19.6
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.
This is actually the block shown in Figure 19.3.
19.18
Note
19.19
Example 19.7
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
This is actually the block shown in Figure 19.3.
19.20
Note
19.21
Example 19.8
Solution
The value of n is 28, which means that number
of addresses is 2 32−28 or 16.
19.22
Example 19.9
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 19.5 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.
19.23
Example 19.9 (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.
19.24
Example 19.9 (continued)
19.25
Figure 19.4 A network configuration for the block 205.16.37.32/28
19.26
Note
19.27
Figure 19.6 A frame in a character-oriented protocol
19.28
Note
19.29
Figure 19.7 Configuration and addresses in a subnetted network
19.30
Figure 19.8 Three-level hierarchy in an IPv4 address
19.31
Example 19.10
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
19.33
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
19.34
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
19.36
Figure 19.10 A NAT implementation
19.37
Figure 19.11 Addresses in a NAT
19.38
Figure 19.12 NAT address translation
19.39
Table 19.4 Five-column translation table
19.40
19-2 IPv6 ADDRESSES
19.41
Note
19.42
Figure 19.14 IPv6 address in binary and hexadecimal colon notation
19.43
Figure 19.15 Abbreviated IPv6 addresses
19.44
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.45
IPv4 Addressing Concepts
and Their IPv6 Equivalents
IPv4 Address IPv6 Address
Address Length – 32 bits 128 bits
Address Representation - decimal hexadecimal
46
IPv6 Packet Format
IPv4 Header Structure
49
IPv6 Packet Format
IPv4 Header - Review
■ Total Length (16 bits)
■ Indicates the total length of the IPv4 packet (IPv4 header + IPv4 payload)
and does not include link layer framing.
■ Identification (16 bits)
■ Identifies this specific IPv4 packet.
■ The Identification field is selected by the originating source of the IPv4
packet. If the IPv4 packet is fragmented, all of the fragments retain the
Identification field value so that the destination node can group the
fragments for reassembly.
■ Flags (3 bits)
■ Identifies flags for the fragmentation process.
■ There are two flags—one to indicate whether the IPv4 packet might be
fragmented and another to indicate whether more fragments follow the
current fragment.
■ Fragment Offset (13 bits)
■ Indicates the position of the fragment relative to the original IPv4 payload.
50
IPv6 Packet Format
IPv4 Header - Review
■ Time to Live ( 8 bits)
■ Indicate the maximum number of links on which an IPv4 packet can travel
before being discarded.
■ Originally used as a time count with which an IPv4 router determined the
length of time required (in seconds) to forward the IPv4 packet,
decrementing the TTL accordingly. When the TTL equals 0,an ICMP Time
Expired-TTL Expired in Transit message is sent to the source IPv4 address
and the packet is discarded.
■ Protocol (8 bits)
■ Identifies the upper layer protocol.
■ For example, TCP uses a Protocol of 6, UDP uses a Protocol of 17, and ICMP
uses a Protocol of 1.
■ The Protocol field is used to demultiplex an IPv4 packet to the upper layer
protocol.
51
IPv6 Packet Format
IPv4 Header - Review
■ Header Checksum (16 Bits)
■ Provides a checksum on the IPv4 header only.
■ The IPv4 payload is not included in the checksum calculation as the IPv4
payload and usually contains its own checksum..
■ Source Address ( 32 bits)
■ Stores the IPv4 address of the originating host.
■ Destination Address (32 bits)
■ Stores the IPv4 address of the destination host.
■ Options (multiple of 32 bits)
■ Stores one or more IPv4 options.
52
IPv6 Packet Format
IPv4 vs IPv6 Header
54
IPv6 Packet Format
IPv6 Header Fields
■ Based on these rules, RFC 2460 defines the following IPv6 header fields:
1. Version (4 bits)
■ 4 bits are used to indicate the version of IP and is set to 6
56
IPv6 Packet Format
IPv6 Header Fields
7. Source IPv6 Address (128 bits)
• Stores the IPv6 address of the originating host.
8. Destination IPv6 Address (128 bits)
■ Stores the IPv6 address of the current destination host.
57
IPv6 Packet Format
Values of the Next Header Field
58
IPv6 Packet Format