3 4

Lesson 2: IP Addressing

The self-contained IP addressing system is one of the most important elements of the TCP/IP protocol suite. IP addresses enable systems running any operating system on any platform to communicate by providing unique identifiers for the system itself and for the network on which it is located. Understanding how IP addresses are constructed and how they should be assigned is an essential part of the TCP/IP network administration process.


After this lesson, you will be able to

Estimated lesson time: 20 minutes


An IP address is a 32-bit value that contains both a network identifier and a host identifier. The address is notated using four decimal numbers ranging from 0 to 255, separated by periods, as in 192.168.1.44. This is known as dotted decimal notation. Each of the four values is the decimal equivalent of an 8-bit binary value. For example, the binary value 10101010 is equal to the decimal value 170. To properly understand some of the concepts of IP addressing, it is important to remember that the familiar decimal numbers have binary equivalents.

NOTE
In TCP/IP terminology, each of the 8-bit values that make up an IP address is often called an octet (or sometimes even a quad), and the combination of four octets is called a word. The more traditional term byte was avoided because some computing platforms use a 7-bit rather than an 8-bit byte. Today, either octet or byte is appropriate.

IP addresses represent network interface adapters, of which there can be more than one in a computer. A router, for example, has interfaces to at least two networks, and must therefore have an IP address for each of those network interface adapters. Workstations typically have only a single LAN interface, but in some cases, they use a modem to connect to another network, such as the Internet. When this is the case, the modem interface has its own separate IP address (usually assigned by the server at the other end of the connection) as well as that of the LAN connection. If other systems on the LAN access the Internet through that computer's modem, that system is actually functioning as a router.

IP Address Assignments

Unlike hardware addresses, which are hardcoded into network interface adapters at the factory, network administrators must assign IP addresses to the systems on their networks. It is essential for each network interface adapter to have its own unique IP address; when two systems have the same IP address, they cannot communicate with the network properly.

As mentioned earlier, IP addresses consist of two parts: a network identifier and a host identifier. All of the network interface adapters on a particular subnet have the same network identifier, but a different host identifier. For systems that are on the Internet, the network identifiers are assigned by a body called the Internet Assigned Numbers Authority (IANA). This is to ensure that there is no address duplication on the Internet. When an organization registers its network, it is assigned a network identifier, and it is then up to the network administrators to assign unique host identifiers to each of the systems on that network. This two-tier system of administration is one of the basic principles of the Internet. Domain names are assigned in the same way.

NOTE
While the IANA is responsible for maintaining the network address assignments, virtually all of the IP addresses available using the current addressing scheme have already been assigned to Internet Service Providers (ISPs). When you are building a new network and want to obtain a registered network address, you now get one from an ISP, not directly from the IANA.

IP Address Classes

The most complicated aspect of an IP address is that the division between the network identifier and the host identifier is not always in the same place. A hardware address, for example, consists of 3 bytes assigned to the manufacturer of the network adapter and 3 bytes which the manufacturer itself assigns to each card. IP addresses can have various numbers of bits assigned to the network identifier, depending on the size of the network.

The IANA defines several different classes of IP addresses, which provide support for networks of different sizes, as shown in Figure 8.5. The configurations of the three basic IP address classes are listed in Table 8.2.

Figure 8.5-The three classes of IP addresses have different sized network and host identifiers.
Figure 8.5  The three classes of IP addresses have different sized network and host identifiers.

Table 8.2  IP address classes and parameters

Class First Bits First Byte Values Network ID Bits Host ID Bits Number of Networks Number of Hosts

A

0

1 through 127

8

24

126

16,777,21 4

B

10

128 through 191

16

16

16, 384

65,534

C

110

192 through 223

24

8

2,097,152

254

NOTE
In addition to Classes A, B, and C, there are two more classes: Class D and Class E. Class D addresses begin with the bit values 1110 and are reserved for use as multicast addresses. A multicast transmission is one that addresses a specific group of systems on a network. Class E addresses begin with bits 11110 and are as yet unused.

To the mathematically adept, the numbers for supported networks and hosts might appear low. However, there are a few rules that exclude some possible values.

The binary values of the first bits of each address class determine the possible decimal values for the first byte of the address. For example, because the first bit of Class A addresses must be 0, the binary values of the first byte range from 00000001 to 01111111, which in decimal form is 1 to 127. Thus, when you see an IP address in which the first byte is a number from 1 to 127, you know that this is a Class A address. In a Class A address, the network identifier is the first 8 bits and the host identifier is the remaining 24 bits. This means that there are only 126 possible Class A networks (network identifier 127 is reserved for diagnostic purposes), but each network can have up to 16,777,214 network interface adapters on it. Class B and Class C addresses devote more bits to the network identifier, which means that they support a greater number of networks, but at the cost of having fewer host identifier bits, which reduces the number of hosts on each network.

Subnet Masking

It may at first seem odd that IP address classes are assigned in this way. After all, there aren't any private networks that have 16 million hosts on them, so it makes little sense even to have Class A addresses. However, it's possible to subdivide IP addresses even further by creating subnets on them. A subnet is simply a subdivision of a network address that can be used to represent one LAN on an internetwork or the network of one of the ISP's clients. Thus, a large ISP might have a Class A address registered to it, and it might farm out pieces of the address to its clients in the form of subnets. In many cases, a large ISP's clients are smaller ISPs, which in turn supply addresses to their own clients.

To understand the process of creating subnets, you must understand the function of the subnet mask. When you configure a TCP/IP system, you assign it an IP address and a subnet mask, but many people don't know what the function of the mask is. Simply put, the subnet mask specifies which bits of the IP address are the network identifier and which bits are the host identifier. For a Class A address, for example, the correct subnet mask value is 255.0.0.0. When expressed as a binary number, a subnet mask's 1 bits indicate the network identifier, and its 0 bits indicate the host identifier. A mask of 255.0.0.0 in binary form is as follows:

11111111 00000000 00000000 00000000

Thus, this mask indicates that the first 8 bits of a Class A IP address are the network identifier bits and the remaining 24 bits are the host identifier. The subnet masks for the three main address classes are listed in Table 8.3.

Table 8.3  Subnet masks for IP address classes

Class Subnet Mask

A

255.0.0.0

B

255.255.0.0

C

255.255.255.0

If all addresses of a particular class used the same number of bits for the network and host identifiers, there would be no need for a subnet mask. The value of the address's first byte would indicate its class. However, you can create multiple subnets within a given address class by using a different mask. If, for example, you have a Class B address, using a subnet mask of 255.255.0.0 would allocate the first 16 bits for the network identifier and the last 16 bits for the host identifier. If you use a mask of 255.255.255.0, you allocate an additional 8 bits to the network identifier. The third byte of the address thus becomes a subnet identifier, as shown in Figure 8.6. You can create up to 254 subnets using that one Class B address, with up to 254 network interface adapters on each subnet. An IP address of 131.24.67.98 would therefore indicate that the network is using the Class B address 131.24.0.0, and that the interface is host number 98 on subnet 67. A large corporate network might do this to create a separate subnet for each of its LANs.

Figure 8.6-Changing the subnet mask enables you to create multiple subnets out of one network address.
Figure 8.6  Changing the subnet mask enables you to create multiple subnets out of one network address.

To complicate matters further, however, the boundary between the network identifier and the host identifier does not have to fall in between two bytes. An IP address can use any number of bits for its network address, and more complex subnet masks are needed in this type of environment. Suppose, for example, you have a Class C address of 199.24.65.0 that you want to subnet. There are already 24 bits devoted to the network address, and you obviously can't allocate the entire fourth byte as a subnet identifier, or there would be no bits left for the host identifier. You can, however, allocate part of the fourth byte. If you use 4 bits of the last byte for the subnet identifier, you have 4 bits left for your host identifier. To do this, the binary form of your subnet mask must appear as follows:

11111111 11111111 11111111 11110000

The decimal equivalent of this binary value is 255.255.255.240, because 240 is the decimal equivalent of 11110000. This leaves you with a 4-bit subnet identifier and a 4-bit host identifier, which means that you can create up to 14 subnets (subnet identifiers have the same not all ones and not all zeros rules as do network IDs and host IDs) with 14 hosts on each one. Figuring out the correct subnet mask for this type of configuration is relatively easy. Figuring out the IP addresses you must assign to your workstations is harder. To do this, you have to increment the 4 subnet bits separately from the 4 host bits. Once again, this is easier to understand when you look at the binary values. The 4-bit subnet identifier can have any one of the following fourteen values:

0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110
TIP
The Calculator program included with Windows has a scientific mode that easily converts numbers between binary and decimal values. After launching the program, choose Scientific from the View menu, and then select either the Dec or the Bin radio button. You can then enter a value and click the other radio button to convert it.

Each one of these subnets can have up to 14 workstations, with each host identifier having one of the values from that same set of 14 values. Thus, to calculate the value of the IP address's fourth byte, you must combine the binary values of the subnet and host identifiers and convert them to decimal form. For example, the first host (0001) on the first subnet (0001) would have a fourth byte binary value of 00010001, which in decimal form is 17. Thus, the IP address for this system would be 199.24.65.17, and its subnet mask would be 255.255.255.240.

TIP
Fortunately, there are utilities available that simplify the process of calculating these addresses, so that you don't have to do them manually. One of the best of these is a freeware program from Net3 Group called IP Subnet Calculator, which is available for download at www.net3group.com/ipcalc.asp.

Registered and Unregistered Addresses

Registered IP addresses are required for computers that are accessible from the Internet, but not by every computer that is connected to the Internet. For security reasons, networks typically use a firewall or some other technology to protect their systems from intrusion by outside computers. These firewalls use various techniques that provide workstations with access to Internet resources without making them accessible to other systems on the Internet.

These workstations typically use unregistered private IP addresses, which the network administrator can freely assign without the necessity of obtaining them from an ISP or the IANA. There are special network addresses in each class (as shown in Table 8.4) that are intended for use on private networks and are not registered to anyone. When building your own private network, you should use these addresses rather than simply choose an address at random.

Table 8.4  IP addresses for private networks

Class Network Address

A

10.0.0.0 through 10.255.255.255

B

172.16.0.0 through 172.31.255.255

C

192.168.0.0 through 192.168.255.255

Exercise 8.2: Variable-Length Subnetting

Specify the subnet mask value you would use for each of the following network configurations:

  1. A Class C network address with a 2-bit subnet identifier
  2. A Class A network address with a 16-bit host identifier
  3. A Class B network address with a 6-bit subnet identifier
  4. A Class A network address with a 21-bit host identifier
  5. A Class B network with a 9-bit host identifier