The following is the second installment of a multi-part series on the fundamentals of routing. Each tip is excerpted...
from Routing First-Step by William Parkhurst, published by Cisco Press. Check back frequently for the next installment, or go to the main series page for all the installments.
Internet addressing protocol
The Internet addressing protocol, or Internet Protocol (IP), is an additional addressing scheme. By following this protocol you can have an address with a structure that will allow you to build a scalable data communication system analogous to the postal system. Because this discussion is about computers, you need to decide how many bits you need for an Internet address, and how many Internet addresses you need. Computers can easily work with byte size pieces of data, so the number of bits in the IP should be a multiple of 8 bits or 1 byte. How many IP addresses will you need? That is, and was, a difficult question. When the IP was developed more than 20 years ago, the PC was not common, and it was difficult to imagine the explosion that would take place in the number of computers used throughout the world.
If you placed yourself back in 1980, and had to determine the size, in bits, of an IP address, what would you have picked? You might have started by determining how many addresses are possible based on the number of bytes that are used. And you might have created a table similar to Table 3-1.
Table 3-1 - Number of IP Addresses Versus Number of Bytes
In 1980, there were more than 256 computers in use, so 1 byte would not be sufficient. Two bytes would give us 65,280 more addresses, but the number is still not sufficient. Although 3 bytes allow more than 16 million addresses, you know that computers are happier with even numbers of things than odd numbers of things. An ideal size is 4 bytes. Four is an even number and you can have in excess of 4 billion IP addresses, which should be sufficient. Now that you have settled on using a 32-bit address for the Internet address, you next need to determine a structure for those 32 bits.
The postal addressing and delivery schemes worked quite well for mail delivery, so let's try and impose the same type of structure on the Internet addresses. You know that a postal address has two components. The first component consisted of the state, city, and street names. The second component was the street or house number. Although the entire address was needed to identify a particular endpoint, or house, you did not need the street number for delivery until the mail reached the street containing the house. Using the same philosophy for the Internet address, use part of the 32 bits to designate the LAN or local network where the computer resides (the network address); and the remaining bits in the address to identify a particular computer, or host (the host address), on that LAN.
The next step is to determine how many bits to use for the network address and how many bits to use to identify a computer, or host, on that network. The easiest approach is to work with bytes, and then use the dotted decimal notation to represent network and host addresses using decimal numbers. You can't use all the bytes for the network address, and you can't use all the bytes for the computer address so the possibilities that remain are listed in Table 3-2.
After some thought, you decide that you want to make some modifications to the range of host addresses. It would be nice if you had a broadcast capability where a message could be sent to every host on a network. Therefore, you need a broadcast address for the network, and you want the broadcast address to be easy to remember. This can be achieved by using a host address of all 1s for the broadcast address. In addition, you want an address that points to the network itself, or "this" network. This can be achieved by using a host address of all 0s. To accommodate the new broadcast and "this" network addresses, the number of hosts listed in Table 3-2 must now be reduced by two. (See Table 3-3.)
Try working through the next exercises to reinforce your understanding. For the first type or class of networks that use 1 byte for the network address and 3 bytes for the host address, the range of addresses in dotted decimal notation are:
0.0.0.1–0.255.255.254 for network 0
184.108.40.206–220.127.116.11 for network 1
18.104.22.168–22.214.171.124 for network 2
255.0.0.1–255.255.255.254 for network 255
1. What is the address for host 8 on network 129?
2. What is the broadcast address for network 129?
For the second class of networks that use 2 bytes for both the network and host addresses, the range of addresses in dotted decimal notation are
0.0.0.1–0.0.255.254 for network 0
0.1.0.1–0.1.255.254 for network 1
255.254.0.1–255.254.255.254 for network 65,534
255.255.0.1–255.255.255.254 for network 65,535
3. What is the address for host 8 on the 258th network?
Answer: Answer.126.96.36.199. The 258th network is network number 257 because network numbering started at 0; 257 in binary = 0000 0001 0000 0001 = 256 + 1 = 257 = 1.1 in dotted decimal notation.
4. What is the broadcast address for the 258th network?
For the third class of networks that use 1 byte for the host address and 3 bytes for the network address, the range of addresses in dotted decimal notation are
0.0.0.1–0.0.0.254 for network 0
0.0.1.1–0.0.1.254 for network 1
0.1.0.1–0.1.0.254 for network 256
188.8.131.52–184.108.40.206 for network 65536
255.255.255.1–255.255.255.254 for network 16,777,215
5. What is the address for host 8 on network 25?
6. What is the address for host 12 on network 103,481?
Answer: 103,481 in hexadecimal = 019439.0116 = 110.94 16 = 14810.3916 = 5710.103,481 in dotted decimal = 1.148.57 so the address for host 12 on network 103,481 is 220.127.116.11
7. What is the broadcast address for network 103,481?
Classful IP Addresses
You must decide which scheme you are going to use for the Internet addresses. You could pick just one, but why not use all three? That way, you would have the flexibility of having networks with a few hosts (254), networks with a moderate number of hosts (65534), and networks with many hosts (16,777,214). This does sound like a good idea, but you need to be able to mix the three address types. A simple way is to use part of the first byte to signal the type of address used. The first byte, like all bytes, contains 8 bits. Using the first few bits to identify the type of network gives you the following rules:
If the first, or most significant, bit of the first byte is 0, then 1 byte is used for the network address and 3 bytes are used for the host, broadcast, and "this" network address. If the most significant bit of the first byte is 1 and the next bit is 0, 2 bytes are used for the network address and 2 bytes are used for the host, broadcast, and "this" network address. If the first 2 bits of the first byte are 1, then 3 bytes are used for the network address and 1 byte is used for the host, broadcast, and "this" network address.
Three types of addresses are called Class A, B, and C. In a Class A address, the most significant bit of the first byte is 0. Additionally, you want to reserve two addresses from the Class A address space. Address 0.0.0.X (where X can be any value from 0–255) is reserved. Address 127.X.X.X is reserved for what is called a loopback address. The loopback address is used by a host to send a message to itself without even being connected to a network. This can be used for testing applications without interfering with the network. So the range of values for the first byte in a Class A address is 0000–0001–0111 1110 or 1–126 (0 and 127 are reserved).
The entire range of Class A addresses is – 18.104.22.168.
In a Class B address, the most significant bit of the first byte is 1 and the next bit is 0. So the range of values for the first byte in a Class B address is 1000 0000–1011 1111 or 128–191.
The entire range of Class B addresses is: 22.214.171.124–126.96.36.199.
In a Class C address, the first two most significant bits of the first byte are 1 and the next bit is 0. So the range of values for the first byte in a Class C address is 1100 0000–1101 1111 or 192–223.
The entire range of Class C addresses is: 192.0.0.0–188.8.131.52.
This Internet Protocol addressing scheme is called classful because every address falls into one of three classes of addresses as summarized in Table 3-4.
A Class A address is identified by the first bit being a 0, as follows:
A Class B address is identified by the first 2 bits being 1 0, as follows:
And a Class C address has the first 3 bits set to 1 1 0, as follows:
One question might have popped into your mind at this point: What about addresses that are not Class A, B, or C? In other words, what about addresses where the first four bits are 1 1 1 0 or 1 1 1 1? Addresses beginning with 1110 are a different class of addresses, Class D, which you will learn about in Chapter 9, "Multicast—What the Post Office Can't Do." The Class D, or multicast, address space is in the range 1110 0000–1110 1111 or 224–239.
Addresses beginning with 1111 are reserved for future use and cover the remaining address space starting at 240.0.0.0.
Figure 3-4 summarizes the structure of the classful IP addresses scheme.
Private IP Addresses
The final addition to the Internet addressing protocol is that of private IP addresses. A public IP address is one that is reachable on the Internet, and therefore must be globally unique (two computers cannot use the same public IP address). You can have LANs that are not connected to the Internet, but the computers on these LANs are using IP for communication. It doesn't make sense to waste public IP addresses on these computers, so a range of addresses has been set aside for these private networks to use. (See Table 3-5.) Because they are private, the same addresses can be used on more than one LAN with the realization that communication between LANs using the same private IP addresses is not possible.
All parts reproduced from the book Routing First-Step, ISBN 1587201224, Copyright 2005, Cisco Systems, Inc. Reproduced by permission of Pearson Education, Inc., 800 East 96th Street, Indianapolis, IN 46240. Written permission from Pearson Education, Inc. is required for all other uses. Visit www.ciscopress.com for a detailed description and to learn how to purchase this title.