IP Addressing Fundamentals
No one reading this book should be shocked to hear that IP addressing is one of the most important topics for passing the the INTRO and ICND exams. In fact, IP addressing is the only major topic that is covered specifically on both the INTRO and ICND exams. Plus, you need a comfortable, confident understanding of IP addressing and subnetting for success on any Cisco certification. In other words, you had better know addressing and subnetting!
This section introduces IP addressing and subnetting, and also covers the concepts behind the struture of an IP address, including how it relates to IP routing. In Chapter 12, "IP Addressing and Subnetting," you will read about the math behind IP addressing and subnetting.
IP Addressing Definitions
If a device wants to communicate using TCP/IP, it needs an IP address. When the device has an IP address and the appropriate software and hardware, it can send and receive IP packets. Any device that can send and receive IP packets is called an IP host.
IP addresses consist of a 32-bit number, usually written in dotted-decimal notation. The "decimal" part of the term comes from the fact that each byte (8 bits) of the 32-bit IP address is converted to its decimal equivalent. The four resulting decimal numbers are written in sequence, with "dots," or decimal points, separating the numbershence the name dotted-decimal. For instance, 168.1.1.1 is an IP address written in dotted-decimal form, but the actual binary version is 10101000 00000001 00000001 00000001. (You almost never need to write down the binary versionbut you will need to know how to convert between the two formats in Chapter 12, "IP Addressing and Subnetting.")
Each of the decimal numbers in an IP address is called an octet. The term octet is just a vendor-neutral term instead of byte. So, for an IP address of 168.1.1.1, the first octet is 168, the second octet is 1, and so on. The range of decimal numbers numbers in each octet is between 0 and 255, inclusive.
Finally, note that each network interface uses a unique IP address. Most people tend to think that their computer has an IP address, but actually their computer's network card has an IP address. If you put two Ethernet cards in a PC to forward IP packets through both cards, they both would need unique IP addresses. Similarly, routers, which typically have many network interfaces that forward IP packets, have an IP address for each interface.
Now that you have some idea about the basic terminology, the next section relates IP addressing to the routing concepts of OSI Layer 3.
How IP Addresses Are Grouped Together
To fully appreciate IP addressing, you first must understand the concepts behind the grouping of IP addresses. The first visions of what we call the Internet were for connecting research sites. A typical network diagram might have looked like Figure 5-3.
Figure 5-3 Sample Network Using Class A, B, and C Network Numbers
The conventions of IP addressing and IP address grouping make routing easy. For example, all IP addresses that begin with 8 are on the Token Ring on the left. Likewise, all IP addresses that begin with 130.4 are on the right. Along the same lines, 199.1.1 is the prefix on the serial link. By following this convention, the routers build a routing table with three entries, one for each prefix, or network number.
So, the general ideas about how IP address groupings can be summarized are as follows:
All IP addresses in the same group must not be separated by a router.
IP addresses separated by a router must be in different groups.
As mentioned earlier in this chapter, IP addressing behaves similarly to ZIP codes. Everyone living in my ZIP code lives in my town. If some members of my ZIP code were in California, some of my mail might be sent out there (I live in Georgia, by the way). Likewise, IP routing counts on the fact that all IP addresses in the same subnet are in the same general location, with the routers in the network forwarding traffic to addresses in my subnet to a router connected to my subnet.
Classes of Networks
In Figure 5-3 and the surrounding text, I claimed that the IP addresses of devices attached to the Token Ring all started with 8 and that the IP addresses of devices attached to the Ethernet all started with 130.4. Why only one number for the "prefix" on the Token Ring and two numbers on the Ethernet? Well, it all has to do with IP address classes.
RFC 790 defines the IP protocol, including multiple different classes of networks. IP defines three different network classes, called A, B, and C, from which individual hosts are assigned IP addresses. TCP/IP defines Class D (multicast) addresses and Class E (experimental) addresses as well.
By definition, all addresses in the same Class A, B, or C network have the same numeric value network portion of the addresses. The rest of the address is called the host portion of the address.
Using the post office example, the network part of an IP address acts like the ZIP code, and the host part acts like the street address. Just as a letter-sorting machine three states away from you cares only about the ZIP code on a letter addressed to you, a router three hops away from you cares only about the network number that your address resides in.
Class A, B, and C networks each have a different length for the part that identifies the network:
Class A networks have a 1-byte-long network part. That leaves 3 bytes for the rest of the address, called the host part.
Class B networks have a 2-byte-long network part, leaving 2 bytes for the host portion of the address.
Class C networks have a 3-byte-long network part, leaving only 1 byte for the host part.
For instance, Figure 5-3 lists network 8.0.0.0 next to the Token Ring. Network 8.0.0.0 is a Class A network, which means that only 1 byte is used for the network part of the address. So, all hosts in network 8.0.0.0 begin with 8. Similarly, Class B network 130.4.0.0 is listed next to the Ethernet; because it is Class B, 2 bytes define the network part, and all addresses begin with those same two bytes. When written down, network numbers have all decimal 0s in the host part of the number. So, Class A network "8" is written 8.0.0.0, Class B network 130.4 is written 130.4.0.0, and so on.
Now consider the size of each class of network. Class A networks need 1 byte for the network part, leaving 3 bytes, or 24 bits, for the host part. There are 224 different possible values in the host part of a Class A IP address. So, each Class A network can have 224 IP addressesexcept for two reserved host addresses in each network, as shown in the last column of Table 5-3. The table summarizes the characteristics of Class A, B, and C networks.
Table 5-3 Sizes of Network and Host Parts of IP Addresses with No Subnetting
Any Network of This Class |
Number of Network Bytes (Bits) |
Number of Host Bytes (Bits) |
Number of Addresses per Network* |
A |
1 (8) |
3 (24) |
224 2 |
B |
2 (16) |
2 (16) |
216 2 |
C |
3 (24) |
1 (8) |
28 2 |
*There are two reserved host addresses per network. |
Network numbers look like actual addresses because they are in dotted-decimal format. However, network numbers are not actually IP addresses because they cannot be assigned to an interface as an IP address. Conceptually, network numbers represent the group of all IP addresses in the network, much like a ZIP code represents the group of all addresses in a community. Based on the three examples from Figure 5-3, Table 5-4 provides a closer look at the numerical version of the three network numbers: 8.0.0.0, 130.4.0.0, and 199.1.1.0.
Table 5-4 Example Network Numbers, Decimal and Binary
Network Number |
Binary Representation, with Host Part Bold |
8.0.0.0 |
00001000 00000000 00000000 00000000 |
130.4.0.0 |
10000010 00000100 00000000 00000000 |
199.1.1.0 |
11000111 00000001 00000001 00000000 |
Two numbers inside each Class A, B, or C network are reserved, as mentioned at Table 5-3. One of the two reserved values is the network number itself. For instance, each of the numbers in Table 5-4 is reserved. The other reserved value is the one with all binary 1s in the host part of the addressthis number is called the network broadcast or directed broadcast address. Also, because the network number is the lowest numerical value inside that network and the broadcast address is the largest, all the numbers between the network number and the broadcast address are the valid, useful IP addresses that can be used to address interfaces in the network.
The Actual Class A, B, and C Network Numbers
Many different Class A, B, and C networks exist. If your firm connects to the Internet, it must use registered, unique network numbers. To that end, the Network Information Center (NIC) assigns network numbers so that all IP address are unique. By assigning one company a particular network number, and not assigning that same network number to any other company, all IP addresses can be unique throughout the Internet. Table 5-5 summarizes the possible network numbers, the total number of each type, and the number of hosts in each Class A, B, and C network.
Table 5-5 List of All Possible Valid Network Numbers*
Class |
First Octet Range |
Valid Network Numbers |
Total Number of This Class of Network |
Number of Hosts per Network |
A |
1 to 126 |
1.0.0.0 to 126.0.0.0 |
27 2 |
224 2 |
B |
128 to 191 |
128.1.0.0 to 191.254.0.0 |
214 2 |
216 2 |
C |
192 to 223 |
192.0.1.0 to 223.255.254.0 |
221 2 |
28 2 |
*The Valid Network Numbers column shows actual network numbers. There are several reserved cases. For example, networks 0.0.0.0 (originally defined for use as a broadcast address) and 127.0.0.0 (still available for use as the loopback address) are reserved. Networks 128.0.0.0, 191.255.0.0, 192.0.0.0, and 223.255.255.0 also are reserved. |
Memorizing the contents of Table 5-5 should be one of the first things you do in preparation for the CCNA exam(s). Engineers should be able to categorize a network as Class A, B, or C with ease. Also memorize the number of octets in the network part of Class A, B, and C addresses, as shown in Table 5-4.
IP Subnetting
One of the most important topics on both the INTRO and ICND exams is the topic of subnetting. You need to know how it works and how to "do the math" to figure out issues when subnetting is in use, both in real life and on the exam.
Chapter 12 covers the details of subnetting concepts, motivation, and math, but you should have a basic understanding of the concepts before covering the topics between here and Chapter 12. So, this section describes the basics.
IP subnetting creates vastly larger numbers of smaller groups of IP addresses, compared with simply using Class A, B, and C conventions. The Class A, B, and C rules still existbut now, a single Class A, B, or C network can be subdivided into many smaller groups. Subnetting treats a subdivision of a single Class A, B, or C network as if it were a network itself. By doing so, a single Class A, B, or C network can be subdivided into many nonoverlapping subnets.
Comparing a single network topology using subnetting with the same topology without subnetting drives home the basic concept. Figure 5-4 shows such a network, without subnetting.
Figure 5-4 Backdrop for Discussing Numbers of Different Networks/Subnetworks
The design in Figure 5-4 requires six groups, each of which is a Class B network in this example. The four LANs each use a single Class B network. In other words, each of the LANs attached to routers A, B, C, and D is in a separate network. Additionally, the two serial interfaces composing the point-to-point serial link between routers C and D use the same network because these two interfaces are not separated by a router. Finally, the three router interfaces composing the Frame Relay network with routers A, B, and C are not separated by an IP router and would compose the sixth network.
Each Class B network has 216 2 hosts addresses in itfar more than you will ever need for each LAN and WAN link. In fact, this design would not be allowed if it were connected to the Internet. The NIC would not assign six separate registered Class B network numbersin fact, you probably would not even get one Class B network because most of the Class B addresses already are assigned. You more likely would get a couple of Class C networks, and the NIC would expect you to use subnetting.
Figure 5-5 illustrates a more realistic example that uses basic subnetting.
Figure 5-5 Using Subnets
As in Figure 5-4, the design in Figure 5-5 requires six groups. Unlike Figure 5-5, this figure uses six subnets, each of which is a subnet of a single Class B network. This design subnets Class B network 150.150.0.0, which has been assigned by the NIC. To perform subnetting,the third octet (in this example) is used to identify unique subnets of network 150.150.0.0. Notice that each subnet number in the figure shows a different value in the third octet, representing each different subnet number. In other words, this design numbers or identifies each different subnet using the third octet.
When subnetting, a third part of an IP address appears between the network and host parts of the addressnamely, the subnet part of the address. This field is created by "stealing" or "borrowing" bits from the host part of the address. The size of the network part of the address never shrinksin other words, Class A, B, and C rules still apply when defining the size of the network part of an address. The host part of the address shrinks to make room for the subnet part of the address. Figure 5-6 shows the format of addresses when subnetting.
Figure 5-6 Address Formats When Subnetting Is Used
Now, instead of routing based on the network part of an address, routers can route based on the combined network and subnet parts. In fact, most people do not even bother distinguishing between the network part and the subnet partthey just call both fields together the subnet part of an address.
Finally, IP addressing with subnetting uses a concept called a subnet mask. A subnet mask helps define the structure of an IP address, as shown in Figure 5-6. Chapter 12 explains the details.