Skip to main content

Resolve all local domains to with dnsmasq

You need DNS to resolve locally ?

  1. Option 1: edit your hosts file

    1. sudo vim /etc/hosts

    2. Add the following:

  2. Option 2: Alternatively, I recommend running dnsmasq and configuring all .dev extensions to resolve to Note that using the .local extension results in lots of problems and kills baby kittens, don’t use it.

    1. First, Ubuntu 12.04 has dnsmasq installed and enabled by default. Config file, y u no work? This needs to be disabled so we can install a version of dnsmasq that allows configuration.

      1. sudo vim /etc/NetworkManager/NetworkManager.conf

      2. Comment out dns=dnsmasq

      3. sudo restart network-manager

    2. Now, install dnsmasq

      1. sudo apt-get install dnsmasq

      2. sudo vim /etc/dnsmasq.conf

      3. Around line 60 ... set *.dev=
        # Add domains which you want to force to an IP address here.
        # The example below send any host in to a local
        # web-server.

      4. Around line 90 put listen-address=
        # Or which to listen on by address (remember to include if
        # you use this.)

      5. sudo /etc/init.d/dnsmasq restart

    3. Test to make sure any subdomain of .dev resolves to local

      1. dig

      2. nslookup