Networking for VPCs

CIDR (Classless Inter-Domain Routing)

  • The formula to calculate the number of assignable IP address:

    • Subtract the number of network bits from 32 and raise 2 to that power.

    • For example, a /24 network has (2^(32-24)) is 256 addresses.

  • For example for 10.0.0.0:

    • A /10 prefix = 10.0.0.0 to 10.255.255.255.

    • A /16 prefix = 10.0.0.0 to 10.0.255.255.

    • A /24 prefix = 10.0.0.0 to 10.0.0.255. A /32 prefix = 10.0.0.0.

  • Bigger the IP network prefix (the number after the slash) = Smaller the range of IP addresses.

    • For example, in AWS, your VPC must be /16 or smaller, which is anything in between /16 and /32.

Private vs Public IP

  • Private IP address of a system is the IP address which is used to communicate within the same network.

    • 10.0.0.0 to 10.255.255.255 (Big networks, like offices) 172.16.0.0 to 172.31.255.255 (Default for AWS) 192.168.0.0 to 192.168.255.255 (Small networks, like homes)

  • Public IP address of a system is the IP address which is used to communicate outside the network.

    • Assigned by the ISP (Internet Service Provider).

Last updated