The presentation is for support of Network Layer class on Logical Addressing topic. From IPv4 address to Network Address Translation. Resources have been derived from Data Communication & Networking by Behrouz A. Forouzan
2. LOGICAL ADDRESSING IPv4 Addresses
Slide 2Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
An IPv4 address is a 32-bit address that uniquely and universally defines
the connection of a device (for example, a computer or a router) to the
Internet.
3. IPv4 ADDRESSES Address Space
Slide 3Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
4. Figure 19.1
Dotted-decimal notation and binary notation for an IPv4 address
Slide 4Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
5. Example 19.1
Slide 5Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
Change the following IPv4 addresses from binary notation to dotted-
decimal notation.
a. 10000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
We replace each group of 8 bits with its equivalent decimal number
and add dots for separation.
a. 129.11.11.239
b. 193.131.27.255
6. Example 19.2
Slide 6Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
Change the following IPv4 addresses from dotted-decimal notation to
binary notation.
a. 111.56.45.78
b. 221.34.7.82
We replace each decimal number with its binary equivalent.
a. 01101111 00111000 00101101 01001110
b. 11011101 00100010 00000111 01010010
7. Example 19.3
Slide 7Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
Find the error, if any, in the following IPv4 addresses.
a. 111.56.045.78 c. 75.45.301.14
b. 221.34.7.8.20 d. 11100010.23.14.67
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.
8. IPv4 ADDRESSES Classful Addressing
Slide 8Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
9. Figure 19.2 Finding the classes in binary and dotted-decimal notation
Slide 9Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
10. Example 19.3
Slide 10Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
Find the class of each address.
a. 00000001 00001011 00001011 11101111 c. 14.23.120.8
b. 11000001 10000011 00011011 11111111 d. 252.5.16.111
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.
11. Table 19.1 Number of blocks and block size in classful IPv4 addressing
Slide 11Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
12. Classful Addressing Transmission Control
Slide 12Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
13. Table 19.2 Default masks for classful addressing
Slide 13Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
14. Classful Addressing Address Depletion
Slide 14Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
15. Classful Addressing Example 19.5
Slide 15Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
Figure 19.3 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.
16. Figure 19.3 A block of 16 addresses granted to a small organization
Slide 16Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
18. Classless Addressing First Address
Slide 18Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
19. Classless Addressing: First Address Example 19.6
Slide 19Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
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?
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.
This is actually the block shown in Figure 19.3.
20. Classless Addressing Last Address
Slide 20Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
21. Classless Addressing: Last Address Example 19.7
Slide 21Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
Find the last address for the block in Example 19.6.
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.
22. Classless Addressing Number of Addresses
Slide 22Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
23. Classless Addressing: Number of Addresses Example 19.8
Slide 23Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
Find the number of addresses in Example 19.6.
The value of n is 28, which means that number of addresses is 232−28
or 16.
24. Classless Addressing: Number of Addresses Example 19.9
Slide 24Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
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.
25. Classless Addressing: Number of Addresses Example 19.9
Slide 25Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
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.
Address: 11001101 00010000 00100101 00100111
Mask: 11111111 11111111 11111111 11110000
First Address: 11001101 00010000 00100101 00100000
26. Classless Addressing: Number of Addresses Example 19.9
Slide 26Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
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.
Address: 11001101 00010000 00100101 00100111
Mask: 00000000 00000000 00000000 00001111
First Address: 11001101 00010000 00100101 00101111
27. Classless Addressing: Number of Addresses Example 19.9
Slide 27Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
c. The number of addresses can be found by complementing the
mask, interpreting it as a decimal number, and adding 1 to it.
Mask complement: 00000000 00000000 00000000 00001111
Number of addresses: 15 + 1 = 16
28. Figure 19.4 A network configuration for the block 205.16.37.32/28
Slide 28Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
29. Classless Addressing Network Address
Slide 29Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
30. Figure Hierarchy in a telephone network in Agartala
Slide 30Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
381 234 2330
31. Figure 19.6 Two levels of hierarchy in an IPv4 address
Slide 31Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
32. Two levels of hierarchy: No Subnetting
Slide 32Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
33. Figure 19.7 Configuration and addresses in a subnetted network
Slide 33Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
34. Figure 19.8 Three-level hierarchy in an IPv4 address
Slide 34Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
35. Classless Addressing: Address Allocation Example 19.10
Slide 35Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
An ISP is granted a block of addresses starting with 190.100.0.0/16
(65,536 addresses). The ISP needs to distribute these addresses to three
groups of customers as follows:
a. The first group has 64 customers; each needs 256 addresses.
b. The second group has 128 customers; each needs 128 addresses.
c. The third group has 128 customers; each needs 64 addresses.
Design the subblocks and find out how many addresses are still available
after these allocations.
36. Classless Addressing: Address Allocation Example 19.10
Slide 36Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
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
1st Customer: 190.100.0.0/24 190.100.0.255/24
2nd Customer: 190.100.1.0/24 190.100.1.255/24
···
64th Customer: 190.100.63.0/24 190.100.63.255/24
Total = 64 x 256 = 16,384
37. Classless Addressing: Address Allocation Example 19.10
Slide 37Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
Group2
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
1st Customer: 190.100.64.0/25 190.100.64.127/25
2nd Customer: 190.100.64.128/25 190.100.64.255/25
···
128th Customer: 190.100.127.128/25 190.100.127.255/25
Total = 128 x 128 = 16,384
38. Classless Addressing: Address Allocation Example 19.10
Slide 38Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
Group 3
For this group, each customer needs 64 addresses. This means that
6(log2 64) bits are needed to define each host. The prefix length is then
32 − 6 = 26. The addresses are
1st Customer: 190.100.128.0/26 190.100.128.63/26
2nd Customer: 190.100.128.64/26 190.100.128.127/26
···
64th Customer: 190.100.159.192/26 190.100.159.255/26
Total = 128 x 64 = 8192
Number of granted addresses to the ISP: 65,536
Number of allocated addresses by the ISP: 40,960
Number of available addresses: 24 576
39. Figure 19.9
An example of address allocation and distribution by an ISP
Slide 39Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
40. Table 19.3 Addresses for private networks
Slide 40Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
41. Figure 19.10 A NAT implementation
Slide 41Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
42. Figure 19.11 Addresses in a NAT
Slide 42Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
43. Figure 19.12 NAT address translation
Slide 43Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
44. Table 19.4 Five-column translation table
Slide 44Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT
45. Figure 19.13 An ISP and NAT
Slide 45Presented by Pankaj Debbarma, Asstt. Prof.
Deptt. of Computer Science & Engineering, TIT