From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Nslookup for lookup domain name to ip number in Labview?

Solved!
Go to solution

I like to make a quick hack to monitor my ISP's DNS functionality, to get some hard data when complaining. What I see is that DNS stops working some minutes some hours, making trouble for a lot of people. But when I call support it works again of course...

 

Is there an easy way to check if the domain name server system of my pc and network is working ok? I was thinking of invoking the command 'nslookup <anynicedomain> in a loop and see how often it fails. Better ways?

0 Kudos
Message 1 of 6
(5,205 Views)
Solution
Accepted by topic author Ola_A
Sounds sensible - you could also use String to IP and IP to String to convert the hostname to an IP address from within LabVIEW which might be a neater solution?

You could also use the ping command and parse the result as that gives an IP address and would allow you to check latency as well as - you could ping your DNS server in a separate loop.

LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 2 of 6
(5,197 Views)

Sam, thanks! The string to IP is really neat, i will go for that!

0 Kudos
Message 3 of 6
(5,195 Views)

Some more about testing dns functionality. Since the DNS is cached on the pc it is not obvious if a "IP to string" or nslookup will really show that the DNS system is working. One way would be to not reuse domain names for the test, but instead have a very long list of domain names to check... Don't know how do acomplish that in pratice.

 

I tried to use ping, but that catches also temporary lost packets and I am really only interested in when dns does not respond correctly.

Some googling led me to the windows command

ipconfig /displaydns

which showes the current cached dns, and each items time to live (TTL). TTL ranged from 30s to >15000s. My current solution is to work with "IP to string" and having a few different domains with different TTL. Will let it run over night and see if it detects anything.

Can anyone think of an easy way to test my program, like forcing the dns to stop working and see that that is detected?

0 Kudos
Message 4 of 6
(5,164 Views)

One option would be to use ipconfig /flushdns to clear the local DNS cache before doing the lookup? (but this makes me a little uneasy if doing it regularly and might cause other DNS lookups to slow down etc.)

To 'force' a failure - you could set your DNS servers manually on either your network connection (TCP/IP settings) locally on your PC, or on your router (e.g. on a home network).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 5 of 6
(5,158 Views)

Alternatively, can you use another DNS?  I use L3's DNS at home - 209.244.0.3 and 209.244.0.4 - and never had an issue.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 6
(5,131 Views)