Dns lookup in Linux provided by a set of functions in glibc. Nameservers must be defined in
/etc/resolv.conf file as below:
All of the
getaddrinfo family of functions follows the process of:
- Send dns query to first nameserver
- If there is no answer in 5 seconds, send same query to second nameserver
- If there is no answer again in 3 seconds, send same query to third nameserver
- If still no answer received in 6 seconds, repeat the process from step 1
If you provide a not working nameserver ip in resolv.conf file in the first lines, all of the functions which depends on name resolution in any time will be slow down as described above.
Also note that, only first 3 nameserver line valid for glibc. If you provide more than 3 nameserver in resolv.conf, they just ignored by glibc.