WireGuardNTSharp icon indicating copy to clipboard operation
WireGuardNTSharp copied to clipboard

not workig

Open xkajxkajx opened this issue 1 year ago • 4 comments

When running "WireGuard-Cli.exe -c client.conf", I got this error:

OpenAdapter Fail And Now Start Create... : 1168 Unhandled exception. System.Net.Sockets.SocketException (11001): No such host is known. at System.Net.Dns.GetHostEntryOrAddressesCore(String hostName, Boolean justAddresses, AddressFamily addressFamily, ValueStopwatch stopwatch) at System.Net.Dns.GetHostEntry(String hostNameOrAddress, AddressFamily family) at WireGuardNT_PInvoke.Adapter.ParseConfFile(String[] lines, WgConfig& wgConfig) in C:\Users\ablestor-bjs\Documents\GitHub\WireGuardNTSharp\WireGuardNT-PInvoke\Adapter.cs:line 92 at WireGuardCli.Program.Main(String[] args) in C:\Users\ablestor-bjs\Documents\GitHub\WireGuardNTSharp\WireGuard-Cli\Program.cs:line 118

xkajxkajx avatar Aug 07 '24 06:08 xkajxkajx

It looks like you didn't write the host address correctly or it's a DNS issue. Try writing the IP address in the address line of your config file

damob-byun avatar Aug 09 '24 05:08 damob-byun

OK, could you please check my config file and see what's wrong with it:


[Interface] PrivateKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= Address = 172.16.0.2/32 Address = 2606:4700:110:8bc1:cd08:82cc:d807:6ef9/128 DNS = 1.1.1.1, 1.0.0.1, 2606:4700:4700::1111, 2606:4700:4700::1001 MTU = 1280 [Peer] PublicKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= AllowedIPs = 0.0.0.0/0 AllowedIPs = ::/0 Endpoint = engage.cloudflareclient.com:2408

xkajxkajx avatar Sep 09 '24 06:09 xkajxkajx

Did you find a solution @xkajxkajx or not?

voidZiAD avatar Oct 15 '24 13:10 voidZiAD

I looks like this project is sort of abandoned... For one of the errors mentioned (host), it can be solved by changing lines 180 - 190 of Adapter.cs Parsing of interface address is not valid, only the network is set. And dont forget, it is IPv4 only, so skipp the IPv6 addressing.

case "address":
   string address = value.Split(',').First().Trim();
   if (ValidateIPv4(address))
   {
        wgConfig.InterfaceNetwork = IPNetwork.Parse(value.Split(',').First());
    }
    else
    {
       var ipEntry = Dns.GetHostEntry(address);
       wgConfig.InterfaceNetwork = IPNetwork.Parse(ipEntry.AddressList[0].ToString());
     }

We can do better when the interface is specified using cidr for example: 10.0.0.1/24 And specifying a DNS name for a local interface address is a bit of so we dont need the Dns.GetHostEntry.

case "address":
   wgConfig.InterfaceNetwork = IPNetwork.Parse(value);
   wgConfig.InterfaceAddress = IPAddress.Parse(value.Split('/')[0]);
   continue;

alphons avatar Nov 10 '24 13:11 alphons