IP addressing and CIDR blocks

5 minutes 5 Questions

IP addressing and CIDR (Classless Inter-Domain Routing) blocks are fundamental concepts for designing AWS network architectures. An IP address is a unique numerical identifier assigned to each device in a network, enabling communication between resources. In AWS, you work primarily with IPv4 addresses (32-bit) and increasingly with IPv6 addresses (128-bit). CIDR notation provides a method for allocating IP addresses and defining network boundaries. It consists of an IP address followed by a forward slash and a number (e.g., 10.0.0.0/16). The number after the slash represents the network prefix length, indicating how many bits are fixed for the network portion. The remaining bits determine available host addresses. For AWS VPC design, understanding CIDR is essential. When creating a VPC, you must specify a CIDR block between /16 (65,536 addresses) and /28 (16 addresses). Common private IP ranges include 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. Key considerations for organizational complexity include: 1. **Non-overlapping ranges**: When connecting multiple VPCs through peering or Transit Gateway, CIDR blocks must not overlap to enable proper routing. 2. **Subnet planning**: Divide your VPC CIDR into smaller subnets across Availability Zones, reserving space for future growth. 3. **Secondary CIDRs**: AWS allows adding secondary CIDR blocks to existing VPCs, providing flexibility for expansion. 4. **IP Address Management (IPAM)**: AWS VPC IPAM helps organizations plan, track, and monitor IP addresses across accounts and regions. 5. **Reserved addresses**: AWS reserves five IP addresses per subnet for networking purposes. For multi-account architectures, establish a centralized IP address allocation strategy to prevent conflicts. Consider using larger CIDR blocks initially and implementing a hierarchical addressing scheme that aligns with your organizational structure and anticipated growth patterns.

IP Addressing and CIDR Blocks - Complete Guide

Why IP Addressing and CIDR Blocks Matter

Understanding IP addressing and CIDR (Classless Inter-Domain Routing) blocks is fundamental to designing AWS network architectures. This knowledge is essential for creating VPCs, subnets, and establishing connectivity between on-premises networks and AWS. Poor IP address planning can lead to routing conflicts, wasted address space, and inability to scale your infrastructure.

What is CIDR?

CIDR is a method for allocating IP addresses and routing IP packets. It replaced the old classful addressing system (Class A, B, C) with a more flexible approach. CIDR notation combines an IP address with a suffix indicating the number of bits in the network prefix.

Format: IP_address/prefix_length (e.g., 10.0.0.0/16)

How CIDR Works

The prefix length (the number after the slash) indicates how many bits are reserved for the network portion:

- /8 = 16,777,216 addresses (255.0.0.0 subnet mask)
- /16 = 65,536 addresses (255.255.0.0 subnet mask)
- /24 = 256 addresses (255.255.255.0 subnet mask)
- /28 = 16 addresses (255.255.255.240 subnet mask)

Key Formula: Number of available addresses = 2^(32 - prefix_length)

AWS VPC CIDR Considerations

- VPC CIDR range: /16 (largest) to /28 (smallest)
- AWS reserves 5 IP addresses in each subnet (first 4 and last 1)
- Secondary CIDR blocks can be added to VPCs
- CIDR blocks must not overlap with existing VPCs when peering

Private IP Ranges (RFC 1918)

- 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)

Subnet Sizing Best Practices

- Plan for growth; choose larger CIDR blocks when possible
- Use /24 or larger for most subnets
- Consider high availability across multiple Availability Zones
- Leave room for additional subnets in your VPC design

Exam Tips: Answering Questions on IP Addressing and CIDR Blocks

1. Memorize Common CIDR Calculations:
Know that /24 = 256 IPs, /25 = 128 IPs, /26 = 64 IPs, /27 = 32 IPs, /28 = 16 IPs. For AWS subnets, subtract 5 for usable addresses.

2. Watch for Overlapping CIDR Scenarios:
Questions often test whether CIDR blocks can be peered or connected. Overlapping ranges cannot be peered. Example: 10.0.0.0/16 overlaps with 10.0.1.0/24.

3. Understand Non-Overlapping Requirements:
VPC peering, Transit Gateway attachments, and VPN connections all require non-overlapping CIDR blocks. When a question mentions connectivity issues, check for overlaps first.

4. Calculate Quickly Using Powers of 2:
Each decrease in prefix length doubles the addresses. /24 to /23 doubles from 256 to 512.

5. Remember AWS-Reserved Addresses:
In a /28 subnet (16 IPs), only 11 are usable. This is commonly tested when sizing subnets for specific workloads.

6. Secondary CIDR Blocks:
If a question mentions running out of IP addresses in a VPC, adding a secondary CIDR block is often the solution.

7. On-Premises Integration:
When connecting to on-premises networks, ensure the VPC CIDR does not conflict with existing corporate IP ranges. Questions may present scenarios where you must choose appropriate non-conflicting ranges.

8. Largest and Smallest Boundaries:
Remember VPC limits: /16 maximum size, /28 minimum size. Subnet must be within VPC CIDR range.
Test mode:
More IP addressing and CIDR blocks questions
30 questions (total)

Other Design Solutions for Organizational Complexity concepts

Account structure for organizational requirementsAmazon InspectorAmazon S3 Storage LensAmazon VPC networking conceptsAutomatic failure recovery architecturesAWS Backup serviceAWS BudgetsAWS Certificate Manager (ACM)AWS CloudTrailAWS Compute OptimizerAWS container networking servicesAWS Control TowerAWS Cost ExplorerAWS Direct ConnectAWS Elastic Disaster RecoveryAWS Global InfrastructureAWS IAM Identity CenterAWS Key Management Service (KMS)AWS Network FirewallAWS OrganizationsAWS Pricing CalculatorAWS PrivateLinkAWS Region and Availability Zone selectionAWS Resource Access Manager (RAM)AWS Savings PlansAWS Security HubAWS Site-to-Site VPNAWS Transit GatewayAWS Trusted AdvisorCentralized logging strategiesCentralized security event notificationsCertificate management best practicesCo-location connectivityConnectivity among multiple VPCsCost allocation tagging strategiesCross-account access managementCross-account resource sharingData backup strategiesDesigning DR solutions for RTO/RPO requirementsEffective backup and restoration strategiesEncryption strategies for data at restEncryption strategies for data in transitEvaluating VPC connectivity optionsHybrid DNS with Route 53 ResolverIAM Access AnalyzerIAM policies and permissionsIAM users, groups, and rolesKMS key policies and grantsLanding zone designMonitoring cost and usageMulti-account event notificationsMulti-account governance modelsMulti-site disaster recoveryNetwork ACLsNetwork latency requirementsNetwork segmentation and subnettingNetwork traffic monitoringOn-premises DNS integrationOn-premises to cloud integrationPilot light disaster recoveryPurchasing options impact on cost and performanceRecovery Point Objectives (RPO)Recovery Time Objectives (RTO)Reserved InstancesRoute tables for securityScale-up vs scale-out architecturesSecurity auditing strategiesSecurity groupsService Control Policies (SCPs)Spot InstancesThird-party identity provider integrationTransitive routing in AWSTroubleshooting traffic flowsVPC endpoints for service integrationsVPC Flow LogsVPC peering connectionsWarm standby disaster recovery