Understanding IP Addresses

To receive and deliver packets successfully between computers, TCP/IP requires that three values be provided by the network administrator: an IP address, a subnet mask, and a default gateway (router).

IP Addresses

Every device attached to a TCP/IP network is identified by a unique IP address. (If a computer has multiple network adapters, each adapter will have its own IP address.) This address is typically represented in dotted-decimal notation—that is, with the decimal value of each octet (8 bits, or 1 byte) of the address separated by a period. The following is a sample IP address:


172.16.48.1

Important

Because IP addresses identify devices on a network, each device on the network must be assigned a unique IP address.

Network ID and Host ID

Although an IP address is a single value, it contains two pieces of information: the network ID and the host ID of your computer.

A computer connected to a TCP/IP network uses the network ID and host ID to determine which packets it should receive or ignore and to determine the scope of its transmissions. (Only computers with the same network ID accept each other's IP-level broadcast messages.)

Note

Networks that connect to the public Internet must obtain an official network ID from the Internet Network Information Center (InterNIC) to guarantee the uniqueness of the IP network ID. For more information, visit the InterNIC home page on the Internet at http://www.internic.net/

After receiving a network ID, the local network administrator must assign unique host IDs for computers within the local network. Although private networks not connected to the Internet can use their own network identifier, obtaining a valid network ID from InterNIC allows a private network to connect to the Internet in the future without reassigning addresses.

The Internet community has defined address classes to accommodate networks of varying sizes. The address class can be discerned from the first octet of an IP address. Table 7.1 summarizes the relationship between the first octet of a given address and its network ID and host ID fields. It also identifies the total number of network IDs and host IDs for each address class that participates in the Internet addressing scheme. The example in Table 7.1 uses w.x.y.z to designate the bytes of the IP address.

Table 7.1 IP Address Classes


Class


w values 1,2


Network ID


Host ID

Available networks

Available hosts per network

A

1–126

w

x.y.z

126

16,777,214

B

128–191

w.x

y.z

16,384

65,534

C

192–223

w.x.y

z

2,097,151

254


1 Inclusive range for the first octet in the IP address.

2 The address 127 is reserved for loopback testing and interprocess communication on the local computer; it is not a valid network address. Addresses 224 and above are reserved for special protocols (Internet Group Management Protocol multicast and others), and cannot be used as host addresses.

Subnet Masks

Subnet masks are 32-bit values that allow the recipient of IP packets to distinguish the network ID portion of the IP address from the host ID. Subnet masks are created by assigning 1s to network ID bits and 0s to host ID bits. The 32-bit value is then converted to dotted-decimal notation, as shown in Table 7.2.

Table 7.2 Default Subnet Masks for Standard IP Address Classes

Address class

Bits for subnet mask

Subnet mask

Class A

11111111 00000000 00000000 00000000

255.0.0.0

Class B

11111111 11111111 00000000 00000000

255.255.0.0

Class C

11111111 11111111 11111111 00000000

255.255.255.0


For example, when the IP address is 172.16.16.1 and the subnet mask is 255.255.0.0, the network ID is 172.16 and the host ID is 16.1.

Because the class of a host is easily determined, configuring a host with a subnet mask might seem redundant. But subnet masks are also used to further segment an assigned network ID among several local networks. Sometimes only portions of an octet need to be segmented, using only a few bits to specify subnet IDs.

Important

To prevent addressing and routing problems, all computers on a logical network must use the same subnet mask and network ID.