How to Change Time Interval to Fall Back to Secondary DNS Server in CentOS/RHEL?

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. 

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 1.2.3.4
nameserver 4.3.2.1
options timeout:30

 

In teh above example the timeout value has been set to 60 seconds from the default 5 seconds.

 

Troubleshooting

 

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 1.2.3.4
nameserver 4.3.2.1
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.

Don’t lose your sleep over server issues. Our server experts will monitor your servers 24/7 and rescue your server from errors. Click here to know more. 

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)