• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

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

by admin

The Ask

How to change the time to wait before failing over to Secondary DNS server in case Primary doesn’t respond?

The Solution

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:

RES_TIMEOUT in 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 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.

Filed Under: CentOS/RHEL 5, CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. How to kill Processes in Linux using kill, killall and pkill
  2. zcat Command Examples in Linux
  3. How to configure VNC Server on CentOS/RHEL 6
  4. CentOS / RHEL 6 : How to Disable / Enable direct root login via telnet
  5. Understanding MySQL Privileges
  6. How to Compress and Extract Files and Directories in Linux Using gzip and bzip2
  7. lastcomm: command not found
  8. chsh: command not found
  9. Shell Script to Find Network Interface Link Status and Speed (CentOS/RHEL)
  10. How to Read Audit Log in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright