PVE 宿主机上编辑 /etc/pve/lxc/容器ID.conf,添加

lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file

如果不开启,就会创建tun设备失败。

进入lxc执行ip转发设置

  • 永久开启:

    echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
    
  • 实际情况,由于这个容器并没有启动标准的 Linux 初始化系统(没有运行 OpenRC 或 Systemd)。它开机后,内核直接把 PID 1 交给了 Entrypoint 里的命令。也就是说,它根本不会去读取 /etc/local.d 或者 /etc/init.d 里的任何自启动脚本。所以上面设置的开启转发并没有在启动的时候加载

  • 为了加载转发设置,需要执行sysctl -p

    • 在 PVE 网页端,双击Entrypoint那一行进行编辑
    • 将原本的内容:sing-box
    • 修改为(利用 shell 将两个命令串联):/bin/sh -c "sysctl -p; exec sing-box run -c /etc/sing-box/config.json"

补全缺失的config.jsonmy-direct.jsonmy-proxy.json

lxcId对应的是lxc的Id,根据实际情况进行对应修改

  • 挂载rootfs到PVE本地
    • pct mount lxcId
  • 上传config.json
    • mkdir -p /var/lib/lxc/lxcId/rootfs/etc/sing-box
    • cp -a /config/path/config.json /var/lib/lxc/lxcId/rootfs/etc/sing-box/config.json
    • cp -a /config/path/my-direct.json /var/lib/lxc/lxcId/rootfs/etc/sing-box/my-direct.json
    • cp -a /config/path/my-proxy.json /var/lib/lxc/lxcId/rootfs/etc/sing-box/my-proxy.json
  • 设置权限
    • 权限处理参加
    • 假设容器内是root,那在本地就是100000:100000
    • chown -R 100000:100000 /var/lib/lxc/lxcId/rootfs/etc/sing-box/
  • 卸载rootfs
    • pct unmount lxcId

启动错误检查

前台运行调试 (推荐) 先确保容器是停止状态,然后在 PVE 宿主机上以前台模式启动这个容器,这样所有的报错都会直接打印在你的屏幕上:

pct stop 100
lxc-start -n 100 -F

如何进入容器修改配置文件

假如容器ID为241,有几种常用方法:

方法一:最直接的方法 pct exec(需要容器内有编辑器)

这是最常用的方式,前提是你的镜像(如 Alpine)内置了 vinano 等编辑器。

# 1. 进入容器的 shell
pct exec 241 -- /bin/sh

# 2. 在容器内部使用 vi 修改文件
vi /etc/sing-box/config.json

# 3. 修改完按 Esc,输入 :wq 保存退出
# 4. 输入 exit 退出容器 shell

方法二:宿主机修改再推送到容器 pct push(最推荐)

如果你的 OCI 镜像非常精简(没有 vi/nano),或者你不习惯在终端里用 vi,可以在 PVE 宿主机上改好,然后“推”进去

# 1. 在 PVE 宿主机上修改(假设你在宿主机也存了一份或者创建一份)
nano /tmp/config.json

# 2. 使用 pct push 命令将文件覆盖到容器内
# 格式:pct push <vmid> <宿主机路径> <容器内路径>
pct push 241 /tmp/config.json /etc/sing-box/config.json

方法三:直接从宿主机修改容器的根文件系统(最暴力/有效)

LXC 容器的磁盘本质上是宿主机上的一个目录或挂载点。即使容器没运行,你也可以直接在宿主机修改它的文件。

如果容器正在运行:

PVE 会将容器的根目录挂载在宿主机的某个临时路径下。你可以通过以下命令找到并进入:

# 找到容器运行时的 rootfs 挂载点
ls -d /proc/$(lxc-info -n 241 -p -H)/root/etc/sing-box/

# 直接用宿主机的编辑器修改(注意路径非常长)
nano /proc/$(lxc-info -n 241 -p -H)/root/etc/sing-box/config.json
  • 参数说明
    • 核心组件:lxc-info -n 253 -p -H
    • 这部分是用来获取容器信息的:
      • -n 253:指定容器的名字(这里名字是 253)。
      • -p:仅显示该容器的 PID(进程 ID)。
      • -H:隐藏标题(Raw output),只输出数字。
      • 作用: 找到容器 253 的主进程在宿主机系统中的 PID。例如,如果返回 1234,那么这个容器在宿主机看来就是一个 PID 为 1234 的进程。
  • 关键路径:/proc/[PID]/root/ 这是 Linux 内核提供的一个“后门”:

在 Linux 中,/proc 目录包含了系统运行的所有进程信息。

每个进程目录下都有一个名为 root 的符号链接,它指向该进程运行时的根目录。

作用: 对于容器来说,通过宿主机的 /proc/[PID]/root/ 路径,你可以像操作本地目录一样直接访问容器内部的文件系统,而无需使用 lxc-attach 进入容器。

  • 完整命令逻辑 ls -d /proc/$(...)/root/etc/sing-box/

$(...):这是一个命令替换,它会先执行里面的 lxc-info 命令,把得到的 PID 填到路径里。

ls -d:查看目录本身的信息(而不是列出目录下的内容)。

完整路径:/proc/容器进程PID/root/etc/sing-box/

如果容器已停止(通过 pct mount

这是修改 .raw 磁盘镜像最稳妥的方法:

# 1. 挂载容器磁盘到宿主机临时目录
pct mount 241
# 执行后会返回一个路径,通常是 /var/lib/lxc/241/rootfs

# 2. 直接在宿主机修改
nano /var/lib/lxc/241/rootfs/etc/sing-box/config.json

# 3. 修改完成后卸载(重要!)
pct unmount 241
  • 封装脚本
#!/bin/sh


# ==========================================

# ⚙️ 配置区域

# ==========================================

# 默认容器名称

CONTAINER_NAME="253"

# 默认容器内目标路径

TARGET_PATH="/etc/sing-box/"


# ==========================================

# 🚀 执行逻辑

# ==========================================

# 1. 获取容器的 PID

# -p: 只打印 PID

# -H: 隐藏标题行

CONTAINER_PID=$(lxc-info -n "$CONTAINER_NAME" -p -H 2>/dev/null)


# 2. 检查容器是否正在运行

if [ -z "$CONTAINER_PID" ] || [ "$CONTAINER_PID" -eq 0 ]; then

    echo "❌ 错误: 容器 '$CONTAINER_NAME' 未运行或不存在。"

    exit 1

fi


# 3. 构造宿主机视角下的容器路径

# /proc/[PID]/root 是进入容器文件系统的“穿梭门”

REAL_PATH="/proc/$CONTAINER_PID/root$TARGET_PATH"


# 4. 验证路径是否存在

if ls -d "$REAL_PATH" >/dev/null 2>&1; then

    echo "✅ 路径已找到!"

    echo "容器 [$CONTAINER_NAME] 的内部路径 $TARGET_PATH 在宿主机映射为:"

    echo "$REAL_PATH"



    printf "\n--- 目录内容如下 ---\n"

    ls -F "$REAL_PATH"

else

    echo "❌ 路径不存在: 容器内找不到 $TARGET_PATH"

    exit 1

fi

💡 特别建议:使用 Bind Mount(挂载映射)

既然你是在玩 sing-box,配置可能会经常改动。最好的办法是把配置文件放在 PVE 宿主机上,映射给容器。

修改 /etc/pve/lxc/241.conf,添加:

lxc.mount.entry: /root/sing-box/config.json etc/sing-box/config.json none bind,create=file 0 0

这样做的好处:

  1. 你直接在 PVE 宿主机的 /root/sing-box/config.json 改文件。
  2. 改完后,只需要 pct restart 241 重启容器即可生效。
  3. 容器就算删了,配置文件也还在宿主机上。

config.json配置

{
  "log": {
    "level": "debug",
    "timestamp": true
  },
  "dns": {
    "servers": [
      {
        "server": "223.5.5.5",
        "type": "udp",
        "tag": "local_local"
      },
      {
        "server": "cloudflare-dns.com",
        "domain_resolver": "hosts_dns",
        "path": "/dns-query",
        "type": "https",
        "tag": "remote_dns",
        "detour": "🚀 节点选择"
      },
      {
        "server": "dns.alidns.com",
        "domain_resolver": "hosts_dns",
        "path": "/dns-query",
        "type": "https",
        "tag": "direct_dns"
      },
      {
        "predefined": {
          "dns.google": [
            "8.8.8.8",
            "8.8.4.4",
            "2001:4860:4860::8888",
            "2001:4860:4860::8844"
          ],
          "dns.alidns.com": [
            "223.5.5.5",
            "223.6.6.6",
            "2400:3200::1",
            "2400:3200:baba::1"
          ],
          "one.one.one.one": [
            "1.1.1.1",
            "1.0.0.1",
            "2606:4700:4700::1111",
            "2606:4700:4700::1001"
          ],
          "1dot1dot1dot1.cloudflare-dns.com": [
            "1.1.1.1",
            "1.0.0.1",
            "2606:4700:4700::1111",
            "2606:4700:4700::1001"
          ],
          "cloudflare-dns.com": [
            "104.16.249.249",
            "104.16.248.249",
            "2606:4700::6810:f8f9",
            "2606:4700::6810:f9f9"
          ],
          "dns.cloudflare.com": [
            "104.16.132.229",
            "104.16.133.229",
            "2606:4700::6810:84e5",
            "2606:4700::6810:85e5"
          ],
          "dot.pub": [
            "1.12.12.12",
            "120.53.53.53"
          ],
          "doh.pub": [
            "1.12.12.12",
            "120.53.53.53"
          ],
          "dns.quad9.net": [
            "9.9.9.9",
            "149.112.112.112",
            "2620:fe::fe",
            "2620:fe::9"
          ],
          "dns.yandex.net": [
            "77.88.8.8",
            "77.88.8.1",
            "2a02:6b8::feed:0ff",
            "2a02:6b8:0:1::feed:0ff"
          ],
          "dns.sb": [
            "185.222.222.222",
            "2a09::"
          ],
          "dns.umbrella.com": [
            "208.67.220.220",
            "208.67.222.222",
            "2620:119:35::35",
            "2620:119:53::53"
          ],
          "dns.sse.cisco.com": [
            "208.67.220.220",
            "208.67.222.222",
            "2620:119:35::35",
            "2620:119:53::53"
          ],
          "engage.cloudflareclient.com": [
            "162.159.192.1"
          ]
        },
        "type": "hosts",
        "tag": "hosts_dns"
      },
      {
        "inet4_range": "198.18.0.0/15",
        "inet6_range": "fc00::/18",
        "type": "fakeip",
        "tag": "fake_dns"
      },
      {
        "type": "udp",
        "server_port": 53,
        "tag": "Router-DNS",
        "server": "192.168.3.1"
      },
      {
        "server": "doh.cmliussss.net",
        "domain_resolver": "local_local",
        "path": "/CMLiussss",
        "type": "https",
        "tag": "ech_dns"
      }
    ],
    "rules": [
      {
        "query_type": [
          12,
          "PTR"
        ],
        "domain_suffix": [
          "168.192.in-addr.arpa"
        ],
        "server": "Router-DNS"
      },
      {
        "query_type": [
          12,
          "PTR"
        ],
        "action": "predefined",
        "rcode": "NXDOMAIN"
      },
      {
        "server": "hosts_dns",
        "ip_accept_any": true
      },
      {
        "server": "ech_dns",
        "domain": [
          "cloudflare-ech.com"
        ],
        "query_type": [
          64,
          65
        ]
      },
      {
        "rule_set": [
          "Category-Ads"
        ],
        "action": "reject"
      },
      {
        "domain_suffix": [
          "boc.cn",
          "bankcomm.com",
          "psbc.com",
          "citicbank.com",
          "pingan.com",
          "pingan.com.cn",
          "cib.com.cn",
          "cmbc.com.cn",
          "hxb.com.cn",
          "jdpay.com",
          "cloudflare.com",
          "letsencrypt.org"
        ],
        "domain_keyword": [
          "alipay",
          "taobao",
          "tenpay",
          "icbc",
          "cmbchina",
          "abchina",
          "ccb",
          "unionpay",
          "95516",
          "cebbank",
          "spdb",
          "cgbchina"
        ],
        "action": "route",
        "server": "direct_dns",
        "strategy": "prefer_ipv4"
      },
      {
        "server": "remote_dns",
        "clash_mode": "Global"
      },
      {
        "server": "direct_dns",
        "clash_mode": "Direct",
        "strategy": "prefer_ipv4"
      },
      {
        "action": "predefined",
        "rcode": "NOTIMP",
        "query_type": [
          64,
          65
        ]
      },
      {
        "server": "fake_dns",
        "type": "logical",
        "mode": "and",
        "rewrite_ttl": 1,
        "rules": [
          {
            "query_type": [
              1,
              28
            ]
          },
          {
            "invert": true,
            "domain": [
              "amobile.music.tc.qq.com",
              "api-jooxtt.sanook.com",
              "api.joox.com",
              "aqqmusic.tc.qq.com",
              "dl.stream.qqmusic.qq.com",
              "ff.dorado.sdo.com",
              "heartbeat.belkin.com",
              "isure.stream.qqmusic.qq.com",
              "joox.com",
              "lens.l.google.com",
              "localhost.ptlogin2.qq.com",
              "localhost.sec.qq.com",
              "mesu.apple.com",
              "mobileoc.music.tc.qq.com",
              "music.taihe.com",
              "musicapi.taihe.com",
              "na.b.g-tun.com",
              "proxy.golang.org",
              "ps.res.netease.com",
              "shark007.net",
              "songsearch.kugou.com",
              "static.adtidy.org",
              "streamoc.music.tc.qq.com",
              "swcdn.apple.com",
              "swdist.apple.com",
              "swdownload.apple.com",
              "swquery.apple.com",
              "swscan.apple.com",
              "turn.cloudflare.com",
              "trackercdn.kugou.com",
              "xnotify.xboxlive.com"
            ],
            "domain_suffix": [
              "126.net",
              "3gppnetwork.org",
              "battle.net",
              "battlenet.com.cn",
              "cdn.nintendo.net",
              "cmbchina.com",
              "cmbimg.com",
              "ff14.sdo.com",
              "ffxiv.com",
              "finalfantasyxiv.com",
              "gcloudcs.com",
              "home.arpa",
              "invalid",
              "kuwo.cn",
              "lan",
              "linksys.com",
              "linksyssmartwifi.com",
              "local",
              "localdomain",
              "localhost",
              "market.xiaomi.com",
              "mcdn.bilivideo.cn",
              "media.dssott.com",
              "msftconnecttest.com",
              "msftncsi.com",
              "music.163.com",
              "music.migu.cn",
              "n0808.com",
              "nflxvideo.net",
              "oray.com",
              "orayimg.com",
              "router.asus.com",
              "sandai.net",
              "square-enix.com",
              "srv.nintendo.net",
              "steamcontent.com",
              "uu.163.com",
              "wargaming.net",
              "wggames.cn",
              "wotgame.cn",
              "wowsgame.cn",
              "xiami.com",
              "y.qq.com",
              "boc.cn",
              "bankcomm.com",
              "psbc.com",
              "citicbank.com",
              "pingan.com",
              "pingan.com.cn",
              "cib.com.cn",
              "cmbc.com.cn",
              "hxb.com.cn",
              "jdpay.com"
            ],
            "domain_keyword": [
              "ntp",
              "stun",
              "time",
              "alipay",
              "taobao",
              "tenpay",
              "icbc",
              "cmbchina",
              "abchina",
              "ccb",
              "unionpay",
              "95516",
              "cebbank",
              "spdb",
              "cgbchina"
            ],
            "domain_regex": [
              "^[^.]+$",
              "^[^.]+\\.[^.]+\\.xboxlive\\.com$",
              "^localhost\\.[^.]+\\.weixin\\.qq\\.com$",
              "^mijia\\scloud$",
              "^xbox\\.[^.]+\\.microsoft\\.com$",
              "^xbox\\.[^.]+\\.[^.]+\\.microsoft\\.com$"
            ]
          }
        ]
      },
      {
        "server": "remote_dns",
        "rule_set": [
          "geosite-google"
        ]
      },
      {
        "server": "Router-DNS",
        "rule_set": [
          "GeoSite-Private"
        ],
        "strategy": "prefer_ipv4"
      },
      {
        "server": "direct_dns",
        "domain_suffix": [
          "alidns.com",
          "doh.pub",
          "dot.pub",
          "360.cn",
          "onedns.net"
        ],
        "strategy": "prefer_ipv4"
      },
      {
        "server": "direct_dns",
        "rule_set": [
          "GeoSite-CN"
        ],
        "strategy": "prefer_ipv4"
      }
    ],
    "final": "remote_dns",
    "disable_cache": false,
    "disable_expire": false,
    "independent_cache": true,
    "strategy": "prefer_ipv4",
    "reverse_mapping": false
  },
  "ntp": null,
  "inbounds": [
    {
      "address": [
        "172.19.0.1/30"
      ],
      "auto_redirect": true,
      "auto_route": true,
      "interface_name": "tun0",
      "mtu": 1400,
      "stack": "system",
      "strict_route": true,
      "tag": "tun-in",
      "type": "tun",
      "udp_timeout": "5m"
    },
    {
      "type": "mixed",
      "tag": "mixed-in",
      "listen": "0.0.0.0",
      "listen_port": 52930,
      "set_system_proxy": false,
      "users": [
        {
          "username": "admin",
          "password": "admin"
        }
      ]
    }
  ],
  "outbounds": [
    {
      "tag": "direct",
      "type": "direct"
    },
    {
      "default": "🎈 自动选择",
      "outbounds": [
        "🎈 自动选择",
        "🎯 全球直连",
        "0904"
      ],
      "tag": "🚀 节点选择",
      "type": "selector"
    },
    {
      "default": "direct",
      "outbounds": [
        "direct"
      ],
      "tag": "🎯 全球直连",
      "type": "selector"
    },
    {
      "interval": "3m",
      "outbounds": [
        "0904",
        "529-example.xyz.ci"
      ],
      "tag": "🎈 自动选择",
      "tolerance": 150,
      "type": "urltest",
      "url": "https://www.gstatic.com/generate_204"
    },
    {
      "default": "🚀 节点选择",
      "interrupt_exist_connections": true,
      "outbounds": [
        "🚀 节点选择",
        "🎈 自动选择",
        "🐟 漏网之鱼",
        "🎯 全球直连"
      ],
      "tag": "GLOBAL",
      "type": "selector"
    },
    {
      "default": "🚀 节点选择",
      "outbounds": [
        "🚀 节点选择",
        "🎯 全球直连",
        "🎈 自动选择"
      ],
      "tag": "🐟 漏网之鱼",
      "type": "selector"
    },
    {
      "domain_resolver": "local_local",
      "flow": "",
      "multiplex": {},
      "packet_encoding": "xudp",
      "server": "example.xyz",
      "server_port": 443,
      "tag": "529-example.xyz.ci",
      "tls": {
        "ech": {
          "enabled": true,
          "query_server_name": "cloudflare-ech.com"
        },
        "enabled": true,
        "server_name": "example.xyz.ci",
        "utls": {
          "enabled": true,
          "fingerprint": "chrome"
        }
      },
      "transport": {
        "early_data_header_name": "Sec-WebSocket-Protocol",
        "headers": {
          "Host": "example.xyz.ci"
        },
        "max_early_data": 2560,
        "path": "/class/openapi/v2",
        "type": "ws"
      },
      "type": "vless",
      "uuid": "cb2aec60-891f-46c8-ba6c-05bb3c0d8d69"
    },
    {
      "domain_resolver": "local_local",
      "multiplex": {},
      "server": "example.xyz",
      "server_port": 443,
      "tag": "0904",
      "tcp_fast_open": true,
      "tcp_multi_path": false,
      "tls": {
        "enabled": true,
        "insecure": true,
        "server_name": "example.xyz.net"
      },
      "transport": {
        "early_data_header_name": "Sec-WebSocket-Protocol",
        "headers": {
          "Host": "example.xyz.net"
        },
        "path": "/proxyip=proxyip.example.xyz.net",
        "type": "ws"
      },
      "type": "vless",
      "uuid": "db349dcb-d10f-4338-9d3b-cfc7b725c365"
    }
  ],
  "services": null,
  "endpoints": null,
  "route": {
    "rules": [
      {
        "action": "sniff"
      },
      {
        "protocol": [
          "dns"
        ],
        "action": "hijack-dns"
      },
      {
        "action": "bypass",
        "outbound": "🎯 全球直连",
        "ip_is_private": true
      },
      {
        "action": "bypass",
        "outbound": "🎯 全球直连",
        "rule_set": [
          "GeoIP-Private"
        ]
      },
      {
        "action": "bypass",
        "network": "icmp",
        "outbound": "🎯 全球直连"
      },
      {
        "action": "bypass",
        "outbound": "🎯 全球直连",
        "ip_cidr": [
          "223.5.5.5",
          "223.6.6.6",
          "2400:3200::1",
          "2400:3200:baba::1",
          "119.29.29.29",
          "1.12.12.12",
          "120.53.53.53",
          "2402:4e00::",
          "2402:4e00:1::",
          "180.76.76.76",
          "2400:da00::6666",
          "114.114.114.114",
          "114.114.115.115",
          "114.114.114.119",
          "114.114.115.119",
          "114.114.114.110",
          "114.114.115.110",
          "180.184.1.1",
          "180.184.2.2",
          "101.226.4.6",
          "218.30.118.6",
          "123.125.81.6",
          "140.207.198.6",
          "1.2.4.8",
          "210.2.4.8",
          "52.80.66.66",
          "117.50.22.22",
          "2400:7fc0:849e:200::4",
          "2404:c2c0:85d8:901::4",
          "117.50.10.10",
          "52.80.52.52",
          "2400:7fc0:849e:200::8",
          "2404:c2c0:85d8:901::8",
          "117.50.60.30",
          "52.80.60.30"
        ]
      },
      {
        "rule_set": [
          "Category-Ads"
        ],
        "action": "reject"
      },
      {
        "network": [
          "udp"
        ],
        "port": [
          443
        ],
        "action": "reject"
      },
      {
        "outbound": "🎯 全球直连",
        "rule_set": [
          "GeoSite-Private"
        ]
      },
      {
        "domain_suffix": [
          "boc.cn",
          "bankcomm.com",
          "psbc.com",
          "citicbank.com",
          "pingan.com",
          "pingan.com.cn",
          "cib.com.cn",
          "cmbc.com.cn",
          "hxb.com.cn",
          "jdpay.com"
        ],
        "domain_keyword": [
          "alipay",
          "taobao",
          "tenpay",
          "icbc",
          "cmbchina",
          "abchina",
          "ccb",
          "unionpay",
          "95516",
          "cebbank",
          "spdb",
          "cgbchina"
        ],
        "action": "route",
        "outbound": "🎯 全球直连"
      },
      {
        "outbound": "🎯 全球直连",
        "rule_set": [
          "my-direct-rules"
        ]
      },
      {
        "outbound": "🚀 节点选择",
        "rule_set": [
          "my-proxy-rules"
        ]
      },
      {
        "outbound": "🎯 全球直连",
        "clash_mode": "Direct"
      },
      {
        "outbound": "GLOBAL",
        "clash_mode": "Global"
      },
      {
        "outbound": "🚀 节点选择",
        "rule_set": [
          "geosite-google"
        ]
      },
      {
        "outbound": "🎯 全球直连",
        "rule_set": [
          "geosite-cloudflare"
        ]
      },
      {
        "outbound": "🎯 全球直连",
        "domain_suffix": [
          "alidns.com",
          "doh.pub",
          "dot.pub",
          "360.cn",
          "onedns.net"
        ]
      },
      {
        "outbound": "🎯 全球直连",
        "rule_set": [
          "GeoIP-CN"
        ]
      },
      {
        "outbound": "🎯 全球直连",
        "rule_set": [
          "GeoSite-CN"
        ]
      },
      {
        "action": "route",
        "rule_set": [
          "GeoLocation-!CN"
        ],
        "outbound": "🚀 节点选择"
      }
    ],
    "rule_set": [
      {
        "type": "local",
        "tag": "my-proxy-rules",
        "format": "source",
        "path": "/etc/sing-box/my-proxy.json"
      },
      {
        "type": "local",
        "tag": "my-direct-rules",
        "format": "source",
        "path": "/etc/sing-box/my-direct.json"
      },
      {
        "tag": "Category-Ads",
        "type": "remote",
        "url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/category-ads-all.srs",
        "format": "binary",
        "download_detour": "🎯 全球直连",
        "update_interval": "1d"
      },
      {
        "tag": "GeoIP-Private",
        "type": "remote",
        "url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geoip/private.srs",
        "format": "binary",
        "download_detour": "🎯 全球直连",
        "update_interval": "1d"
      },
      {
        "tag": "GeoSite-Private",
        "type": "remote",
        "url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/private.srs",
        "format": "binary",
        "download_detour": "🎯 全球直连",
        "update_interval": "1d"
      },
      {
        "tag": "GeoIP-CN",
        "type": "remote",
        "url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geoip/cn.srs",
        "format": "binary",
        "download_detour": "🎯 全球直连",
        "update_interval": "1d"
      },
      {
        "tag": "GeoSite-CN",
        "type": "remote",
        "url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/cn.srs",
        "format": "binary",
        "download_detour": "🎯 全球直连",
        "update_interval": "1d"
      },
      {
        "tag": "GeoLocation-!CN",
        "type": "remote",
        "url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/geolocation-!cn.srs",
        "format": "binary",
        "download_detour": "🎯 全球直连",
        "update_interval": "1d"
      },
      {
        "tag": "geosite-google",
        "type": "remote",
        "format": "binary",
        "url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/google.srs",
        "download_detour": "🎯 全球直连",
        "update_interval": "1d"
      },
      {
        "tag": "geosite-cloudflare",
        "type": "remote",
        "format": "binary",
        "url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/cloudflare.srs",
        "download_detour": "🎯 全球直连",
        "update_interval": "1d"
      }
    ],
    "auto_detect_interface": true,
    "final": "🐟 漏网之鱼",
    "default_domain_resolver": {
      "server": "direct_dns",
      "strategy": "prefer_ipv4"
    }
  },
  "experimental": {
    "cache_file": {
      "enabled": true,
      "path": "/etc/sing-box/cache.db",
      "cache_id": "cache.db",
      "store_fakeip": true
    },
    "clash_api": {
      "external_controller": "0.0.0.0:9090",
      "secret": "admin",
      "external_ui": "/etc/sing-box/ui",
      "external_ui_download_url": "https://github.com/MetaCubeX/metacubexd/archive/gh-pages.zip",
      "external_ui_download_detour": "🚀 节点选择",
      "default_mode": "rule",
      "access_control_allow_private_network": false
    }
  }
}

自定义规则

自定义my-direct.json

{
  "version": 1,
  "rules": [
    {
      "domain": [
        "www.hidoha.net",
        "www.gname.com",
        "zoneabc.net",
        "domain.stackryze.com",
        "eecd.cc",
        "gname.vip",
        "www.spaceship.com",
        "www.ip0168.com",
        "www.gzsk5.com",
        "vip.dytt-tvs.com",
        "www.baizhaowang.com"
      ],
      "domain_suffix": [
        "gname.com",
        "stackryze.com",
        "spaceship.com",
        "run.claw.cloud",
        "gzsk5.com",
        "cloudflare.com",
        "letsencrypt.org",

      ]
    }
  ]
}

自定义my-proxy.json

{
  "version": 1,
  "rules": [
    {
      "domain": [
        "one.one.one.one"
      ],
      "domain_suffix": [
        "registry-1.docker.io"
      ]
    }
  ]
}