7

We are running a script that tries to resolve thousands of domains for a research project. The issue we are having is that a lot of domains are not resolvable for example foo.com. If we ping foo.com the system will do a lookup for foo.com. If that does not resolve, it will do a lookup for foo.com.ourdomain.com. It /etc/resolv.conf we had:

# Generated by NetworkManager

search ourdomain.com
nameserver 8.8.8.8
nameserver 4.2.2.2

The above result is expected since we had the search setting set. If we changed it to say:

# Generated by NetworkManager

search ourdomain.net
nameserver 8.8.8.8
nameserver 4.2.2.2

then as expected any non-resolvable query will be queried again with ourdomain.net at the end.

The issue that we have is if we remove the search line completely from resolv.conf then system goes back to using ourdomain.com as the search. What we want is if a DNS lookup does not resolve to NOT then look it up with the domain that WAS set in resolv.conf (which is also the domain of the box).

1 Answer 1

8

The solution is to set the search option in /etc/resolv.conf to:

search .

so /etc/resolv.conf would look like.

search .
nameserver 8.8.8.8
nameserver 4.2.2.2
1
  • It works. It still has side-effect that the nonexistent FQDN will be resolved twice: as a FQDN and as a FQDN rooted to . from "search". Those are same domain on the wire, but it may double PPS in some corner-cases.
    – darkk
    Dec 9, 2018 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.