IP version 4 (IPv4) addresses are 32 bits long, as Figure A shows. IPv4 addresses typically occur as a sequence of four numbers that represent the decimal value of each of the address bytes. Because periods separate the values in IPv4 addresses, the IPv4 address notation is called dotted decimal.
IP addresses are hierarchical for routing purposes (as are the addresses of all Open Systems Interconnection—OSI—network layer protocols) and divided into two subfields. The Network Identifier (NET_ID) subfield identifies the IP subnetwork and facilitates high-level routing between networks in much the same way country codes, city codes, and area codes facilitate routing in telephone networks. The Host Identifier (HOST_ID) subfield identifies the specific host within a subnetwork.
To accommodate different-size networks, IP defines several classful addresses. Classes A, B, and C apply to host addressing; the only difference between the three classes is the length of the NET_ID subfield.
Class A addresses have a 7-bit NET_ID and a 24-bit HOST_ID. Class A addresses apply to very large networks and can address up to 16,777,216 (224) hosts per network. The first segment of a Class A address is a number between 1 and 126; however, very few networks are this large. IBM's network has a Class A address.
Class B addresses have a 14-bit NET_ID and a 16-bit HOST_ID. Class B addresses apply to moderate-size networks and can address up to 65,536 (216) hosts per network. The first segment of a Class B address is a number between 128 and 191. The Class B address space has been under threat of depletion for some time, and getting a new Class B address is difficult. (To learn more about the IP address-depletion problem and the coming change in IP addressing from IPv4 to IPv6, see Tao Zhou, "The Next Generation IP in Action," June 1998.) America Online's (AOL's) network has a Class B address.
Class C addresses have a 21-bit NET_ID and an 8-bit HOST_ID. These addresses apply to small networks and can address only up to 256 (28) hosts per network. The first segment of a Class C address is a number between 192 and 223. Currently, most networks receive Class C (or sub-Class C) address assignments; one example includes Saint Michael's College in Colchester, Vermont.
The remaining two address classes apply to special functions only. Class D addresses, which begin with a value between 224 and 239, are for IP multicasting (i.e., broadcasting one packet to multiple hosts). Class E addresses begin with a value between 240 and 255 and are for experimental use.
Several NET_ID and HOST_ID values either are reserved or have special meaning. A HOST_ID of 0 is a dummy value reserved as a placeholder when referring to an entire subnetwork; the address 192.168.99.0 refers to a Class C address with a NET_ID of 192.168.99. A HOST_ID consisting solely of ones (usually written 255 but also sometimes depicted as -1) is the broadcast address and refers to all hosts on a network. The NET_ID value 127 is for loopback testing, and the address 127.0.0.1 refers to the localhost.
Request for Comments (RFC) 1918 reserves several NET_IDs for private network addresses, and routers won't pass packets over the Internet to these network addresses. The reserved NET_IDs are the Class A address 10.0.0.0 (formerly assigned to ARPAnet), the 16 Class B addresses from 172.16.0.0 to 172.31.0.0, and the 256 Class C addresses from 192.168.0.0 to 192.168.255.0. Organizations with private network addresses frequently use the addresses on a network sitting behind a firewall or router that performs Network Address Translation (NAT). NAT converts a host's private address to a public IP address for Internet use. One advantage to using NAT is that an organization need not change host addresses if the organization changes service providers and receives another public IP address.
An additional addressing tool is the subnet mask. The subnet mask indicates the portion of the address that identifies the network (or subnetwork) for routing purposes. The subnet mask appears in dotted decimal, and the total number of ones that a subnet mask contains identifies the significant NET_ID bits (for fans of Boolean logic, the subnet mask and the entire 32-bit IP address are ANDed together to obtain the relevant NET_ID bits). Table A shows the subnet mask and number of significant address bits for the NET_ID in classful IP addresses. Depending on the context and literature, subnet masks appear in dotted decimal form or simply as a number representing the number of significant address bits for the NET_ID. Thus, 192.168.99.17 255.255.255.0 and 192.168.99.17/24 both refer to a Class C NET_ID of 192.168.99.
Subnet masks can also subdivide a large address space or combine multiple small address spaces. A network might subdivide its address space to define multiple logical networks by segmenting the HOST_ID subfield into a Subnetwork Identifier (SUBNET_ID) and (smaller) HOST_ID. For example, an organization with an assigned Class B address space of 184.108.40.206 might segment the address into a 16-bit NET_ID, 4-bit SUBNET_ID, and 12-bit HOST_ID. The subnet mask for routing to the NET_ID on the Internet would be 255.255.0.0 (or 16 bits), and the mask for routing to individual subnets within the larger Class B address space would be 255.255.240.0 (or 20 bits). Alternatively, an organization with the assigned four Class C addresses of 220.127.116.11, 18.104.22.168, 22.214.171.124, and 126.96.36.199 might use the subnet mask 255.255.252.0 (or 22 bits) for routing to this domain. Using subnet masks in routing tables to consolidate addresses using NET_IDs that aren't one, two, or three bytes in length is termed Classless Inter-Domain Routing (CIDR).