5 seconds for hostname -f and a strange DNS request

Solution 1:

The order in which DNS queries are resolved is based on the contents of /etc/nsswitch.conf. Specifically, the order of the options on the line for hosts

For example, this line will cause your machine to query a server before checking local files:

hosts:          dns files

Man page: http://man7.org/linux/man-pages/man5/nsswitch.conf.5.html