Skip to content

Instantly share code, notes, and snippets.

@haggen
Created March 21, 2020 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haggen/12d6d02661155624aa5bdb8011adeb4a to your computer and use it in GitHub Desktop.
Save haggen/12d6d02661155624aa5bdb8011adeb4a to your computer and use it in GitHub Desktop.
Local DNS with dnsmasq on Ubuntu 18 (bionic)
#!/bin/usr/env bash
set -ue
# Need sudo.
test $(id -u) -eq 0 || { sudo $0; exit 0; }
# Free up port 53
systemctl stop systemd-resolved
systemctl disabled systemd-resolved
# Even if dnsmasq is already present (mine was), install the package so we get the init.d scripts installed as well
apt install dnsmasq
# Configure dnsmasq.
# Add one address for each domain you want.
# Sub-domains will work as well.
cat <<-EOF > /etc/dnsmasq.conf
address=/node-1/10.133.7.123
address=/node-2/10.133.7.124
server=1.1.1.1
server=1.1.0.0
EOF
# Start dnsmasq service.
service dnsmasq start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment