OpenBuildLog open source, water and glass

· 7 min read

Open Source Software Defined Network with consumer hardware

Fanless off-the-shelf switches, $5 optics and OpenWrt turn a "smart managed" network into a software-defined fabric.

Zyxel XGS1210-12 switch with the OpenWrt logo on its lid
Illustration, AI-generated

A rainy weekend was enough to turn a home network in Zurich into a fully software-defined fabric, built from consumer switches and open source.

The project started four years earlier, when the first fibre went into the walls and the “smart managed” Zyxel XGS1210-12 was shortlisted. Today four of these switches carry the network, and none of them runs the firmware it shipped with.

The requirements

  • Low power, passively cooled. No fans in a living space.
  • 10GbE over SFP+. Two SFP+ cages for the links between rooms, filled with $5 transceivers, two 2.5GbE ports for the machines that need more than 1GbE, eight 1GbE ports for everything else.
  • Consumer hardware. Off-the-shelf and available again tomorrow, at a unit cost of around CHF 120.
  • Switching capacity. 66 Gbps, enough to run every port at full duplex.
  • IGMP snooping. The household’s FPV cars send their video as multicast, which has to reach the screens in real time without flooding every port.
  • Always on the latest release. The fabric updates itself, unattended, whenever OpenWrt ships a patch release or the configuration changes.
  • Only fibre in the walls. Fibre carries the next speed step with new optics at both ends; copper in the walls would have to be pulled again. 10GbE over copper also runs hot.

The optics turned out to be the cheapest part: 10GbE SFP+ transceivers at about $5 each and slim fibre patch cables, both from AliExpress.

What the stock firmware lacks

The hardware met every requirement; the firmware did not. It offers no API for automation, no HTTPS and no Ansible module. Every change meant typing the web UI password by hand and clicking through the settings, switch by switch.

OpenWrt supports the switch’s Realtek RTL930x chip. Support for the XGS1210-12 landed in development in mid-2025, and the first stable release with images for both hardware revisions, 25.12.0, followed in March 2026. The switches were flashed with 25.12.6, released in October 2026. With it and a few adjustments they became a software-defined fabric: configured as code, kept on the latest OpenWrt release by CI, and reporting chip and SFP module temperatures, link states and traffic to the same Grafana as the rest of the homelab. With both 10GbE and both 2.5GbE ports in use, the switch chip peaks at 70 °C on an open shelf and its SFP+ modules run almost as hot, so an enclosure needs watching.

Grafana panel: temperatures of all four switches over two and a half days. The top two lines are the core switch: its chip at 70 °C and its SFP+ module just below. The other sensors stay between 45 and 65 °C.
Chip, SFP+ module and 2.5GbE PHY temperatures of all four switches; top: the core switch's chip and SFP+ module. Panel definition: network.json in cluster-config

Two revisions, one board

The revision is printed on the label on the back, top right; no revision means A1. A1 and B1 differ only in their 2.5GbE PHYs: A1 has two Realtek RTL8226, B1 two RTL8221B. OpenWrt builds a separate image for each (zyxel_xgs1210-12-a1 and -b1). The PHYs can be told apart in the kernel log, so the flash script reads dmesg and picks the right image by itself.

The serial header

The console sits behind the vents on the right side: 3.3 V, 115200 baud, 8N1. Top to bottom:

PinSignalWireTo the USB adapter
1Vcc–leave unconnected
2TXgreenadapter RX
3RXyellowadapter TX
4GNDbrownGND

A cheap 3.3 V USB-serial adapter and three jumper wires are enough; the case stays closed.

Three jumper wires plugged onto the console header through the side vents of the switch, a USB-serial adapter in the background.
Three jumper wires on the console header, straight through the side vents

Flashing: one web upload, then serial only

The installation has two phases.

1. Boot OpenWrt from RAM through the stock web UI. The stock firmware accepts the OpenWrt initramfs image as a firmware upload. Its web interface resists scripting, though: the login password is RSA-encrypted in the browser, every request carries a hash of its own query string, and the upload only goes through as application/octet-stream. A small Python script (zyxel.py) handles login, upload and reboot.

2. Install permanently over the serial console. In the initramfs the switch ports are dead, so everything goes over the serial line. flash.py waits for the console and picks the A1 or B1 image. It then streams the image and a small config archive over the console as base64, which takes about eleven minutes at 115200 baud. Once both have arrived, it runs a single shell line:

[ "$(sha256sum /tmp/cfg.tgz | cut -c1-64)" = <expected> ] &&
[ "$(sha256sum /tmp/sysupgrade.bin | cut -c1-64)" = <expected> ] &&
sysupgrade -T -f /tmp/cfg.tgz /tmp/sysupgrade.bin &&
fw_setenv bootcmd 'rtk network on; boota' &&
sysupgrade -f /tmp/cfg.tgz /tmp/sysupgrade.bin

Both checksums must match and the image must pass sysupgrade -T; only then does the script fix the boot command and flash. If any step fails, nothing is written. The switch comes up on OpenWrt with its hostname, its root password and DHCP on the LAN, without anyone touching a keyboard.

The cables have to move to another switch first: the ports stay dead for the whole serial phase. Flashing the core switch took the internet down, and with it the session driving the flash.

Pitfalls

  • Dead ports after reboot. On OpenWrt 25.12 the ports stay down unless U-Boot runs rtk network on before it boots, hence the fw_setenv above.
  • sysupgrade -f from the ramdisk. The config archive has to go in with -f, packed with tar --owner=0 --group=0. It must not contain globals in network: OpenWrt generates it per switch on first boot, including the DHCP client DUID, and a copied one makes every switch ask for the same lease.
  • New DHCP leases. OpenWrt sends a different DHCP client ID than the stock firmware, so every switch gets a new address until it is reserved.

Updated unattended

The serial procedure is needed only once. After that, the switches update themselves. Every night a scheduled pipeline builds one image per revision with the OpenWrt Image Builder (build.sh): the Prometheus node exporter with its hardware-monitoring and thermal modules baked in, the configuration on top, and no secrets inside. Renovate moves the Image Builder to each new OpenWrt patch and minor release by itself; a major upgrade waits for approval.

The same pipeline then rolls the image out (deploy.sh) over SSH, one switch at a time, the leaf switches first and the core last. Each image is stamped with a hash of its inputs, the configuration and the Image Builder release, so a switch is only flashed when one of them has changed; most nights nothing happens. After each upgrade the job waits until the switch answers again and is scraped by Prometheus. If a switch does not come back, the job stops before touching the next one. Nobody needs to be awake for any of it. The Grafana dashboard above is defined in network.json.

The network at a glance

With OpenWrt on every switch, their MAC tables and link states are readable, and a CI job (diagram/) draws the network from what the switches actually see, never by hand. Every switch shows all twelve ports in front-panel order, coloured by link speed, with each device hanging under its port. A simplified version:

Network diagram: the router, running Red Hat Enterprise Linux, has four SFP+ ports, two in use: a 25GbE fibre uplink and a link to fabric01. The four switches form a chain over SFP+: fabric01, fabric02, fabric03, fabric04, and fabric04’s second SFP+ port connects server03. The workstation hangs off fabric01, two Wi-Fi access points, a 3D printer and an Android TV off fabric02, server01 and server02 off fabric03, two desktops and two Raspberry Pis off fabric04. server03 has a mobile phone on USB as internet fallback.
Simplified topology: ports coloured by link speed

The router runs Red Hat Enterprise Linux and has four SFP+ ports, two of them in use: the 25GbE fibre uplink and the link to fabric01, the core. From there 10GbE links chain all four switches: fabric02 with the Wi-Fi access points, fabric03 next to the servers, and fabric04, whose second SFP+ port gives server03 10GbE. If the fibre uplink fails, server03 shares a mobile phone’s connection over USB as internet fallback.

Next

Two of the router’s SFP+ ports are still free. Evaluation of a 25GbE switching platform has started, to upgrade the 10GbE chain step by step: 25GbE to the workstation, 10GbE to the servers.