Dns lookup in Linux provided by a set of functions in glibc. Nameservers must be defined in
/etc/resolv.conf file as below:
nameserver 126.96.36.199 nameserver 188.8.131.52 nameserver 184.108.40.206
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.