跳转至

构建一个可放入登机箱的迷你家庭实验室

文章背景与核心概要

为了准备即将到来的 VCF Midwest 展会(展示老旧 Mac NTP 时间历史同步),作者构建了一套功能齐全、便携的网络协议栈。这套设备基于 Ubiquiti(优比快)硬件,收纳在 3U 的 DeskPi RackMate TT 迷你机架内。这个尺寸刚好能塞进登机箱的家庭实验室支持 1–10 Gbps 网络、多路 WAN 连接(包含 5G 备用链路)、12 个有线以太网端口,并能通过 APC UPS 提供超过一小时的电池续航。

尽管对于老旧电脑演示来说,这样的配置显然有些大材小用,但该构建方案提供了一个强大、灵活且完全本地优先的移动测试环境。本文详细记录了硬件选型、UniFi 生态体验、3D 打印机架改装以及实际出行测试的心得。


简介 (Introduction)

I'm traveling to Chicago for VCF Midwest next month. I'll be demoing NTP time history on vintage Macs, with my own GPS-derived NTP service hosted on an Xserve G5, synced via NTP or a strange AppleTalk timing extension from the 1990s.

我将在下个月前往芝加哥参加 VCF Midwest。我将在老旧的 Mac 上演示 NTP 时间历史同步,届时将使用托管在 Xserve G5 上的自建 GPS 派生 NTP 服务,通过 NTP 或一个奇怪的 20世纪90年代 AppleTalk 计时扩展进行同步。

Ubiquiti mini rack network with UPS

So I built a little 'portable homelab' (pictured above) that supports 1-10 Gbps networking, can run off a small battery for at least an hour, switches between multiple WANs (so I can get my own 5G Internet connection, in case I need it), and gives me 12 wired Ethernet connections.

因此,我构建了一个小型“便携式家庭实验室”(如上图所示),它支持 1-10 Gbps 网络,能靠小电池运行至少一小时,可在多个 WAN 之间切换(以便在需要时使用我自己的 5G 网络连接),并提供了 12 个有线以太网接口。

Is it overkill for this particular scenario? Absolutely. Would it look different if Micro Center hadn't sponsored the build as part of their Columbus OH grand re-opening event? You bet.

对于这个特定的场景来说,它是不是大材小用?当然是。如果不是 Micro Center 赞助了这次构建作为其俄亥俄州哥伦布市盛大重张活动的一部分,它会长这样吗?那肯定的

That said, it's not far off some of the other networking mini-rack builds I've seen in the Project MINI RACK Build Showcase. And I'm happy to have more flexibility when I'm on the road trying to keep other weird stuff (like vintage computers) running. It's better to go overkill on the network stack since I don't want to debug that alongside the Macs.

话虽如此,它与我在 Project MINI RACK Build Showcase 中看到的一些其他网络迷你机架构建相差无几。而且我很很高兴能在出差路上拥有更多灵活性,去维护其他奇奇怪怪的设备(比如老旧电脑)。在网络协议栈上过度配置总归是更好的选择,因为我可不想在调试 Mac 的同时还要去修网络。


探索 Ubiquiti (Exploring Ubiquiti)

This is my first experience with UniFi. I've run routers on bare Debian Linux installs, consumer routers with OpenWRT/AsusWRT (my home router is still running that!), and my studio router is currently a mini fanless PC running OPNsense.

这是我第一次使用 UniFi。我曾在裸机 Debian Linux 上运行过路由器,用过搭载 OpenWRT/AsusWRT 的消费级路由器(我家里的路由器现在还在用这个!),而我工作室的路由器目前则是一台运行 OPNsense 的无风扇迷你 PC。

I figured it was time to see if the UniFi kool-aid is as good as all the influencers say it is.

我觉得是时候看看 UniFi 的“毒药”(译者注:指粉丝群体的盲目追捧或生态黏性)是否真如网红们说的那般美妙了。

First impressions? It's a nice walled garden.

第一印象?这是一个相当精致的“围墙花园”。

There are plenty of pitfalls to the UniFi's proprietary ecosystem, but if you want to play in their sandbox, it's easy to pick up.

UniFi 的专有生态系统有很多陷阱,但如果你想在他们的沙盒里玩,上手还是相当容易的。

The things I like after messing with this particular Ubiquiti setup: * Everything is local-first, and doesn't need any account tie-in * Optional cloud integration adds on functionality like remote management and easier site-to-site VPN setup * There are no licensing fees for core functionality * Most of the hardware is plug-and-play, and easy to manage in one web UI

在折腾了这套 Ubiquiti 设备后,我喜欢的地方包括: * 一切都是本地优先,不需要绑定任何账户 * 可选的云集成带来了远程管理和更简便的站点到站点 VPN 设置等功能 * 核心功能没有任何许可费用 * 大多数硬件都是即插即用的,并且易于在一个 Web UI 中进行管理

There are two sides to every coin, and the big sore point I have is the lack of control over the hardware I bought. I don't see any way to unlock the bootloader, so even though the Gateway is running an Arm SoC, there's no way to load my own OS on it.

任何事物都有两面性,我最大的痛点在于缺乏对所购硬件的控制权。我找不到任何解锁引导加载程序的方法,所以尽管网关运行的是 Arm SoC,也无法在其上加载我自己的操作系统。

Not that I'd want to, today... but in 10, 20, or however many years, when Ubiquiti drops support for the Gateway I bought, it looks like it'll go straight to e-waste.

倒不是说我现在就想这么做……但如果在 10 年、20 年或多年以后,当 Ubiquiti 停止支持我买的网关时,它看起来就会直接变成电子垃圾。

But my main goal was to test if I set up everything from scratch without connecting the Cloud Gateway to the Internet, and never connect any sort of Ubiquiti account to the hardware at all. And I could!

但我的主要目标是测试:在不将云网关连接到互联网、且完全不将任何 Ubiquiti 账户连接到硬件的情况下,从头开始设置一切是否可行。事实证明完全可以!


硬件构建 (The Build)

Here are all the components used in the build (linked via Micro Center where purchased, though items are also available direct from Ubiquiti):

以下是本次构建所使用的所有组件(购买渠道链接至 Micro Center,部分商品也可直接从 Ubiquiti 购买):

I used some extra patch cables I had laying around for the Ethernet connections, but did add on an extra DAC cable since the Ubiquiti DACs are either too short or much too long for this particular setup. Here's the DAC I'm using, and it's all getting mounted inside a RackMate TT:

以太网连接我用了手头多余的跳线,不过额外加购了一条 DAC(直连铜缆)线,因为 Ubiquiti 的 DAC 要么太短,要么对这个特定的机架来说太长了。以下是我使用的 DAC,所有设备都将安装在 RackMate TT 内部:

3D 打印与安装挑战 (3D Printing and Mounting Challenges)

Ubiquiti doesn't make any 10" / mini rack mounting hardware, so most people resort to 3D printing as an upgrade over placing components on rack shelves. It's a hard requirement for my setup, because portability means rigid mounts for everything. I don't want a switch sliding out while I'm lugging the mini rack!

Ubiquiti 没有生产任何 10 英寸/迷你机架的安装硬件,因此大多数人会选择通过 3D 打印来代替将组件直接放在机架隔板上。这对于我的设置来说是一个硬性要求,因为便携性意味着所有东西都要有刚性固定。我可不希望在拖着迷你机架到处跑的时候,交换机突然滑出来!

To make the prints as durable and sag-resistant as possible—and also self-extinguishing for a little extra safety—I tried printing them out of Prusament PETG V0. That turned out okay with a lot of filament drying and tuning for two of the mounts, but I had failure after failure printing the switch enclosure:

为了让打印件尽可能耐用且抗变形——并具备自熄性以提高安全性——我尝试使用 Prusament PETG V0 来打印它们。经过大量的耗材干燥和参数微调,其中两个支架打印得还算顺利,但在打印交换机外壳时却遭遇了一次又一次的失败:

Prusament PETG V0 Spaghetti Print

V0 is notoriously stringy, and no matter how I tuned things, it would glob up on the nozzle and eventually start touching the printed part. As it got taller and on one side, only narrowly supported, the glob would knock off part of the print... and then spaghetti was the result. I think I would design this print to have a little more cross-bracing on the long sides, as even my Bambu P1S had trouble with regular ol' PLA on this print!

V0 以严重拉丝闻名,无论我怎么调整参数,它都会在喷嘴上结块并最终触碰到打印件。随着打印高度增加,由于单侧支撑非常有限,结块会撞掉打印件的一部分……结果就是喜闻乐见的“面条”翻车现场。我想我会为这个打印件的长边设计更多的交叉支撑,因为即使是我的 Bambu P1S 在用普通 PLA 打印这个模型时也遇到了麻烦!

Here are the links to the 3D-printed rackmounts used: * Cloud Gateway Fiber 10" Rackmount * Cloud Gateway Fiber M.2 SSD Tray * Flex 2.5G 8 PoE 10" Rackmount * U7 Lite 10" Rackmount * Ubiquiti 210W Power Supply Rackmount

以下是所使用的 3D 打印机架安装件链接: * Cloud Gateway Fiber 10" 机架安装件 * Cloud Gateway Fiber M.2 SSD 托盘 * Flex 2.5G 8 PoE 10" 机架安装件 * U7 Lite 10" 机架安装件 * Ubiquiti 210W 电源机架安装件

The Ubiquiti 210W power supply is rather large, and I couldn't find a way to origami it inside the 3U RackMate TT, so I designed a blanking panel that hard-mounts it on the rear, using the wall mount bracket that comes with the power supply.

Ubiquiti 210W 电源体积相当大,我无法像叠纸艺一样把它塞进 3U RackMate TT 内部,因此我设计了一块盲板,利用电源自带的壁挂支架将其硬安装在机架背面。


打包与实地测试 (Packing and Real-World Testing)

With all the 3D prints sorted, everything is hard-mounted and ready for travel. I cut a few blocks of foam to support everything inside during travel, and as long as I unplug the cables and remove the top handles, it fits nicely in my standard carry-on luggage bag:

所有 3D 打印件搞定后,所有设备都已固定完毕,随时准备出发。我切了几块泡沫在旅行过程中支撑内部的所有设备,只要拔掉线缆并拆下顶部把手,它就能完美地塞进我的标准登机行李箱中:

Ubiquiti Mini Rack inside Carry-on luggage

I brought the rack with me to and from Columbus, OH, and used it along with the 5G Backup stick in lieu of hotel WiFi.

我带着这个机架往返于俄亥俄州哥伦布市,并将其与 5G 备用棒一起使用,以此替代酒店的 Wi-Fi。

And after spending far too long debugging why I only got 4G LTE speeds with the U5G-Backup on my AT&T SIM, I realized the hotel had a wired Ethernet jack with 500 Mbps symmetric bandwidth available!

花了太长时间调试为什么我的 AT&T SIM 卡在 U5G-Backup 上只能获得 4G LTE 速度之后,我突然发现酒店提供了一个拥有 500 Mbps 对称带宽的有线以太网口!

The hotel's WiFi would only give me 30-40 Mbps, but the wired connection seemed to give me the full connection. So I plugged that into WAN1 on the back of the Cloud Gateway Fiber, and switched to that for primary Internet.

酒店的 Wi-Fi 只能提供 30-40 Mbps 的速度,而有线连接似乎能提供满血带宽。于是我将其插入 Cloud Gateway Fiber 背面的 WAN1,并切换到该线路作为主用互联网。

The flexibility of the little setup was working exactly as intended, but I still wanted to see how true 5G connectivity would perform.

这套小设备的灵活性完全按预期工作,但我仍然想看看真正的 5G 连接性能如何。

So I tested the UniFi 5G Max, which is a more full-featured 5G modem (with dual-SIM, better antennas, a touchscreen status display, etc.), and was getting speeds in excess of 500 Mbps down inside the Columbus, OH Micro Center:

因此我测试了 UniFi 5G Max,这是一款功能更全的 5G 调制解调器(具备双卡、更好的天线、触摸屏状态显示等),在俄亥俄州哥伦布市的 Micro Center 店内测得了超过 500 Mbps 的下行速度:

UniFi 5G Max with over 500 Mbps bandwidth in Micro Center

When I got back to St. Louis, I did a little more digging on the UniFi 5G modems. Apparently they only work with UniFi's networking; you can't plug one into a generic router and use it as a separate WAN.

回到圣路易斯后,我对 UniFi 5G 调制解调器进行了深入了解。显然,它们只能与 UniFi 的网络设备配合使用;你无法将其插入通用路由器并用作独立的 WAN。

That was a bit disappointing, especially for the 5G Max which costs over $400. Since I'd like a redundant 5G connection at the studio (where I run OPNsense, not Ubiquiti), I'm now looking at a Pepwave 5G Adapter, since it looks like it works with anything.

这有点令人失望,尤其是售价超过 400 美元的 5G Max。由于我希望在工作室(那里运行的是 OPNsense 而不是 Ubiquiti)建立冗余的 5G 连接,我现在正考虑 Pepwave 5G 适配器,因为它们看起来可以搭配任何设备使用。


结论 (Conclusion)

Before getting into this build, I knew the meme of people buying one UniFi switch or gateway since it meets their needs... then a few years later their entire homelab is laden in hues of UniFi grey and white.

在开始这次构建之前,我就知道那个老梗:有人因为刚好满足需求而买了一个 UniFi 交换机或网关……然后几年后,他们的整个家庭实验室都浸染在 UniFi 的灰色和白色调中了。

I don't blame anyone for going that way; Ubiquiti has a complete ecosystem at this point with anything from physical security, environment monitoring, routing, data storage, etc., and all the equipment I've tried is at least competent.

我并不怪任何人选择这条路;目前的 Ubiquiti 拥有一个完整的生态系统,涵盖物理安全、环境监测、路由、数据存储等各个方面,而且我尝试过的所有设备至少都称职。

Personally, I'm not migrating from OPNsense and my hodge-podge studio network. But I will get some use out of the mobile carry-on-sized UniFi mini rack.

就我个人而言,我不会从 OPNsense 和我那拼凑的工作室网络迁移走。但我会充分利用这个登机箱大小的移动 UniFi 迷你机架。

UniFi mini rack on workbench with Xserve G5

Right now it's running on my workbench next to an old Xserve G5 and a TrueTime XL GPS time server, which I'm prepping for VCF Midwest!

现在它正运行在我的工作台上,紧挨着一台老旧的 Xserve G5 和一台 TrueTime XL GPS 时间服务器,我正在为 VCF Midwest 展会做最后的准备!


延伸阅读 (Further Reading)