Skip to content

Sing-box 高效配置与出站路由全解析:从入门到真实场景实战 (2026版)

毛佳国

在各大代理协议与客户端工具极致迭代的 2026 年,无论是软路由、Windows 台式机、MacBook、iPhone 还是 Apple TV 客厅网络,全面统一迁移至 Sing-box 已成为极客圈的主流选择。

对于习惯了 Clash 生态一键拖拽节点的小伙伴,初次面对 Sing-box 的 JSON 配置文件往往感到无从下手。

今天我们将结合真实排错经历与底层网络逻辑,为你带来全网最详尽的 Sing-box 2026 生产级配置与路由实战指南

[!NOTE] 📌 核心速览(TL;DR / 快问快答):

  • 数据流转四大核心Inbounds(流量入口 TUN/SOCKS5)-> DNS(防污染解析管道)-> Route(SRS 规则调度)-> Outbounds(VLESS-Reality / Hysteria 2 出口)。
  • 防泄露铁律:境外 DNS 必须指定 "detour": "proxy",确保 DNS 查询在加密隧道内完成;本地直连走公网 DNS 并直通网卡。
  • 2026 规则规范:全面采用二进制 .srs 规则集 (rule_set: ["geosite-cn"]) 与 uTLS 浏览器指纹 (fingerprint: "chrome")。

🛠️ 2026 生产级 Sing-box 全量通用配置模板

{
  "log": {
    "level": "info",
    "timestamp": true
  },
  "dns": {
    "servers": [
      {
        "tag": "dns-proxy",
        "address": "https://8.8.8.8/dns-query",
        "detour": "proxy"
      },
      {
        "tag": "dns-direct",
        "address": "https://223.5.5.5/dns-query",
        "detour": "direct"
      },
      {
        "tag": "dns-fakeip",
        "address": "fakeip"
      }
    ],
    "rules": [
      {
        "outbound": "any",
        "server": "dns-direct"
      },
      {
        "rule_set": ["geosite-cn"],
        "server": "dns-direct"
      },
      {
        "query_type": ["A", "AAAA"],
        "server": "dns-fakeip"
      }
    ],
    "fakeip": {
      "enabled": true,
      "inet4_range": "198.18.0.0/15",
      "inet6_range": "fc00::/18"
    },
    "independent_cache": true
  },
  "inbounds": [
    {
      "type": "tun",
      "tag": "tun-in",
      "interface_name": "singbox-tun",
      "inet4_address": "172.19.0.1/30",
      "inet6_address": "fdfe:dcba:9876::1/126",
      "auto_route": true,
      "strict_route": true,
      "stack": "system",
      "sniff": true
    }
  ],
  "outbounds": [
    {
      "type": "selector",
      "tag": "proxy",
      "outbounds": [
        "auto-fallback",
        "node-us-reality",
        "node-hk-hys2",
        "direct"
      ],
      "default": "auto-fallback"
    },
    {
      "type": "urltest",
      "tag": "auto-fallback",
      "outbounds": ["node-us-reality", "node-hk-hys2"],
      "url": "https://www.gstatic.com/generate_204",
      "interval": "3m",
      "tolerance": 50
    },
    {
      "type": "vless",
      "tag": "node-us-reality",
      "server": "us.yourdomain.com",
      "server_port": 443,
      "uuid": "your-uuid-here",
      "flow": "xtls-rprx-vision",
      "tls": {
        "enabled": true,
        "server_name": "www.microsoft.com",
        "utls": {
          "enabled": true,
          "fingerprint": "chrome"
        },
        "reality": {
          "enabled": true,
          "public_key": "YOUR_REALITY_PUBKEY",
          "short_id": "YOUR_SHORT_ID"
        }
      }
    },
    {
      "type": "direct",
      "tag": "direct"
    },
    {
      "type": "block",
      "tag": "block"
    },
    {
      "type": "dns",
      "tag": "dns-out"
    }
  ],
  "route": {
    "rules": [
      {
        "protocol": "dns",
        "outbound": "dns-out"
      },
      {
        "ip_cidr": [
          "127.0.0.0/8",
          "10.0.0.0/8",
          "172.16.0.0/12",
          "192.168.0.0/16"
        ],
        "outbound": "direct"
      },
      {
        "rule_set": ["geosite-ads"],
        "outbound": "block"
      },
      {
        "rule_set": ["geosite-cn", "geoip-cn"],
        "outbound": "direct"
      }
    ],
    "rule_set": [
      {
        "tag": "geosite-cn",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-cn.srs",
        "download_detour": "proxy"
      },
      {
        "tag": "geoip-cn",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs",
        "download_detour": "proxy"
      },
      {
        "tag": "geosite-ads",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-category-ads-all.srs",
        "download_detour": "proxy"
      }
    ],
    "final": "proxy",
    "auto_detect_interface": true
  }
}

❓ 常见问题与 AI 快问快答 (FAQ)

Q1: 在 FakeIP 模式下为什么必须开启 sniff: true 流量嗅探?

:在 FakeIP 模式下,系统数据包的目标 IP 是虚拟分配的假 IP(如 198.18.x.x)。开启 sniff: true 能从 TLS 握手 ClientHello 中强行嗅探出真实域名,从而让 route.rules 中的 geosite 与域名分流规则正常生效。

Q2: 生产环境下自建节点配合商业机场的最佳实践是什么?

:在 selector 中将主节点指定为自建 DMIT搬瓦工中国电信 CN2 GIA / 联通 AS9929 专线 VPS,将商业专线机场作为 auto-fallback 备用池,做到安全隐私与高可用容灾的极致平衡。推荐阅读 《“饿饭CC云”深度评测》


(相关资源导航:如果您需要购买部署自建节点的独立 VPS,欢迎阅读 《2026 国外 VPS 选购指南》 获取 DMIT、搬瓦工与 CloudCone 优惠;商用专线推荐见 《“饿饭CC云”深度评测》!)

上一篇
使用 Ollama 与 Qdrant 构建企业级本地 RAG 知识库
下一篇
网盘界的最强王者:Alist 聚合网盘一键挂载全网大厂云端,打造私人影音库 (2026版)