IP addresses are divided into five classes labelled A to E. In classes A to C, the 32-bit IP address is divided into two fields: an upper network number field that identifies the network and a host number field that identifies a network interface on a physical system attached to that network. A system connected to more than one network (e.g. a router) will have a different IP number for each network interface. To join the Internet, a host must be allocated at least one IP number in one of the Classes A, B or C, 0.0.0.0 223.255.255.255, and thus attached to some network in the Internet.
Figure 1: IP number formats
Each Class A network may have 224
hosts, each Class B network, 216 hosts and each Class C network only
256 hosts.
Class |
Bit 0-3 |
Network range |
Host range |
A |
0xxx |
0.0.0.0127.0.0.0 |
0.0.0255.255.255 (224 hosts) |
B |
10xx |
128.0.0.0191.255.0.0 |
0.0255.255 (216 hosts) |
C |
110x |
192.0.0.0223.255.255.0 |
0255 (256 hosts) |
D |
1110 |
224.0.0.0239.255.255.255 |
N/A |
E |
1111 |
240.0.0.0255.255.255 |
N/A |
Table 1 IP number classes
Some IP addresses are reserved for special purposes:
the address belonging to any network with a host number of 0 is called the network address of the network (it does not denote any host);
addresses with a network number of 0 are used to refer to the current network, allowing a host to send to a neighbour without needing to know the network number of its local network (IP packets with a destination network address of 0 are not routed);
0.0.0.0 means "this host" (used only when host doesnt know its own IP number, for example, when querying a DHCP server);
255.255.255.255 (limited broadcast address) means all hosts on current physical network;
any address with host number of all (binary) 1's (directed broadcast address) means all hosts on current network (including hosts on other IP subnets).
any number beginning with 127 (loopback address) should go straight from a host's output to its input (without being transmitted onto the network). Any host address may be used with 127, but conventionally the commonest is 127.0.0.1.
The network number space is under ultimate control of IANA (Internet Assigned Numbers Authority) but assignment of numbers is now delegated to various Regional Internet Registries (ARIN in America, RIPE in Europe etc). Originally an organisation requiring a network number would be allocated a Class A, Class B or Class C number, but as demand increased this scheme proved very inefficient at using the limited address space. To alleviate this problem the Internet authorities have introduced a system known as classless addressing which allows the network number to be any number of bits long (from 2 to 32). The original system using Class A, B and C addresses is now called classful.
Looking at an IP number alonehether a network is classless or classful, its network mask is a 32-bit number which if bitwise ANDed with any IP address belonging to the network would yield the network address. An example of a network with a 24-bit network number is shown in Figure 2.
Three ranges are reserved for private networks: 10.x.x.x; 172.16.x.x 172.31.x.x; and 192.168.0.x 192.168.255.x and are guaranteed not to be allocated as real Internet addresses. Any network using private addresses must not be directly connected to the Internet but must rather be linked to it by some device capable of address translation: such a device will hide the individual hosts on the private network from the Internet. A host cannot send an IP packet to a private address unless it is on the same private network as that address.