This article assume you have a default Ubuntu 14.04 Server installed.
Config the DNS Server
Note:
10.0.0.200 should be your Ubuntu server’s IP
Assuming you want to use Google’s DNS (i.e. 8.8.8.8 and 8.8.4.4)
Added are two wildcard domains: *.app and *.dev and they will all point to localhost
You can also add more in /etc/dnsmasq.conf in this format “address=/DOMAIN/IP”
apt-get install dnsmasq
cp /etc/dnsmasq.conf /etc/dnsmasq.conf.org
cat > /etc/dnsmasq.conf << EOL
domain-needed
bogus-priv
no-resolv
no-poll
server=/localnet/10.0.0.200
server=8.8.8.8
server=8.8.4.4
local=/localnet/
address=/double-click.net/127.0.0.1
no-hosts
expand-hosts
EOL
cat > /etc/dnsmasq.d/app-tld << EOL
local=/app/
address=/app/192.168.10.10
EOL
cat > /etc/dnsmasq.d/dev-tld << EOL
local=/dev/
address=/dev/127.0.0.1
EOL
service dnsmasq restart
Optional: Update your router to use your own custom DNS Server
If you do this the custom domains on your DNS will be applied to all computers using your router. And if you do this you don’t have to add your own DNS server IP to your NIC’s DNS Server list anymore.