Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > Dashboard Users Guide > Clouds > AWS Regions > VPCs > Concepts > CIDR Block Example

CIDR Block Example

When you create a Virtual Private Cloud in EC2 using RightScale, you are allowed to configure multiple subnets within that cloud.  From there, you can launch instances in any of the subnets you have created. The means for describing your IP space for each subnet is Classless Inter-Domain Routing or a CIDR block.  CIDR is an excellent way to specify a subnet by using dotted quad IP and a subnet in a single compact string, without the more wasteful traditional netmasks (for example,  a 255.255.255.0 netmask for a Class C internet address.)  Of course, CIDR blocks also allow for more efficient use of IP addresses within the various Class A, B, or Class C internet addresses.

CIDR Block example

As an example, lets use a fictitious company LargeCorp.com, which has a Class B address with three subnets: 

LargeCorp.com Traditional IP Traditional Netmask CIDR Block notation
Subnet A 10.0.3.* 255.255.255.0 10.0.3.0/24
Subnet B 10.0.10.* 255.255.255.0 10.0.10.0/24
Subnet C 10.0.62.* 255.255.255.0 10.0.62.0/24

Netmask Refresher

For those in need of further description of how the "/24" was arrived at with respect to the netmask portion of the CIDR block:

  • The "/24" is because a network contains 256 IP addresses.  256 = 2^8 = 8 bits. IP addresses are 32 bits, and 32-8 = 24 bits left over for the network itself (as opposed to the hosts within the network).
  • Or, to put it another way, 255 in binary is 11111111 (one octet = 8 bits), so if you were to write the subnet mask in binary you would get 11111111.11111111.11111111.0. That is 24 1's, so this subnet mask can be represented by /24
  • In this case the first 24 bits of the IP address for hosts in that network will always the same - it's the network number.  That is, the part of the IP address which does not change.
  • The last 8 bits of the IP address changes per machine - it's the host number of each individual machine within that network.
  • In more complex examples you don't have to split the network/host portions up on octet boundaries. For example, an IP Address of 10.0.6.0 with subnet of 255.255.248.0 could be represented by 10.0.6.0/21.
  • The purpose of the netmask is to tell both humans and computers how to parse the IP address and extract out just the network number (or just host numbers, if you invert the netmask).
You must to post a comment.
Last modified
11:35, 26 Sep 2013

Tags

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.