Dnsmasq For Local Development Site

Found via HN. I've used to edit /etc/hosts file and add local testing site manually and it never occurs to me to use Dnsmasq to redirect all URLs that ends with .dev to 127.0.0.1.

Setup steps for Ubuntu as follows:
$ sudo apt-get install dnsmasq
$ echo 'address=/dev/127.0.0.1' | sudo tee /etc/dnsmasq.d/localhost.dev
$ sudo sed -i '1inameserver 127.0.0.1' /etc/resolv.conf
$ sudo service dnsmasq restart
$ dig foobar.dev @127.0.0.1| grep IN
$ ping foobar.dev

Simple yet smart way to use Dnsmasq.

No comments:

Post a Comment