0
votes

I am trying to write a Dynamic DNS updater for a domain name. I have everything working like I want it to be. Basically the chain of events are as such:

  1. curl my public ip address
  2. use a command (nslookup, whois, dig, host) to check current IP record of domain name
  3. compare the two
  4. update dns if not equal

The problem I ran into is that on site there is a local dns server which resolves the domain names to their respective local IP address instead of public IP address so that when used from inside the LAN it will use the local IP address.

How can I find out the A record of a domain straight from whois records, avoiding it querying my DNS server?

1

1 Answers

1
votes

You can just query a nameserver for that domain directly.

For example with dig to query Google public DNS

dig example.com @8.8.8.8 +short

This will query the record against 8.8.8 directly.

You can replace the IP with IP of the primary nameserver for that domain, to be sure answer is received from domain namesevers.

You can get nameservers of the domain with:

dig NS example.com +short