<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[IP Addressing and AWS Networking]]></title><description><![CDATA[IP Addressing and AWS Networking]]></description><link>https://ip-addressing-and-aws-networking.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 27 Oct 2026 21:55:31 GMT</lastBuildDate><atom:link href="https://ip-addressing-and-aws-networking.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[CIDR Unlocked: The Ultimate Guide to AWS Networking & IP Addressing for DevOps]]></title><description><![CDATA[Networking is the backbone of DevOps, AWS, and Kubernetes, and CIDR (Classless Inter-Domain Routing) is one of the most critical concepts. If you've ever…]]></description><link>https://ip-addressing-and-aws-networking.hashnode.dev/cidr-unlocked-the-ultimate-guide-to-aws-networking-and-ip-addressing-for-devops</link><guid isPermaLink="true">https://ip-addressing-and-aws-networking.hashnode.dev/cidr-unlocked-the-ultimate-guide-to-aws-networking-and-ip-addressing-for-devops</guid><category><![CDATA[AWS]]></category><category><![CDATA[CIDR]]></category><category><![CDATA[cidrsubnets]]></category><category><![CDATA[ip address]]></category><category><![CDATA[subnetting]]></category><dc:creator><![CDATA[Shraddha Modhera]]></dc:creator><pubDate>Tue, 11 Mar 2025 04:48:54 GMT</pubDate><content:encoded><![CDATA[<p>Networking is the backbone of <strong>DevOps, AWS, and Kubernetes</strong>, and <strong>CIDR (Classless Inter-Domain Routing)</strong> is one of the most critical concepts. If you've ever been confused by <strong>subnet masks, IP ranges, AWS reserved IPs, or Terraform CIDR calculations</strong>, this guide will clear everything up!</p>
<p>By the end of this blog, you’ll understand:<br />✅ <strong>How CIDR works and how to calculate IP ranges manually</strong><br />✅ <strong>AWS's reserved IPs—why they matter for VPC design</strong><br />✅ <strong>Terraform's CIDR tricks—how to let infrastructure code do the hard work</strong><br />✅ <strong>Best practices that even experienced engineers get wrong</strong></p>
<h1 id="heading-cidr-101-the-foundation-of-ip-addressing">🏗 <strong>CIDR 101: The Foundation of IP Addressing</strong></h1>
<p>At its core, <strong>CIDR (Classless Inter-Domain Routing)</strong> is just a <strong>compact way to define IP ranges.</strong> Instead of using <strong>old-school subnet masks</strong> (<code>255.255.255.0</code>), we use a <strong>prefix notation</strong> like this:</p>
<pre><code class="lang-plaintext">plaintextCopy code10.0.1.0/24
</code></pre>
<p>Here’s what’s happening:<br />🔹 <code>10.0.1.0</code> → <strong>Network address</strong><br />🔹 <code>/24</code> → <strong>Subnet mask</strong>, meaning the <strong>first 24 bits</strong> define the network, and the rest are available for hosts.</p>
<p>That’s the theory, but how do we figure out <strong>how many IPs we actually get?</strong></p>
<hr />
<h1 id="heading-manual-cidr-calculations-because-terraform-wont-always-save-you">🔢 <strong>Manual CIDR Calculations (Because Terraform Won’t Always Save You)</strong></h1>
<p>Every <strong>IPv4 address</strong> is <strong>32 bits</strong>, split into <strong>four octets (8 bits each)</strong>:</p>
<pre><code class="lang-plaintext">plaintextCopy code11000000.10101000.00000001.00000000  →  192.168.1.0
</code></pre>
<p>Each <strong>bit</strong> can be <strong>0 or 1</strong>, meaning <strong>each octet has 256 possible values (2⁸ = 256).</strong></p>
<h2 id="heading-how-many-ips-in-a-subnet"><strong>How Many IPs in a Subnet?</strong></h2>
<p>We calculate this using:</p>
<pre><code class="lang-plaintext">plaintextCopy codeTotal IPs = 2^(32 - subnet mask)
</code></pre>
<h3 id="heading-cidr-cheat-sheet"><strong>CIDR Cheat Sheet:</strong></h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>CIDR</strong></td><td><strong>Subnet Mask</strong></td><td><strong>Total IPs</strong></td><td><strong>Usable IPs</strong></td></tr>
</thead>
<tbody>
<tr>
<td><code>/32</code></td><td><code>255.255.255.255</code></td><td>1</td><td>1 (Single host)</td></tr>
<tr>
<td><code>/30</code></td><td><code>255.255.255.252</code></td><td>4</td><td>2 (Point-to-point links)</td></tr>
<tr>
<td><code>/29</code></td><td><code>255.255.255.248</code></td><td>8</td><td>6</td></tr>
<tr>
<td><code>/28</code></td><td><code>255.255.255.240</code></td><td>16</td><td>14</td></tr>
<tr>
<td><code>/27</code></td><td><code>255.255.255.224</code></td><td>32</td><td>30</td></tr>
<tr>
<td><code>/26</code></td><td><code>255.255.255.192</code></td><td>64</td><td>62</td></tr>
<tr>
<td><code>/25</code></td><td><code>255.255.255.128</code></td><td>128</td><td>126</td></tr>
<tr>
<td><code>/24</code></td><td><code>255.255.255.0</code></td><td>256</td><td>254</td></tr>
<tr>
<td><code>/16</code></td><td><code>255.255.0.0</code></td><td>65,536</td><td>65,534</td></tr>
<tr>
<td><code>/8</code></td><td><code>255.0.0.0</code></td><td>16,777,216</td><td>16,777,214</td></tr>
</tbody>
</table>
</div><p><strong>But wait... AWS reserves 5 IPs per subnet!</strong> So let’s address that next.</p>
<hr />
<h1 id="heading-awss-5-reserved-ips-per-subnet-why-they-matter">⚠️ <strong>AWS’s 5 Reserved IPs Per Subnet – Why They Matter</strong></h1>
<p>AWS <strong>automatically reserves 5 IP addresses per subnet</strong>, which means you <strong>never get the full range of usable IPs</strong>.</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Reserved IP</strong></td><td><strong>Purpose</strong></td></tr>
</thead>
<tbody>
<tr>
<td><strong>First IP (Network Address)</strong></td><td>Identifies the subnet (e.g., <code>10.0.1.0/24</code>)</td></tr>
<tr>
<td><strong>Second IP</strong></td><td>Reserved for the <strong>VPC router</strong></td></tr>
<tr>
<td><strong>Third IP</strong></td><td>Reserved for <strong>AWS DNS services</strong></td></tr>
<tr>
<td><strong>Fourth IP</strong></td><td>Reserved for <strong>future AWS use</strong></td></tr>
<tr>
<td><strong>Last IP (Broadcast Address)</strong></td><td>AWS doesn’t support broadcast, but it’s still reserved</td></tr>
</tbody>
</table>
</div><p>🔹 <strong>Example:</strong> <code>10.0.1.0/24</code><br />Total IPs = <strong>256</strong>, but <strong>usable IPs = 251</strong> because AWS keeps <strong>5 IPs for itself</strong>.</p>
<hr />
<h1 id="heading-cidr-subnetting-with-terraform-automate-the-madness">🛠 <strong>CIDR Subnetting with Terraform (Automate the Madness)</strong></h1>
<h3 id="heading-without-terraform-painful-manual-subnetting"><strong>Without Terraform: (Painful Manual Subnetting)</strong></h3>
<p>Say you need <strong>three</strong> <code>/24</code> subnets inside a <code>10.0.0.0/16</code> VPC. You'd have to manually plan them:</p>
<pre><code class="lang-plaintext">plaintextCopy codeSubnet 1: 10.0.1.0/24
Subnet 2: 10.0.2.0/24
Subnet 3: 10.0.3.0/24
</code></pre>
<p>🚨 <strong>What if you need to scale? Or if a junior DevOps engineer messes up?</strong></p>
<h3 id="heading-with-terraform-automated-subnetting-with-cidrsubnet"><strong>With Terraform: (Automated Subnetting with</strong> <code>cidrsubnet()</code>)</h3>
<p>Terraform <strong>does the hard work for you</strong> with <code>cidrsubnet()</code>:</p>
<pre><code class="lang-plaintext">hclCopy codevariable "vpc_cidr" {
  default = "10.0.0.0/16"
}

output "subnet_1" {
  value = cidrsubnet(var.vpc_cidr, 8, 1)  # 10.0.1.0/24
}

output "subnet_2" {
  value = cidrsubnet(var.vpc_cidr, 8, 2)  # 10.0.2.0/24
}
</code></pre>
<h3 id="heading-breaking-it-down"><strong>Breaking it Down:</strong></h3>
<ul>
<li><p><strong>Base CIDR:</strong> <code>"10.0.0.0/16"</code></p>
</li>
<li><p><strong>Newbits:</strong> <code>8</code> (Takes <code>/16</code> → <code>/24</code>)</p>
</li>
<li><p><strong>Index:</strong> <code>1, 2, 3...</code> (Auto-calculates subnets)</p>
</li>
</ul>
<p>🚀 <strong>Why use Terraform?</strong> <strong>No manual mistakes, no overlapping subnets, and future-proof networking.</strong></p>
<hr />
<h1 id="heading-pro-tips-for-cidr-planning-in-aws">🔥 <strong>Pro Tips for CIDR Planning in AWS</strong></h1>
<p>✅ <strong>Leave room for growth</strong> – Don't over-allocate IPs in the beginning.<br />✅ <strong>Avoid overlapping CIDRs</strong> – Especially in multi-account setups (AWS Transit Gateway hates this).<br />✅ <strong>Plan for AWS reserved IPs</strong> – Remember that you lose <strong>5 IPs per subnet</strong>.<br />✅ <strong>Use Terraform’s</strong> <code>cidrsubnet()</code> – Automate everything; manual CIDR planning is error-prone.<br />✅ <strong>Think about private IP exhaustion</strong> – Large microservices architectures <strong>burn through private IPs fast</strong>.</p>
<hr />
<h1 id="heading-final-thoughts-cidr-is-devops-gold">🎯 <strong>Final Thoughts: CIDR is DevOps Gold</strong></h1>
<p>If you’re serious about <strong>AWS, Kubernetes, and Cloud Networking</strong>, <strong>CIDR isn’t just a topic—it’s a survival skill.</strong></p>
<p>🔹 <strong>Understand subnetting manually first.</strong><br />🔹 <strong>Remember AWS's 5 reserved IPs.</strong><br />🔹 <strong>Use Terraform to automate subnet calculations.</strong></p>
]]></content:encoded></item></channel></rss>