![]() |
domain existence
How could I check if a DNS domain exists? dig doesn't work because my DNS servers (OpenDNS) return the IP of their search server.
|
Do you want to check the existence of any domain - nslookup?
Options let you specify a domain to limit the search. You can also specify the DNS box. I'm not sure what you meant by a DNS domain in this context.... |
nslookup isn't what I want, but its man page pointed me to host, which is exactly what I wanted.
|
:/ host doesn't handle LAN IPs or aliases in /etc/hosts.
|
Check out 'man gethostbyname'. I believe that this library uses the standard DNS lookup stack in *nix (typically in /etc/host.conf).
|
Umm... this is the shell forum, not the C forum.
|
Quote:
If you just simply want to see if a domain name resolves, you can use something like: :
ping $DOMAIN -c1 | grep ^PING | \That returns the IP address of the domain. If the domain does not resolve, you get: :
ping: unknown host googlaoeuaoee.comIf you do not care what the IP is, you can simply use ping: :
#!/bin/bashHope this helps. :cool: |
Quote:
:
notroot@arthur[0:~]$ ping -c1 asdr.ear.baawer |
Quote:
-'host' can resolve the IP of any FQDN given it -'ping' can resolve the IP of any local DN (that you may specify in /etc/hosts) host + ping + glue = solution ;) Edit: Playing around a bit more with OpenDNS as my nameserver, it appears to only return its search server IPs when the domain is not found. This being the case, you can still solve this with one tool (ping) and some parsing of the results (if $IP is in $IPS_OWNED_BY_OPENDNS....). :cool: |
Your proposed solution has given me a better idea. Ping gives the packet loss percent. All I need to do is check if that's like <=15.
Damn I should learn awk. |
| All times are GMT -5. The time now is 9:16 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC