Basic VPC CIDR

  • CIDR stands for Classless Inter-Domain Routing.
  • It is a method for allocating IP addresses and for IP routing.
  • CIDR IP addresses are composed of two sets of numbers — Prefix and Suffix.
  • The network address is written as a prefix like you would see a normal IP address (e.g. 10.0.0.0). The second part is the suffix which indicates how many bits are in the entire address (e.g. /24). Putting it together, a CIDR IP address would look like the following.
10.0.0.0/24
  • /32 allows for 1 IP = 2⁰
  • /31 allows for 2 IP = 2¹
  • /30 allows for 4 IP = 2²
  • /29 allows for 8 IP = 2³
  • /28 allows for 16 IP = 2⁴
  • /27 allows for 32 IP = 2⁵
  • /26 allows for 64 IP = 2⁶
  • /25 allows for 128 IP = 2⁷
  • /24 allows for 256 IP = 2⁸
  • /16 allows for 65,536 IP = 2¹⁶
  • /0 allows for all IPs = 2³²
  • When you create a VPC, you must specify a range of IPv4 addresses for the VPC in the form of a Classless Inter-Domain Routing (CIDR) block.
  • AWS recommends that you specify a CIDR block (of /16 or smaller) from the private IPv4 address ranges as specified in RFC 1918.
  • Here are the address blocks you can get started with:
  • If you create a VPC with CIDR block 10.0.0.0/27, it supports 32–27=5 and 2⁵ =32 IP addresses (for addresses 10.0.0.0–10.0.0.31)
  • You can break this CIDR block into two subnets, each supporting 16 IP addresses. One subnet has CIDR 10.0.0.0/28 (for addresses 10.0.0.0–10.0.0.15) and second subnet 10.0.0.16/28 (for addresses 10.0.0.16–10.0.0.31).
  • If you create a VPC with CIDR block 10.0.0.0/24, it supports 32–24=8 and 2⁸= 256 IP addresses (for addresses 10.10.0.0–10.10.0.255)
  • You can break this CIDR block into four subnets, each supporting 64 IP addresses.
  • First subnet has CIDR 10.10.0.0/26 (for addresses 10.10.0.0–10.10.0.63)
  • Second subnet has CIDR 10.10.0.64/26 (for addresses 10.10.0.64–10.10.0.127).
  • Third subnet has CIDR 10.10.0.128/26 (for addresses 10.10.0.128–10.10.0.191).
  • Forth subnet has CIDR 10.10.0.192/26 (for addresses 10.10.0.192–10.10.0.255).
  • If you create a VPC with CIDR block 10.100.0.0/22, it supports 32–22=10 and 2¹⁰=1024 IP addresses (for addresses 10.100.0.0–10.100.3.255)
  • You can break this CIDR block into four subnets, each supporting 256 IP addresses.
  • First subnet has CIDR 10.100.0.0/24 (for addresses 10.100.0.0–10.100.0.255).
  • Second subnet has 10.100.1.0/24 (for addresses 10.100.1.0–10.100.1.255).
  • The third subnet has 10.100.2.0/24(for addresses 10.100.2.0–10.100.2.255).
  • Forth subnet 10.100.3.0/24 (for address 10.100.3.0–10.100.3.255).
  • If you create a VPC with CIDR block 10.10.0.0/16, it supports 32–16=16 and 2¹⁶=65536 IP addresses (for addresses 10.10.0.0–10.10.255.255)
  • You can break this CIDR block according to the requirement.
  • If you break this CIDR block into 16 subnets, each supporting 4096 IP addresses.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store