Isso é realmente simples, com dnsmasq
:
# install dnsmasq
sudo apt-get install dnsmasq
# map anything ending in .dev to 127.0.0.1
echo address=/dev/127.0.0.1 | sudo tee /etc/dnsmasq.d/dev
# restart to make it read new config
sudo service dnsmasq restart
# verify it's working
host gsdf.gsd.fg.sdf.g.dev
# gsdf.gsd.fg.sdf.g.dev has address 127.0.0.1