Vous êtes sur la page 1sur 15

UNIVERSIDAD TECNOLOGICA NACIONAL

REGIONAL SANTA FE

CARRERA INGENIERIA EN SISTEMA DE INFORMACION

CATEDRA REDES DE INFOMACIN AO 2009

Unidad II Tema 4 La Familia de Protocolos TCP/IP Direccionamiento IP: Subredes

Ctedra Redes de Informacin

ISI - FRSF - UTN

Fuente: Network Analysis, Architecture, and Design. 3rd Ed. James D. McCabe. Morgan Kaufmann Publishers. 2007.

Addressing Mechanisms
In this section we discuss some of the popular mechanisms for addressing networks: classful addressing, subnetting, and variable-length subnetting. Although these mechanisms all basically share the same theme (manipulating address space), we treat them as separate in order to highlight their differences. It should be noted that the concept of classful addressing is a bit outdated. We discuss it here in order to give some background on newer mechanisms and to provide insight into the addressing process.

1. Classful Addressing
Classful addressing is applying predetermined mask lengths to addresses in order to support a range of network sizes. The result is a set of classes of addresses (A, B, C, D, and E), each of which supports a different maximum network size. A class identifier at the beginning (first octet) of the address determines its class. A Class A address is indicated when the first bit of the first octet is 0 (network addresses 1 through 127), a Class B address is when the first bit is 1 and the second bit is 0 (network addresses 128 through 191), and a Class C address is when the first bit is 1, the second bit is 1, and the third bit is 0 (network addresses 192 through 223). The structures of Classes A, B, and C are shown in Figure 1. Classes D and E are not shown here, as they are used for special purposes (Class D is used for multicast) or reserved. Classful addresses default to a natural mask which coincides with the class boundary and reflects that classs network and host space allocations. The natural mask is different for each class. For Class A addresses the natural mask is 255.0.0.0, indicating that the bits in the first octet represent the network for that class. Since the first bit of the first octet is used to indicate a Class A address, and neither all 0s nor all 1s can be used as network addresses (they represent broadcasts), there can be 272 or 126 possible networks. The device (host) portion of the mask is the remaining three octets, so there can be up to 2242 or over 16 million possible device addresses per network for Class A networks. So, Class A provides for a few very large networks. The natural mask for Class B addresses is 255.255.0.0, so the first two octets represent the network for that class. Since the first two bits are used to identify the class, there can be 2142 or 16,382 possible networks. The device portion of the mask is the remaining two octets, so there can be up to 2162 or 65,534 possible device addresses
Ao 2009 Pgina 1 de 13

Ctedra Redes de Informacin

ISI - FRSF - UTN

per network. So, Class B provides for tens of thousands of (still quite large) networks. At one time this seemed like a lot of networksbut not anymore.

FIGURE 1. Classful Addressing Uses Traditional Class Boundaries to Form Class A, B, or C Addresses

The natural mask for Class C addresses is 255.255.255.0, so the first three octets represent the network for that class. Since the first three bits are used to identify the class, there can be 2212 or slightly over 2 million possible networks. The device portion of the mask is the remaining octet, so there can be up to 282 or 254 possible device addresses per network. So, Class C provides for millions of small networks. There are two additional classes of address space (Classes D and E) that are used or reserved for special purposes. Class D is used for multicast addresses, and Class E is reserved. Class D address spaces are calculated in the same way as the other classes, so Class D is indicated when the first, second, and third bits of the first octet are 1, and the fourth bit is 0 (network addresses 224 through 239). Classful addressing was the first step to add hierarchy to addressing. Although the three classes can address from very small to very large networks, there are some Addressing Mechanisms fundamental problems with this scheme. First, Class A and B networks can address large numbers of devices. As it turns out, networks do not scale well to the size of a Class A or B, and further hierarchy is needed. And, as Class A and B address space ran out, the use of Class C address space impacted routing in the Internet. Clearly, something more than classful addressing was needed.

Example 1. Determining Class and Natural Mask. For the network address 136.178.10.1, lets determine its class and natural mask. The binary representation of 136.178.10.1:

Ao 2009

Pgina 2 de 13

Ctedra Redes de Informacin

ISI - FRSF - UTN

Looking at the first three bits (from left to right) of the first octet, we see that they are 100. Since the first bit must be 0 for a Class A address, 136.178.10.1 is not Class A. The first two bits are 10, which are consistent with Class B; therefore 136.178.10.1 is a Class B address. The natural mask for this address is the natural mask for Class B, 255.255.0.0.

There are limitations in allocating addresses based on Class A, B, and C boundaries. First, since there are relatively few Class A and B addresses, they have already been allocated. This leaves new networks with only Class C address space. Thus, a network may require many Class C addresses. Second, these class boundaries are not an efficient use of network addresses. Many networks require more addresses than a single Class C can provide, yet are not large enough to justify a Class A or B, even if such network addresses were available. There are networks that have Class A or B addresses but can only use a small fraction of the total address space. There needed to be a more flexible method to match address space to the requirements of each network. This was accomplished by expanding the network mask to create subnets and variable-length subnets, as described next.

2. Subnetting
The next step in adding hierarchy to addressing is to allow a classful network address to be segmented into smaller sections. Subnetting (RFC 950) accomplishes this. Subnetting is using part of the device (host) address space to create another level of hierarchy. Changing the address mask increases the number of bits allocated to the network, creating the subnet. The resultant mask now includes a subnet mask, and the network segments that are created are termed subnets. What is essentially happening in subnetting is that, by changing the address mask to increase the number of bits allocated to the network and thereby decreasing the number of bits allocated to devices, subnetting takes address space away from devices and gives it to the network. Subnetting can be done on Class A, B, or C networks, although it is rare to subnet a Class C network (since there are only 254 addresses for devices anyway). The result of subnetting is a set of equal-sized subnets, where the length of the subnet mask determines the number of subnets and the size of each subnet. An example of this for Class B networks is shown in Figure 2. Subnetting adds hierarchy to a network. A network in which all devices are addressed with the same network address can have problems scaling to a large number of devices. The term large is relative: some networks have problems with a few dozen devices,

Ao 2009

Pgina 3 de 13

Ctedra Redes de Informacin

ISI - FRSF - UTN

while others can scale to hundreds of devices without problems. The problems are usually related to traffic loads and behavior at the link and physical layers. The behaviors of users, applications, and devices are reflected in the traffic flows on the network, and the characteristics of these flows (including their sources and sinks) impact the scalability of the network. How network devices are configured at the link layer affects how they communicate at that layer. Problems at the link layer, such as jabbering devices or broadcast/multicast storms, impact scalability of the network. Subnetting helps to reduce the problem by segmenting the network into subnets connected by routers. Routers terminate the link and physical layers, thus stopping problems in one subnet from impacting other subnets. Subnet masks (and therefore subnets) are recognized only within that network.

FIGURE 2. Masks and Sizes for Subnetting a Class B Network

When routes to that network are advertised, the natural mask is used. This is desirable; since subnetting is used to provide hierarchy within that network, there is no need to reveal that hierarchy outside of the network.

Example 2. Creating Subnets. Lets subnet 129.99.0.0 into seven subnets. 129.99.0.0 is a Class B (how do we know this?) address with a natural mask of 255.255.0.0. To create subnets, we increase the

Ao 2009

Pgina 4 de 13

Ctedra Redes de Informacin

ISI - FRSF - UTN

mask into the third octet by enough bits to get seven subnets. From Figure 2, we see that three bits will give us seven subnets, using an extended mask (subnet mask) of 255.255.224.0, as shown below.

Each subnet is shown below in binary and dotted-decimal forms.

3. Variable-Length Subnetting
Subnetting segments of a network into a number of equal-sized subnets is often inefficient. If a goal of subnetting is to create subnets that are scaled to the sizes of groups (workgroups) in the organization, so that a subnet can be allocated to each group, then it is desirable to have subnets of different sizes. Variable-length subnetting is subnetting where multiple variable-length subnet masks (VLSM) are used, creating subnets of different sizes. This practice allows for a better mapping of subnets to workgroups. For example, the following organization has a number of workgroups of varying sizes.

This organization has a Class B address (136.178.0.0, mask 255.255.0.0) and would like to give one subnet to each group. If we were to use only the natural mask, this network would support 65,534 devices, which is far more than needed. However, it is likely that the network would have problems scaling to that size. We cannot implement subnets of

Ao 2009

Pgina 5 de 13

Ctedra Redes de Informacin

ISI - FRSF - UTN

equal size, given the requirement of one subnet per group. In order to support the largest group (Marketing, with 1950 devices), we would need a 5-bit or smaller subnet mask. But this would give a maximum of 31 possible subnets (with a 5-bit mask). In order to have enough subnets, we would need a 6-bit or larger subnet mask, but then the size of the subnet would not be large enough for Marketing. By using variablelength subnetting, we can tailor the subnets to the sizes of the groups and the quantity of subnets we need. For this example we choose to use a combination of 4-bit and 8-bit subnet masks. With a 4-bit mask (255.255.240.0), we would have 15 subnets, each with a maximum of 4096 devices. This would be sufficient for Engineering and Marketing. The 8-bit subnet mask (255.255.255.0) provides subnets that can have a maximum of 254 devices each, sufficient for each of the groups Sales, R&D, and Support. The subnet allocations are as follows: The 4-bit mask (255.255.240.0) is used to allocate the following 15 subnets:

Not all of these subnets would be used at this time. We would allocate three subnets to Engineering (136.178.16.0, 136.178.32.0, and 136.178.48.0), one subnet to Marketing (136.178.64.0), and we probably should allocate one to Administration (136.178.80.0), as it would be close to the maximum number of devices for an 8-bit subnet. For the 8-bit mask, we would take one of the 4-bit subnets and apply the 8-bit mask to it. We could take the next 4-bit subnet available (136.178.96.0) and apply an 8-bit mask (255.255.255.0), yielding the following 8-bit subnets:

These are all the 8-bit subnets between 136.178.96.0 and 136.178.112.0. Each can support up to 254 devices. We would allocate 15 of these subnets (136.178.97.0 through 136.178.110.0) to Sales, and the last one (136.178.111.0) to R&D. At this point we need to create more 8-bit subnets (22 subnets for Support), so we would repeat this procedure for the next two available 4-bit subnets (136.178.112.0 and 136.178.128.0). For 136.178.112.0:

Ao 2009

Pgina 6 de 13

Ctedra Redes de Informacin

ISI - FRSF - UTN

and for 136.178.128.0:

The 22 subnets for Support would be 136.178.113.0 through 136.178.127.0, and 136.178.129.0 through 136.178.129.0. The remaining 4-bit and 8-bit subnets would be available for future growth.

Ao 2009

Pgina 7 de 13

Ctedra Redes de Informacin

ISI - FRSF - UTN

Fuente: TCP/IP - Architecture, Protocols, and Implementation with IPv6 and IP Security. 3rd Ed. Sidnie Feit. McGraw Hill. 1999.

Variable-Length Subnet Masks


1. Introduction
The Internet address format has caused many problems for network administrators. The 32-bit address space is just too small and cramped. Computers work with these addresses using bit boundaries. A computer is happy to accept network, subnet, and host addresses that use any convenient bit boundaries. Humans are not very comfortable with batches of bits. To add to the confusion, we write addresses by translating bytes to decimal numbersfor example, 130.15.1.2. When our subnet boundaries do not fall on byte boundaries, we need to engage in some mental arithmetic to extract the subnet and host parts of an address. It can be difficult to choose a single subnet mask for an organization. Many enterprise networks are made up of a mixture of communications facilitieslong distance lines or frame relay circuits, large headquarters LANs, and small branch office LANs. Fortunately, today you can assign addresses efficiently by using variable-length subnet masks. In other words, use several mask sizes, tailored to fit your subnetworks. The only reason that this was not done in the past was that subnet mask information was not passed between routers by the old routing protocols. Today's routing tables include a subnet mask for each destination, and so we now can match the size of the host and subnet fields to the real requirements of our network topology. It is the purpose of this appendix to make it easier for you to work with subnet masks that are not aligned on byte boundaries and to demonstrate how a site can use several different subnet sizes. The ability to use variable-length subnet masks is important for sites that have small, medium, and large LANs. We look at several examples in which we define subnets of the class B net work 130.15. Table C-1 at the end of this chapter displays a list of class B subnet sizes. Table C-2 presents Class C subnet sizes. The official rules of IP say that you should not use an all-0 subnet field, but real implementations use them every day. We use an all-0s subnet in some of the examples that follow. An all-1s subnet field is more problematic, and we do not use it.

2. A Variable-Length Subnet Mask Plan


Suppose that Company ABCD owns Class B address 130.15 and needs:
4 LANs with 300500 systems (Large) 20 LANs with 50100 systems (Medium)

Ao 2009

Pgina 8 de 13

Ctedra Redes de Informacin

ISI - FRSF - UTN

1000 LANs with 1020 systems (Small)

We will develop the follow plan: 130.15.0130.15.7 130.15.8130.15.15 130.15.16130.15.25 130.15.26130.15.31 130.15.32130.15.156 130.15.156130.15.255 Large LANs Reserved Medium-sized LANs Reserved Small LANs Reserved

2.1. Large LANs


Checking Table C-1, we can see that we will need to use 9 host bits to provide enough addresses for a LAN whose size ranges up to 500 hosts. The corresponding subnet part of the address must be 7 bits. When the host part of your address has more than 8 bits, you are opting for fewer subnets with more hosts on each subnet. We start off with an all-0s subnet field. The display below shows the subnet and host bits for the first and last hosts on the first subnet. It also shows the subnet mask and the first and last addresses in dot notation.
S S S S S S S H 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 H H H H H H H H 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 Mask: 255.255.254.0 First: 130.15.0.1 Last: 130.15.1.254

When translated to dot notation, your first subnet includes addresses: 130.15.0.1 to 130.15.0.255 130.15.1.0 to 130.15.1.254 All addresses starting with 130.15.0 and 130.15.1 are on the same subnet. This makes sense. We needed twice as many addresses as we normally get when using byte boundaries, so we need to use two adjacent third-byte numbers. Note that host address 130.15.0.255 is legal. This address ends with an all-1s byte but not with an all-1s host field because of the 0 in the previous byte. Similarly, 130.15.1.0 is legal because we end with an all-0s byte but not with an all-0s host field. The second subnet will include addresses: 130.15.2.1 to 130.15.2.255 130.15.3.0 to 130.15.3.254 Now we can see the pattern. Each big subnet will start at an even number and stretch across an adjacent pair of even and odd numbers. This makes sense. An 8-bit host part would give us roughly 250 host addresses. Every time we add a bit to the host field, we double the number of available host addresses. Adding a bit to the host field is equivalent to using two adjacent numbers in the third byte. This doubles the number of host addresses at our disposal.

Ao 2009

Pgina 9 de 13

Ctedra Redes de Informacin

ISI - FRSF - UTN

Using the pairs of numbers (0,1), (2,3), (4,5), and (6,7) in the third byte gives us the four big LANs that we needed. We will skip the numbers from 8 to 15 to allow for possible future requirements.

2.2. Medium-Sized LANs


We need 20 LANs that contain up to 100 systems. Checking Table C-1, we see that 7 host bits will cover this number of hosts efficiently. Note that this is equivalent to 1/2 of a conventional subnet. We will start numbering the medium-sized LANs at 130.15.16. The subnet and host parts for the first two LANs are shown below:
S S S S S S S S 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 S H H H H H H H 0 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 Mask: 255.255.255.128 First: 130.15.16.1 Last: 130.15.16.126 First: 130.15.16.129 Last: 130.15.16.254

Once again, we can apply common sense to these blocks of addresses. An 8-bit host part provides roughly 250 addresses, and a 7-bit host part provides half as many. The first LAN uses the addresses below 128 and the second LAN uses addresses above 128. We had to skip a couple of addresses: 130.15.16.127 because it is an all-1s host address and 130.15.16.128 because it is an all-0s host address. The range of ten numbers from 130.15.16.0130.15.25.255 will provide the 20 mediumsized LANs that we need.

2.3. Small LANs


As before, it probably is a good idea to leave a gap in the numbers that can be used for future expansion. We will skip to 130.15.32 for our next set of LANs. We want to allow for 1000 LANs with up to 20 systems. Checking Table C-1, five bits provides enough addresses for 30 hosts, which allows for some growth in the LAN size. This is equivalent to roughly 1/8 of the number of addresses that we would get from an 8-bit host part. We will start numbering the small LANs at 130.15.32. The display that follows shows the eight LANs that we squeeze out of the number space that starts with 130.15.32.
S S S S S S S S 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 S S S H H H H H 0 0 0 0 0 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 0 0 0 1 0 0 1 1 1 1 1 0 0 1 0 0 0 0 0 1 0 1 0 1 1 1 1 0 Mask: 255.255.255.224 First: 130.15.32.1 Last: 130.15.32.30 First: 130.15.32.33 Last: 130.15.32.62 First: 130.15.32.65 Last: 130.15.32.94

Ao 2009

Pgina 10 de 13

Ctedra Redes de Informacin

ISI - FRSF - UTN

0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0

0 1 1 0 0 0 0 1 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 1 0 0 0 0 1 1 0 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 0 1 1 1 1 0 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0

First: 130.15.32.97 Last: 130.15.32.126 First: 130.15.32.129 Last: 130.15.32.158 First: 130.15.32.161 Last: 130.15.32.190 First: 130.15.32.193 Last: 130.15.32.222 First: 130.15.32.225 Last: 130.15.32.254

Similarly, 130.15.33 gives us eight more LANs. We can generate 1000 small LANs from the number range 130.15.32.0130.15.156.255.

3. Subnetting Tables
Table 1 provides an overview of subnet numbering for a Class B network. It shows what happens when we build a subnet whose host addresses start at 130.15.0.1 for a wide variety of subnet sizes. If you check through some examples, you will see that two numbers are always skipped between usable number ranges. This is because the number after the last usable host number always represents an all-1s host field, and the number after that represents an all-0s host field. Number of Hosts 16.382 8.190 4.094 2.046 1.022 510 254 126 62 30 14 6 2 Sample Range of Numbers on One Subnet x.y.0.1 - x.y.63.254 x.y.0.1 - x.y.31.254 x.y.0.1 - x.y.15.254 x.y.0.1 - x.y.7.254 x.y.0.1 - x.y.3.254 x.y.0.1 - x.y.1.254 x.y.0.1 - x.y.0.254 x.y.0.1 - x.y.0.126 x.y.0.1 - x.y.0.62 x.y.0.1 - x.y.0.30 x.y.0.1 - x.y.0.14 x.y.0.1 - x.y.0.6 x.y.0.1 - x.y.0.2

Host Bits 14 13 12 11 10 9 8 7 6 5 4 3 2

Subnet Bits 2 3 4 5 6 7 8 9 10 11 12 13 14

Subnet Mask 255.255.192.0 255.255.224.0 255.255.240.0 255.255.248.0 255.255.252.0 255.255.254.0 255.255.255.0 255.255.255.128 255.255.255.192 255.255.255.224 255.255.255.240 255.255.255.248 255.255.255.252

TABLE 1. Class B Host and Subnet Bits.

Ao 2009

Pgina 11 de 13

Ctedra Redes de Informacin

ISI - FRSF - UTN

Table 2 displays ways that a Class C network can be subnetted. We do not display a row for 7 host bits because we are following the guideline that rules out an all-1s subnet field. The result is that we would have only one subnet (with subnet bit value 0), and there would be no point in doing this. We do not display a row for 7 subnet bits because we would have no hosts on a subnet with 1-bit host addresses! Number of Hosts 254 62 30 14 6 2 Sample Range of Numbers on One Subnet x.y.z.1 - x.y.z.254 x.y.z.1 - x.y.z.62 x.y.z.1 - x.y.z.30 x.y.z.1 - x.y.z.14 x.y.z.1 - x.y.z.6 x.y.z.1 - x.y.z.2

Host Bits 8 6 5 4 3 2

Subnet Bits 0 2 3 4 5 6

Subnet Mask 255.255.255.0 255.255.255.192 255.255.255.224 255.255.255.240 255.255.255.248 255.255.255.252

TABLE 2. Class C Host and Subnet Bits.

4. More Discussion and Examples


When building big LANs for a Class B network, a clump of numbers in the third byte are used for the same LANjust as was the case in the preceding ''Large LANs" example. For example, if we need to use 14 host bits, there are 2 subnet bits and we could build three enormous LANs. We will not use the fourth subnet number because the subnet field would be all-1s (11). Host addresses for the first LAN would range from 130.15.0.1130.15.63.254. A second LAN would range from 130.15.64.1130.15.127.254, and a third LAN would range from 130.15.128.1130.15.191.254. Note that fresh LANs start at multiples of 64: 0, 64, and 128. With 13 host bits, there are 3 subnet bits, so we can build seven big LANs. Host addresses for the first LAN would range from 130.15.0.1-130.15.31.254. The second would be 130.15.32.1-130.15.63.254 and the third would be 130.15.64.1-130.15.95.254. Note that fresh LANs start at multiples of 32: 0, 32, 64, 96, 128, 160, and 192. Jumping down to 8-bit host addresses, the range of addresses on a LAN is familiar: 130.15.0.1130.15.0.254, 130.15.1.1130.15.1.254, and so forth. A new LAN starts at each number: 0, 1, 2, and so forth. When we use less than 8 bits for the host part, we get more LANs by dividing up the number space for one third-byte number. For example, with 4-bit host numbers, the ranges are 130.15.0.1-130.15.0.14, 130.15.0.17-130.15.0.30, 130.15.0.33-130.15.0.46, and so on.

Ao 2009

Pgina 12 de 13

Ctedra Redes de Informacin

ISI - FRSF - UTN

With 3-bit host addresses, the ranges would be 130.15.0.1-130.15.0.6, 130.15.0.9130.15.0.14, 130.15.0.17-130.15.0.22, and so forth. With 2-bit addresses, the ranges are 130.15.0.1-130.15.0.2, 130.15.0.5- 130.15.0.6, 130.15.0.9-130.15.0.10, and so forth. Put another way, our LANs start out using up 64 adjacent third-byte numbers, then go down to 32, 16, 8, 4, and 2 adjacent numbers. Then we reach the single third-byte number. After that, the LANs are cut to 1/2, 1/4, 1/8, 1/16, and 1/32 of the numbers provided by one byte.

5. Summary
Variable-length masks support the efficient assignment of IP addresses. The first step in using them is to examine a network and identify the subnet sizes that are needed. Next, ranges of numbers can be set aside for use with each mask size. It is a good idea to leave gaps between these ranges, to allow for future expansion.

Ao 2009

Pgina 13 de 13

Vous aimerez peut-être aussi