General question regards to DNS

Some nameserver fails to resolve the domain of 3rd party we need to connect to, in this situation we could fetch the history data and manually override the DNS resolution.

Some one explain me with example please?

Hello,

Normally, on a UNIX-style system which is set to use DNS to resolve hostnames, the resolver will work through each of the nameservers listed in /etc/resolv.conf and will try them in turn until it gets an answer. If it gets no answer from any of them, then it will fall back on any other hostname resolution methods that are permitted (such as entries in /etc/hosts). And if all other methods fail, then the hostname fails to resolve.

So if you're wanting to always be able to get the last-known-good IP address that a hostname resolved to, then you would either have to handle this application-side, or be using a DNS server that was set to cache records for your desired period of time. The operating system hostname resolver itself won't do this, and doesn't offer any way of you querying previous hostname resolution results.

In short then, unless you write your application to do this (e.g. you could store resolved IP addresses in a hash or an array or some other data structure, and check the results from there if your hostname lookup calls to the OS fail), and unless the hostname you want to resolve has a non-changing static IP that you can put in /etc/hosts, then you would be depending on the nameserver(s) you are using caching the last lookup result and returning that cached result.

@drysdalk thanks for your input!

we have dump file, for such case nameserver fails to resolve domain, in this case case fetch the history data and manually override DNS.
Having DNS bind server, how to implement override ?

You can use dnsmasq on your clients to override any DNS behavior e.g use another set of DNS servers for specified search per say wildcard domain, instead of default DNS servers and many more features.

Also, you can utilize dnsmasq caching mechanism as well, which will return the cached result honoring the TTL of course.

Would this suit your needs or ?
Are your clients linux servers ?

Regards
Peasant.

1 Like

Hello,

If your application is recording the IP addresses that it gets back from DNS queries in a file, then there is no way I know of to make BIND refer to that file. Fundamentally, BIND is a name server, and it gets its answers either from its own authoritative zones when queried against those zones, or by doing lookups against others servers until it finds one which can give it an authoritative answer. BIND itself won't be able to use a separate file of your own creation for providing answers to DNS queries.

Probably the better thing to focus on is: why are the DNS queries failing sometimes ? Are you using a DNS server which is unreliable, or which has issues of some sort that prevent it from returning answers to queries ? If so, could you use a different name server, or run your own caching name server locally on the machine which runs your application ?

1 Like

Thanks! yes Linux server

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.