IPv4 Address Space

The IP address space is managed globally by the Internet Assigned Number Authority (IANA) and by five regional internet registries (RIR) which control the assignment to local Internet registries.

Special IPs and Ranges

127.0.0.1

Loopback address, commonly known as localhost

0.0.0.0 - 0.255.255.255

Unused but reserved addressed. 0.0.0.0 is used to specify any IP address of a host when opening a socket, which means it will listen to all network interfaces.

Private Address Space

The following three blocks of the IP address space are reserved for private networks:

Network

IP address range

10.0.0.0/8

10.0.0.0 - 10.255.255.255

172.16.0.0/12

172.16.0.0 - 172.31.255.255

192.168.0.0/16

192.168.0.0 - 192.168.255.255

Addresses out these range can not be routed on the public Internet.

Subnets

You can take a given IP range and subdivide it into smaller networks. These are called subnets. They are created by increasing the number of bits used for the network ID. Let’s take the following network as an example:

Network

IP address range

# of IPs

192.168.0.0/16

192.168.0.0 - 192.168.255.255

65,536

../../_images/subnet_16.png

Here the network ID has 16 bits, and 16 bits for the host ID. This IP block has \(2^{16}\) = 65536 unique IPs. For each bit we add to the network ID, the number of subnets we can create out of this block increases by a factor of 2, while the number of available IPs in each block decreases by a factor of 2.

2 subnets out of 192.168.0.0/16 block:

Network

IP address range

# of IPs

192.168.0.0/17

192.168.0.0 - 192.168.127.255

32,768

192.168.128.0/17

192.168.128.0 - 192.168.255.255

32,768

../../_images/subnet_17.png

4 subnets out of 192.168.0.0/16 block:

Network

IP address range

# of IPs

192.168.0.0/18

192.168.0.0 - 192.168.63.255

16,384

192.168.64.0/18

192.168.64.0 - 192.168.127.255

16,384

192.168.128.0/18

192.168.128.0 - 192.168.191.255

16,384

192.168.192.0/18

192.168.192.0 - 192.168.255.255

16,384

../../_images/subnet_18.png

Reserved addresses

The first and the last IP of a subnet are reserved as network and broadcast addresses. E.g., in the 192.168.0.0/16 network you can not assign 192.168.0.0 and 192.168.255.255. This reduces your effective number of available IPs by 2.

Network

Available IP address range

# of IPs

192.168.0.0/16

192.168.0.1 - 192.168.255.254

65,534

Network

Available IP address range

# of IPs

192.168.0.0/17

192.168.0.1 - 192.168.127.254

32,766

192.168.128.0/17

192.168.128.1 - 192.168.255.254

32,766

Network

Available IP address range

# of IPs

192.168.0.0/18

192.168.0.1 - 192.168.63.254

16,382

192.168.64.0/18

192.168.64.1 - 192.168.127.254

16,382

192.168.128.0/18

192.168.128.1 - 192.168.191.254

16,382

192.168.192.0/18

192.168.192.1 - 192.168.255.254

16,382

Note

While it is possible to assign IP addresses with .0 at the end if the subnet allows it, it is generally avoided to prevent confusion. That is why you will likely not see an IP assignment of 192.168.1.0 in a network such as 192.168.0.0/16, even though it would technically be a legal IPs in that subnet.