Chap 05 Network Layer

download Chap 05 Network Layer

of 104

Transcript of Chap 05 Network Layer

  • 8/2/2019 Chap 05 Network Layer

    1/104

    TCP/IP Protocol Suite 1

    Chapter

    Outline

    5.1 Introduction

    5.2 Classful Addressing5.3 Classless Addressing

    5.4 Special Addresses

    5.5 NAT

  • 8/2/2019 Chap 05 Network Layer

    2/104

    TCP/IP Protocol Suite 2

    An IPv4 address is 32 bits long.

    Note

    The IPv4 addresses are uniqueand universal.

    Note

  • 8/2/2019 Chap 05 Network Layer

    3/104

    TCP/IP Protocol Suite 3

    The address space of IPv4 is232or 4,294,967,296.

    Note

    Numbers in base 2, 16, and 256 arediscussed in Appendix B.

    Note

  • 8/2/2019 Chap 05 Network Layer

    4/104

    TCP/IP Protocol Suite 4

    Binary to Decimal Conversion

    Bit 7 6 5 4 3 2 1 0

    27= 26= 25= 24= 23= 22= 21= 20=

    Deci 128 64 32 16 8 4 2 1

    Binary 1 0 1 0 1 1 1 0

    Deci 128 0 32 0 8 4 2 0

    Binary (10101110)2 = (128+32+8+4+2)10

    Decimal = 174

    Example: Convert the binary number (10101110)2 into decimalequivalent

  • 8/2/2019 Chap 05 Network Layer

    5/104

    TCP/IP Protocol Suite 5

    Figure 5.1 Dotted-decimal notation

    IPv4Least Address= 00000000. 00000000. 00000000. 00000000 = 0.0.0.0

    Max Addr = 11111111 .11111111. 11111111 .11111111 = 255.255.255.255

    Number of address = 232 = 4,294,967,296

    Or Address Space

  • 8/2/2019 Chap 05 Network Layer

    6/104

    TCP/IP Protocol Suite 6

    Find the number of addresses in a range if the first address is146.102.29.0 and the last address is 146.102.32.255.Solution

    Last address 146 . 102 . 32 . 255 (-)First Address 146 . 102 . 29 . 0

    --------------------------

    0 . 0 . 3 . 255

    --------------------------

    Example 5.5

  • 8/2/2019 Chap 05 Network Layer

    7/104

    TCP/IP Protocol Suite 7

    The first address in a range of addresses is 14.11.45.96. If thenumber of addresses in the range is 32, what is the lastaddress?SolutionWe convert the number of addresses minus 1 to base 256,which is 0.0.0.31. We then add it to the first address to get thelast address. Addition is in base 256.

    Example 5.6

  • 8/2/2019 Chap 05 Network Layer

    8/104

    TCP/IP Protocol Suite 8

    Figure 5.2 Bitwise NOT operation

  • 8/2/2019 Chap 05 Network Layer

    9/104

    TCP/IP Protocol Suite 9

    Example 5.7

  • 8/2/2019 Chap 05 Network Layer

    10/104

    TCP/IP Protocol Suite 10

    Figure 5.3 Bitwise AND operation

  • 8/2/2019 Chap 05 Network Layer

    11/104

    TCP/IP Protocol Suite 11

    Example 5.8

    Shortcut#1 for AND operation

    When at least one of the number is

    0 or 255selects the smaller byte

    or one of them if equal

    Shortcut#2 for AND operation

    When none of the two bytes iseither 0 or 255,

    write each byte as the sum of

    eight terms, where each term is a

    power of 2.

    select the smaller term in each (or

    one of them if equal)

    and add them to get the result.

  • 8/2/2019 Chap 05 Network Layer

    12/104

    TCP/IP Protocol Suite 12

    Figure 5.4 Bitwise OR operation

  • 8/2/2019 Chap 05 Network Layer

    13/104

    TCP/IP Protocol Suite 13

    Example 5.9

    Shortcut#1 for OR operation

    When at least one of the number is

    0 or 255selects the Largest byte

    or one of them if equal

    Shortcut#2 for OR operation

    When none of the two bytes is

    either 0 or 255,

    write each byte as the sum ofeight terms, where each term is a

    power of 2.

    select the larger term in each (or

    one of them if equal)

    and add them to get the result.

  • 8/2/2019 Chap 05 Network Layer

    14/104

    TCP/IP Protocol Suite 14

    5-2 CLASSFUL ADDRESSING

    IP addresses, when started a few decades ago,used the concept of classes. This architecture iscalled classful addressing. In the mid-1990s, a newarchitecture, called classless addressing, wasintroduced that supersedes the original architecture.In this section, we introduce classful addressingbecause it paves the way for understandingclassless addressing and justifies the rationale formoving to the new architecture. Classlessaddressing is discussed in the next section.

  • 8/2/2019 Chap 05 Network Layer

    15/104

    TCP/IP Protocol Suite 15

    Figure 5.5 Occupation of address space

  • 8/2/2019 Chap 05 Network Layer

    16/104

    TCP/IP Protocol Suite 16

    Figure 5.6 Finding the class of address

  • 8/2/2019 Chap 05 Network Layer

    17/104

    TCP/IP Protocol Suite 17

    Figure 5.7 Finding the class of an address using continuous checking

    1

    Class: A

    0Start

    1

    0

    Class: B

    1

    0

    Class: C

    1

    0

    Class: D Class: E

  • 8/2/2019 Chap 05 Network Layer

    18/104

    TCP/IP Protocol Suite 18

    Find the class of each address:a. 00000001 00001011 00001011 11101111b. 11000001 10000011 00011011 11111111c. 10100111 11011011 10001011 01101111d. 11110011 10011011 11111011 00001111SolutionSee the procedure in Figure 5.7.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 Caddress.c. The first bit is 1; the second bit is 0. This is a class Baddress.d. The first 4 bits are 1s. This is a class E address.

    Example 5.10

  • 8/2/2019 Chap 05 Network Layer

    19/104

    TCP/IP Protocol Suite 19

    Find the class of each address:a. 227.12.14.87b. 193.14.56.22c. 14.23.120.8d. 252.5.15.111Solutiona. The first byte is 227 (between 224 and 239); the class is D.b. The first byte is 193 (between 192 and 223); the class is C.c. The first byte is 14 (between 0 and 127); the class is A.d. The first byte is 252 (between 240 and 255); the class is E.

    Example 5.11

  • 8/2/2019 Chap 05 Network Layer

    20/104

    TCP/IP Protocol Suite 20

    Figure 5.8 Netid and hostid

  • 8/2/2019 Chap 05 Network Layer

    21/104

    TCP/IP Protocol Suite 21

    Figure 5.9 Blocks in Class A

    27 =

    0

  • 8/2/2019 Chap 05 Network Layer

    22/104

  • 8/2/2019 Chap 05 Network Layer

    23/104

    TCP/IP Protocol Suite 23

    Figure 5.10 Blocks in Class B

    214=

    10

  • 8/2/2019 Chap 05 Network Layer

    24/104

    TCP/IP Protocol Suite 24

    Many class B addresses are wasted.

    Note

  • 8/2/2019 Chap 05 Network Layer

    25/104

    TCP/IP Protocol Suite 25

    Figure 5.11 Blocks in Class C

    110

    221=

  • 8/2/2019 Chap 05 Network Layer

    26/104

    TCP/IP Protocol Suite 26

    Not so many organizations are so smallto have a class C block.

    Note

    Fi 5 12 Th i l bl k i Cl D

  • 8/2/2019 Chap 05 Network Layer

    27/104

    TCP/IP Protocol Suite 27

    Figure 5.12 The single block in Class D

  • 8/2/2019 Chap 05 Network Layer

    28/104

    TCP/IP Protocol Suite 28

    Class D addresses are made of oneblock, used for multicasting.

    Note

    Fi 5 13 Th i l bl k i Cl E

  • 8/2/2019 Chap 05 Network Layer

    29/104

    TCP/IP Protocol Suite 29

    Figure 5.13 The single block in Class E

  • 8/2/2019 Chap 05 Network Layer

    30/104

  • 8/2/2019 Chap 05 Network Layer

    31/104

    TCP/IP Protocol Suite 31

    The range of addresses allocated to anorganization in classful addressing

    was a block of addresses in

    Class A, B, or C.

    Note

    Fig re 5 14 T l l add ssi g i lassf l add ssi g

  • 8/2/2019 Chap 05 Network Layer

    32/104

    TCP/IP Protocol Suite 32

    Figure 5.14 Two-level addressing in classful addressing

    Figure 5 15 Information extraction in classful addressing

  • 8/2/2019 Chap 05 Network Layer

    33/104

    TCP/IP Protocol Suite 33

    Figure 5.15 Information extraction in classful addressing

    netid

    First address

    000 ... 0

    Example 5 13

  • 8/2/2019 Chap 05 Network Layer

    34/104

    TCP/IP Protocol Suite 34

    An address in a block is given as 73.22.17.25. Find the number of

    addresses in the block, the first address, and the last address.

    Solution

    73.22.17.15 belongs class B with n=8

    1. The number of addresses in this block is

    N = 232n = 232

    8 =224 = 16,777,216.2. To find the First address,

    we keep the leftmost 8 bits and

    set the rightmost 24 bits all to 0s.

    The first address is 3.0.0.0/8, in which 8 is the value ofn.

    3. To find the last address, we keep the leftmost 8 bits and

    set the rightmost 24 bits all to 1s.

    The last address is 73.255.255.255.

    Example 5.13

  • 8/2/2019 Chap 05 Network Layer

    35/104

  • 8/2/2019 Chap 05 Network Layer

    36/104

    Figure 5 17 Solution to Example 5 14

  • 8/2/2019 Chap 05 Network Layer

    37/104

    TCP/IP Protocol Suite 37

    Figure 5.17 Solution to Example 5.14

    Example 5 15

  • 8/2/2019 Chap 05 Network Layer

    38/104

    TCP/IP Protocol Suite 38

    An address in a block is given as 200.11.8.45. Find the numberof addresses in the block, the first address, and the lastaddress.SolutionFigure 5.17 shows a possible configuration of the network thatuses this block.1. The number of addresses in this block is N = 232n = 256.2. To find the first address, we keep the leftmost 24 bits and setthe rightmost 8 bits all to 0s. The first address is200.11.8.0/24, in which 24 is the value of n.3. To find the last address, we keep the leftmost 24 bits and setthe rightmost 8 bits all to 1s. The last address is200.11.8.255/24.

    Example 5.15

  • 8/2/2019 Chap 05 Network Layer

    39/104

    Figure 5 19 Sample Internet

  • 8/2/2019 Chap 05 Network Layer

    40/104

    TCP/IP Protocol Suite 40

    Figure 5.19 Sample Internet

  • 8/2/2019 Chap 05 Network Layer

    41/104

    TCP/IP Protocol Suite 41

    The network address is the identifier of anetwork.

    Note

    Figure 5.20 Network addresses

  • 8/2/2019 Chap 05 Network Layer

    42/104

    TCP/IP Protocol Suite 42

    Figure 5.20 Network addresses

    Figure 5.21 Network mask

  • 8/2/2019 Chap 05 Network Layer

    43/104

    TCP/IP Protocol Suite 43

    Figure 5.21 Network mask

  • 8/2/2019 Chap 05 Network Layer

    44/104

    TCP/IP Protocol Suite 44

    Given To find Method

    First

    Address

    and last

    address

    Number of addresses (Range) Subtract first and last address

    Convert the result into

    decimal equivalent plus 1.

    IP address

    (classful

    addressing)

    Number of addresses = 232-n

    First Address = AND operation with

    network address

    Last Address = we keep the leftmost

    mask bits and set the rightmost

    remaining all bits to 1s

    Identify the class of IP address

    Identify the netid of the IP

    address

    Identify the network

    address/mask by placing 1s for

    netid and 0s for hostid.

    Figure 5.22 Finding a network address using the default mask

  • 8/2/2019 Chap 05 Network Layer

    45/104

    TCP/IP Protocol Suite 45

    g g g f

    Example 5 16

  • 8/2/2019 Chap 05 Network Layer

    46/104

    TCP/IP Protocol Suite 46

    A router receives a packet with the destination address201.24.67.32. Show how the router finds the network address ofthe packet.SolutionSince the class of the address is B, we assume that the routerapplies the default mask for class B, 255.255.0.0 to find thenetwork address.

    Example 5.16

    Example 5.18

  • 8/2/2019 Chap 05 Network Layer

    47/104

    TCP/IP Protocol Suite 47

    Figure 5.23 shows a network using class B addresses beforesubnetting. We have just one network with almost 216 hosts.The whole network is connected, through one singleconnection, to one of the routers in the Internet. Note that wehave shown /16 to show the length of the netid (class B).

    Example 5.18

  • 8/2/2019 Chap 05 Network Layer

    48/104

    TCP/IP Protocol Suite 48

    NetworkSubnetwork

    Computer lab # 1 Computer lab # 2

    Computer lab # 4Computer lab # 3

    Example 5.19

  • 8/2/2019 Chap 05 Network Layer

    49/104

    TCP/IP Protocol Suite 49

    Figure 5.24 shows the same network in Figure 5.23 aftersubnetting. The whole network is still connected to the Internetthrough the same router. However, the network has used aprivate router to divide the network into four subnetworks. Therest of the Internet still sees only one network; internally thenetwork is made of four subnetworks. Each subnetwork cannow have almost 214 hosts. The network can belong to auniversity campus with four different schools (buildings). Aftersubnetting, each school has its own subnetworks, but still thewhole campus is one network for the rest of the Internet. Notethat /16 and /18 show the length of the netid and subnetids.

    Example 5.19

    Figure 5.24 Example 5.19

  • 8/2/2019 Chap 05 Network Layer

    50/104

    TCP/IP Protocol Suite 50

    Computer lab # 1 Computer lab # 2

    Computer lab # 3Computer lab # 4

    Figure 5.25 Network mask and subnetwork mask

  • 8/2/2019 Chap 05 Network Layer

    51/104

    TCP/IP Protocol Suite 51

    Formula to find the subnet id : nsub = n + log2s

    Where, nsub: length of each subnetidn : length of netid

    s : number of subnet (must power of 2)

    Example 5.20

  • 8/2/2019 Chap 05 Network Layer

    52/104

    TCP/IP Protocol Suite 52

    Divided a class B network into four subnetworks.SolutionFormula to find the subnet id : nsub = n + log2s

    Where, nsub: length of each subnetid

    n : length of netid

    s : number of subnet (must power of 2)

    The value of n = 16

    The value of n1 = n2 = n3 = n4 = 16 + log24 = 18.

    This means that the subnet mask has eighteen 1s and fourteen 0s.

    In other words, the subnet mask is 255.255.192.0

    Different from the network mask for class B (255.255.0.0).

    Example 5.20

    Example 5.21

  • 8/2/2019 Chap 05 Network Layer

    53/104

    TCP/IP Protocol Suite 53

    Since one of the addresses in subnet 2 is 141.14.120.77, wecan find the subnet address as:

    Example 5.21

    The values of the first, second, and fourth bytes are calculatedusing the first short cut for AND operation. The value of the thirdbyte is calculated using the second short cut for the ANDoperation.

    Figure 5.26 Comparison of subnet, default, and supernet mask

  • 8/2/2019 Chap 05 Network Layer

    54/104

    TCP/IP Protocol Suite 54

    nsub=n+log2s

    nsuper=n-log2c

  • 8/2/2019 Chap 05 Network Layer

    55/104

    TCP/IP Protocol Suite 55

    Type To find Method

    IP address

    (classful

    addressing)

    Number of addresses = 232-n

    First Address = AND operation with

    network address

    Last Address = we keep the

    leftmost mask bits and set the

    rightmost remaining all bits to 1s

    Identify the class of IP address

    Identify the netid of the IP

    address

    Identify the network

    address/mask by placing 1s for

    netid and 0s for hostid.

    Subnetting

    Classful

    Addressing

    Subnet id Network : n+log2S

    S No. of subnets required (mustbe in power of 2)

    Identify the class of IP address

    Identify the netid of the IP

    address (n)

    -Sbunetting

    -Classless

    Addressing

    Prefix of network: n+log2(N/Ni)

    N: total number of address granted

    Ni : number of address per subnet

  • 8/2/2019 Chap 05 Network Layer

    56/104

    TCP/IP Protocol Suite 56

    5-3 CLASSLESS ADDRESSING

    Subnetting and supernetting in classful addressing didnot really solve the address depletion problem. Withthe growth of the Internet, it was clear that a largeraddress space was needed as a long-term solution.Although the long-range solution has already beendevised and is called IPv6, a short-term solution wasalso devised to use the same address space but tochange the distribution of addresses to provide a fairshare to each organization. The short-term solutionstill uses IPv4 addresses, but it is called classlessaddressing.

    Topics Discussed in the Section

  • 8/2/2019 Chap 05 Network Layer

    57/104

    TCP/IP Protocol Suite 57

    Topics Discussed in the Section

    Variable Length Blocks

    Two-Level Addressing

    Block Allocation

    Subnetting

    Figure 5.27 Variable-length blocks in classless addressing

  • 8/2/2019 Chap 05 Network Layer

    58/104

    TCP/IP Protocol Suite 58

  • 8/2/2019 Chap 05 Network Layer

    59/104

    TCP/IP Protocol Suite 59

    In classless addressing, the prefixdefines the network and the suffix

    defines the host.

    Note

    Figure 5.28 Prefix and suffix

  • 8/2/2019 Chap 05 Network Layer

    60/104

    TCP/IP Protocol Suite 60

  • 8/2/2019 Chap 05 Network Layer

    61/104

    TCP/IP Protocol Suite 61

    The prefix length in classlessaddressing can be 1 to 32.

    Note

    Example 5.22

  • 8/2/2019 Chap 05 Network Layer

    62/104

    TCP/IP Protocol Suite 62

    What is the prefix length and suffix length if the whole Internet isconsidered as one single block with 4,294,967,296 addresses?SolutionIn this case, the prefix length is 0 and the suffix length is 32. All32 bits vary to define 232 = 4,294,967,296 hosts in this singleblock.

    p

    Example 5.23

  • 8/2/2019 Chap 05 Network Layer

    63/104

    TCP/IP Protocol Suite 63

    What is the prefix length and suffix length if the Internet isdivided into 4,294,967,296 blocks and each block has onesingle address?SolutionIn this case, the prefix length for each block is 32 and the suffixlength is 0. All 32 bits are needed to define 232 = 4,294,967,296blocks. The only address in each block is defined by the blockitself.

    p

    Example 5.24

  • 8/2/2019 Chap 05 Network Layer

    64/104

    TCP/IP Protocol Suite 64

    The number of addresses in a block is inversely related to thevalue of the prefix length, n. A small n means a larger block; alarge n means a small block.

    Figure 5.29 Slash notation

  • 8/2/2019 Chap 05 Network Layer

    65/104

    TCP/IP Protocol Suite 65

  • 8/2/2019 Chap 05 Network Layer

    66/104

    TCP/IP Protocol Suite 66

    In classless addressing, we need toknow one of the addresses in the blockand the prefix length to define the block.

    Note

    Example 5.25

  • 8/2/2019 Chap 05 Network Layer

    67/104

    TCP/IP Protocol Suite 67

    In classless addressing, an address cannot as such define theblock the address belongs to. For example, the address230.8.24.56 can belong to many blocks some of them areshown below with the value of the prefix associated with thatblock:

    Example 5.26

  • 8/2/2019 Chap 05 Network Layer

    68/104

    TCP/IP Protocol Suite 68

    The following addresses are defined using slash notations.a. In the address 12.23.24.78/8, the network mask is 255.0.0.0.The mask has eight 1s and twenty-four 0s. The prefix lengthis 8; the suffix length is 24.b. In the address 130.11.232.156/16, the network mask is255.255.0.0. The mask has sixteen 1s and sixteen 0s.Theprefix length is 16; the suffix length is 16.c. In the address 167.199.170.82/27, the network mask is

    255.255.255.224. The mask has twenty-seven 1s and five0s. The prefix length is 27; the suffix length is 5.

    Example 5.27

  • 8/2/2019 Chap 05 Network Layer

    69/104

    TCP/IP Protocol Suite 69

    One of the addresses in a block is 167.199.170.82/27. Find thenumber of addresses in the network, the first address, and thelast address.SolutionThe value of n is 27. The network mask has twenty-seven 1sand five 0s. It is 255.255.255.240.a. The number of addresses in the network is 232 n = 32.b. We use the AND operation to find the first address (networkaddress). The first address is 167.199.170.64/27.

    167.199.170.64/27

    255.255.255.240

    167.199.170.82

    Example 5.27 Continued

  • 8/2/2019 Chap 05 Network Layer

    70/104

    TCP/IP Protocol Suite 70

    c. To find the last address, we first find the complement of thenetwork mask and then OR it with the given address: The lastaddress is 167.199.170.95/27.

  • 8/2/2019 Chap 05 Network Layer

    71/104

    Example 5.28 Continued

  • 8/2/2019 Chap 05 Network Layer

    72/104

    TCP/IP Protocol Suite 72

    c. To find the last address, we use the complement of thenetwork mask and the first short cut method wediscussed before. The last address is 17.63.110.255/24.

    Example 5.29

  • 8/2/2019 Chap 05 Network Layer

    73/104

    TCP/IP Protocol Suite 73

    One of the addresses in a block is 110.23.120.14/20. Find thenumber of addresses, the first address, and the last address inthe block.SolutionThe network mask is 255.255.240.0.a. The number of addresses in the network is 232 20 = 4096.b. To find the first address, we apply the first short cut tobytes 1, 2, and 4 and the second short cut to byte 3. Thefirst address is 110.23.112.0/20.

    Example 5.29 Continued

  • 8/2/2019 Chap 05 Network Layer

    74/104

    TCP/IP Protocol Suite 74

    c. To find the last address, we apply the first short cut tobytes 1, 2, and 4 and the second short cut to byte 3. TheOR operation is applied to the complement of the mask.The last address is 110.23.127.255/20.

    Example 5.30

  • 8/2/2019 Chap 05 Network Layer

    75/104

    TCP/IP Protocol Suite 75

    An ISP has requested a block of 1000 addresses. The followingblock is granted.a. Since 1000 is not a power of 2, 1024 addresses aregranted (1024 = 210).b. The prefix length for the block is calculated as n = 32

    log21024 = 22.c. The beginning address is chosen as 18.14.12.0 (which isdivisible by 1024).The granted block is 18.14.12.0/22. The first address is18.14.12.0/22 and the last address is 18.14.15.255/22.

    First address 18.14.12.0/22 18.14.00001100.00000000

    Last Address 18.14.15.255/22 18.14.00001111.11111111

  • 8/2/2019 Chap 05 Network Layer

    76/104

    TCP/IP Protocol Suite 76

    Example 5.31

  • 8/2/2019 Chap 05 Network Layer

    77/104

    TCP/IP Protocol Suite 77

    Assume an organization has given a class A block as 73.0.0.0in the past. If the block is not revoked by the authority, theclassless architecture assumes that the organization has ablock 73.0.0.0/8 in classless addressing.

  • 8/2/2019 Chap 05 Network Layer

    78/104

    TCP/IP Protocol Suite 78

    The restrictions applied in allocatingaddresses for a subnetwork are

    parallel to the ones used to allocateaddresses for a network.

    Note

    Example 5.32

  • 8/2/2019 Chap 05 Network Layer

    79/104

    TCP/IP Protocol Suite 79

    An organization is granted the block 130.34.12.64/26. Theorganization needs four subnetworks, each with an equalnumber of hosts. Design the subnetworks and find theinformation about each network.SolutionThe number of addresses for the whole network can be foundas N = 232 26 = 64.The first address in the network is 130.34.12.64/26 and the lastaddress is 130.34.12.127/26. We now design the subnetworks:1. We grant 16 addresses for each subnetwork to meet thefirst requirement (64/16 is a power of 2).2. The subnetwork mask for each subnetwork is:

    N: total number of address granted

    Ni : number of address per subnet

    Example 5.32 Continued

  • 8/2/2019 Chap 05 Network Layer

    80/104

    TCP/IP Protocol Suite 80

    3. We grant 16 addresses to each subnet starting from thefirst available address. Figure 5.30 shows the subblock foreach subnet. Note that the starting address in eachsubnetwork is divisible by the number of addresses inthat subnetwork.

    Figure 5.30 Solution to Example 5.32

  • 8/2/2019 Chap 05 Network Layer

    81/104

    TCP/IP Protocol Suite 81

    Example 5.33

  • 8/2/2019 Chap 05 Network Layer

    82/104

    TCP/IP Protocol Suite 82

    An organization is granted a block of addresses with thebeginning address 14.24.74.0/24. The organization needs tohave 3 subblocks of addresses to use in its three subnets asshown below: One subblock of 120 addresses. One subblock of 60 addresses. One subblock of 10 addresses.SolutionThere are 232 24 = 256 addresses in this block. The firstaddress is 14.24.74.0/24; the last address is 14.24.74.255/24.a. The number of addresses in the first subblock is not a

    power of 2. We allocate 128 addresses. The subnetmask is 25. The first address is 14.24.74.0/25; the lastaddress is 14.24.74.127/25.

    Example 5.33 Continued

  • 8/2/2019 Chap 05 Network Layer

    83/104

    TCP/IP Protocol Suite 83

    b. The number of addresses in the second subblock is not apower of 2 either. We allocate 64 addresses. The subnetmask is 26. The first address in this block is14.24.74.128/26; the last address is 14.24.74.191/26.c. The number of addresses in the third subblock is not apower of 2 either. We allocate 16 addresses. The subnetmask is 28. The first address in this block is14.24.74.192/28; the last address is 14.24.74.207/28.d. If we add all addresses in the previous subblocks, theresult is 208 addresses, which means 48 addresses are leftin reserve. The first address in this range is 14.24.74.209.The last address is 14.24.74.255.e. Figure 5.31 shows the configuration of blocks. We haveshown the first address in each block.

    Figure 5.31 Solution to Example 5.33

  • 8/2/2019 Chap 05 Network Layer

    84/104

    TCP/IP Protocol Suite 84

    Example 5.34

  • 8/2/2019 Chap 05 Network Layer

    85/104

    TCP/IP Protocol Suite 85

    Assume a company has three offices: Central, East, and West.The Central office is connected to the East and West offices viaprivate, WAN lines. The company is granted a block of 64addresses with the beginning address 70.12.100.128/26. Themanagement has decided to allocate 32 addresses for theCentral office and divides the rest of addresses between the twoother offices.1. The number of addresses are assigned as follows:

    2. We can find the prefix length for each subnetwork:

    Example 5.34 Continued

  • 8/2/2019 Chap 05 Network Layer

    86/104

    TCP/IP Protocol Suite 86

    3. Figure 5.32 shows the configuration designed by themanagement. The Central office uses addresses70.12.100.128/27 to 70.12.100.159/27. The company has usedthree of these addresses for the routers and has reserved thelast address in the subblock. The East officeuses the addresses 70.12.100.160/28 to 70.12.100.175/28. Oneof these addresses is used for the router and the company hasreserved the last address in the subblock. The West office usesthe addresses 70.12.100.160/28 to 70.12.100.175/28. One ofthese addresses is used for the router and the company hasreserved the last address in the subblock. The company usesno address for the point-to-point connections in WANs.

    Figure 5.32 Example 5.34

  • 8/2/2019 Chap 05 Network Layer

    87/104

    TCP/IP Protocol Suite 87

  • 8/2/2019 Chap 05 Network Layer

    88/104

    Example 5.35 Continued

  • 8/2/2019 Chap 05 Network Layer

    89/104

    TCP/IP Protocol Suite 89

    SolutionLet us solve the problem in two steps. In the first step, weallocate a subblock of addresses to each group. The totalnumber of addresses allocated to each group and the prefixlength for each subblock can found as

    Figure 5.33 shows the design for the first hierarchical level.Figure 5.34 shows the second level of the hierarchy. Note thatwe have used the first address for each customer as the subnetaddress and have reserved the last address as a specialaddress.

    Figure 5.33 Solution to Example 5.35: first step

  • 8/2/2019 Chap 05 Network Layer

    90/104

    TCP/IP Protocol Suite 90

    Figure 5.34 Solution to Example 5.35: second step

  • 8/2/2019 Chap 05 Network Layer

    91/104

    TCP/IP Protocol Suite 91

    5-4 SPECIAL ADDRESSES

  • 8/2/2019 Chap 05 Network Layer

    92/104

    TCP/IP Protocol Suite 92

    5 4 SPECIAL ADDRESSES

    In classful addressing some addresses werereserved for special purposes. The classlessaddressing scheme inherits some of these specialaddresses from classful addressing.

  • 8/2/2019 Chap 05 Network Layer

    93/104

    Figure 5.35 Example of using the all-zero address

  • 8/2/2019 Chap 05 Network Layer

    94/104

    TCP/IP Protocol Suite 94

    Source: 0.0.0.0Destination: 255.255.255.255

    Packet

    Figure 5.36 Example of limited broadcast address

  • 8/2/2019 Chap 05 Network Layer

    95/104

    TCP/IP Protocol Suite 95

    221.45.71.20/24 221.45.71.178/24

    221.45.71.64/24 221.45.71.126/24

    Network

    Figure 5.37 Example of loopback address

  • 8/2/2019 Chap 05 Network Layer

    96/104

    TCP/IP Protocol Suite 96

    Transport layer

    Application layer

    Network layer

    Process 1 Process 2

    Destination address:127.x.y.z

    Packet

  • 8/2/2019 Chap 05 Network Layer

    97/104

    TCP/IP Protocol Suite 97

    Figure 5.38 Example of a directed broadcast address

  • 8/2/2019 Chap 05 Network Layer

    98/104

    TCP/IP Protocol Suite 98

    221.45.71.0/24

    221.45.71.20/24 221.45.71.178/24

    221.45.71.64/24 221.45.71.126/24

    Network:

    Packet

    5-5 NAT

  • 8/2/2019 Chap 05 Network Layer

    99/104

    TCP/IP Protocol Suite 99

    5 5 NAT

    The distribution of addresses through ISPs hascreated a new problem. If the business grows or thehousehold needs a larger range, the ISP may not beable to grant the demand because the addressesbefore and after the range may have already beenallocated to other networks. In most situations,however, only a portion of computers in a smallnetwork need access to the Internet simultaneously.A technology that can help in this cases is networkaddress translation (NAT).

    Topics Discussed in the Section

  • 8/2/2019 Chap 05 Network Layer

    100/104

    TCP/IP Protocol Suite 100

    Address Translation

    Translation Table

    Figure 5.39 NAT

  • 8/2/2019 Chap 05 Network Layer

    101/104

    TCP/IP Protocol Suite 101

    Figure 5.40 Address resolution

  • 8/2/2019 Chap 05 Network Layer

    102/104

    TCP/IP Protocol Suite 102

    Internet

    Site using private addresses

    172.18.3.1

    172.18.3.2

    172.18.3.20

    Source: 172.18.3.1 Source: 200.24.5.8

    Destination: 200.24.5.8Destination: 172.18.3.1

    Figure 5.41 Translation

  • 8/2/2019 Chap 05 Network Layer

    103/104

    TCP/IP Protocol Suite 103

  • 8/2/2019 Chap 05 Network Layer

    104/104