Skip to content

Instantly share code, notes, and snippets.

@robwilkerson
Created May 22, 2013 15:12
Show Gist options
  • Save robwilkerson/5628350 to your computer and use it in GitHub Desktop.
Save robwilkerson/5628350 to your computer and use it in GitHub Desktop.
Installs DNSMasq. Tested in a Vagrant shell provisioner for a Ubuntu 12.04 VM.
# Installing dnsmasq so that loopback communication using the site URL doesn't fail.
if [ ! -e '/etc/dnsmasq.conf' ]; then
echo -n "Installing and configuring DNSMasq..."
apt-get install dnsmasq -qq -y > /dev/null 2>&1
cat >> /etc/dnsmasq.conf << "EOF"
address=/.umassmemorial.org/127.0.0.1
listen-address=127.0.0.1
EOF
sed -i -r -e 's/^(\s*)#(\s*prepend domain-name-servers\s+.*)$/\1\2/' /etc/dhcp/dhclient.conf
service dnsmasq restart > /dev/null
else
echo "DNSMasq is already installed (and presumably configured)."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment