Each host on a TCP/IP network is assigned a unique 32-bit IP address consisting of a network number and a host number. The network number identifies a specific network, and must be assigned by the Internet Network Information Center (InterNIC) or an accredited registrar. An Internet Service Provider (ISP) can obtain blocks of network addresses from InterNIC and can assign addresses as necessary. The host number identifies a host on a network and is assigned by the network administrator. The IP address is grouped into four binary octets (an octet is a group of eight bits) and is represented using dotted decimal notation. The minimum value for an octet is 0, and the maximum value is 255. The basic format is illustrated below.
The basic format of an IP address
IP addressing supports five address classes - A, B, C, D, and E, of which only classes A, B, and C are available for commercial use. The following table illustrates the IP address classes.
|Class||Format||Purpose||Address range||Max hosts|
|A||N.H.H.H||A few large organisations||184.108.40.206 - 220.127.116.11||16,777,214|
|B||N.N.H.H||Medium-size organisations||18.104.22.168 - 22.214.171.124||65,534|
|C||N.N.N.H||Relatively small organisations||126.96.36.199 - 188.8.131.52||254|
|D||N/A||Multicast groups (RFC 1112)||184.108.40.206 - 220.127.116.11||N/A|
|E||N/A||Experimental||240.0.0.0 - 254.255.255.255||N/A|
(N = Network number, H = Host number)
The diagram below illustrates the format of the commercial IP address classes.
The format of the commercial IP address classes
The address class can be determined using the following table. For example, IP address 172.31.1.2 has a first octet of 172, which falls between 128 and 191, so 172.31.1.2 is a Class B address.
|Class||First octet||High-order bits|
|A||1 - 126||0|
|B||128 - 191||10|
|C||192 - 223||110|
|D||224 - 239||1110|
|E||240 - 254||1111|
Note that addresses beginning with 127 are used by some systems for special purposes. Note also that addresses with all zeros in the host part of the address refer to the network itself, and addresses ending in 255 are not used to refer to individual hosts on the network, since they are considered to be broadcast addresses.
IPv6 addresses are typically composed of a 64-bit network prefix, and a 64-bit host part. The host part may be automatically generated from the interface's MAC address, or assigned sequentially. IPv6 addresses are normally written as eight groups of four hexadecimal numbers. A group consisting solely of zeros can be omitted. For example, 2001:0db8:85a3:0000:1319:8a2e:0370:1337 can be shortened to 2001:0db8:85a3::1319:8a2e:0370:1337. Note, however, that there must be only one double colon in an address. Leading zeros in a group can also be omitted, so the addresses below are all valid and equivalent to each other: