Skip to content

Commit de497f6

Browse files
committed
docs: 📝 增加 & 修改文章
1 parent 44065fe commit de497f6

17 files changed

Lines changed: 142 additions & 16 deletions

File tree

content/posts/a-practical-use-of-automation/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "笔记 | 用自动化克服我的懒惰"
2+
title: "小记 | 用自动化克服我的懒惰"
33
slug: "a-practical-use-of-automation"
44
date: 2025-06-26T18:14:23+08:00
55
cover:

content/posts/android-windows-subsystem/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: 适用于 Android™ 的 Windows 子系统 Magisk + LSPosed 指南
2+
title: 介绍 | 适用于 Android™ 的 Windows 子系统 Magisk + LSPosed 指南
33
tags:
44
- Windows11
55
- Android

content/posts/cache/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "将字体进行缓存,优化网站速度"
2+
title: "探索 | 将字体进行缓存,优化网站速度"
33
slug: "cache-font"
44
date: 2023-08-29T11:51:43+08:00
55
cover: cover.svg

content/posts/china-github/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: GitHub 的多种访问方式
2+
title: 小记 | GitHub 的多种访问方式
33
sticky: 1
44
tags: [github, gfw]
55
showSummary: true

content/posts/electron-vue-mdui/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Electron + Vue + Mdui
2+
title: 小记 | Electron + Vue + Mdui
33
sticky: 1
44
tags:
55
- electron

content/posts/home-server/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "家庭服务器指南"
2+
title: "小记 | 家庭服务器指南"
33
slug: "home-server"
44
date: 2024-02-07T15:05:18+08:00
55
cover: cover.svg
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
title: "小记 | Homelab 实践"
3+
slug: "homelab-practice"
4+
date: 2026-02-21T21:14:16+08:00
5+
cover: cover.svg
6+
thumbnail: cover.svg
7+
draft: false
8+
categories: "Server"
9+
tags: ["Docker"]
10+
gemini: false
11+
showSummary: true
12+
summary:
13+
---
14+
15+
## Zerotier 回家
16+
17+
### 安装 Zerotier
18+
19+
使用 `Zerotier` 作为虚拟局域网工具,可以让我们方便的连接到 `Homelab` 服务
20+
21+
为了方便管理 **Docker Compose**,我选择使用一个专用文件夹
22+
23+
新建文件夹 `~/docker-compose/zerotier`,将以下内容写入 `docker-compose.yml`
24+
25+
```yaml
26+
version: "3.8"
27+
28+
services:
29+
zerotier:
30+
image: zerotier/zerotier
31+
container_name: zerotier
32+
restart: unless-stopped
33+
network_mode: host # 必须是 host 模式,才能加入虚拟网络
34+
35+
cap_add:
36+
- NET_ADMIN
37+
- SYS_ADMIN
38+
devices:
39+
- /dev/net/tun # 允许使用 TUN 设备
40+
volumes:
41+
- ./zerotier_data:/var/lib/zerotier-one
42+
43+
volumes:
44+
zerotier_data:
45+
```
46+
47+
执行 `docker-compose up -d`进行部署
48+
49+
过后还需要加入网络,**网络 ID** 从 [Zerotier Central][1] 处可获得
50+
51+
运行命令以加入局域网
52+
53+
```bash
54+
docker-compose exec zerotier zerotier-cli join <网络 ID>
55+
```
56+
57+
完成后,在其余设备上安装 `Zerotier` 即可
58+
59+
但是,仅限如此,我们只能访问已经加入 `Zerotier` 网络的设备,不能访问局域网内其他设备,所以还需要配置路由
60+
61+
### 配置局域网路由
62+
63+
进入 **Zerotier Central**,点选自己创建的网络
64+
65+
{{< alert >}}
66+
67+
这里需要注意:网络类型需要设置为 `Private`,这样会分配固定 IP 地址;如果不选择 `Private`,请对 `Homelab` 设备编辑 **IP Assignments** 和 **Do Not Auto-Assign IPs**
68+
69+
{{</ alert >}}
70+
71+
![image-20260221214920596](https://images.hesiy.cn/2026/02/dab30eda64c7b8dc232309e9f2f6dd06.png)
72+
73+
接着划到 **Advanced -> Managed Routes -> Add Routes**,添加路由
74+
75+
| Destination | Via |
76+
| :---------------------------------------: | :-------------------------------------: |
77+
| 局域网子网<br />(如 **192.168.1.0/24**) | `Homelab` IP<br />(如 **172.30.0.1**) |
78+
79+
添加提交后就可以通过 `Zerotier` 访问局域网设备
80+
81+
### 用家中网络访问外网
82+
83+
有时候或许需要通过家里的网络访问外网,此时也需配置路由
84+
85+
添加路由
86+
87+
| Destination | Via |
88+
| :---------: | :-------------------------------------: |
89+
| 0.0.0.0/0 | `Homelab` IP<br />(如 **172.30.0.1**) |
90+
91+
当然,此处仅为 `Zerotier` 云端配置,还需要修改每个设备
92+
93+
#### Windows
94+
95+
右键 `Zerotier` 托盘图标,选择 **Allow Default Route Override**
96+
97+
#### Android
98+
99+
进入 `Zerotier` APP,进入网络详细界面,转到 **Configuration**,勾选 **Route all traffic through ZeroTier**
100+
101+
#### DNS 配置
102+
103+
部分 DNS 提供了 **DNS 重写**功能,允许我们指定域名解析,可以在 `Zerotier` 中配置,使得每个设备都可以通过自定义域名连接到某个服务
104+
105+
> 搭配 [Nginx Proxy Manager][2] 食用更佳
106+
107+
不过,这部分笔者并未跑通,目前笔者选择在 `Zerotier` 客户端上使用自定义 DNS
108+
109+
## 服务导航(列表)
110+
111+
我自己手搓了一个 [FloatSheep FNG Gateway | Export Port][3]
112+
113+
{{< figure
114+
src="https://images.hesiy.cn/2026/02/9a0930db154dc4827be37d10af75c21f.png"
115+
caption="Demo"
116+
>}}
117+
118+
原理其实就是前端访问 **API** -> **API** 利用 **Unix Socket** 访问 **Docker Engine API**,获取数据然后返回
119+
120+
对于访问来源的判断:有一个数组,依次是 **本地地址**、**内网地址**、**外网地址**,请求到哪个就判断是哪个来源
121+
122+
其他玩法等待挖掘...
123+
124+
[1]: <https://my.zerotier.com/network/>
125+
[2]: <https://github.com/NginxProxyManager/nginx-proxy-manager>
126+
[3]: <https://export.hesiy.cn/>

content/posts/hugo-shortcode/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Hugo Shortcodes"
2+
title: "小记 | Hugo Shortcodes"
33
slug: "hugo-shortcodes"
44
date: 2023-08-26T10:10:04+08:00
55
cover: cover.svg

content/posts/mi-docker/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "小米路由器 Docker 折腾指北"
2+
title: "探索 | 小米路由器 Docker 折腾指北"
33
slug: "mi-docker"
44
date: 2023-09-30T12:04:28+08:00
55
cover: cover.svg

content/posts/open-port-in-nat/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "NAT 简介 & 端口开放"
2+
title: "探索 | NAT 简介 & 端口开放"
33
slug: "open-port-in-nat"
44
date: 2024-07-28T12:28:22+08:00
55
cover: cover.svg

0 commit comments

Comments
 (0)