I use internet (personal connection from ISP). My operating System is Ubuntu 18.4. I am aware of /etc/hosts file, but it has limitation with wild card entries (to block websites).

I wanted to know if Ubuntu does caching of DNS or do I need to install some other tool? There is a Network Manager installed. And Systemd is the daemon manager. Do these tools have ways of managing DNS? Do, I need to use Dnsmasq?

I have read that many people prefer Dnsmasq, but I am not sure why is it preferable? I am not sure if this can already be done by Networkmanager or systemd.


  • My goal, is to block websites and do caching of DNS if it is significantly beneficial? Also, I am not a web developer.

  • Can I use wildcards to block websites without dnsmasq?

  • @earthmeLon questioned: Also, are you trying to block or allow access to more of the Internet? Should you be blacklisting or whitelisting?

    • I am trying to blacklist, as I don't know if I might need to access some other websites in the future.

Your system will honor TTL, which 'caches' the response for some time. You don't want to ignore these values or mess with these at all.

Many people prefer dnsmasq (I have to assume) because it gives them more control of the DNS responses. In most scenarios, dnsmasq is set up as a sort of proxy to query other DNS servers for most domains, but allow you to customize or edit certain domains. bind is a more robust DNS server.

An example would be if you are a developer and (before Google bought .dev TLD) you wanted to set up nic.dev on your computer or LAN such that the domain resolves to an IP instead of erroring that their is no record.

It's great that you are interested in these technologies, but don't mess up your main system playing around, especially if you're not addressing a problem. Set up a VM or another system and play around with dnsmasq or bind if you have the interest or need.

| improve this answer | |
  • 1
    You asked why people like/use dnsmasq. I was trying to provide an example. I don't feel you need to be a developer to understand what I mentioned, but maybe you're feeling you don't need dnsmasq, because you're not a developer, and that's most likely true. – earthmeLon Apr 4 '19 at 23:35
  • How can I check TTL for my system? So, I don't need DNS caching? – Porcupine Apr 4 '19 at 23:35
  • Please read TTL document provided. Please Google and do a bit of research on your own. It sounds like you're going to try to adjust TTL values, which is a bad idea. They are part of DNS records that the administrators of the domain set up. They know all about DNS and TTL and you should trust their values. Your system will (by default) hold/cache records for 300s (5m), so no, you do not need anything else. – earthmeLon Apr 4 '19 at 23:36
  • Thanks for the answer. Can I use wildcards to block websites without dnsmasq? – Porcupine Apr 4 '19 at 23:37
  • That's a new question. It depends on your criteria. Without DNS, iptables can block CIDR blocks or specific IPs. There are many guides out there to set up DNS servers on Linux, even stuff like pi hole. Please let me know if you have a specific question by asking a new question if one arises. – earthmeLon Apr 4 '19 at 23:38

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.