diff --git a/Netch/Controllers/TUNController.cs b/Netch/Controllers/TUNController.cs index 249d014249..686cc60cc5 100644 --- a/Netch/Controllers/TUNController.cs +++ b/Netch/Controllers/TUNController.cs @@ -93,7 +93,7 @@ public async Task StartAsync(Socks5Server server, Mode mode) if (_tunConfig.UseCustomDNS) { - Dial(NameList.TYPE_DNSADDR, _tunConfig.DNS); + Dial(NameList.TYPE_DNSADDR, DnsUtils.AppendPort(_tunConfig.DNS)); } else { @@ -175,8 +175,13 @@ private void SetupRouteTable() if (_tunConfig.UseCustomDNS) { - // NOTICE: DNS metric is network interface metric - RouteUtils.CreateRoute(_tun.FillTemplate(_tunConfig.DNS, 32)); + if (_tunConfig.ProxyDNS) + { + // NOTICE: DNS metric is network interface metric + RouteUtils.CreateRoute(_tun.FillTemplate(_tunConfig.DNS, 32)); + } + + tunNetworkInterface.SetDns(_tunConfig.DNS); } else {