<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>barrucadu&#39;s memos - Tech Docs</title>
  <link href="https://memo.barrucadu.co.uk/taxon/techdocs.xml" rel="self" />
  <link href="https://memo.barrucadu.co.uk/" />
  <id>https://memo.barrucadu.co.uk/taxon/techdocs.xml</id>
  <author>
    <name>Michael Walker</name>
    <email>mike@barrucadu.co.uk</email>
  </author>
  
  <updated>2022-10-07T00:00:00Z</updated>
  
  
  <entry>
    <title>Home Network</title>
    <link href="https://memo.barrucadu.co.uk/home-network.html" />
    <id>https://memo.barrucadu.co.uk/home-network.html</id>
    <published>2021-03-22T00:00:00Z</published>
    <updated>2022-10-07T00:00:00Z</updated>
    <summary type="html">
      <![CDATA[
<figure>
<img src="home-network/hardware.jpg" alt="The pile of network hardware." />
<figcaption aria-hidden="true">The pile of network hardware.</figcaption>
</figure>
<ol type="1">
<li>Wireless access point (UniFi FlexHD)</li>
<li>Server (nyarlathotep)</li>
<li>6U network cabinet, with:
<ol type="1">
<li>24-port keystone patch panel, with:
<ol type="1">
<li>4x USB power</li>
<li>4x blank</li>
<li>Ethernet (azathoth)</li>
<li>Ethernet (nyarlathotep)</li>
<li>Ethernet (Raspberry Pi)</li>
<li>11x blank</li>
<li>Ethernet (AP)</li>
<li>Ethernet (WAN)</li>
</ol></li>
<li>Router (UniFi DreamMachine Pro)</li>
<li>Switch (UniFi Switch 24 (non-PoE))</li>
<li>Mesh plate</li>
<li>Shelf, with Raspberry Pi</li>
<li>8-way C13 power distribution unit, with:
<ol type="1">
<li>Router</li>
<li>Switch</li>
<li>AP</li>
<li>Server</li>
<li>Raspberry Pi</li>
<li>USB power</li>
</ol></li>
</ol></li>
</ol>
<p>Plus a surge-protected 8-way mains extension lead and a pile of spare cat6 cables, for guest use.</p>
<hr />
<figure>
<img src="home-network/map.png" alt="The network topology." />
<figcaption aria-hidden="true">The network topology.</figcaption>
</figure>
<ul>
<li><p><a href="https://github.com/barrucadu/nixfiles#azathoth">azathoth</a> is my desktop machine, and is running a NixOS / Windows 10 dual boot. I mostly use NixOS for programming and for work (which is, mostly, programming); and Windows 10 for everything else.</p></li>
<li><p><a href="home-network.html#nyarlathotep">nyarlathotep</a> is my general-purpose server and also a NAS, and is running NixOS. As you can see in the photo above, nyarlathotep sits atop the network cabinet; I’ll probably upgrade to a rack and a suitable chassis at some point.</p></li>
<li><p>The <a href="https://pi-hole.net/">pi-hole</a> is providing DNS, and is running Raspbian. I have plans to put NixOS on this too and rename it to <a href="https://en.wikipedia.org/wiki/Cthulhu_Mythos_deities#Yog-Sothoth">yog-sothoth</a>.</p></li>
</ul>
<p>Noise is a concern, as everything is set up in my living room, which is where guests staying overnight sleep. So to keep everything quiet at night (and at all times) I’m using <a href="https://noctua.at/">Noctua</a> fans running at as low an RPM as I can get them.</p>
<hr />
<p>I’m using Ubiquiti’s managed <a href="https://unifi-network.ui.com/">UniFi networking equipment</a>, which is overkill for the small network I have, but it’s all very nice.</p>
<p>350Mbit WAN comes in through my Virgin Media router (running in modem mode), into my UniFi Dream Machine Pro’s WAN port, which is connected to a UniFi Switch 24 (non-PoE) and a UniFi FlexHD Access Point.</p>
<p>I have three VLANs with some firewall rules set up between them:</p>
<table>
<colgroup>
<col style="width: 17%" />
<col style="width: 7%" />
<col style="width: 12%" />
<col style="width: 61%" />
</colgroup>
<thead>
<tr class="header">
<th>Name</th>
<th>VLAN ID</th>
<th>IP Range</th>
<th>Firewall rules</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Wired</td>
<td>1</td>
<td>10.0.0.0/24</td>
<td>Can talk to hosts in VLANs 1 and 10</td>
</tr>
<tr class="even">
<td>Wireless</td>
<td>10</td>
<td>10.0.10.0/24</td>
<td>Can talk to hosts in VLANs 1 and 10</td>
</tr>
<tr class="odd">
<td>Untrusted Wireless</td>
<td>20</td>
<td>10.0.20.0/24</td>
<td>Can send DNS traffic to the pi-hole and HTTP traffic to nyarlathotep</td>
</tr>
</tbody>
</table>
<p>The untrusted wireless is for phones and smart devices which don’t make it easy to see what they’re doing. And my work laptop. Normal computers (eg, a guest’s laptop) go straight on the trusted wireless network.</p>
<p>I’ve got a few custom DNS records set up for various static IP addresses:</p>
<pre><code>address=/router.lan/10.0.0.1
address=/pi.hole/10.0.0.2
address=/nyarlathotep/10.0.0.3

# for https://github.com/alphagov/govuk-docker
address=/dev.gov.uk/127.0.0.1

# for general use
address=/localhost/127.0.0.1

# these should be CNAMEs but windows doesn&#39;t resolve them
address=/help.lan/10.0.0.3
address=/nas.lan/10.0.0.3

# firefox in windows has started redirecting http://nyarlathotep to http://www.nyarlathotep.com ???
# so add in a domain with a dot, which it seems happier with
address=/nyarlathotep.lan/10.0.0.3</code></pre>
<p>The <code>help.lan</code> and <code>nas.lan</code> rules are for guests. Visiting <code>http://help.lan</code> tells you what VLAN you’re on, gives a summary of the firewall rules, and gives guest credentials for the NAS (if not on VLAN 20). <code>http://help.lan</code> is served by nyarlathotep, so to restrict access to the other domains it’s serving, it 302-redirects to <code>http://help.lan</code> if the user is on VLAN 20.</p>
<h2 id="nyarlathotep">Nyarlathotep</h2>
<p>Services and configuration are covered in <a href="https://github.com/barrucadu/nixfiles#nyarlathotep">my NixOS config</a>.</p>
<h3 id="storage">Storage</h3>
<h4 id="system">System</h4>
<p>nyarlathotep uses a 250GB SSD as the system volume (connected via PCI-e), with a ZFS partition and a vfat partition (the UEFI system volume).</p>
<p>The ZFS partition consists of one zpool with volumes:</p>
<ul>
<li><strong><code>local/volatile/root</code></strong>: mounted at <code>/</code></li>
<li><strong><code>local/persistent/home</code></strong>: mounted at <code>/home</code></li>
<li><strong><code>local/persistent/nix</code></strong>: mounted at <code>/nix</code></li>
<li><strong><code>local/persistent/persist</code></strong>: mounted at <code>/persist</code></li>
<li><strong><code>local/persistent/var-log</code></strong>: mounted at <code>/var/log</code></li>
</ul>
<p>This <code>local/volatile/root</code> dataset is configured in the <a href="https://grahamc.com/blog/erase-your-darlings">“erase your darlings”</a> style: everything is deleted by rolling back to an empty snapshot at boot. Any state which needs to be persisted is in <code>/persist</code>, and managed through configuration and symlinks.</p>
<p>The <code>local/persistent</code> dataset has automatic snapshots configured.</p>
<h4 id="nas">NAS</h4>
<p>nyarlathotep uses 8 hot-swap SATA bays configured as a zpool of mirrored pairs for NAS:</p>
<pre><code>Mirror Device  Mirror Device
     0 A            0 B
     1 A            1 B
     2 A            2 B
     - A            - B</code></pre>
<p>The “A” volume of each pair is connected to the motherboard SATA controller and the “B” volume of each pair to a PCI-e SATA controller.</p>
<p>The HDD serial numbers are:</p>
<ol type="1">
<li><strong>0A:</strong> <code>ata-ST10000VN0004-1ZD101_ZA206882</code></li>
<li><strong>0B:</strong> <code>ata-ST10000VN0004-1ZD101_ZA27G6C6</code></li>
<li><strong>1A:</strong> <code>ata-ST10000VN0004-1ZD101_ZA22461Y</code></li>
<li><strong>1B:</strong> <code>ata-ST10000VN0004-1ZD101_ZA27BW6R</code></li>
<li><strong>2A:</strong> <code>ata-ST10000VN0008-2PJ103_ZLW0398A</code></li>
<li><strong>2B:</strong> <code>ata-ST10000VN0008-2PJ103_ZLW032KE</code></li>
</ol>
<p>The zpool currently has a single dataset:</p>
<ul>
<li><strong><code>data/nas</code></strong>: mounted at <code>/mnt/nas</code></li>
</ul>
<p>The <code>data</code> dataset has automatic snapshots configured.</p>
<h2 id="future-projects">Future projects</h2>
<p>I’ve got a few thoughts on future projects and expansions for this set-up, but given how much I spent on the last upgrade these are all likely to be a few years off at least.</p>
<h3 id="get-a-rack">Get a rack</h3>
<p>Currently I have a network cabinet, and a non-rackmount server chassis. I could instead get a larger rack, an appropriate server chassis, and use that for everything.</p>
<p>The main downsides to this are cost (just by virtue of being rack compatible it seems everything gets more expensive) and noise (with less space in the chassis fans have to work harder). Ease of transport is also a consideration, as I’m only renting my current flat.</p>
<p>So this is probably something I’d only do after finding a place I intend to stay at long-term; ideally where I can have a dedicated computer room and run ethernet cables through the walls.</p>
<h3 id="redundant-wan">Redundant WAN</h3>
<p>Currently I rely on just the one ISP for internet. They’re usually pretty good, but sometimes issues do occur. My UDM Pro supports a second WAN source, so I could get a 4G / 5G modem and set up automatic failover if the primary goes down.</p>
<h3 id="upgrade-to-poe">Upgrade to PoE</h3>
<p>Currently I have a Raspberry Pi and a UniFi Access Point powered by regular power cables. Both of these devices are capable of being powered by a switch with PoE (with some extra hardware for the Pi), which would reduce other cables.</p>
<p>However, PoE switches are significantly more expensive. So I could either get a small PoE switch for the limited number of devices I have, or save this upgrade for when I have use for more PoE-connected devices. For example, if I get a house and need to set up multiple access points.</p>
<h3 id="upgrade-to-10gbit">Upgrade to 10Gbit</h3>
<p>Totally overkill, but it could be cool to get a switch which supports 10Gbit connections, and also 10Gbit NICs for azathoth and nyarlathotep.</p>
<p>I think I would need to rebuild nyarlathotep before doing this, as it doesn’t have a free PCI-e port.</p>
<h3 id="raspberry-pi-cluster">Raspberry Pi cluster</h3>
<p>People have designed <a href="https://www.youtube.com/watch?v=splC57efBFQ">3D-printable rack mounting gear for Raspberry Pis</a>, and since reading an article about <a href="https://mirailabs.io/blog/building-a-microcloud/">a Raspberry Pi cluster</a> I’ve been tempted. I wasn’t very keen on Kubernetes when I last tried it; at work we use Cloud Foundry, and it’s pretty easy to deploy things to, so I’d probably look into running that first.</p>
<p>I could move some of the services off nyarlathotep onto this Pi cluster, though I’d probably still want to use nyarlathotep as backing storage.</p>

      ]]>
    </summary>
  </entry>
  
</feed>