<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on Andy Als</title><link>https://andyals.com/posts/</link><description>Recent content in Posts on Andy Als</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>Andy Als</copyright><lastBuildDate>Tue, 20 May 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://andyals.com/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>VLANs at Home — Building a Segmented Network From Scratch</title><link>https://andyals.com/posts/2025/05/vlans-at-home-building-a-segmented-network-from-scratch/</link><pubDate>Tue, 20 May 2025 00:00:00 +0000</pubDate><guid>https://andyals.com/posts/2025/05/vlans-at-home-building-a-segmented-network-from-scratch/</guid><description>&lt;p&gt;My home network had everything on one flat subnet for years. Laptops, phones, a desktop, a NAS, a couple of smart plugs of questionable origin — all of it talking to everything else with nothing in between. It worked, but it wasn&amp;rsquo;t a network so much as a free-for-all.&lt;/p&gt;
&lt;p&gt;I finally sorted it out properly. Two VLANs — one for wired trusted devices, one for WiFi. Here&amp;rsquo;s the design and what the subnetting decisions looked like.&lt;/p&gt;</description><content type="html"><![CDATA[<p>My home network had everything on one flat subnet for years. Laptops, phones, a desktop, a NAS, a couple of smart plugs of questionable origin — all of it talking to everything else with nothing in between. It worked, but it wasn&rsquo;t a network so much as a free-for-all.</p>
<p>I finally sorted it out properly. Two VLANs — one for wired trusted devices, one for WiFi. Here&rsquo;s the design and what the subnetting decisions looked like.</p>
<hr>
<h2 id="the-topology">The topology</h2>
<p><img src="/img/posts/vlan-topology-diagram.png" alt="VLAN topology diagram showing two VLANs on separate subnets connected through a managed switch and router"></p>
<p>The diagram above shows the full picture. Gateway handles inter-VLAN routing. Managed switch carries the trunk down from the gateway and breaks it out to access ports. Two VLANs, two subnets, one physical network.</p>
<hr>
<h2 id="subnetting-decisions">Subnetting decisions</h2>
<p>This is where most people just default to /24 for everything and move on. I wanted to actually think about it.</p>
<p><strong>VLAN 10 — Wired (192.168.10.0/26)</strong></p>
<p>The wired network has maybe five or six devices on it. A /24 would give me 254 usable addresses for a network that will never have more than ten. That&rsquo;s wasteful and also lazy. A /26 gives 62 usable addresses — still plenty of headroom, and it forced me to actually calculate it instead of reaching for the default.</p>
<p>Block size for /26 is 64:</p>
<table>
  <thead>
      <tr>
          <th>Address</th>
          <th>Role</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>192.168.10.0</td>
          <td>Network address</td>
      </tr>
      <tr>
          <td>192.168.10.1</td>
          <td>Gateway</td>
      </tr>
      <tr>
          <td>192.168.10.2 — .62</td>
          <td>Usable hosts</td>
      </tr>
      <tr>
          <td>192.168.10.63</td>
          <td>Broadcast</td>
      </tr>
  </tbody>
</table>
<p>The desktop gets a static address near the bottom of the range. Picked deliberately — easy to remember, easy to target in firewall rules.</p>
<p><strong>VLAN 20 — WiFi (192.168.20.0/24)</strong></p>
<p>WiFi is a different story. Phones, laptops, tablets, guests occasionally. A /24 is reasonable here — 254 usable addresses, proper headroom. No strong reason to subnet further.</p>
<hr>
<h2 id="why-separate-vlans-at-all">Why separate VLANs at all</h2>
<p>The practical reason: I don&rsquo;t trust the WiFi devices as much as the wired ones. A laptop connecting over WiFi is probably fine, but it&rsquo;s also the network my phone is on, and guest devices when people come round. Keeping wired and WiFi separated means a problem on the WiFi side can&rsquo;t directly reach the wired network without going through the gateway first — which is where the firewall rules live.</p>
<p>The study reason: I&rsquo;m working through CCNA. Setting this up on real hardware is worth more than reading about it. Every time I check a device&rsquo;s IP or look at a firewall rule, I&rsquo;m reinforcing something.</p>
<hr>
<h2 id="whats-next">What&rsquo;s next</h2>
<p>The inter-VLAN rules are still too loose — currently I&rsquo;ve allowed everything between the two VLANs just to get connectivity working. Tightening those up is the next job. Eventually I want a third VLAN for IoT stuff, but one thing at a time.</p>
]]></content></item><item><title>Setting Up VLANs and a VPN on My Home Network</title><link>https://andyals.com/posts/2025/05/setting-up-vlans-and-a-vpn-on-my-home-network/</link><pubDate>Sun, 18 May 2025 00:00:00 +0000</pubDate><guid>https://andyals.com/posts/2025/05/setting-up-vlans-and-a-vpn-on-my-home-network/</guid><description>&lt;p&gt;This took me way longer than it probably should have but I learned more from this than from anything I&amp;rsquo;d read up to that point.&lt;/p&gt;
&lt;p&gt;The basic goal was: stop having everything on one flat network, add some segmentation, and set up a VPN so I can get back in when I&amp;rsquo;m not at home without relying on some third party service.&lt;/p&gt;
&lt;h2 id="the-setup"&gt;The setup&lt;/h2&gt;
&lt;p&gt;Running a UniFi gateway and a couple of UniFi switches and APs. Started with everything on the default network — every device, same subnet, no separation. Fine for a simple home setup, not great if you&amp;rsquo;re trying to learn networking.&lt;/p&gt;</description><content type="html"><![CDATA[<p>This took me way longer than it probably should have but I learned more from this than from anything I&rsquo;d read up to that point.</p>
<p>The basic goal was: stop having everything on one flat network, add some segmentation, and set up a VPN so I can get back in when I&rsquo;m not at home without relying on some third party service.</p>
<h2 id="the-setup">The setup</h2>
<p>Running a UniFi gateway and a couple of UniFi switches and APs. Started with everything on the default network — every device, same subnet, no separation. Fine for a simple home setup, not great if you&rsquo;re trying to learn networking.</p>
<p>The plan:</p>
<ul>
<li>Wired VLAN for the desktop and anything that lives on the desk</li>
<li>WiFi VLAN for laptops, phones, everything wireless</li>
<li>Firewall rules between them</li>
<li>WireGuard VPN on the gateway for remote access</li>
</ul>
<h2 id="vlans">VLANs</h2>
<p>UniFi makes VLAN setup pretty straightforward once you understand what you&rsquo;re doing. Create the network, assign it to the relevant ports or SSID, done. The harder part is thinking through the addressing.</p>
<p>I didn&rsquo;t just default to /24 for both. The wired network doesn&rsquo;t need 254 hosts — there are maybe 5 devices on it. Used a /26 instead, which gives you 62 usable addresses. More than enough, and it made me actually think about the subnetting rather than just chucking a /24 at everything.</p>
<p>Once both VLANs were up I tested routing between them — pinged the wired desktop from the WiFi laptop. Worked. Inter-VLAN routing handled by the gateway.</p>
<h2 id="wireguard-vpn">WireGuard VPN</h2>
<p>Wanted remote access without using Tailscale or any similar service. WireGuard is built into the UniFi gateway so this was the obvious choice.</p>
<p>The setup itself isn&rsquo;t that complicated. You configure the server on the gateway, generate a client config, import it into the WireGuard app on your laptop. What&rsquo;s less obvious is the DDNS piece.</p>
<p>Home internet connections have dynamic IPs. Your ISP can change your IP at any point. If you hard-code your home IP into the WireGuard client config and your IP changes, the VPN stops working silently — it just won&rsquo;t connect and you won&rsquo;t immediately know why.</p>
<p>The fix is DDNS — a hostname that automatically updates to point at your current IP. I set this up using ddclient running as a service, updating a Cloudflare DNS record whenever the IP changes. Now the client config points to a hostname rather than an IP and the whole thing just works even when the address rotates.</p>
<h2 id="firewall-rules">Firewall rules</h2>
<p>This is where I spent most of the time. The main things I wanted to lock down:</p>
<ul>
<li>SSH access to the machines on the wired network — allowed from inside the house only, not from the internet directly, only through the VPN</li>
<li>Same for remote desktop</li>
<li>Nothing from the outside world should reach internal services without going through the VPN first</li>
</ul>
<p>Getting firewall rules right requires you to actually think about source, destination, and port for each rule. &ldquo;Allow SSH&rdquo; is not a firewall rule. It&rsquo;s a starting point for a conversation. You need to specify where it&rsquo;s coming from and where it&rsquo;s going.</p>
<p>Also found out the hard way that Windows Firewall is a separate layer from the network firewall and needs its own rules if you&rsquo;re running services on a Windows machine. Spent a while confused about why things weren&rsquo;t working before I realised I&rsquo;d sorted the network rules but Windows was still blocking the traffic at the host level.</p>
<h2 id="what-id-do-differently">What I&rsquo;d do differently</h2>
<p>I&rsquo;d think through the firewall rules before setting up the VLANs rather than retrofitting them afterwards. It&rsquo;s easier to build the rules into the design than to add them to something that&rsquo;s already running.</p>
<p>Also would have set up DDNS from day one rather than realising I needed it when the VPN stopped working after my IP changed.</p>
<h2 id="whats-next">What&rsquo;s next</h2>
<p>The inter-VLAN rules are still too permissive — anything on WiFi can reach anything on the wired network. That needs tightening up. And I want to add a proper isolated network for IoT stuff at some point, things like smart plugs and such probably shouldn&rsquo;t be on the same network as everything else.</p>
]]></content></item><item><title>Subnetting — How I Finally Got It to Stick</title><link>https://andyals.com/posts/2025/05/subnetting-how-i-finally-got-it-to-stick/</link><pubDate>Sat, 10 May 2025 00:00:00 +0000</pubDate><guid>https://andyals.com/posts/2025/05/subnetting-how-i-finally-got-it-to-stick/</guid><description>&lt;p&gt;So subnetting. The thing that makes people quit CCNA prep early.&lt;/p&gt;
&lt;p&gt;I avoided it for longer than I should have. Not because I didn&amp;rsquo;t understand the concept, I kind of got it, but when it came to actually working through questions I was slow and uncertain and kept second guessing myself. I was using subnet calculators to check my work and that was the problem, I wasn&amp;rsquo;t actually learning anything I was just verifying answers.&lt;/p&gt;</description><content type="html"><![CDATA[<p>So subnetting. The thing that makes people quit CCNA prep early.</p>
<p>I avoided it for longer than I should have. Not because I didn&rsquo;t understand the concept, I kind of got it, but when it came to actually working through questions I was slow and uncertain and kept second guessing myself. I was using subnet calculators to check my work and that was the problem, I wasn&rsquo;t actually learning anything I was just verifying answers.</p>
<p>Eventually I just sat down with a notebook and worked through it until it stopped being scary. Here&rsquo;s what actually helped.</p>
<h2 id="why-calculators-are-the-enemy-at-first">Why calculators are the enemy (at first)</h2>
<p>When you use a calculator you skip the part where your brain builds the model. You type in an address, get back a bunch of numbers, move on. Does nothing for you in an exam or in a real conversation with someone.</p>
<p>The goal with CCNA is to work through subnetting problems in your head, or at most on rough paper, at a reasonable pace. That means you need the patterns to be automatic.</p>
<h2 id="the-thing-that-made-it-click">The thing that made it click</h2>
<p>Subnetting is just dividing a block of addresses into equal chunks. The prefix length tells you the chunk size. That&rsquo;s it.</p>
<p>Once you have this table in your head the rest follows:</p>
<table>
  <thead>
      <tr>
          <th>CIDR</th>
          <th>Subnet Mask</th>
          <th>Block Size</th>
          <th>Usable Hosts</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>/24</td>
          <td>255.255.255.0</td>
          <td>256</td>
          <td>254</td>
      </tr>
      <tr>
          <td>/25</td>
          <td>255.255.255.128</td>
          <td>128</td>
          <td>126</td>
      </tr>
      <tr>
          <td>/26</td>
          <td>255.255.255.192</td>
          <td>64</td>
          <td>62</td>
      </tr>
      <tr>
          <td>/27</td>
          <td>255.255.255.224</td>
          <td>32</td>
          <td>30</td>
      </tr>
      <tr>
          <td>/28</td>
          <td>255.255.255.240</td>
          <td>16</td>
          <td>14</td>
      </tr>
      <tr>
          <td>/29</td>
          <td>255.255.255.248</td>
          <td>8</td>
          <td>6</td>
      </tr>
      <tr>
          <td>/30</td>
          <td>255.255.255.252</td>
          <td>4</td>
          <td>2</td>
      </tr>
  </tbody>
</table>
<p>Each row the block size halves. Usable hosts is always block size minus 2 (one for the network address, one for broadcast).</p>
<h2 id="working-through-an-example">Working through an example</h2>
<p>Say you get given 192.168.10.0/27 and you need to list the subnets.</p>
<p>Block size for /27 is 32. So you just count up in 32s from .0:</p>
<ul>
<li>.0 to .31 — first subnet, network .0, broadcast .31</li>
<li>.32 to .63 — second subnet</li>
<li>.64 to .95 — third subnet</li>
</ul>
<p>Keep going until you hit 256. You end up with 8 subnets total. You can work that out in your head in about 20 seconds once the block sizes are automatic.</p>
<h2 id="where-im-at-now">Where I&rsquo;m at now</h2>
<p>Can get through most subnetting questions without reaching for anything. Still slow on some of the nastier ones. The next thing I need to get solid is VLSM — that&rsquo;s where you&rsquo;re carving up address space into different sized subnets to avoid wasting addresses, which is what actually happens in real networks.</p>
<p>Going to do a separate write-up on that once I&rsquo;ve got enough reps in to explain it properly.</p>
]]></content></item></channel></rss>