CCNA Exam Cram[tm] 2 (Exams 640-821, 640-811, 640-801)
Every computer that communicates on the Internet is assigned a unique IP address that identifies the device and distinguishes it from other computers on the Internet. This section looks at the various classes of IP addressing and pays great attention to examples of each, as you will be required to know the various classes by heart for a Cisco examination. Binary Notation
Let's start right off by making an unbelievable claim: IP addressing is a simple, straightforward, easy-to-remember method for uniquely identifying a device to the rest of an IP network. Nobody seems to have a problem with the part about uniquely identifying devices, but as far as being "simple and easy to remember" no way! Actually, IP addressing is only complex because it is invariably presented as a mix of base 2 math, base 10 math, a little hexadecimal for interest, and a seemingly endless number of arbitrary rules. Instead of adopting this approach, let's look at IP addressing as it was developed. The people who developed IP were real geeks. They coded in base 2, were comfortable using base 2, and, of course, the native language of computers was base 2 machine language. Why would they develop IP in anything other than base 2? 32 digits could be grouped into four octets, which easily fit in computer registers and provided a reasonable range of addresses. However, 32 digits only provided a reasonable range if organized in a hierarchical structure, and this is where it got interesting. If all 32 digits were used in a linear address, there could be 1 network with a little more than four trillion stations, or slightly over four trillion networks with 1 station each. Either scenario made a good argument for dividing the digits, with some identifying the network and some identifying the station. The big question would be where to make the division. If the 32 digits were allocated evenly (16 to network address and 16 to station address), there could be up to 65,535 networks with each having up to 65,535 stations each. Sounds reasonable, but wouldn't it be neat if the division could be variable depending on need? Geeks like neat and these geeks worked with the Defense Department so a little cryptography produced the ideal solution; the address would become a code within a code. If the first bit (the leftmost or most significant bit) of the address was zero, then the first octet would be the network address and the remaining three octets would form the station or host address. This would yield up to 126 networks (2 are reserved for testing and broadcast) and more than 65 million hosts on each network. If the first 2 bits were "10", then the first two octets would be the network address and the last two octets would be the host address. This provided more than 16 thousand networks and more than 65,000 hosts on each network. If the first three digits were "110" then the first three octets would be network addresses and the last octet would be host addresses. More than 2 million network addresses, with 256 host addresses on each network, would be provided with this structure. Of course, special use addresses are required for any network, so addresses where the first four digits were "1110" were reserved for multicast/broadcast, and addresses starting with "11110" were reserved for experimentation. This in a nutshell is IP addressing: simple, straightforward, and easy to remember (so long as you work with it in binary). Later the four address structures would be labeled A, B, C, and D, and binary would be converted to base 10 and formatted as dotted decimal notation. Unfortunately, the relations that are so easy to see in binary are unrecognizable in dotted decimal notation.
Dotted Decimal Notation
IP addresses are typically shown in dotted decimal notation , which was developed so that people could easily read and write IP addresses. You already know that an IP address in its native form is binary. You also know that the address is composed of 32 bits that have been divided into 8-bit groups, referred to as octets or bytes . An IP address in dotted decimal notation specifies the decimal equivalents of each of the four octets, separated by dots. An example of a dotted decimal IP address is 209.128.50.98. Each octet can have a decimal value between 0 and 255. Why would there be such a limitation, you ask? The total number of possible values for a binary number with 8 bits can be written mathematically as 2 8 . Although 2 8 has a total value of 256, IP addresses begin with the number 0 instead of 1; therefore, the decimal range starts at 0 and ends with 255, for a total of 256 possible values. IP Classes
The number of bits assigned to the network ID and the host ID depends on the number of hosts required on a given network and the number of networks required in an environment. Before the idea of classful addressing was in place, it was the network administrator's responsibility to determine which bits in the 32-bit address to assign to the network ID and which bits to assign to the host ID. If the number of hosts required on a given network was enormous , the network administrator assigned a large portion of the 32 bits available to host IDs and used a small portion for network IDs. If a large number of networks were required with only a few hosts per network, the network administrator used a small portion of the bits for host IDs and a large number for network IDs. This method of allocating address space was inefficient, often giving small organizations the right to a large number of IP address spaces. Therefore, IP address space was divided into three classes in the attempt to meet the needs of large and small organizations. (Actually, the IP address was divided into five classes; however, we will focus on the three more commonly used classes.) With the class system, it is possible to assign a corporation address space based on the number of hosts and networks it requires. This system is referred to as classful addressing . Classful addressing divides the 4,294,967,296 (2 32 ) possible IP addresses into five different classes. The first 3 bits of the address indicate a class A, B, or C IP address. After a while, you will only need to look at the first octet of an IP address in decimal format to determine its class. The class of an IP address governs the number of bits that can be used for network IDs and the number of bits that can be used for host IDs. For example, an organization that is allocated a class B address must use 16 bits to identify its network ID and 16 bits to identify its host ID. It is important to note that this strict rule can be avoided, and most often is, through a process known as subnetting . Class A
Class A addresses are typically assigned to very large organizations, universities, and the military. It is extremely difficult ”if not impossible ”to get a class A address today. These addresses are identified in binary by the first bit having a value of 0 or in decimal by having a value between 1 and 126 . Class A addresses use the first 8 bits to specify the network ID and the last 24 bits to designate the host ID. A maximum of 126 class A network IDs are available. This value is arrived at by taking the number of bits used for the network ID to the power of 2. In this case, 2 7 equals a total of 128 (only 7 bits are available because the first bit must be 0). However, the network ID 0.0.0.0 is reserved for the default route, and the network ID 127.0.0.0 is reserved for the loopback function. Therefore, the range of possible class A network IDs in decimal is 1 to 126. Although you may never need to know the exact number, each class A network ID can support a total of 16,777,214 (2 24 “2) host IDs. The purpose of subtracting 2 from the possible number of hosts is to remove two special host IDs. Any time every bit in the host ID portion of an IP address has a value of 1, it is considered a broadcast IP address , meaning that all hosts in the network should read a message sent to this address, like an ARP request. Obviously, no device should have an address that is used for broadcasting information. The second consideration is when every bit in the host ID's binary value is 0. This value is used to denote a network ID number. Class B
Class B addresses are typically assigned to medium and large organizations. These addresses are identified in binary by the first 2 bits having a value of 10, or in decimal by having a value between 128 and 191 . Class B addresses use the first 16 bits to specify the network ID and the last 16 bits to designate the host IDs. Because the first 2 bits of all class B addresses are always 10, however, only 14 bits are available to be used for network IDs. This allows a total of 16,384 (2 14 ) class B network addresses. Each network ID supports a total of 65,534 (2 16 “2) host IDs. Class C
Class C addresses are typically assigned to small and medium organizations. These addresses are identified in binary by the first 3 bits having a value of 110, or in decimal by having a value between 192 and 223 . Class C addresses use the first 24 bits to specify the network ID and the last 8 bits to designate the host IDs. Because the first 3 bits of a class C address are 110, however, only 21 bits are available to be used for network IDs. This allows a total of 2,097,152 (2 21 ) class C network addresses. Each network ID supports a total of 254 (2 8 “2) host IDs.
Other Classes
Two other classes of addresses are also available but generally not used in the public address space; these have been reserved for specific functions. Class D addresses are identified in binary by the first 4 bits having a value of 1110, or in decimal by having a value between 224 and 239. Class D addresses have been reserved to support IP multicasting , which is the process of using one address to send a message to a group of people. The main benefit of sending a chunk of data headed for multiple destinations is that it has to be sent between the transit routers only once, and therefore a ton of bandwidth is conserved. Class E addresses are identified in binary by the first 5 bits having a value of 11110, or in decimal by having a value between 240 and 247. Class E addresses have been reserved for experimental or research use. Subnetting
One of the major goals of classful addressing is the ability to assign one and only one address to an organization. However, few organizations can function with just one network address. Subnetting provides a solution for this problem. Default Mask
A default mask is a 32-bit number divided into four octets, just like an IP address. A default mask indicates the number of bits used to identify the network ID, and it's implied with all class A, B, and C addresses. Class A addresses imply an 8-bit default mask because the first 8 bits in these addresses designate the network ID. Therefore, the default mask (the number of bits that indicate the network ID) can be represented in decimal format as 255.0.0.0. Why do we need a default mask if we can already determine this by the class of the IP address? As mentioned previously, organizations often have the need to increase the number of networks in their intranet. However, when an organization has only one block of IP addresses it can advertise to the Internet but wishes to have many subnetworks in its environment, the organization can indicate that it has used some of the host ID bits as network ID bits by providing a subnet mask. Subnet Mask
A subnet mask is an extension to the default mask. It indicates the number of bits in addition to the default mask that should be used to identify network IDs. What does this do for an organization? It increases the number of networks an organization can create from one class A, B, or C network ID. For example, if an organization has a registered class C address and needs to create two networks, it must somehow get more network IDs. The organization can accomplish this by using some of the bits designated as host IDs as network IDs. However, the organization must indicate that this class C address is no longer using the default 24 bits as a network ID. The organization can indicate this by applying a subnet mask to represent the additional bits that are to be used as network IDs versus host IDs. The subnet mask can be represented in various ways; in this chapter, we will refer to the subnet mask as the default mask plus any additional bits used for network IDs. Logical ANDing
How should the subnet mask be used to determine the network ID for an IP address? To determine the network ID and the host ID for an IP address, it is necessary to perform a process known as logical ANDing . When information is sent to a router and is destined for a remote location, the router cares only about which network to send the information to. The router knows the subnet mask and the destination IP, so the ANDing process is used with these two addresses to determine the network portion of an IP address and then a routing table is used to determine the remote network to send the information to. This indicates which bits to use as network bits and which bits to use as host bits when the IP address is deciphered. When the subnet mask is applied to an IP address, each bit starting from the most significant bit to the least significant bit is compared between the IP address and the subnet mask. For example, the first bit of the first octet of the IP address is compared with the first bit of the first octet of the subnet mask. The resulting value from this bit-by-bit comparison is the network ID. The rule set to apply is listed as follows :
So far, you have learned that IP addresses are divided into classes to allocate the IP address space to varying sizes of organizations efficiently . Efficient allocation of address space also minimizes the number of entries that need to be maintained in the routing tables of Internet routers. Because organizations required more networks than the InterNIC believed reasonable to assign due to wasted IP address space, a subnet mask was created, giving organizations a tool for increasing the number of networks they had by borrowing bits from the host IDs of their assigned IP address space. A subnet mask uses the logical AND process to distinguish between the network ID and the host ID of an IP address. Next , we'll discuss some of the items to consider when determining the number of bits to use for the subnet mask. A bad decision on a subnet mask can place constraints on an organization's future addressing choices. Subnetting Consideration
Remember that the purpose of the subnet mask is to give an organization the flexibility to increase the number of networks in its environment. So, you might think that an organization should give itself the maximum number of networks possible with its assigned IP address space. Any time a bit is added to the network ID, however, a bit is removed from the host ID. Therefore, if the number of networks is increased, the number of host IDs available per network is decreased. Organizations need to determine the happy medium between sufficient host IDs and network IDs for their specific needs. The cost of changing the subnet mask on thousands of computers because of a scaling issue is not a welcome thought for network administrators. Here are some of the questions that must be asked before a subnet addressing scheme is developed:
The answers to these questions will determine how an organization subnets its assigned IP address space. The purpose of asking about current and future requirements is to get an understanding of what is absolutely needed today and what should be planned for the future. To illustrate the process of classful IP addressing, subnetting, and logical ANDing as well as IP addressing considerations, examples using class A and C addresses are provided in the following sections.
Class A Network Example
This example uses a fictitious company named AWSB to illustrate the process of determining the proper subnetting for an organization. AWSB has been allocated the class A IP address 114.0.0.0 by the InterNIC. AWSB must determine the proper way to use this IP address space to support its current and future needs. To determine these needs, we must answer the four questions suggested previously. These questions are repeated here, along with AWSB's responses to them:
AWSB has been assigned only one network ID; however, it needs lots more to support its current and future requirements. AWSB plans to use subnetting to create more network IDs. As mentioned previously, by default, 24 bits are allocated for host IDs with a class A IP address space. We know that AWSB requires 5,000 networks today and 9,000 in the future. Therefore, to create enough network IDs, we have to take bits from the host IDs and use them for network IDs. How many bits have to be taken from the host ID bits to provide 5,000 network IDs? AWSB requires a total of 13 bits to provide 5,000 network IDs. The number of bits required can be determined by taking 2 13 (for a total of 8,192 possible networks). A subnet mask of 255.255.248.0 is used to represent the 13 bits of subnetting. However, 13 bits provide only 8,192 total possible networks, which is not enough to support AWSB's expected growth. A total of 14 bits is required to ensure that 9,000+ networks can be supported in the future. If AWSB uses 14 bits as the subnet mask (a subnet mask of 255.255.252.0), it has a total of 16,384 (2 14 ) possible network IDs. AWSB would prefer to use 14 bits of the host ID to subnet the current 114.0.0.0 class A address; however, taking 13 bits from the host ID would provide a sufficient number of network IDs (subnets) to provide for today's needs. AWSB must determine whether enough bits still remain to provide an adequate number of host IDs. AWSB requires 1,000 host IDs per network today and expects to need 2,000 host IDs per network in the future. How many bits are required to provide 1,000 host IDs? How many bits are required to provide 2,000 host IDs? How many bits are still available to be used as host IDs? The number of bits required for 1,000 host IDs is 10, which provides a total combination of 1,022 (2 10 “2). Remember that we subtract 2 to represent the broadcast (all 1s) and the zero (all 0s) value in each network. However, AWSB requires 11 bits to provide sufficient host IDs to support its future requirement of 2,000 hosts. AWSB has only 24 bits of host IDs in its class A 114.0.0.0 IP address to use for both hosts and networks. To get enough host IDs for 2,000 users per network and 9,000+ network IDs, however, it would take 14 network ID bits and 11 host ID bits, for a total of 25 bits. AWSB is short 1 bit, so it has to decide whether to limit the number of hosts or networks to have in the future. In this case, AWSB would probably opt to use only 13 bits (8,192 networks) for network IDs and 11 bits for host IDs (2,046 host IDs per network). The decision can become more difficult, however, when an organization doesn't have the luxury of owning an entire class A IP address. Class C Network Example
In this example, we will define the actual subnets and host IDs. If an organization named AWSB has been assigned the IP address space 210.14.12.0, it has been assigned a class C address with a default mask of 255.255.255.0. This organization requires five networks today and expects to need eight in the future. In addition, AWSB expects the largest number of hosts on a given network now and in the future to be 30 users. AWSB requires more networks and must subnet the 8 bits allocated to host IDs to provide these networks. To do so, AWSB must subnet 3 bits to provide eight more networks (2 3 ). The subnet mask of this IP address is now 255.255.255.224. The value of the last octet has changed to represent the 3 bits (128 + 64 + 32 = 224) that are now used to identify networks instead of hosts. However, AWSB must make sure that it will have enough host IDs left to identify all 30 devices on its largest network. AWSB has 5 bits remaining for host IDs, giving it a total of 30 (2 5 “2) host IDs per network. |