IP Network Design. Part1

Chapter 8 Advanced TCP/IP Network Design Part1   The key issues in this chapter are the importance of how to use IP addressing to properly defi...
Author: Joella Crawford
6 downloads 0 Views 1MB Size
Chapter 8 Advanced TCP/IP Network Design

Part1





The key issues in this chapter are the importance of how to use IP addressing to properly define subnet masks and how the logical distribution of IP addresses must correlate to the physical topology of the network By the completion of this chapter, the reader should be comfortable designing IP-based networks in both a classful and classless addressing environment

NETWORK DESIGN WITH CLASSFUL IP ADDRESSING Address Classes 



Classful addresses are broken apart on octet boundaries. Therefore, there are three basic classes of addresses. As illustrated in Figure 8-1, these classes are known as class A, B, or C networks.

Classful IP Addressing



Figure 8.1: There are three basic classes of addresses known as class A, B, or C networks







To distinguish between classes, the first few bits of each segment address is used to denote the address class of the segment. The class ID plus network ID portions of the IP address are also known as the network prefix, the network number, or the major network. As illustrated in , Class A addresses have an 8-bit network prefix, sometimes referred to as “/8” (slash eight); Class B addresses have a 16 bit network prefix and are sometimes referred to as /16 addresses, and Class C addresses have a 24bit network prefix and are sometimes referred to as /24s









Class Aaddresses can be identified if the first bit is a 0 in binary notation, or has a decimal value between 1 and 126. Class B addresses can be identified if the first two bits are 10 or if the first decimal octet is between 128 and 191. The first octet address of 127 is reserved for loopback tests on network interface cards and routers. Class C addresses can be identified if the first three bits in binary notation are 110 or if the first octet’s decimal value is between 192 and 223, inclusive



The assignment of address classes and network ID ranges to a particular organization wishing to connect to the Internet is the responsibility of the Internet Activities Board (IAB)

Subnetting 





 

A Class C address with its limit of 254 hosts (computers) per network is too small for most organizations, while a Class B address with its limit of 65,534 hosts per subnet is too large. Unfortunately, Class B addresses were given out to organizations that would never need the 65,534 addresses A second issue came about as organizations’ networks grew and needed to be divided or segmented in order to improve traffic flow. Routers join two separate networks. Networks that are separated by routers must have different network IDs so that the router can distinguish between them.









This would require all organizations that needed to install a router-based internetwork to go back to the IAB for more addresses, thereby accelerating the depletion of IP addresses Since the network IDs were assigned by IAB and could not be altered, the only choice was to “borrow” some of the host ID bits that were under the control of the organization to which the address had been assigned. These “borrowed” bits constitute the subnet portion of the address. A subnet mask identifies which particular bits are used for the subnet ID







Subnetting allowed organizations to use the one network ID assigned by the IAB and create multiple subnets within their private network. Although their internal routers needed to remain aware of all of the internal subnets in order to properly deliver data, the Internet routing tables did not need to be concerned about that since all of these subnets existed behind the original network ID assigned by the IAB. As a result, organizations could build router-based internetworks without asking for additional network IDs and the Internet routing tables did not need to be overloaded with all the information about routes to all of the internal subnets

Subnet Masks 



By applying a 32-bit subnet mask to a Class B IP address, a portion of the bits that make up the host ID can be reserved for denoting subnetworks, with the remaining bits being reserved for host IDs per subnetwork. If the first 8 bits of the host ID were reserved for subnetwork addresses and the final 8 bits of the host ID were reserved for hosts per subnetwork, this would allow the same Class B address to yield 254 subnetworks with 254 hosts each as opposed to one network with 65,534 hosts.











Figure 8-2 provides examples of subnet masks. The overall effect of subnetworking is to create multiple network segments within the address space given by the IAB By default, in the case of a Class B address, the first 16 bits are reserved for network ID and the second 16 bits are reserved for host ID. Of the 16 bits originally reserved for host ID, we can reserve those bits that we wish to use for a subnet ID by placing a 1 in that bit position. If we wish to retain the use of a bit position for host ID, then we reserve that bit position with a 0

Subnet Masks



Figure 8.2: Alternative Subnet masks for a Class B network - IPv4 Subnetworking

Extended Network Prefix 





The extended network prefix is the classful network prefix (/16 in the case of a Class B address) plus the number of bits borrowed from the host ID. In the case of the example illustrated in Figure 8-2, the extended network prefix would be /24 (/16 network prefix + /8 subnet mask). As an example, if we were given the Class B address of 128.210. 49. 213/24 what would we know?



Figure 8-3 illustrates the network prefix, extended network prefix, subnet mask in binary and decimal, network ID, subnet ID, and host ID

Figure 8.3: This figure illustrates the network prefix, extended network prefix, subnet mask in binary and decimal, network ID, subnet ID, and host ID

The TCP/IP Subnet Definition Chart 



Once the theory behind how subnet masks are defined is understood, it would be nice to be able to define appropriate subnet masks without having to perform binary arithmetic. Figure 8-4 provides a chart that can be quickly used to define the proper subnet mask dependent on the class of the original network ID, the number of required subnets, and the number of required hosts per subnet

Working with Subnet Masks—Subnet Design 





In order to illustrate the use of the TCP/IP Subnet Definition Chart, let’s take a practical example:

Referring to the TCP/IP Subnet Definition Chart, we can see that if 6 subnets are required, then the last octet in the subnet mask should be 224, not 240, which would yield 30 hosts per subnet. In the example, the defined subnet of 240 would yield 14 subnets but only 14 host per subnet, which would not meet the requirement



 

The correct answer, 224, has 3 ones in the subnet mask borrowed from the host ID. A Class C address is a /24 subnet mask by default Adding the 3 ones yields a correct subnet mask of 255.255.255.224 or a correct extended network prefix of /27 (24 + 3)



In order to properly define a subnet mask for a given classful address, one must know the following information:







Example:

The given IP address is 165.32.0.0. This is a Class B or /16 address, which means we have 16 bits available with which to define the subnet mask. In order to determine the number of required subnets, we take the 80 current stores and add 160 more (20 per year × 8 years) for a total anticipated number of stores or subnets of 240.







We only need two host IDs per subnet. Using the TCP/IP Subnet Definition Chart, we see that in order to have 240 subnets, we will need 8 bits in the subnet mask. Adding the subnet mask to the default for a Class B address yields 255.255.255.0 or an extended network prefix of /24 (/16 + 8)

Defining Subnet Numbers

Reserved Subnet Numbers 







Two subnet numbers, the all-zeroes subnet and the all-ones subnet are typically reserved, especially in routers that support classful routing protocols. The all-zeroes subnet is labeled as Subnet 0 and the all-ones subnet is labeled as Subnet 255 in Figure 8-5. As can be seen in Figure 8-5, the full address of subnet 0 (165.32.0.0) is identical to the Assigned network ID of 165.32.0.0. In order to differentiate between the two, one would have to know the extended network prefix in each case.





Since routers supporting classful routing protocols don’t exchange extended network prefixes, there is no way for them to differentiate between the assigned major network ID, sometimes referred to as the default route, and subnet 0 of the major network, leading the subnet 0 address to be declared reserved. The all-ones subnet ID is reserved because it has a special meaning to classful routing protocol routers—namely, broadcast to all subnets

Defining Host Addresses for a Given Subnet 



 



In the current example the network ID with extended network prefix is 165.32.0.0/24. That tells us that the last octet, or last 8 bits, has been reserved to define host IDs. Host IDs are defined within a given subnet. In Figure 8-7, we have chosen to define host IDs for subnet #1. As a result, we know that all host IDs will have the same first three octets in dotted decimal format, namely, 165.32.1

Determining if IP Addresses Are Part of the Same Subnet 







The subnet ID in the address 165.32.2.46/24 is 2 and the subnet ID in the address 165.32.1.23/24 is 1 What if the entire third octet were not reserved for the subnet ID? How would we, or the routers for that matter, be able to determine what the real subnet address was when all we are given is the dotted decimal format? Given the network ID 192.210.165.0 from the IAB, we need to define a subnet ID that will yield 30 subnets with up to six hosts per subnet. Noting that we are dealing with a Class C address and referring back to the Subnet Definition Chart (Figure 8-4), we should see that we need the last octet to be 248.







Since this is a Class C or /24 address and we are reserving 5 or the remaining 8 bits for subnet ID, it should be evident that the extended network prefix will be /29 or the subnet mask in dotted decimal format would be equivalently expressed as 255.255.255.248. Figure 8-8 shows how the subnets would be defined Notice how in Figure 8-8 there are only 5 bits available for subnet IDs and 3 bits reserved for host IDs for each subnet





Figure 8-9 defines Host IDs for Subnet 1 from Figure 8-8. Since there are only 3 bits reserved for host ID, we can only define eight different host IDs, two of which are reserved. Notice how the extended network prefix does not increase when we define host IDs for a given subnet the way it did when we defined additional subnet levels to existing subnets







In the case of subnet 1 (subnet address 8), if we were to choose one of the full host IDs as defined Figure 8-9, we don’t immediately see the subnet address of 8 in the full dotted decimal address of the host IDs. Where is the subnet address of 8 hiding? Why is the subnet address of subnet 1 defined as 8? As illustrated in Figure 8-10, it is due to the decimal place values of the binary digits used to define the subnet number





 

Routers must be given the subnet mask or extended network prefix of the address in question and then use a type of binary arithmetic known as a logical AND. If a one is present in a given place in both the IP address and the subnet mask, then a one is placed in the result, otherwise a zero is placed in the result. This operation is illustrated in Figure 8-11 As illustrated in Figure 8-11, although the last octet of the full address had a value of 13, by using binary arithmetic the router is able to determine the actual subnet ID of the address as long as it also knows the subnet mask or extended network prefix







If the subnet ID of the destination address on the data packet is the same as the subnet of the router interface, the router will do nothing. Since it is a local delivery, the router does not need to get involved. If after determining the real subnet ID of the destination address it turns out that the destination subnet is not the same as the local router interface’s subnet, then the router needs to go to work consulting its routing tables and determining the address of the next hop router that will help this data packet on its way to its ultimate destination

Limitations of Classful Addressing and Fixed-Length Subnet Masks 





Before moving on to classless addressing and variable-length subnet masks, it is important to understand the problems that these techniques are attempting to fix:  Wasted addresses because only one subnet mask can be used for a network prefix  A shrinking pool of available IPv4 addresses Recalling that a subnet mask is the logical portion that relates to a physical network topology, it should be evident that a fixed subnet mask implies a fixed subnet size for all subnets of a given network ID. Naturally, subnets must be sized to accommodate the largest required subnet within a given network ID.



    

As a result, all subnets, regardless of their requirements, are sized to this largest required size, resulting in wasted host addresses that cannot be recovered or used by other subnets. Internet traffic is doubling every three to six months. Class A addresses are exhausted. Class B addresses are either exhausted, or nearly so. All that remains is Class C addresses. However, as was seen in the IP Subnet Definition Chart, Class C addresses, with only an 8-bit host ID, don’t leave much room for subnet definition