Created
March 21, 2020 14:24
-
-
Save haggen/12d6d02661155624aa5bdb8011adeb4a to your computer and use it in GitHub Desktop.
Local DNS with dnsmasq on Ubuntu 18 (bionic)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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