sing box 透明代理折腾了几天局域网设备还是没法连通,请教下大家是我的规则配的有问题嘛

3 天前
 guangnan

配置是跟着不良林大佬的基础上修改的,但是我用闲置的 mac 启动 sing box ,本机可以正常连外网,但是局域网设备的网关&dns 指向 mac ip 都不行。

应该不是 mac 的防火墙原因,mac 上防火墙都是全关状态,alist 的网盘还是可以正常访问的

折腾几天各种换配置都不行,希望大佬可以指点下

{
  "log": {
    "disabled": false,
    "level": "info",
    "timestamp": true
  },
  "dns": {
    "servers": [
      {
        "tag": "default-dns",
        "address": "223.5.5.5",
        "detour": "direct-out"
      },
      {
        "tag": "system-dns",
        "address": "local",
        "detour": "direct-out"
      },
      {
        "tag": "block-dns",
        "address": "rcode://name_error"
      },
      {
        "tag": "google",
        "address": "https://dns.google/dns-query",
        "address_resolver": "default-dns",
        "address_strategy": "ipv4_only",
        "strategy": "ipv4_only",
        "client_subnet": "59.36.166.66"
      }
    ],
    "rules": [
      {
        "outbound": "any",
        "server": "default-dns"
      },
      {
        "query_type": "HTTPS",
        "server": "block-dns"
      },
      {
        "clash_mode": "direct",
        "server": "default-dns"
      },
      {
        "clash_mode": "global",
        "server": "google"
      },
      {
        "rule_set": "cnsite",
        "server": "default-dns"
      }
    ],
    "strategy": "ipv4_only",
    "disable_cache": false,
    "disable_expire": false,
    "independent_cache": false,
    "final": "google"
  },
  "inbounds": [
    {
      "type": "tun",
      "address": "172.19.0.1/30",
      "auto_route": true,
      "strict_route": false,
      "sniff": true,
      "sniff_override_destination": true
    }
  ],
  "outbounds": [
    {
      "type": "direct",
      "tag": "direct-out"
    },
    {
      "type": "block",
      "tag": "block-out"
    },
    {
      "type": "dns",
      "tag": "dns-out"
    },
    {
      "type": "urltest",
      "tag": "自动选择",
      "outbounds": [
        "美国"
      ]
    },
    {
      "type": "selector",
      "tag": "手动选择",
      "outbounds": [
        "direct-out",
        "block-out",
        "自动选择",
        "美国"
      ],
      "default": "自动选择"
    },
    {
      "type": "selector",
      "tag": "GLOBAL",
      "outbounds": [
        "direct-out",
        "手动选择",
        "自动选择",
        "美国"
      ],
      "default": "手动选择"
    },
    {
      "type": "vless",
      "tag": "美国"
    }
  ],
  "route": {
    "rules": [
      {
        "protocol": "dns",
        "outbound": "dns-out"
      },
      {
        "protocol": "quic",
        "outbound": "block-out"
      },
      {
        "clash_mode": "direct",
        "outbound": "direct-out"
      },
      {
        "clash_mode": "global",
        "outbound": "GLOBAL"
      },
      {
        "rule_set": [
          "cnip",
          "cnsite"
        ],
        "outbound": "direct-out"
      }
    ],
    "rule_set": [
      {
        "type": "remote",
        "tag": "cnip",
        "format": "binary",
        "url": "https://github.com/MetaCubeX/meta-rules-dat/raw/sing/geo-lite/geoip/cn.srs",
        "download_detour": "direct-out"
      },
      {
        "type": "remote",
        "tag": "cnsite",
        "format": "binary",
        "url": "https://github.com/MetaCubeX/meta-rules-dat/raw/sing/geo-lite/geosite/cn.srs",
        "download_detour": "direct-out"
      }
    ],
    "auto_detect_interface": true,
    "final": "手动选择"
  },
  "experimental": {
    "clash_api": {
      "external_controller": "0.0.0.0:9090",
      "external_ui_download_url": "https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip",
      "external_ui_download_detour": "手动选择",
      "default_mode": "rule"
    }
  }
}

908 次点击
所在节点    宽带症候群
9 条回复
lpt0
3 天前
mac 是软路由?
guangnan
3 天前
@lpt0 就是闲置的一个旧 mac 当旁路由,想翻墙的设备就把网关和 dns 指向 mac 这个 ip
之前用 clash 都没啥问题,换成 sing box 就不可以了
lpt0
3 天前
参考一下我的,尤其是 inbound 部分
https://raw.githubusercontent.com/Laputa0/archrouter/refs/heads/main/debian_sysroot/etc/sing-box/
config.json.with-dns.bak
lpt0
3 天前
route rules 部分似乎没有处理 private ip 走直连
leehaoze98
3 天前
配置看着没啥毛病,如果是走的无线网,mac 上没开启 IP 动态伪装,很可能是包从主路由发出去的时候没做 NAT ,可以去主路由上用 tcpdump 抓一下发出去的包看看
zfabl
3 天前
inbounds tun 加上"auto_redirect": true
Laoz666
3 天前
mac 有个互联网共享 开开
Ipsum
2 天前
nat 做了吗? ipforward 做了吗?
leon2023
1 天前
我也折腾了一段时间,始终有些问题,放弃了,感觉还是 v2 或者 clash 稳定

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1088807

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX