This section provides details about IP addresses and subnet masks.
Every host interface, or node, on a TCP/IP network is identified by a unique IP address. This address is used to identify a host on a network; it also specifies routing information in an internetwork. The IP address identifies a computer as a 32-bit address that is unique across a TCP/IP network. An address is usually represented in dotted decimal notation, which depicts each octet (eight bits, or one byte) of an IP address as its decimal value and separates each octet with a period. An IP address looks like this:
102.54.94.97
Although an IP address is a single value, it contains two pieces of information: the network ID and the host (or system) ID for your computer.
Networks that connect to the public Internet must obtain an official network ID from the InterNIC to guarantee unique IP network IDs. 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 choose to use their own network identifiers, 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. Each network class can be discerned from the first octet of its IP address. The following table 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. This sample uses w.x.y.z to designate the bytes of the IP address.
IP Address Classes
Class | w values1,2 | Network ID | Host ID | Available networks | Available hosts per net | |
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 (IGMP multicast and others), and cannot be used as host addresses.
A network host 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 nodes with the same network ID accept each other's IP-level broadcasts).
Because the sender's IP address is included in every outgoing IP packet, it is useful for the receiving computer to derive the originating network ID and host ID from the IP address field. This is done by using subnet masks, as described in the following section.
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. Similar to an IP address, the value of a subnet mask is frequently represented in dotted decimal notation. Subnet masks are determined by assigning 1s to bits that belong to the network ID and 0s to bits that belong to the host ID. When the bits are in place, the 32-bit value is converted to dotted decimal notation, as shown in the following table.
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 |
The result allows TCP/IP to determine the host and network IDs of the local computer. For example, when the IP address is 102.54.94.97 and the subnet mask is 255.255.0.0, the network ID is 102.54 and the host ID is 94.97.
Although configuring a host with a subnet mask might seem redundant after examining the previous tables (since the class of a host is easily determined), subnet masks are also used to further segment an assigned network ID among several local networks.
For example, suppose a network is assigned the Class-B network address 144.100. This is one of over 16,000 Class-B addresses capable of serving more than 65,000 nodes. However, the worldwide corporate network to which this ID is assigned is composed of 12 international LANs with 75 to 100 nodes each. Instead of applying for 11 more network IDs, it is better to use subnetting to make more effective use of the assigned ID 144.100. The third octet of the IP address can be used as a subnet ID, to define the subnet mask 255.255.255.0. This splits the Class-B address into 254 subnets: 144.100.1 through 144.100.254, each of which can have 254 nodes. (host IDs 0 and 255 should not be assigned to a computer; they are used as broadcast addresses, which are typically recognized by all computers.) Any 12 of these network addresses could be assigned to the international LANs in this example. Within each LAN, each computer is assigned a unique host ID, and they all have the subnet mask 255.255.255.0.
The preceding example demonstrates a simple (and common) subnet scheme for Class-B addresses. Sometimes it is necessary to segment only portions of an octet, using only a few bits to specify subnet IDs (such as when subnets exceed 256 nodes). Each user should check with the local network administrator to determine the network's subnet policy and the correct subnet mask. For all systems on the local network, the subnet mask must be the same for that network ID.