sing-box icon indicating copy to clipboard operation
sing-box copied to clipboard

在开启网络共享的情况下IPv6地址本机可以访问 局域网其它机器无法访问

Open cakeuui0414 opened this issue 3 years ago • 4 comments

操作系统

Linux

系统版本

Armbian 23.08

安装类型

sing-box 原始命令行程序

如果您使用图形客户端程序,请提供该程序版本。

No response

版本

sing-box version 1.4.0-beta.3

Environment: go1.21.0 linux/arm64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_reality_server,with_clash_api
Revision: f2095d7e1a7541936801505ce27302263a56c043
CGO: disabled

描述

本机和局域网设备使用dig或者nslookup均能解析到IPv6地址 但是局域网下其它设备均无法连接

dig

armbian:~:# dig 6.ipw.cn AAAA

; <<>> DiG 9.18.12-0ubuntu0.22.04.2-Ubuntu <<>> 6.ipw.cn AAAA
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61860
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; MBZ: 0x0093, udp: 1232
;; QUESTION SECTION:
;6.ipw.cn.                      IN      AAAA

;; ANSWER SECTION:
6.ipw.cn.               147     IN      AAAA    2402:4e00:1013:e500:0:9671:f018:4947

;; Query time: 0 msec
;; SERVER: 202.103.224.68#53(202.103.224.68) (UDP)
;; WHEN: Sun Aug 13 08:18:21 CST 2023
;; MSG SIZE  rcvd: 73

对应日志

23-08-13 08:18:20[ info ]dns: exchanged 6.ipw.cn. AAAA 6.ipw.cn. 147 IN AAAA 2402:4e00:1013:e500:0:9671:f018:4947
23-08-13 08:18:20[ info ]dns: cached 6.ipw.cn OPT OPT PSEUDOSECTION: EDNS: version 0 flags: MBZ: 0x0093, udp: 1232
23-08-13 08:18:20[ info ]dns: cached 6.ipw.cn AAAA 6.ipw.cn. 147 IN AAAA 2402:4e00:1013:e500:0:9671:f018:4947
23-08-13 08:18:20[ debug ]dns: cached 6.ipw.cn NOERROR 147
23-08-13 08:18:20[ debug ]dns: exchange 6.ipw.cn. IN AAAA
23-08-13 08:18:20[ debug ][1891379614 0ms] router: match[0] port=53 => dns-out
23-08-13 08:18:20[ debug ][1891379614 0ms] router: sniffed packet protocol: dns
23-08-13 08:18:20[ info ][1891379614 0ms] inbound/tun[tun-in]: inbound packet connection to 202.103.224.68:53
23-08-13 08:18:20[ info ][1891379614 0ms] inbound/tun[tun-in]: inbound packet connection from 172.19.0.1:52252

nslookup

armbian:~:# nslookup 6.ipw.cn
Server:         202.103.224.68
Address:        202.103.224.68#53

Non-authoritative answer:
Name:   6.ipw.cn
Address: 2402:4e00:1013:e500:0:9671:f018:4947

对应日志

23-08-13 08:21:40[ info ]dns: exchanged 6.ipw.cn. AAAA 6.ipw.cn. 180 IN AAAA 2402:4e00:1013:e500:0:9671:f018:4947
23-08-13 08:21:40[ info ]dns: exchanged 6.ipw.cn AAAA 6.ipw.cn. 180 IN AAAA 2402:4e00:1013:e500:0:9671:f018:4947
23-08-13 08:21:40[ debug ]dns: exchanged 6.ipw.cn NOERROR 180
23-08-13 08:21:40[ debug ]dns: exchange 6.ipw.cn. IN AAAA
23-08-13 08:21:40[ debug ][967181184 0ms] router: match[0] port=53 => dns-out
23-08-13 08:21:40[ debug ][967181184 0ms] router: sniffed packet protocol: dns
23-08-13 08:21:40[ info ][967181184 0ms] inbound/tun[tun-in]: inbound packet connection to 202.103.224.68:53
23-08-13 08:21:40[ info ][967181184 0ms] inbound/tun[tun-in]: inbound packet connection from 172.19.0.1:32835
23-08-13 08:21:40[ info ]dns: cached 6.ipw.cn SOA ipw.cn. 158 IN SOA ns3.dnsv2.com. level3dnsadmin.dnspod.com. 1688803189 3600 180 1209600 180
23-08-13 08:21:40[ debug ]dns: cached 6.ipw.cn NOERROR 158
23-08-13 08:21:40[ debug ]dns: exchange 6.ipw.cn. IN A
23-08-13 08:21:40[ debug ][2152037806 0ms] router: match[0] port=53 => dns-out
23-08-13 08:21:40[ debug ][2152037806 0ms] router: sniffed packet protocol: dns
23-08-13 08:21:40[ info ][2152037806 0ms] inbound/tun[tun-in]: inbound packet connection to 202.103.224.68:53
23-08-13 08:21:40[ info ][2152037806 0ms] inbound/tun[tun-in]: inbound packet connection from 172.19.0.1:50349

重现方式

{
  "log": {
    "level": "debug",
    "timestamp": true
  },
  "dns": {
    "independent_cache": true,
    "servers": [
      {
        "address": "tls://1.12.12.12",
        "address_resolver": "dns-direct",
        "strategy": "prefer_ipv6",
        "tag": "dns-remote"
      },
      {
        "address": "https://1.12.12.12/dns-query",
        "address_resolver": "dns-local",
        "detour": "direct",
        "strategy": "prefer_ipv6",
        "tag": "dns-direct"
      },
      {
        "address": "local",
        "detour": "direct",
        "tag": "dns-local"
      },
      {
        "tag": "block",
        "address": "rcode://success"
      }
    ],
    "rules": [
      {
          "geosite": [
          "cn",
          "apple@cn",
          "category-games@cn"
        ],
        "server": "dns-direct"
      },
      {
        "geosite": "category-ads-all",
        "server": "block",
        "disable_cache": true
      },
      {
        "domain": [
          "dns.alidns.com"
        ],
        "server": "dns-direct"
      }
    ]
  },
  "experimental": {
    "clash_api": {
      "external_controller": "0.0.0.0:9090",
      "external_ui": "yacd",
      "store_selected": true,
      "store_fakeip": true
    }
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "listen_port": 6450,
      "override_address": "1.12.12.12",
      "override_port": 53,
      "tag": "dns-in",
      "type": "direct"
    },
    {
      "type": "tun",
      "tag": "tun-in",
      "interface_name": "singbox-tun",
      "inet4_address": [
        "172.19.0.1/28"
      ],
      "inet6_address": [
        "fdfe:dcba:9876::1/126"
      ],
      "auto_route": true,
      "strict_route": true,
      "stack": "system",
      "sniff": true
    }
  ],
  "outbounds": [
    {
      "type": "selector",
      "tag": "🎯 科学上网",
    
      "outbounds": [
        "广西移动 | TCP | 分流",
        "广西移动1 | TCP | 分流",
        "广西电信 | TCP | 分流"
      ]
    },
    {
      "type": "selector",
      "tag": "🚀 中国代理",
    
      "outbounds": [
        "direct",
        "广西移动 | WS",
        "广西移动1 | WS",
        "广西电信 | WS",
	"🎯 科学上网"
      ]
    },
    {
      "type": "direct",
      "tag": "direct"
    },
    {
      "type": "block",
      "tag": "block"
    },
    {
      "tag": "dns-out",
      "type": "dns"
    }
  ],
  "route": {
    "auto_detect_interface": true,
    "geosite": {
      "path": "/etc/sing-box/geosite.db",
      "download_url": "https://github.com/CHIZI-0618/v2ray-rules-dat/releases/latest/download/geosite.db",
      "download_detour": "🎯 科学上网"
    },
    "geoip": {
      "path": "/etc/sing-box/geoip.db",
      "download_url": "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.db",
      "download_detour": "🎯 科学上网"
    },
    "rules": [
      {
        "outbound": "dns-out",
        "port": [
          53
        ]
      },
      {
        "inbound": [
          "dns-in"
        ],
        "outbound": "dns-out"
      },
      {
        "geosite": [
          "cn"
        ],
        "outbound": "🚀 中国代理"
      },
      {
        "geoip": [
          "cn"
        ],
        "outbound": "🚀 中国代理"
      },
      {
        "ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ],
        "outbound": "block",
        "source_ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ]
      }
    ]
  }
}

日志

23-08-13 08:24:06[ info ]dns: cached 6.ipw.cn SOA ipw.cn. 12 IN SOA ns3.dnsv2.com. level3dnsadmin.dnspod.com. 1688803189 3600 180 1209600 180
23-08-13 08:24:06[ debug ]dns: cached 6.ipw.cn NOERROR 12
23-08-13 08:24:06[ debug ]dns: exchange 6.ipw.cn. IN HTTPS
23-08-13 08:24:06[ debug ][236955312 1ms] router: match[0] port=53 => dns-out
23-08-13 08:24:06[ debug ][236955312 0ms] router: sniffed packet protocol: dns
23-08-13 08:24:06[ info ][236955312 0ms] inbound/tun[tun-in]: inbound packet connection to 202.103.224.68:53
23-08-13 08:24:06[ info ][236955312 0ms] inbound/tun[tun-in]: inbound packet connection from 172.19.0.1:58961
23-08-13 08:24:06[ info ]dns: cached 6.ipw.cn SOA ipw.cn. 12 IN SOA ns3.dnsv2.com. level3dnsadmin.dnspod.com. 1688803189 3600 180 1209600 180
23-08-13 08:24:06[ debug ]dns: cached 6.ipw.cn NOERROR 12
23-08-13 08:24:06[ debug ]dns: exchange 6.ipw.cn. IN HTTPS
23-08-13 08:24:06[ debug ][4074107415 1ms] router: match[0] port=53 => dns-out
23-08-13 08:24:06[ debug ][4074107415 0ms] router: sniffed packet protocol: dns
23-08-13 08:24:06[ info ][4074107415 0ms] inbound/tun[tun-in]: inbound packet connection to 202.103.224.68:53
23-08-13 08:24:06[ info ][4074107415 0ms] inbound/tun[tun-in]: inbound packet connection from 172.19.0.1:34960

cakeuui0414 avatar Aug 13 '23 00:08 cakeuui0414

tun auto_route 不处理操作系统防火墙,也就是说,您需要手动配置 iptables/nftables 以允许透明代理。此外,您可能还需要检查 ip_forward 与 rp_filter。

nekohasekai avatar Aug 13 '23 01:08 nekohasekai

已确认dns配置错误

cakeuui0414 avatar Aug 13 '23 17:08 cakeuui0414

请问是如何解决的,我也遇到了。

enpioodada avatar Aug 24 '23 17:08 enpioodada

请问是如何解决的,我也遇到了。

开fakeip 把dns换成tls://dns.alidns.com

cakeuui0414 avatar Aug 24 '23 18:08 cakeuui0414