Docsity

Ip addressing esercizi, Esercizi di Reti Di Calcolatori

Anteprima parziale del testo

Scarica Ip addressing esercizi e più Esercizi in PDF di Reti Di Calcolatori solo su Docsity!

Politecnico di Torino

Exercises on IP Addressing

Fulvio Risso

March 1, 2013

Contents

License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Un-

ported License.

You are free:

  • to Share: to copy, distribute and transmit the work
  • to Remix: to adapt the work

Under the following conditions:

  • Attribution: you must attribute the work in the manner specified by the author or licensor

(but not in any way that suggests that they endorse you or your use of the work).

  • Noncommercial: you may not use this work for commercial purposes.
  • Share Alike: if you alter, transform, or build upon this work, you may distribute the resulting

work only under the same or similar license to this one.

More information on the Creative Commons website (http://creativecommons.org).

Acknowledgments

The author would like to thank all the persons that contributed to those exercises. Particularly, special

thanks go to Flavio Marinone, Guido Marchetto, Santo Vario, Dario Orfeo and Jon Brenas.

Part I.

Methodology

1.0.1. Identification of the existing IP networks

The list of the IP networks in the above network includes the two local area networks (LAN1, LAN2)

and the point-to-point connection between the two routers (please do not forget that two IP routers

are always connected through an IP network).

1.0.2. Number of allocated/needed addresses

Each IP network needs a number of addresses equal to the number of end systems (thus 40 for LAN

and 100 for LAN2), plus those needed for the correct behavior of IP, i.e., the two reserved addresses

named this net (or network ) and directed broadcast. Those reserved addresses correspond respectively

to the first and the last address of the address space that will be assigned to this LIN. Further more,

each LAN includes also an interface of a router, which brings the number of needed IP addresses to

43, 103 and 4, respectively for the networks LIN1, LIN2 and LIN3.

With respect to the addresses that we need to allocate to each network, each IP address can be

split in a network part and an host part, whose size is given by the netmask (or the prefix length).

As a consequence, an IP network cannot have an arbitrary size but must have a value equal to 2n,

e.g., 2, 4, 8, etc. The minimum size of an IP network will thus be equal to the number of needed

addresses, computed at the previous step, rounded to the value of 2n^ immediately equal or greater.

As a consequence, we need 64 addresses for LAN1, 128 for LAN2 and 4 for the point-to-point link.

In the real life, the number of allocated addresses is also chosen by considering the foreseen future

expansions of the various networks. For example, it would not be so clever to allocate 16 addresses

to a network that already needs 15 address, because future expansions would be problematic as no

other addresses will be available for the future hosts. On the other hand, however, in our example we

allocate 4 addresses for the point-to-point link: this does not cause any problem because the number

of hosts on this type of link would never grow because of the point-to-point nature of the connection.

It is worthy nothing that this steps gives immediately the netmask of each LIN. In fact, given the

number of needed IP addresses, we can determine the size of the address block that has to be allocated

to each LIN in term of netmask/prefix length. Particularly, prefix lengths /26, /25, /30 (respectively

for the network LIN1, LIN2 and LIN3) will be used in the example, corresponding to the netmasks

255.255.255.192, 255.255.255.252 and 255.255.255.128.

The number of needed/allocated IP addresses is shown in the figure below.

R1 R

1. Identification of the existing IP networks

Network IP 1 Network IP 2 Network IP 3 LAN 1, 40 end-systems LAN 2, 100 end-systems R1 R

2. Number of IP addresses needed / allocated

Addresses: 43 (64) (^) Indirizzi: 103 (128) Addresses: 4 (4) Netmask: 255.255.255. Prefix length: / Netmask: 255.255.255. Prefix length: / Netmask: 255.255.255. Prefix length: /

1.0.3. Validity of the address block

This points consists in determining of the number of IP addresses needed to handle the entire topology

of the network.

In the best case we need just to sum all the addresses allocated in the previous point (in this case,

64 + 128 + 4 = 196 addresses) and ask to the network administrator (or, in general, the responsible

of the IP address allocation in the organization) an address range whose size is at least equal to the

number of IP addresses we need.

However, in most cases the process is done in the opposite way. Giving a predetermined address

range (in our case, the address range 10.0.0.0/24), the network administrator has to verify if this is

enough for its network; if not, it has to take some actions in order to reduce the consumption of IP

addresses, e.g., by trying to reduce the allocated (but not used) addresses.

This second case is banal if the dimension of the address range allocated initially is greater or equal

to the address range that we need in our network. In this case, one can directly go to the next step.

Vice-versa, in the case in which the assigned address range is not big enough to manage the entire

network, we need to partitioning the existing IP networks in order to save addresses. This can be

done by observing that some networks could have a (large) number of allocated addresses, but only a

portion of those are used.

For example, the LAN1 (40 hosts) needs 43 addresses to handle its hosts but we need to allocate 64

because of the “predefined” size of the IP network. It follows that 21 addresses are currently unused.

In this case, we could configure this network of 40 hosts as a set of two IP networks: the first including

32 addresses (29 hosts plus a router) followed by a second with 16 addresses (the remaining 11 hosts

and one additional address for the default gateway, plus 4 additional unused addresses). This would

result in the allocation of 48 addresses, with a saving of 16 addresses (48 allocated addresses compared

to 64).

It is worthy noticing that in this case the number of addresses actually used increase compared with

the original solution. In fact, while in the first case 43 addresses would have been used (40 hosts +

to hosts outside that link layer network, appear not to be reachable because they are not physically

present on that LAN. Finally, note that a host cannot know how many addresses are actually assigned

to other devices on its LIN: its knowledge is limited to its network address and to the netmask and

thus it would consider all addresses in that range as directly reachable.

Using the table reported in next page, it possible to “color” the address range already used: this

way, it would be possible to see, from the picture, which ranges are already used, i.e., the ranges that

cannot be used by other networks.

The solution of points (3) and (4) is reported in the figure below.

LAN 1, 40 end-systems (^) LAN 2, 100 end-systems R1 R

Addressing space needed: 196 indirizzi
Available address range: 10.0.0.0/24  OK
3. Check the validity of the addressing block

Addresses: 43 (64) (^) Addresses: 103 (128) Addresses: 4 (4) R1 R

4. Network addresses

10.0.0.128/26 10.0.0.0/ 10.0.0.192/

Contiguous address space

We suggest to complete the assignment of the address spaces to the LIN by starting from the largest

IP network. In this way, the addresses assigned to all the LIS will result in a set of contiguous IP

address ranges. This is due to the fact that the last address of a block with prefix length /N is always

followed by an address space with prefix length /(N+1), which can be clearly seen in the address range

table. The assignment of the addresses with a diverse order often leads to the creation of “holes” in

the allocated address space. Apart from looking a little chaotic, the problem is that this “random”

assignment could lead to a waste of addresses, and in some cases to the impossibility to manage the

network.

For example, let us assume that in our network we has assigned the addresses spaces as follows:

  • LAN 1: 10.0.0.0/26 (addresses at the beginning of the block /24)
  • point-to-point network: 10.0.0.252/30 (addresses at the end of the block /24)

In this case we would be in the impossibility to handle the LAN2, because all the possible address

spaces (10.0.0.0/25 and 10.0.0.128/25) would be overlapped with another IP network.

This is the reason why we always suggest to assign address spaces from the largest to the smallest.

Number of addresses available

if ‘ 1 ’ bits in the last byte of the netmask

Last byte of the netmask (dec/hex) Last byte of the netmask (bin) 256 addrs. 0 bits (/24) 0 (0x00) 00000000 128 addrs. 1 bits (/25) 128 (0x80) 10000000 64 addrs. 2 bits (/26) 192 (0xC0) 11000000 32 addrs. 3 bits (/27) 224 (0xE0) 11100000 16 addrs. 4 bits (/28) 240 (0xF0) 11110000 8 addrs. 5 bits (/29) 248 (0xF8) 11111000 4 addrs. 6 bits (/30) 252 (0xFC) 11111100 Ranges of valid addresses. 0 -. 255. 0 -. 127. 0 -. 63. 0 -. 31. 0 -. 15. 0 -. 7. 0 -. 3

. 4 -. 7 . 8 -. 15. 8 -. 11 . 12 -. 15 . 16 -. 31. 16 -. 23. 16 -. 19 . 20 -. 23 . 24 -. 31. 24 -. 27 . 28 -. 31 . 32 -. 63. 32 -. 47. 32 -. 39. 32 -. 35 . 36 -. 39 . 40 -. 47. 40 -. 43 . 44 -. 47 . 48 -. 63. 48 -. 55. 48 -. 51 . 52 -. 55 . 56 -. 63. 56 -. 59 . 60 -. 63 . 64 -. 127. 64 -. 95. 64 -. 79. 64 -. 71. 64 -. 67 . 68 -. 71 . 72 -. 79. 72 -. 75 . 76 -. 79 . 80 -. 95. 80 -. 87. 80 -. 83 . 84 -. 87 . 88 -. 95. 88 -. 91 . 92 -. 95 . 96 -. 127. 96 -. 111. 96 -. 103. 96 -. 99 . 100 -. 103 . 104 -. 111. 104 -. 107 . 108 -. 111 . 112 -. 127. 112 -. 119. 112 -. 115 . 116 -. 119 . 120 -. 127. 120 -. 123 . 124 -. 127 . 128 -. 255. 128 -. 191. 128 -. 159. 128 -. 143. 128 -. 135. 128 -. 131 . 132 -. 135 . 136 -. 143. 136 -. 139 . 140 -. 143 . 144 -. 159. 144 -. 151. 144 -. 147 . 148 -. 151 . 152 -. 159. 152 -. 155 . 156 -. 159 . 160 -. 191. 160 -. 175. 160 -. 167. 160 -. 163 . 164 -. 167 . 168 -. 175. 168 -. 171 . 172 -. 175 . 176 -. 191. 176 -. 183. 176 -. 179 . 180 -. 183 . 184 -. 191. 184 -. 187 . 188 -. 191 . 192 -. 255. 192 -. 223. 192 -. 207. 192 -. 199. 192 -. 195 . 196 -. 199 . 200 -. 207. 200 -. 203 . 204 -. 207 . 208 -. 223. 208 -. 215. 208 -. 211 . 212 -. 215 . 216 -. 223. 216 -. 219 . 220 -. 223 . 224 -. 255. 224 -. 239. 224 -. 231. 224 -. 227 . 228 -. 231 . 232 -. 239. 232 -. 235 . 236 -. 239 . 240 -. 255. 240 -. 247. 240 -. 239 . 244 -. 247 . 248 -. 255. 248 -. 251 . 252 -. 255 Valid address with prefix length between /24 and /30.

Part II.

Exercises

  1. Classful addressing 2.1. Exercise 1

Assuming a classful addressing, determine if the following addresses are network or host addresses.

Furthermore, determine also the class they belong to.

Address Is it a network address? Class (A/B/C)

3.3. Exercise 4

Define a classful addressing plan for the network depicted in the figure below. The chosen address

ranges should belong to the private addressing space; use the first addresses available in classes A, B

or C according to the size of each logical IP network.

205 hosts
60 hosts
61 hosts 4 hosts 12 hosts
300 hosts
R
R1 R
R
R
R
  1. Classless addressing 4.1. Exercise 5

Assuming a classless addressing, define the netmask and the prefix length that should be assigned to

hypothetic networks composed by the given number of hosts.

Number of hosts Netmask Prefix length Number of available IP addresses

4.2. Exercise 6

Assuming a classless addressing plan, define the address ranges (in the form “network address/prefix

length”) that can be used to handle a set of IP networks that include the number of hosts shown in the

table below. The address spaces assigned to the networks should be assigned in order, one immediately

following the other, within the address range 192.168.0.0/16. Determine also the broadcast address

for each network.

Number of hosts
Network
address /
prefix length
Broadcast address

Determine which networks can be used in private addressing, which ones can be used in public ad-

dressing, which ones are reserved for other purposes. For the last category, write why they are neither

private nor public addresses.

  • I. Methodology
    1. Classless addressing plans
      • 1.0.1. Identification of the existing IP networks
      • 1.0.2. Number of allocated/needed addresses
      • 1.0.3. Validity of the address block
      • 1.0.4. Network address
      • 1.0.5. Hosts and routers address
      • 1.0.6. Some hints for calculating IP addresses
    • 1.1. Acknowledgments
  • II. Exercises
    1. Classful addressing
    • 2.1. Exercise
    1. Classful addressing plans
    • 3.1. Exercise
    • 3.2. Exercise
    • 3.3. Exercise
    1. Classless addressing
    • 4.1. Exercise
    • 4.2. Exercise
    • 4.3. Exercise
    • 4.4. Exercise
    • 4.5. Exercise
    1. Classless addressing plans
    • 5.1. Exercise
    • 5.2. Exercise
    • 5.3. Exercise
    • 5.4. Exercise
    • 5.5. Exercise
    • 5.6. Exercise
    1. Troubleshooting
    • 6.1. Exercise
    • 6.2. Exercise
    • 6.3. Exercise
    • 6.4. Exercise
    • 6.5. Exercise
    • 6.6. Exercise
  • III. Solutions
    1. Classful addressing
    • 7.1. Solution of exercise
    1. Classful addressing plans
    • 8.1. Solution of exercise
    • 8.2. Solution of exercise
    • 8.3. Solution of exercise
    1. Classless addressing
    • 9.1. Solution of exercise
    • 9.2. Solution of exercise
    • 9.3. Solution of exercise
    • 9.4. Solution of exercise
    • 9.5. Solution of exercise
  • 10.Classless addressing plans
    • 10.1. Solution of exercise
      • 10.1.1. Address range /22
      • 10.1.2. Address range /23
    • 10.2. Solution of exercise
    • 10.3. Solution of exercise
      • 10.3.1. Address range /21
      • 10.3.2. Address range /22
    • 10.4. Solution of exercise
    • 10.5. Solution of exercise
    • 10.6. Solution of exercise
  • 11.Troubleshooting
    • 11.1. Solution of exercise
    • 11.2. Solution of exercise
    • 11.3. Solution of exercise
    • 11.4. Solution of exercise
    • 11.5. Solution of exercise
    • 11.6. Solution of exercise
  • 4.5. Exercise - 1.1.1.0. Network address / Prefix length Is it public? Is it private? What is it then? - 8.8.8.24/ - 10.10.10.0/ - 10.8.8.0/ - 20.2.2.0/ - 70.2.3.0/ - 127.0.0.0/ - 127.1.1.0/ - 130.192.0.0/ - 172.9.0.0// - 172.31.0.0/ - 172.32.0.0/ - 180.12.4.0/ - 192.168.12.0/ - 192.168.16.0/ - 192.169.0.0/
    • 200.200.200.0/ - 220.10.20.0/ - 224.0.0.0/ - 230.2.3.64/ - 241.0.0.0/ - 248.2.3.0/
  1. Classless addressing plans 5.1. Exercise 10

Define a classless addressing plan for the network in the figure below, using first the address range

192.168.0.0/22, and then the address range 192.168.4.0/23. The address ranges assigned to the LIN

should form a contiguous space; consider also that no expansions (in terms of the number of hosts)

are required in the future.

300 hosts 120 hosts
R1 R