IPv4 Addressing

An IPv4 address is a 32-bit address that is usually represented in dotted decimal notation, with a decimal value representing each of the 4 octets (bytes) that make up the address. For example:
    00001001010000110110000100000010        32-bit address
    00001001 01000011 01100001 00000010     4 octets
       9        67       97       2         dotted decimal notation (9.67.97.2)
The IP address consists of a network address and a host address. Within the internet, the network addresses are assigned by a central authority, the Network Information Center (NIC). The portion of the IPv4 address that is used for each of these addresses is determined by the class of address. There are four commonly used classes of IPv4 address (see Figure 1).
Figure 1. Classes of IP Addresses
Classes of IP Addresses
The class of address of the IPv4 network is determined from the first 4 bits in the first octet of the IP address. Figure 2 shows how the class of address is determined.
Figure 2. Determining the Class of an IP Address
    32-bit address           xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx

    Class A                  0xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
                   min       00000000
                   max       01111111
                   range     0 - 127    (decimal notation)

    Class B                  10xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
                   min       10000000
                   max       10111111
                   range     128 - 191  (decimal notation)

    Class C                  110xxxxx xxxxxxxx xxxxxxxx xxxxxxxx
                   min       11000000
                   max       11011111
                   range     192 - 223  (decimal notation)

    Class D                  1110xxxx xxxxxxxx xxxxxxxx xxxxxxxx
                   min       11100000
                   max       11101111
                   range     224 - 239.255.255.255
       

As shown in Figure 2, the value of the bits in the first octet determine the class of address, and the class of address determines the range of values for the network and host segment of the IP address. For example, the IP address 9.67.97.2 would be a class A address, since the first 2 bits in the first octet contain B'00'. The network part of the IP address is 9 and the host part of the IP address is 67.97.2.

Refer to RFC 1166 - Internet Numbers for more information about IP addresses. Refer to RFC 1060 - Assigned Numbers for more information about reserved network and host IP addresses, such as a network broadcast address.