233boy Singbox启用IPv6/IPv4优先的配置文件

近三天内
26次阅读
没有评论

以前一直用的233boy开发的singbox整合脚本,主要是轻便。

后面换了面板,前几天统一使用了v2bx,可惜v2bx不支持端口转发。

细细想想还是换回了singbox,无他,这个是真好用。

可惜默认就是ipv4优先出站,以前没在意,后面发现还是ipv6比较干净,必须得优先使用ipv6。

修改这个文件即可:/etc/sing-box/config.json

IPv4优先(默认的配置):

{
  "log": {
    "output": "/var/log/sing-box/access.log",
    "level": "info",
    "timestamp": true
  },
  "dns": {},
  "ntp": {
    "enabled": true,
    "server": "time.apple.com"
  },
  "outbounds": [
    {
      "tag": "direct",
      "type": "direct"
    }
  ]
}

IPv6优先(修改完毕的):

{
  "log": {
    "output": "/var/log/sing-box/access.log",
    "level": "info",
    "timestamp": true
  },
  "dns": {
    "servers": [
      {
        "tag": "cf-ipv6",
        "address": "2001:4860:4860::8888"
      },
      {
        "tag": "ipv4-dns",
        "address": "8.8.8.8"
      }
    ],
    "strategy": "prefer_ipv6"
  },
  "outbounds": [
    {
      "tag": "ipv6-outbound",
      "type": "direct",
      "inet6_bind_address": "::",
      "inet4_bind_address": "0.0.0.0",
      "domain_resolver": {
        "server": "cf-ipv6",
        "strategy": "prefer_ipv6"
      }
    },
    {
      "type": "block",
      "tag": "block"
    }
  ],
  "route": {
    "rules": [
      {
        "ip_is_private": true,
        "outbound": "block"
      },
      {
        "outbound": "ipv6-outbound",
        "network": [
          "udp",
          "tcp"
        ]
      }
    ],
    "final": "ipv6-outbound"
  },
  "experimental": {
    "cache_file": {
      "enabled": true
    }
  }
}

可能有点臃肿,但我对这个不太熟,只能做到这个程度了。

正文结束
自由书生
版权声明:本站原创文章,由 自由书生 于2025-12-13发表,共计1024字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)
验证码