In /etc/hosts, I can for example input   example.com

Now I have a nameserver (pdns with postgre-backend), which I want to use in the intranet.

So, I tell my dns server, that example.com is, for example,

Assuming the DNS server runs on, how can I replace /etc/hosts with my nameserver ?

That is to say, it should resolve example.com to (using the DNS on, but any other domain that I did not overwrite locally should be resolved to its real IP, using whatever is used by default.

Where do I have to put this in Ubuntu 14.04 ?

  • Comment out the entry from /etc/hosts, since it has priority over entries from DNS.
    – muru
    Oct 14, 2015 at 10:55
  • @muru: That much is clear...
    – WitchCraft
    Oct 14, 2015 at 11:31
  • @muru does /etc/hosts priority can be set in nsswitch? Oct 14, 2015 at 11:41
  • @AizuddinZali Yes, but not for a single site. Just move dns before files
    – muru
    Oct 14, 2015 at 11:42
  • @muru, ok make sense he only want single site. Oct 14, 2015 at 11:43


Browse other questions tagged .