How to change the time to wait before failing over to Secondary DNS server in case Primary doesn’t respond?
The parameter timeout:n can be set in the configuration file /etc/resolv.conf to adjust the time taken to fallback to a secondary DNS in case the primary is not reachable. From the Man page of resolve.conf:
The “options timeout:n” option sets the amount of time the resolver will wait for a response from a remote name server before retrying the query via a different name server. Measured in seconds, the default is RES_TIMEOUT. The value for this option is silently capped to 30.
You can change timeout value by giving a numerical value at timeout field. For example:
# vi /etc/resolv.conf nameserver 184.108.40.206 nameserver 220.127.116.11 options timeout:30
In teh above example the timeout value has been set to 60 seconds from the default 5 seconds.
The command ‘nslookup [server_name]’ may return an error as shown below:
nslookup: parse of /etc/resolv.conf failed
When you run the nslookup the system check the /etc/resolv.conf file to get informations about domains and about the DNS. If you have any wrong parameter in this file the nslookup command return the error listed above. Suppose, you have an entry of the “options timeout:n” parameter as shown below:
# cat /etc/resolv.conf nameserver 18.104.22.168 nameserver 22.214.171.124 options timeout:0.3
In the above output the timeout parameter from the option session have a . (dot). The timeout have to be set in secondas, but it have to be a integer. as you can see in ‘man resolv.conf’. You can set the value to an integer with max value of 30 seconds and this error can be resolved.