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

local dns not working even with CGO enabled in windows

Open fsheidaiee opened this issue 2 years ago • 2 comments

Welcome

  • [X] Yes, I'm using the latest major release. Only such installations are supported.
  • [X] Yes, I'm using the latest Golang release. Only such installations are supported.
  • [X] Yes, I've searched similar issues on GitHub and didn't find any.
  • [X] Yes, I've included all information below (version, config, log, etc).

Description of the problem

when setting local dns no website opens (if set "192.168.1.1" instead of "local" websites begin to open)

Version of sing-box

sing-box version 1.1-beta9

Environment: go1.19.1 windows/amd64 Tags: with_clash_api,with_quic Revision: 37be205dccdd52a95f41f191a04bcbc12649745a CGO: enabled

Server and client configuration file

{ "log": { "disabled": false, "level": "info", "output": "./log", "timestamp": true }, "dns": { "servers": [ { "tag": "mydns", "address": "local", "detour": "direct" }, { "tag": "ddns", "address": "https://cloudflare-dns.com/dns-query", "address_resolver": "mydns", "detour": "direct" } ], "rules": [ { "domain_suffix": [".ir"], "geosite": ["private", "private"], "server": "local" }, { "source_geoip": ["ir"], "server": "local" } ], "final": "ddns", "strategy": "ipv4_only" }, "inbounds": [ { "type": "tun", "tag": "tun-in", "interface_name": "singbox", "inet4_address": "172.19.0.1/30", "auto_route": true, "stack": "system", "mtu": 9000, "sniff": true }

],
"outbounds": [

{ "type": "selector", "tag": "select",

"outbounds": [ "vless", "vmess", "socks", "direct" ], "default": "vmess" }, { "type": "vless", "tag": "vless", "server": "xxxxxxxxxxxxxxx", "server_port": xxxxxxxxx, "uuid": "xxxxxxxxxxxxxx", "packet_encoding": "xudp", "transport": { "type": "ws", "path": "/", "headers": {} } }, { "type": "vmess", "tag": "vmess",

"server": "xxxxxxxxxxxx", "server_port": xxxxxx, "uuid": "xxxxxxxxxxxxxxxxxx", "security": "auto", "alter_id": 0, "global_padding": false, "packet_encoding": "xudp", "transport": { "type": "ws", "path": "xxxxxxxxxxx", "headers": {"xxxxxxxxxxxxxxxxx"}, "max_early_data": 0, "early_data_header_name": "" } }, { "type": "socks", "tag": "socks",

"server": "127.0.0.1", "server_port": 2080, "version": "5" }, { "type": "direct", "tag": "direct" }, { "type": "block", "tag": "block" }, { "type": "dns", "tag": "dns-out" } ], "route": { "rules": [ { "protocol": "dns", "outbound": "dns-out" }, { "geosite": "category-ads-all", "outbound": "block" }, { "domain_suffix": [".ir"], "geosite": ["private", "ir"], "outbound": "direct" }, { "geoip": ["ir", "private"], "outbound": "direct" }, { "source_geoip": ["ir"], "outbound": "direct" } ], "auto_detect_interface": true, "final": "select" }, "experimental": { "clash_api": { "external_controller": "127.0.0.1:9090", "external_ui": "dashboard", "direct_io": false, "default_mode": "rule", "store_selected": true } } }

Server and client log file

log.log

fsheidaiee avatar Oct 07 '22 16:10 fsheidaiee

tun is designed to hijack system dns, so local dns is not supported.

nekohasekai avatar Oct 07 '22 16:10 nekohasekai

I have the same problem, but I didn't get any ERROR. It run OK on 1.1-beta8, but not working on 1.1-beta9 (same config).

Client Config:

{
  "log": {
  	"disabled": false,
  	"level": "info",
  	"output": "",
  	"timestamp": true
  },
  "dns": {
	"servers": [
  	{
  		"tag": "cloudflare",
  		"address": "https://1.1.1.1/dns-query"
  	},
	{
  		"tag": "google",
  		"address": "https://8.8.8.8/dns-query"
  	},
  	{
  		"tag": "self",
  		"address": "local",
  		"detour": "direct"
  	}
  ],
  "rules": [
  	{
		"inbound": [
			"mixed-in"
		],
  		"domain_keyword": [
  			"bilibili.com",
  			"hdslb.com",
  			"akamaized.net",
  			"szbdyd.com",
  			"b23.tv"
  		],
  		"geosite": [
  			"geolocation-!cn",
  			"greatfire",
  			"bilibili",
  			"telegram"
  		],
  		"server": "cloudflare"
  	},
	{
		"inbound": [
			"mixed-in"
		],
		"domain_keyword": [
  			"monitor.uu.qq.com",
  			"pingjs.qq.com",
  			"pingma.qq.com",
  			"pingtcss.qq.com",
  			"mi.gdt.qq.com",
  			"qq.com",
  			"api.mixpanel.com"
  		],
  		"geosite": [
  			"category-ads",
  			"category-ads-all",
			"google-ads"
  		],
		"domain_regex": [
			"^adservice.google.([a-z]{2}|com?)(.[a-z]{2})?$"
		],
		"server": "self"
  	}
 ],
  "final": "cloudflare",
  "strategy": "prefer_ipv6",
  "disable_cache": true,
  "disable_expire": true
 },
  "outbounds": [
  	{
  		"type": "trojan",
  		"tag": "trojan-out",
  		"server": "xxx.xxx.xxx",
  		"server_port": 443,
  		"password": "abcd",
  		"tls": {
  			"enabled": true,
  			"disable_sni": false,
  			"server_name": "xxx.xxx.xxx",
			"insecure": false,
  			"alpn": [
  				"http/2"
  			],
			"min_version": "1.2",
  			"max_version": "1.3",
  			"cipher_suites": [
  				"TLS_RSA_WITH_AES_128_CBC_SHA",
  				"TLS_RSA_WITH_AES_256_CBC_SHA",
  				"TLS_RSA_WITH_AES_128_GCM_SHA256",
  				"TLS_RSA_WITH_AES_256_GCM_SHA384",
  				"TLS_AES_128_GCM_SHA256",
  				"TLS_AES_256_GCM_SHA384",
  				"TLS_CHACHA20_POLY1305_SHA256",
  				"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
  				"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
  				"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
  				"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
  				"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
  				"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
  				"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
  				"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
  				"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
  				"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256"
  			],
			"utls": {
				"enabled": false,
				"fingerprint": "chrome"
			}
  		},
  		"multiplex": {
  			"enabled": false,
  			"protocol": "smux",
  			"max_connections": 30,
  			"min_streams": 4,
  			"max_streams": 0
  		},
  		"transport": {
  			"type": "ws",
  			"path": "/yyy"
  		},
  		"connect_timeout": "5s",
		"tcp_fast_open": true,
		"udp_fragment": false,
		"domain_strategy": "prefer_ipv6",
		"fallback_delay": "100ms"
  	},
	{
		"type": "dns",
		"tag": "dns-out"
	},
	{
		"type": "block",
		"tag": "block-out"
	},
	{
  		"type": "direct",
  		"tag": "direct-out",
  		"connect_timeout": "5s",
  		"tcp_fast_open": false,
  		"udp_fragment": false,
  		"domain_strategy": "prefer_ipv6",
  		"fallback_delay": "100ms"
  	}
  ],
  "inbounds": [
  	{
  		"type": "mixed",
  		"tag": "mixed-in",
  		"listen": "127.0.0.1",
  		"listen_port": 1080,
  		"tcp_fast_open": false,
  		"udp_fragment": false,
  		"sniff": true,
  		"proxy_protocol": true,
  		"proxy_protocol_accept_no_header": true,
  		"set_system_proxy": false
  	}
  ],
  "route": {
  	"geoip": {
  		"path": "geoip.db"
  		},
  	"geosite": {
  		"path": "geosite.db"
  		},
  	"rules": [
		{
			"protocol": "dns",
			"outbound": "dns-out"
		},
		{
			"inbound": [
				"mixed-in"
			],
  			"domain_keyword": [
  				"bilibili.com",
  				"hdslb.com",
  				"akamaized.net",
  				"szbdyd.com",
  				"b23.tv"
  			],
  			"geosite": [
  				"geolocation-!cn",
  				"greatfire",
  				"bilibili",
  				"telegram"
  			],
  			"outbound": "trojan-out"
  		},
		{
			"inbound": [
				"mixed-in"
			],
  			"domain_keyword": [
  				"monitor.uu.qq.com",
  				"pingjs.qq.com",
  				"pingma.qq.com",
  				"pingtcss.qq.com",
  				"mi.gdt.qq.com",
  				"qq.com",
  				"api.mixpanel.com"
  			],
			"domain_regex": [
				"^adservice.google.([a-z]{2}|com?)(.[a-z]{2})?$"
			],
  			"outbound": "block-out"
  		}
  	],
  	"final": "trojan-out",
  	"default_interface": "enp3s0",
	"auto_detect_interface": false
  }
}

Client log: +0800 2022-10-08 15:04:17 INFO [558707430] inbound/mixed[mixed-in]: inbound connection from 127.0.0.1:40704 +0800 2022-10-08 15:04:17 INFO [558707430] inbound/mixed[mixed-in]: inbound connection to www.baidu.com:80 +0800 2022-10-08 15:04:17 INFO [558707430] outbound/trojan[trojan-out]: outbound connection to www.baidu.com:80 +0800 2022-10-08 15:04:17 INFO [558707430] dns: lookup succeed for xxx.xxx.xxx

No website opens even though set "192.168.1.1"/"192.168.1.0" instead of "local".

cupidads avatar Oct 08 '22 07:10 cupidads

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Dec 08 '22 02:12 github-actions[bot]