Integrating NetworkManager and dnsmasq

Sometimes /etc/hosts  might be enough, but when you want wildcard domains to be mapped you might need dnsmasq. And if you are on Linux you might want to integrate your NetworkManager service with dnsmasq. Follow these steps below

  1. Make sure you installed dnsmasq
    • `sudo dnf install dnsmasq`
  2. Edit /etc/NetworkManager/NetworkManager.conf
    • [main]
      #plugins=ifcfg-rh,ibft
      dns=dnsmasq

  3. Add resolver on /etc/NetworkManager/dnsmasq.d/local-resolver.conf
    • address=/myhost1.test/127.0.0.1
      address=/myhost2.test/127.0.0.1

  4. Make sure dnsmasq not running, because dnsmasq need to started by NetworkManager  in order these two to be integrated. And make sure its disable on startup, so NetworkManager can start it successfully on startup.
    • `sudo systemctl stop dnsmasq`
    • `sudo systemctl disable dnsmasq`
  5. Restart Network Manager
    • `sudo systemctl restart NetworkManager`
  6. Test
    • `ping myhost1.test`

Leave a comment

Your email address will not be published. Required fields are marked *