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

Cant resolve hostnames #209

Closed
WattsC-90 opened this issue Aug 13, 2019 · 27 comments
Closed

Cant resolve hostnames #209

WattsC-90 opened this issue Aug 13, 2019 · 27 comments
Labels

Comments

@WattsC-90
Copy link

Describe your issue:
I was using version 1.6.1 for a long time, with no issues (mainly used it for the IP scanner to see which hostnames/IPs were active. I thought I would update to version 1.10.0 (and now 1.11.1), but it seems like the hostname resolution has stopped working, I can no longer resolve any hostnames for IP addresses that are found in the specified ranges.

image

Version 1.6 (which I had downloaded and run standalone) shows the hostnames correctly when scanning.

If I right click and use DNS Lookup menu, then IPAddress is available, but Hostname is grayed out:
image

Running on Windows Enterprise 1809, i dont know what other info you need.. please ask and ill update this question.

@BornToBeRoot
Copy link
Owner

Since version 1.6.3, i am using Heijden.DNS instead of the .NET default method to resolve the hostname from an ip address.

Can you check these settings:

image

This should automatically detect the dns server configured in windows... Try to set the dns server manually with Use custom DNS server.

@WattsC-90
Copy link
Author

So neither seem to do anything? I had configured the custom dns already but not added the other network (in this case 192.168.4.1 is my router.. so added that one), but its not changed anything.. it was already pointing at the right corporate DNS servers, but not showing the Hostnames (different ip range to the one being shown above). Any other ideas?

@BornToBeRoot
Copy link
Owner

BornToBeRoot commented Aug 14, 2019

You could check with nslookup.exe 192.168.4.1 if a PTR is resolved for this IP address, when you query your corporate DNS server.

Edit: You could reset the settings by deleting the file %appdata%\NETworkManager\Settings\Settings.xml

@brucechaser
Copy link

Hello all,
I to can not get hostnames to apear on the list.
Every other IP Scanner i have tried works.
Capture

@BornToBeRoot
Copy link
Owner

@brucechaser

Can you test the "DNS Lookup" in the NETworkManager if you can resolve the PTR record for one of these ip addresses...

By default, the tool detects the windows dns server (you can overwrite this option in the settings)

Which DNS server are you using (Router like FritzBox or Netgear, Windows Server, etc.)???

@WattsC-90
Copy link
Author

@BornToBeRoot , i never got this to work, the settings you mentioned in your comment were already configured to the right dns settings for my network. I just used the old version instead, takes a bit longer but it works

@brucechaser
Copy link

brucechaser commented Sep 24, 2019

In DNS Lookup when i use the host name I do get results but when I enter the IP address a get nothing.
We use Windows Server as DNS Server.
Version 1.6.2.0 works fine.
Actually it does not resolve all the host names as Advanced IP Scanner

@BornToBeRoot
Copy link
Owner

Actually it does not resolve all the host names as Advanced IP Scanner

Advanced IP Scanner also resolves NETBIOS.

I try to replace Heijden.DNS with DnsClient in the next version. Heijden.DNS won't get any updates and i added some custom fixes to make it work with IPv6 dns servers...

I post a preview version here, once i have it implemented... so you can test it in your environment.

https://github.com/MichaCo/DnsClient.NET
https://www.nuget.org/packages/DnsClient/

@brucechaser
Copy link

Thank you man, really appreciate it.
The app is bad ass btw, design and all.
Excellent work.

@BornToBeRoot
Copy link
Owner

@brucechaser @WattsC-90 Can you test this version and give me feedback? It should use the default windows dns server... user settings are ignored.

NETworkManager_v2_2019_09_28_DnsClient_Portable.zip

BornToBeRoot added a commit that referenced this issue Sep 28, 2019
@WattsC-90
Copy link
Author

Thanks! Ill give it a go on monday as it struggles on the work network architecture, ill try give it a go at home too just to make sure its working in a more basic environment! Thanks again for your work on this.

@BornToBeRoot BornToBeRoot mentioned this issue Oct 1, 2019
3 tasks
@BornToBeRoot
Copy link
Owner

does it work?

@WattsC-90
Copy link
Author

I had forgotten.. trying it now..

@WattsC-90
Copy link
Author

WattsC-90 commented Oct 2, 2019

@BornToBeRoot It appears not.. seems to hang up for me..
clicking cancel just causes it to hang up cancelling for ages, not sure if that will help you determine where the issue is..

its just sat at 347 for a while now and still cancelling.. Ill have to kill the app

image

NOTE

If i switch off Hostname resolution in the settings it pops all of the IPs up and breezes through the entire range. So definitely something with the hostname resolution!

@BornToBeRoot
Copy link
Owner

I could reproduce the issue... i upload a new version this evening...

@BornToBeRoot
Copy link
Owner

@WattsC-90 @brucechaser can you test this version and give me feedback? Thanks!

NETworkManager_Issue209_v2.zip

@WattsC-90
Copy link
Author

So I feel like were getting somewhere... still getting errors but its failing fast.
Fortunately these are all private networks so I can share the screenshots!!

image

Which source file has your DNS lookup code? I was trying to find it but couldnt find the type LookupClient? I want to see what youre doing and if I can find a solution that works.. or a better idea why its not working..

@BornToBeRoot
Copy link
Owner

BornToBeRoot commented Oct 3, 2019

Here is the LookupClient for the IP scanner

DnsLookupClient = UseCustomDNSServer ? new LookupClient(new IPEndPoint(CustomDNSServer, CustomDNSPort)) : new LookupClient();

This is the query:

var dnsQueryResponse = DnsLookupClient.QueryReverse(ipAddress);

The DNS server 160.100.160.254 Port 53 and 162.118.144.233 Port 53 are correct?

@WattsC-90
Copy link
Author

@BornToBeRoot Ta, saw the query line, cant find the LookupClient object/type is it in a nuget? or in the repo?

@WattsC-90
Copy link
Author

Ta, had a look.. no idea why it throws these errors.. its intermittent between ServerFailure and the shown Error: No connection could be established to any of the following name servers... issue..

Can I ask, whats the downside with DNS.GetHostEntry(ip)?

@BornToBeRoot
Copy link
Owner

BornToBeRoot commented Oct 3, 2019

With DNS.GetHostEntry(ip)? you can't set a custom dns server... it always use the windows dns.

I can add an option that DNS.GetHostEntry can be used as fallback.

Edit: At least i replaced the Heijden.DNS... it's not suported anymore...

@WattsC-90
Copy link
Author

WattsC-90 commented Oct 3, 2019

...https://www.codeproject.com/Articles/23673/DNS-NET-Resolver-C <uses Heijden DNS :(
maybe?
pain to write your own, but it looks like it would be versatile.. didnt realise you couldnt specify your own dns servers, hadnt tried before..

not sure if WMI would allow you to

@BornToBeRoot
Copy link
Owner

I think it doesn't make sense to write my own dns resolver, when there are well tested libaries available. DnsClient.NET has 7 million downloads on nuget, so the most bugs are fixed and it is stable. And then i still can't test agains your dns server...

With WMI you can query / set windows specific settings.

The best to make it work, would be a fallback option to use DNS.GetHostEntry... But with the default .NET dns resolver, you can't set custom dns, timeout, retries...

@MichaCo
Copy link

MichaCo commented Oct 8, 2019

Hey, jumping in here out of the blue, trying to help ^^

The error No connection could be established to any of the following name servers really means what it says, the DnsClient's LookupClient couldn't connect to the server on port 53 via UDP.
Maybe that's blocked by your local firewall or the server is dead or not reachable from your network...

There are a couple of things you can try, for example dig or nslookup

Doing a reverse lookup via dig would look like this: dig @160.100.160.254 -x <ip>
If that fails, then its your network having issues to access that server and there is no problem with the code.

@WattsC-90
Copy link
Author

@MichaCo Thanks for the jump in, im stuck! As you know from my question on DNSclient.net project it just doesnt work where the windows one does.. our DNS servers work.. theyre just corporate versions.. if DNS didnt work we would be stuffed! what I cant find any information out on is how the windows version differs to yours/others?

@MichaCo
Copy link

MichaCo commented Oct 8, 2019

@WattsC-90 did you try to query your DNS servers with tools like dig or nslookup via command line?
The windows subsystem for linux is pretty handy for those kind of tests because you can use dig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants