Skip to content

TUN not working for latest homeproxy (sing-box 1.12.8-r1 + homeproxy 25.258.32386~fc82650), with generated sing-box-c.json attached #379

Description

@evan0greenup

Bug description

ust update the ImmortalWRT to the latest version (sing-box: 1.12.8-r1 and luci-app-homeproxy: 25.258.32386~fc82650).

While the version of kmod-tun is 6.6.93-r1.

When Homeproxy is in Redirect TCP + TProxy UDP, the proxy works without problem. However, when switch to Tun TCP/UDP, Homeproxy and sing-box are both stopped (after running shortly).

Actual behavior

When sing-box and Homeproxy are stopped, there will be no sing-box-c.log. But when I just run the command sing-box run -c sing-box-c.json, Here is the output from stderr/stdout:

FATAL[0000] start service: start dns/udp[default-dns]: detour to an empty direct outbound makes no sense

Expected behavior

It are supposed to work in both Redirect+TProxy and Tun mode.

Steps to reproduce

Just update the package to latest (in release immortalwrt 24.10.2). You will see the problem.

HomeProxy configuration

config homeproxy 'infra'
        option __warning 'DO NOT EDIT THIS SECTION, OR YOU ARE ON YOUR OWN!'
        option common_port '22,53,80,143,443,465,853,873,993,995,5222,8080,8443,9418'
        option mixed_port '5330'
        option redirect_port '5331'
        option tproxy_port '5332'
        option dns_port '5333'
        option ntp_server 'ntp.xxx.xxx'
        option sniff_override '1'
        option tun_name 'singtun0'
        option tun_addr4 '172.19.0.1/30'
        option tun_addr6 'fdfe:dcba:9876::1/126'
        option tun_mtu '9000'
        option table_mark '100'
        option self_mark '100'
        option tproxy_mark '101'
        option tun_mark '102'

config homeproxy 'migration'
        option crontab '1'

config homeproxy 'config'
        option main_node 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
        option main_udp_node 'same'
        option dns_server 'x.x.x.x'
        option china_dns_server 'x.x.x.x'
        option routing_mode 'bypass_mainland_china'
        option proxy_mode 'tun'
        option ipv6_support '0'
        option log_level 'warn'

config homeproxy 'control'
        ......

config homeproxy 'routing'
        option sniff_override '1'
        option default_outbound 'direct-out'
        option default_outbound_dns 'default-dns'
        option bypass_cn_traffic '0'
        option tcpip_stack 'system'

config homeproxy 'dns'
        option dns_strategy 'prefer_ipv4'
        option default_server 'default-dns'

config homeproxy 'subscription'
        ..........

config homeproxy 'server'
        option enabled '0'
        option log_level 'warn'

config node 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
        ........

sing-box configuration

{
        "log": {
                "disabled": false,
                "level": "warn",
                "output": "/var/run/homeproxy/sing-box-c.log",
                "timestamp": true
        },
        "ntp": {
                "enabled": true,
                "server": "ntp.xxx.xxx",
                "detour": "direct-out",
                "domain_resolver": "default-dns"
        },
        "dns": {
                "servers": [
                        {
                                "tag": "default-dns",
                                "type": "udp",
                                "server": "x.x.x.x",
                                "detour": "direct-out"
                        },
                        {
                                "tag": "system-dns",
                                "type": "local",
                                "detour": "direct-out"
                        },
                        {
                                "tag": "main-dns",
                                "domain_resolver": {
                                        "server": "default-dns",
                                        "strategy": "ipv4_only"
                                },
                                "detour": "main-out",
                                "type": "tcp",
                                "server": "x.x.x.x"
                        },
                        {
                                "tag": "china-dns",
                                "domain_resolver": {
                                        "server": "default-dns",
                                        "strategy": "prefer_ipv6"
                                },
                                "detour": "direct-out",
                                "type": "udp",
                                "server": "x.x.x.x"
                        }
                ],
                "rules": [
                        {
                                "rule_set": "direct-domain",
                                "action": "route",
                                "server": "china-dns"
                        },
                        {
                                "rule_set": "geosite-cn",
                                "action": "route",
                                "server": "china-dns",
                                "strategy": "prefer_ipv6"
                        },
                        {
                                "type": "logical",
                                "mode": "and",
                                "rules": [
                                        {
                                                "rule_set": "geosite-noncn",
                                                "invert": true
                                        },
                                        {
                                                "rule_set": "geoip-cn"
                                        }
                                ],
                                "action": "route",
                                "server": "china-dns",
                                "strategy": "prefer_ipv6"
                        }
                ],
                "strategy": "ipv4_only",
                "final": "main-dns"
        },
        "inbounds": [
                {
                        "type": "direct",
                        "tag": "dns-in",
                        "listen": "::",
                        "listen_port": 5333
                },
                {
                        "type": "mixed",
                        "tag": "mixed-in",
                        "listen": "::",
                        "listen_port": 5330,
                        "sniff": true,
                        "sniff_override_destination": true,
                        "set_system_proxy": false
                },
                {
                        "type": "tun",
                        "tag": "tun-in",
                        "interface_name": "singtun0",
                        "address": [
                                "172.19.0.1/30"
                        ],
                        "mtu": 9000,
                        "auto_route": false,
                        "stack": "system",
                        "sniff": true,
                        "sniff_override_destination": true
                }
        ],
        "outbounds": [
                ......
        ],
        "route": {
                "rules": [
                        {
                                "inbound": "dns-in",
                                "action": "hijack-dns"
                        },
                        {
                                "rule_set": "direct-domain",
                                "action": "route",
                                "outbound": "direct-out"
                        }
                ],
                "rule_set": [
                        {
                                "type": "inline",
                                "tag": "direct-domain",
                                "rules": [
                                        {
                                                "domain_keyword": [
                                                        ......
                                                ]
                                        }
                                ]
                        },
                        {
                                "type": "remote",
                                "tag": "geoip-cn",
                                "format": "binary",
                                "url": "https://fastly.jsdelivr.net/gh/1715173329/IPCIDR-CHINA@rule-set/cn.srs",
                                "download_detour": "main-out"
                        },
                        {
                                "type": "remote",
                                "tag": "geosite-cn",
                                "format": "binary",
                                "url": "https://fastly.jsdelivr.net/gh/1715173329/sing-geosite@rule-set-unstable/geosite-geolocation-cn.srs",
                                "download_detour": "main-out"
                        },
                        {
                                "type": "remote",
                                "tag": "geosite-noncn",
                                "format": "binary",
                                "url": "https://fastly.jsdelivr.net/gh/1715173329/sing-geosite@rule-set-unstable/geosite-geolocation-!cn.srs",
                                "download_detour": "main-out"
                        }
                ],
                "auto_detect_interface": true,
                "default_domain_resolver": {
                        "action": "route",
                        "server": "default-dns",
                        "strategy": "prefer_ipv4"
                },
                "final": "main-out"
        },
        "experimental": {
                "cache_file": {
                        "enabled": true,
                        "path": "/var/run/homeproxy/cache.db"
                }
        }
}

HomeProxy log

No log due to unexpected stop.

sing-box log

No log due to unexpected stop

OpenWrt/ImmortalWrt release

24.10.2

Device

Multiple devices occurs exactly same issue (all of them are aarch64 architecture)

Additional information

@1715173329 If there is still essential information which is missing, please do not close this issue, just let me know and I will provide that information as soon as possible. Thanks for your patience.

Terms

  • I confirm that the HomeProxy I installed is from official source, like GitHub artifacts or official ImmortalWrt opkg feeds.
  • I confirm that the Homeproxy I installed does not contain Clash mode support.
  • I confirm that the version of OpenWrt/ImmortalWrt I installed is >= 24.10.
  • I confirm that I have installed the latest version of HomeProxy and sing-box.
  • I confirm that I have read the sing-box documentation, understand the meaning of all the configuration items I added.
  • I confirm that I have not mixed iptables and nftables rules.
  • I confirm that I have not modified system DNS settings, or enabled any other DNS servers like MosDNS and SmartDNS.
  • I confirm that I have cleared the browser cache.
  • I confirm that I have selected all terms blindly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions