本文由我排障、AI总结
节点 A:受限环境(WSL1 / 老旧内核机器)
设备名: modal (100.75.215.54)
核心瓶颈: 内核版本 4.4.0,不支持 TUN 设备,无 systemd。
🚩 遇到的报错
- 启动失败:
System has not been booted with systemd as init system - 网卡报错:
is CONFIG_TUN enabled in your kernel? modprobe tun failed - 最终崩溃:
tstun.New("tailscale0"): operation not permitted
✅ 解决方案:用户态接管
- 手动创建目录:
bash sudo mkdir -p /var/run/tailscale /var/lib/tailscale - 启动用户态 Daemon:
bash sudo tailscaled --tun=userspace-networking --socks5-server=localhost:1055 > /dev/null 2>&1 & - 配置上线(必须带上特殊参数):
bash sudo tailscale up --netfilter-mode=off --ssh --accept-routes
节点 B:精简系统(云服务器 / 容器)
设备名: ampere (100.120.140.67)
核心瓶颈: 系统过于精简,未安装 SSH 服务,网络通路被封锁。
🚩 遇到的报错
- 远程拒绝:
ssh: connect to host 100.120.140.67 port 22: Connection refused - 服务缺失:
Unit ssh.service could not be found.
✅ 解决方案:补齐服务 + 端口代解
- 安装并启动 SSH 服务:
bash sudo apt update && sudo apt install openssh-server -y sudo service ssh start - 激活 Tailscale 内置 SSH 能力:
bash # 利用 Tailscale 内部通道直接接管 SSH 流量 sudo tailscale up --ssh --accept-routes
节点 C:主控端(你的操作机)
设备名: tianyi-ubuntu
✅ 跨机连接指令
- 查看全网状态:
bash tailscale status - 通过 Tailscale 隧道连接(最稳的方式):
# 连接受限机器 A tailscale ssh root@100.75.215.54 # 连接精简机器 B tailscale ssh root@100.120.140.67
💡 核心知识点总结 (Post-Mortem)
| 机器 | 问题本质 | 报错关键词 | 核心对策 |
|---|---|---|---|
| Node A (modal) | 网卡层故障 | modprobe tun, operation not permitted | 使用 --tun=userspace-networking |
| Node B (ampere) | 应用层故障 | Connection refused, service not found | 安装 openssh-server 并开启 --ssh |
🔧 后续维护 (Persistence)
由于 Node A (modal) 没有 systemd 管理启动项,建议在它的 ~/.bashrc 底部加入这一行,确保你下次登录时它会自动尝试拉起服务:
pgrep -x tailscaled > /dev/null || sudo tailscaled --tun=userspace-networking --socks5-server=localhost:1055 > /dev/null 2>&1 &