Use dnsmasq to resolve tld

When I develop webstuff, I sometimes use a vagrant box for the development. This is how I use dnsmasq to resolve all domains ending with <insert tld here> to one and the same IP (be it your local IP or that of, in my case, a vagrant box).

First. Install dnsmasq.

/etc/dnsmasq.conf

# listen only to this IP
listen-address=127.0.0.1

# file with dns servers
resolv-file=/etc/resolv.dnsmasq.conf

# resolve all .app tlds to this IP
address=/.app/192.168.10.10

/etc/resolv.dnsmasq.conf

Using this, you can use more than three servers (in Linux the max is 3, see /usr/include/resolv.h).

nameserver 10.0.0.47
nameserver 8.8.8.8
nameserver 8.8.4.4

/etc/resolv.conf

And finally use your dnsmasq server in your resolv.conf file.

nameserver 127.0.0.1

CategoriesUncategorized

Leave a Reply

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