更新文案描述

This commit is contained in:
CallMeR
2026-08-14 17:42:30 +08:00
parent a7bf1b06eb
commit abccbcad01
8 changed files with 144 additions and 126 deletions
+4 -7
View File
@@ -245,13 +245,10 @@ $ journalctl --update-catalog
![最后的物理接口网桥](img/p02/pve_br_last_phyport.jpeg)
额外说明:
1. 如非特殊需求,通常情况下 PVE 系统无需使用 IPv6 网络。
2. 当主路由未配置 IPv6 ULA 网段时,无需填写 `IPv6/CIDR` 参数(如本文演示地址 `fdac::fe/64` )。
3. 多数情况下无需填写 IPv6 `网关` 参数,其网关将通过 IPv6 LLA (链路本地地址)自动配置。
**额外说明:**
- 如非特殊需求,通常情况下 PVE 系统无需使用 IPv6 网络
- 当主路由未配置 IPv6 ULA 网段时,无需填写 `IPv6/CIDR` 参数(如本文演示地址 `fdac::fe/64`
- 多数情况下无需填写 IPv6 `网关` 参数,其网关将通过 IPv6 LLA (链路本地地址)自动配置
![最后的物理接口网桥](img/p02/pve_br_last_phyport_ipv6.jpeg)
+3 -6
View File
@@ -538,12 +538,9 @@ $ find /sys/kernel/iommu_groups/ -type l
## 6. BTRFS 调整
**额外说明:**
1. 本节专为 `BTRFS` 单盘 `RAID0`(条带模式)安装的 PVE 系统设计,使用其他安装模式时,请跳过此节。
2. `BTRFS` 文件系统当前仍为技术预览状态,请谨慎操作。
3. 有关在 PVE 中使用 `BTRFS` 的详情,请参阅 [Proxmox VE - BTRFS](https://pve.proxmox.com/wiki/BTRFS) 。
- 本节专为 `BTRFS` 单盘 `RAID0`(条带模式)安装的 PVE 系统设计,使用其他安装模式时,请跳过此节
- `BTRFS` 文件系统当前仍为技术预览状态,请谨慎操作
- 有关在 PVE 中使用 `BTRFS` 的详情,请参阅 [Proxmox VE - BTRFS](https://pve.proxmox.com/wiki/BTRFS)
安装 PVE 时,若使用了 `BTRFS` 单盘 `RAID0` 的安装模式,系统默认未启用 swap 和 zstd 压缩,需要手动开启。
+3 -6
View File
@@ -249,12 +249,9 @@ $ qm disk resize 1001 scsi0 24G
|IP 配置 (net0)|`ip=172.16.1.250/24,gw=172.16.1.1,ip6=auto`|模板的 IP 设置|
**额外说明:**
1. 修改 `Cloud-Init` 参数时,需要在虚拟机关机情况下修改才会生效。
2. `DNS服务器` 参数支持输入多个 IPv4 / IPv6 地址,使用空格隔开。
3. 当前 `DNS服务器` 参数为主路由 LAN 口 IPv4 地址,确保虚拟机能正常联网。
- 修改 `Cloud-Init` 参数时,需要在虚拟机关机情况下修改才会生效
- `DNS服务器` 参数支持输入多个 IPv4 / IPv6 地址,使用空格隔开
- 当前 `DNS服务器` 参数为主路由 LAN 口 IPv4 地址,确保虚拟机能正常联网
![CI网络配置](img/p04/vm_ci_dns.jpeg)
+2 -7
View File
@@ -109,7 +109,7 @@ EOF
```bash
## 创建 resolv.conf 软链接
$ sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
$ sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
```
配置完成后,需重启 `systemd-resolved.service` 服务,并再次检查系统 `53` 端口占用。
@@ -277,6 +277,7 @@ $ sudo crontab -e
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/anti-ad.smartdns.conf https://anti-ad.net/anti-ad-for-smartdns.conf
30 9 * * * /usr/local/bin/smartdns-cnlist
```
若仅需定时重启 `SmartDNS` 服务,定时任务可调整如下。
@@ -321,9 +322,7 @@ $ sudo editor /etc/smartdns/smartdns.conf
在编辑器对话框中输入以下内容,并保存。
**额外说明:**
- `SmartDNS` 端口监听参数为 `6053@lo` WebUI 端口监听参数为 `5380` ,请根据实际情况进行调整
- WebUI 默认用户名密码为 `admin/password` ,若需公网访问建议将默认密码修改为强密码
```bash
@@ -418,13 +417,9 @@ $ sudo editor /etc/dnsmasq.d/10-server-dnsmasq.conf
在编辑器对话框中输入以下内容,并保存。
**额外说明:**
- 请根据系统内存使用情况,调整缓存参数 `cache-size`
- 配置文件中监听的网卡名为 `eth0` ,请根据实际情况进行调整
- 配置文件中内网域名为 `fox.internal` ,请根据实际情况进行调整
- `Dnsmasq` 有且仅有 `SmartDNS` 作为上游 DNS 服务器
```bash
+100 -56
View File
@@ -109,7 +109,7 @@ $ sudo apt install qemu-guest-agent btop curl tmux logrotate cronie neovim zsh g
$ sudo apt install unattended-upgrades powermgmt-base
## 安装网络工具
$ sudo apt install nftables sshguard lsof knot-dnsutils ethtool dnsmasq conntrack
$ sudo apt install nftables sshguard lsof knot-dnsutils ethtool dnsmasq conntrack networkd-dispatcher
## 安装 TS
$ curl -fsSL https://tailscale.com/install.sh | sh
@@ -419,9 +419,12 @@ $ sudo systemctl enable nftables.service
$ sudo editor /etc/nftables.conf
```
配置完成后,重启 `nftables.service` 服务。
配置完成后,先检查防火墙规则,再重启 `nftables.service` 服务。
```bash
## 检查 nftables 配置文件
$ sudo nft --check --file /etc/nftables.conf
## 重启 nftables.service
$ sudo systemctl restart nftables.service
```
@@ -450,7 +453,7 @@ EOF
```bash
## 创建 resolv.conf 软链接
$ sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
$ sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
```
配置完成后,需重启 `systemd-resolved.service` 服务。
@@ -489,13 +492,9 @@ $ sudo editor /etc/dnsmasq.d/10-server-dnsmasq.conf
在编辑器对话框中输入以下内容,并保存。
**额外说明:**
- 请根据系统内存使用情况,调整缓存参数 `cache-size`
- 配置文件中监听的网卡名为 `eth0``tailscale0` ,请根据实际情况进行调整
- 配置文件中内网域名为 `fox.internal` ,请根据实际情况进行调整
- `Dnsmasq` 上游 DNS 服务器分为三类,请根据实际情况进行调整
- `server=/ts.net/100.100.100.100` TS 服务 `MagicDNS` 专用 DNS 服务器
- `server=/fox.internal/172.16.1.1` :内网域名解析 DNS 服务器,通常为主路由地址
@@ -562,17 +561,44 @@ $ sudo systemctl restart dnsmasq.service
### 2.1.网卡调优
根据 TS 官方文档 [Performance best practices](https://tailscale.com/kb/1320/performance-best-practices) 的技术指引,优化网卡的 `rx-udp-gro-forwarding``rx-gro-list` 参数提升 UDP 转发性能。
根据 TS 官方文档 [Performance best practices](https://tailscale.com/docs/reference/best-practices/performance) 的技术指引,Linux 转发节点可通过调整网卡 Offload 参数提升 UDP 性能。
本文使用 `ethtool` 工具并结合 `systemd` 服务提供参数自动配置方案
为了在网卡重新上线后自动恢复参数,本文使用 `networkd-dispatcher` 监听 `routable` 状态
优化脚本直接使用事件中的 `IFACE`,仅处理由 `systemd-networkd` 配置的底层网卡,并跳过 `tailscale0` 和其他 TUN 设备。
首先检查 TS 服务器的底层出口网卡。
```bash
## 创建 tailscale-nic-optim 脚本
$ sudo editor /usr/local/bin/tailscale-nic-optim
## 检查 systemd-networkd 状态
$ systemctl is-active systemd-networkd
## 获取由 networkd 配置且已上线的以太网卡
$ NETDEV=$(networkctl list --no-legend --no-pager | awk '$3 == "ether" && $4 == "routable" && $5 == "configured" {print $2; exit}')
## 检查网卡管理状态
$ networkctl status "$NETDEV"
```
`systemd-networkd` 应显示为 `active`,底层出口网卡应显示为 `State: routable (configured)`
检查完成后,创建 `networkd-dispatcher``routable` 事件脚本。
```bash
## 创建 routable 事件脚本目录
$ sudo install -d -o root -g root -m 0755 /etc/networkd-dispatcher/routable.d
## 创建 TS 网卡优化脚本
$ sudo editor /etc/networkd-dispatcher/routable.d/50-tailscale
```
在脚本文件中输入以下内容,并保存。
**额外说明:**
- 脚本会记录跳过、成功或失败原因,并在执行失败时保留 `ethtool` 的原始退出状态
- `networkd-dispatcher` 会记录非零退出警告,但不会停止服务或立即重试
- 网卡再次进入 `routable` 状态时,脚本会重新执行
```bash
#!/bin/sh
#
@@ -580,77 +606,96 @@ $ sudo editor /usr/local/bin/tailscale-nic-optim
# Optimize NIC offload parameters for local TS server.
#
ETHTOOL_PATH=$(command -v ethtool)
if [ -z "${IFACE:-}" ]; then
echo "Error: IFACE is not set." >&2
exit 1
fi
if [ -z "${AdministrativeState:-}" ]; then
echo "Error: AdministrativeState is not set for $IFACE." >&2
exit 1
fi
if [ "$AdministrativeState" != "configured" ]; then
echo "Skipping network device $IFACE: administrative state is $AdministrativeState."
exit 0
fi
if [ ! -e "/sys/class/net/$IFACE/device" ]; then
echo "Skipping network device $IFACE: no hardware device is associated."
exit 0
fi
ETHTOOL_PATH=$(command -v ethtool 2>/dev/null)
if [ -z "$ETHTOOL_PATH" ]; then
echo "Error: ethtool command not found. Please install ethtool."
exit 1
echo "Error: ethtool command not found in PATH. Please install ethtool." >&2
exit 127
fi
NETDEV=$(ip route show default | awk '{for (i=1; i<=NF; i++) {if ($i == "dev") {print $(i+1); exit;}}}')
if [ -z "$NETDEV" ]; then
echo "Error: Could not determine default network device using 'ip route show default'."
exit 1
fi
echo "Configuring network device $NETDEV using $ETHTOOL_PATH for Tailscale optimizations..."
"$ETHTOOL_PATH" -K "$NETDEV" rx-udp-gro-forwarding on rx-gro-list off
if [ "$?" -eq 0 ]; then
echo "Configuration successful for $NETDEV."
exit 0
if "$ETHTOOL_PATH" -K "$IFACE" rx-udp-gro-forwarding on rx-gro-list off; then
echo "Configured network device $IFACE using $ETHTOOL_PATH successfully."
else
echo "Error: ethtool configuration failed. Check permissions or device status."
exit 1
exit_status=$?
echo "Error: $ETHTOOL_PATH failed to configure network device $IFACE (exit status $exit_status)." >&2
exit "$exit_status"
fi
```
设置脚本可执行权限,并防止脚本被意外修改
`networkd-dispatcher` 仅执行属于 `root` 且具有可执行权限的脚本,执行以下命令进行设置
```bash
## 设置脚本所有者
$ sudo chown root:root /etc/networkd-dispatcher/routable.d/50-tailscale
## 设置脚本可执行权限
$ sudo chmod +x /usr/local/bin/tailscale-nic-optim
$ sudo chmod 0755 /etc/networkd-dispatcher/routable.d/50-tailscale
## 设置脚本文件防篡改
$ sudo chattr +i /usr/local/bin/tailscale-nic-optim
$ sudo chattr +i /etc/networkd-dispatcher/routable.d/50-tailscale
```
进一步创建 `tailscale-nic-optim` 服务配置文件,以满足系统自动化设置需求
设置完成后,手动模拟网卡事件,检查脚本能否正常应用参数
```bash
## 创建 tailscale-nic-optim.service 配置文件
$ sudo systemctl edit --force --full tailscale-nic-optim.service
## 测试 TS 网卡优化脚本
$ sudo env IFACE="$NETDEV" AdministrativeState=configured /etc/networkd-dispatcher/routable.d/50-tailscale
```
由于 TS 虚拟机不包含无线网卡,可通过 `systemd` 日志过滤器忽略无线工具探测信息。
```bash
## 编辑 networkd-dispatcher.service 服务扩展配置
$ sudo systemctl edit networkd-dispatcher.service
```
在服务配置文件中输入以下内容,并保存。
```bash
[Unit]
Description=Tailscale NIC Offload Optimization
ConditionVirtualization=!container
After=network-online.target
Wants=network-online.target
Before=tailscaled.service
```ini
[Service]
Type=oneshot
ExecStart=/usr/local/bin/tailscale-nic-optim
RemainAfterExit=yes
StandardOutput=journal
[Install]
WantedBy=multi-user.target
LogFilterPatterns=~^No valid path found for iw(config)?$
```
执行以下命令让 `tailscale-nic-optim` 服务立即启动并置为开机自启状态。
测试通过后,启动 `networkd-dispatcher` 并设置为开机自启状态。
```bash
## 设置 tailscale-nic-optim 服务开机自启
$ sudo systemctl enable --now tailscale-nic-optim.service
## 设置 networkd-dispatcher 开机自启
$ sudo systemctl enable --now networkd-dispatcher.service
## 验证启动状态事件补发机制
$ sudo systemctl restart networkd-dispatcher.service
```
最后检查网卡优化参数。
```bash
## 检查网卡优化参数
$ sudo ethtool -k "$NETDEV" | grep -E 'rx-udp-gro-forwarding|rx-gro-list'
#### ethtool 示例输出
rx-gro-list: off
rx-udp-gro-forwarding: on
```
### 2.2.启动模式
@@ -675,7 +720,6 @@ $ sudo tailscale up --advertise-exit-node --accept-dns=false --reset
若需 TS 提供内网路由功能并能访问内网私有服务,执行以下命令。
**额外说明:**
- 请根据内网网段,调整 TS 内网路由参数 `advertise-routes`
```bash
+4 -8
View File
@@ -22,14 +22,10 @@
|作业评论|`Backup Your Server :)`|`备份作业` 的备注信息,使用英文输入|
**额外说明:**
1. 计划中的 `*-01,16 03:30` 表示每月 `1``16` 号的 `03:30` 执行备份任务。
2. `备份作业` 在正确配置收件人邮箱之前,并不能发出邮件。
3. `停止` 模式表示备份时会将虚拟机置于关机状态,备份完成后再恢复至之前的状态。
4. 虚拟机列表中,勾选 `备份作业` 需要备份的虚拟机(可多选)。
- 计划中的 `*-01,16 03:30` 表示每月 `1``16` 号的 `03:30` 执行备份任务
- `备份作业` 在正确配置收件人邮箱之前,并不能发出邮件
- `停止` 模式表示备份时会将虚拟机置于关机状态,备份完成后再恢复至之前的状态
- 虚拟机列表中,勾选 `备份作业` 需要备份的虚拟机(可多选)
![备份作业常规选项](img/p08/vm_job_normal.jpeg)
+28 -20
View File
@@ -4,29 +4,37 @@
# Optimize NIC offload parameters for local TS server.
#
ETHTOOL_PATH=$(command -v ethtool)
if [ -z "${IFACE:-}" ]; then
echo "Error: IFACE is not set." >&2
exit 1
fi
if [ -z "${AdministrativeState:-}" ]; then
echo "Error: AdministrativeState is not set for $IFACE." >&2
exit 1
fi
if [ "$AdministrativeState" != "configured" ]; then
echo "Skipping network device $IFACE: administrative state is $AdministrativeState."
exit 0
fi
if [ ! -e "/sys/class/net/$IFACE/device" ]; then
echo "Skipping network device $IFACE: no hardware device is associated."
exit 0
fi
ETHTOOL_PATH=$(command -v ethtool 2>/dev/null)
if [ -z "$ETHTOOL_PATH" ]; then
echo "Error: ethtool command not found. Please install ethtool."
exit 1
echo "Error: ethtool command not found in PATH. Please install ethtool." >&2
exit 127
fi
NETDEV=$(ip route show default | awk '{for (i=1; i<=NF; i++) {if ($i == "dev") {print $(i+1); exit;}}}')
if [ -z "$NETDEV" ]; then
echo "Error: Could not determine default network device using 'ip route show default'."
exit 1
fi
echo "Configuring network device $NETDEV using $ETHTOOL_PATH for Tailscale optimizations..."
"$ETHTOOL_PATH" -K "$NETDEV" rx-udp-gro-forwarding on rx-gro-list off
if [ "$?" -eq 0 ]; then
echo "Configuration successful for $NETDEV."
exit 0
if "$ETHTOOL_PATH" -K "$IFACE" rx-udp-gro-forwarding on rx-gro-list off; then
echo "Configured network device $IFACE using $ETHTOOL_PATH successfully."
else
echo "Error: ethtool configuration failed. Check permissions or device status."
exit 1
exit_status=$?
echo "Error: $ETHTOOL_PATH failed to configure network device $IFACE (exit status $exit_status)." >&2
exit "$exit_status"
fi
@@ -1,16 +0,0 @@
[Unit]
Description=Tailscale NIC Offload Optimization
ConditionVirtualization=!container
After=network-online.target
Wants=network-online.target
Before=tailscaled.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/tailscale-nic-optim
RemainAfterExit=yes
StandardOutput=journal
[Install]
WantedBy=multi-user.target