Working with IPv4 addresses

A few examples of IPv4 addresses and subnets described using CIDR notation are as follows:

  • 192.168.100.50/24 represents the IP address 192.168.100.50, its associated routing prefix 192.168.100.0, and the subnet mask 255.255.255.0 (that is, 24 "1" bits). There are 256 total addresses in a /24, with 254 addresses available for use.
  • 172.16.1.200/23 represents the IP address 172.16.0.200, its associated routing prefix 172.16.0.0, and the subnet mask 255.255.254.0 (that is, 23 "1" bits). There are 512 total addresses in a /23, with 510 addresses available for use.
  • 10.0.10.4/22 represents the IP address 10.0.10.4, its associated routing prefix 10.0.8.0, and the subnet mask 255.255.252.0 (that is, 22 "1" bits). There are 1,024 total addresses in a /22, with 1,022 addresses available for use.

Not every address in a subnet might be usable, as the first and last addresses are usually reserved as the network and broadcast addresses, respectively. As a result, Neutron will not assign the first or last address of a subnet to network resources, including instances. Use the following formula to determine the total number of usable addresses in a subnet when sizing your network. The x variable represents the number of host bits available in the subnet mask:

2ˆx-2 = number of useable addresses in a subnet 

Keep in mind that when creating a subnet, it is important to plan ahead as the subnet mask, or CIDR, is currently not an updatable attribute. When instances and other resources consume all of the available IP addresses in a subnet, devices can no longer be added to the network. To resolve this, a new subnet will need to be created and added to the existing network, or an entirely new network and subnet will need to be created. Depending on your network infrastructure, this might not be an easy change to implement.

VLSM and CIDR, to an extent, are important when designing networks for use within an OpenStack cloud and will play an even more important role when we discuss the use of subnet pools later on in this chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset