Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bind_interface无法正确处理ipv6 #2116

Open
4 of 5 tasks
qweaszxcdf opened this issue Sep 16, 2024 · 6 comments
Open
4 of 5 tasks

bind_interface无法正确处理ipv6 #2116

qweaszxcdf opened this issue Sep 16, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@qweaszxcdf
Copy link

操作系统

Linux

系统版本

Linux version 6.6.50 (ubuntu@op-build) (x86_64-openwrt-linux-musl-gcc (OpenWrt GCC 13.3.0 r27299-66559946ac) 13.3.0, GNU ld (GNU Binutils) 2.42) #0 SMP Fri Sep 13 10:20:01 2024

安装类型

sing-box 原始命令行程序

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

No response

版本

sing-box version 1.9.4

Environment: go1.22.7 linux/amd64
Tags: with_clash_api,with_ech,with_gvisor,with_quic,with_reality_server,with_utls,with_wireguard
CGO: enabled

描述

我有telecom和unicom双线拨号接入,均开启IPv6,利用bind_interface进行绑定接口分流时sing-box不能正确处理其中一个接口的ipv6访问

重现方式

config.json

{
	"log": {
		"disabled": false,
		"level": "trace",
		"timestamp": true
	},
	"dns": {
		"servers": [
			{
				"tag": "default-dns",
				"address": "local",
				"detour": "direct-out"
			}
		],
		"rules": [
			{
				"outbound": "any",
				"server": "default-dns"
			}
		],
		"disable_cache": true,
		"disable_expire": false,
		"independent_cache": false,
		"final": "default-dns"
	},
	"outbounds": [
		{
			"type": "direct",
			"tag": "direct-out",
			"routing_mark": 100
		},
		{
			"type": "block",
			"tag": "block-out"
		},
		{
			"type": "dns",
			"tag": "dns-out"
		},
		{
			"type": "direct",
			"tag": "telecom",
			"routing_mark": 100,
			"tcp_fast_open": true,
			"tcp_multi_path": true,
			"udp_fragment": true,
			"bind_interface": "pppoe-wan"
		},
		{
			"type": "direct",
			"tag": "unicom",
			"routing_mark": 100,
			"tcp_fast_open": true,
			"tcp_multi_path": true,
			"udp_fragment": true,
			"bind_interface": "pppoe-unicom"
		}
	],
	"route": {
		"rules": [
			{
				"inbound": "dns-in",
				"outbound": "dns-out"
			},
			{
				"protocol": "dns",
				"outbound": "dns-out"
			}
		],
		"rule_set": [],
		"auto_detect_interface": false,
		"final": "unicom"
	},
	"experimental": {}
}
root@OpenWrt:~# ip -6 route
default from 2408:820c:d020 /64 via fe80::d64f:67ff:fe57:1226 dev pppoe-unicom proto static metric 512 pref medium
default from 2408:820c:d02c /60 via fe80::d64f:67ff:fe57:1226 dev pppoe-unicom proto static metric 512 pref medium
default from 240e:388:c51a /56 via fe80::ce1a:faff:fee9:66c0 dev pppoe-wan proto static metric 512 pref medium
default from 240e:38f:cf02 /64 via fe80::ce1a:faff:fee9:66c0 dev pppoe-wan proto static metric 512 pref medium
unreachable 2408:820c:d020 /64 dev lo proto static metric 2147483647 pref medium
2408:820c:d02c /64 dev br-lan proto static metric 1024 pref medium
unreachable 2408:820c:d02c /60 dev lo proto static metric 2147483647 pref medium
240e:388:c51a /64 dev br-lan proto static metric 1024 pref medium
unreachable 240e:388:c51a /56 dev lo proto static metric 2147483647 pref medium
unreachable 240e:38f:cf02 /64 dev lo proto static metric 2147483647 pref medium
fd9e:3006:b245::/64 dev br-lan proto static metric 1024 pref medium
unreachable fd9e:3006:b245::/48 dev lo proto static metric 2147483647 pref medium
fe80::2e2:697e:4a51:53 dev pppoe-wan proto kernel metric 256 pref medium
fe80::565:6c95:5312:a372 dev pppoe-unicom proto kernel metric 256 pref medium
fe80::ce1a:faff:fee9:66c0 dev pppoe-wan proto kernel metric 256 pref medium
fe80::d64f:67ff:fe57:1226 dev pppoe-unicom proto kernel metric 256 pref medium
fe80::/64 dev br-lan proto kernel metric 256 pref medium
fe80::/64 dev iptv85 proto kernel metric 256 pref medium
fe80::/64 dev eth0.2 proto kernel metric 256 pref medium
fe80::/64 dev eth1 proto kernel metric 256 pref medium

日志

root@OpenWrt:~# sing-box tools fetch ip.gs -c test.json
+0000 2024-09-16 11:34:15 INFO router: updated default interface pppoe-wan, index 20
+0000 2024-09-16 11:34:15 INFO sing-box pre-started (0.00s)
+0000 2024-09-16 11:34:15 INFO outbound/direct[unicom]: outbound connection to ip.gs:80
+0000 2024-09-16 11:34:15 DEBUG dns: lookup domain ip.gs
+0000 2024-09-16 11:34:15 DEBUG dns: match[0] outbound=any => default-dns
+0000 2024-09-16 11:34:15 DEBUG outbound/direct[direct-out]: outbound packet connection to 127.0.0.1:53
+0000 2024-09-16 11:34:15 DEBUG outbound/direct[direct-out]: outbound packet connection to 127.0.0.1:53
+0000 2024-09-16 11:34:15 DEBUG dns: lookup succeed for ip.gs: 2606:4700:3036::6815:eb0 2606:4700:3035::ac43:a01c 104.21.14.176 172.67.160.28
FATAL[0000] Get "http://ip.gs": net/http: HTTP/1.x transport connection broken: dial tcp [2606:4700:3036::6815:eb0]:80: connect: network is unreachable

支持我们

完整性要求

  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
  • 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
  • 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。
@nekohasekai nekohasekai added bug Something isn't working and removed bug Something isn't working labels Sep 16, 2024
@nekohasekai
Copy link
Member

OpenWrt 并没有给本机配置 IPv6 路由,你还需要手动指定 IP 地址: https://sing-box.sagernet.org/configuration/shared/dial/#inet6_bind_address

@qweaszxcdf
Copy link
Author

手动指定ip后确实可以访问了,但如果是没配置路由的话,那么指定telecom和unicom后应该都是network is unreachable,而现在telecom不指定ip也能访问。从日志上看,初始化的时候获取了pppoe-wan接口对应的ip(?),bind_interface自动获取并设置出口ip是否更合理?

@nekohasekai
Copy link
Member

nekohasekai commented Sep 16, 2024

发送你的这条命令的结果:
ip route get 2606:4700:4700::1111

@qweaszxcdf
Copy link
Author

root@OpenWrt:~# ip -6 route get 2606:4700:4700::1111
RTNETLINK answers: Network unreachable

@nekohasekai
Copy link
Member

你能再提供命令 ip addr 的结果吗?

@qweaszxcdf
Copy link
Author

root@OpenWrt:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host proto kernel_lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br-lan state UP group default qlen 1000
    link/ether bc:24:11:*** brd ff:ff:ff:ff:ff:ff
3: teql0: <NOARP> mtu 1500 qdisc noop state DOWN group default qlen 100
    link/void
4: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:e2:69:*** brd ff:ff:ff:ff:ff:ff
    inet6 fe80::2e2:***/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
5: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br-lan state UP group default qlen 1000
    link/ether 00:e2:69:*** brd ff:ff:ff:ff:ff:ff
6: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br-lan state UP group default qlen 1000
    link/ether 00:e2:69:*** brd ff:ff:ff:ff:ff:ff
9: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether bc:24:11:*** brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.1/24 brd 10.0.0.255 scope global br-lan
       valid_lft forever preferred_lft forever
    inet6 240e:388:c501:***/60 scope global dynamic noprefixroute
       valid_lft 2972sec preferred_lft 2972sec
    inet6 2408:820c:d02c:***/60 scope global dynamic noprefixroute
       valid_lft 256770sec preferred_lft 170370sec
    inet6 240e:388:c508:***/60 scope global deprecated dynamic
       valid_lft 608sec preferred_lft 0sec
    inet6 2408:820c:d02c:***/60 scope global deprecated dynamic
       valid_lft 4762sec preferred_lft 0sec
    inet6 2408:820c:d02c:***/60 scope global deprecated dynamic
       valid_lft 3975sec preferred_lft 0sec
    inet6 fd9e:3006:b245::1/60 scope global noprefixroute
       valid_lft forever preferred_lft forever
    inet6 fe80::be24:11ff:***/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
12: iptv85: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:e2:69:*** brd ff:ff:ff:ff:ff:ff
    inet 23.246.87.229/17 brd 23.246.127.255 scope global iptv85
       valid_lft forever preferred_lft forever
    inet6 fe80::2e2:69ff:***/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
15: eth0.85@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master iptv85 state UP group default qlen 1000
    link/ether bc:24:11:*** brd ff:ff:ff:ff:ff:ff
17: wg: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
    link/none
    inet 10.0.1.1/24 brd 10.0.1.255 scope global wg
       valid_lft forever preferred_lft forever
25: eth1.85@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master iptv85 state UP group default qlen 1000
    link/ether 00:e2:69:*** brd ff:ff:ff:ff:ff:ff
26: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether bc:24:11:*** brd ff:ff:ff:ff:ff:ff
    inet6 fe80::be24:11ff:***/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
27: pppoe-unicom: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 139.22*** peer 139.22***/32 scope global pppoe-unicom
       valid_lft forever preferred_lft forever
    inet6 2408:820c:d020:***/64 scope global dynamic noprefixroute
       valid_lft 258259sec preferred_lft 171859sec
    inet6 fe80::55e6:60ed:8934:d269 peer fe80::d64f:***/128 scope link
       valid_lft forever preferred_lft forever
28: pppoe-wan: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp
    inet 218.83*** peer 218.83***/32 scope global pppoe-wan
       valid_lft forever preferred_lft forever
    inet6 240e:38f:cf***/64 scope global dynamic noprefixroute
       valid_lft 2591972sec preferred_lft 604772sec
    inet6 fe80::2e2:691*** peer fe80::ce1a:faff:***/128 scope link
       valid_lft forever preferred_lft forever

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants