Skip to content

Instantly share code, notes, and snippets.

@Shogan Shogan/dnsmasq.conf
Created Nov 17, 2019

Embed
What would you like to do?
Creates a dnsmasq.conf configuration file
sudo tee /etc/dnsmasq.conf &>/dev/null <<EOF
# Our DHCP service will be providing addresses over our eth0 adapter
interface=eth0
# We will listen on the static IP address we declared earlier
listen-address=10.0.0.1
# Pre-allocate a bunch of IPs on the 10.0.0.0/8 network for the Raspberry Pi nodes
# DHCP will allocate these for 12 hour leases, but will always assign the same IPs to the same Raspberry Pi
# devices, as you'll populate the MAC addresses below with those of your actual Pi ethernet interfaces
dhcp-range=10.0.0.32,10.0.0.128,12h
dhcp-host=b8:27:eb:00:00:01,10.0.0.50
dhcp-host=b8:27:eb:00:00:02,10.0.0.51
dhcp-host=b8:27:eb:00:00:03,10.0.0.52
dhcp-host=b8:27:eb:00:00:04,10.0.0.53
dhcp-host=b8:27:eb:00:00:05,10.0.0.54
dhcp-host=b8:27:eb:00:00:06,10.0.0.55
dhcp-host=b8:27:eb:00:00:07,10.0.0.56
# DNS nameservers. Configure with your own. Cloudflare and OpenDNS used below
server=1.1.1.1
server=208.67.222.222
# Bind dnsmasq to the interfaces it is listening on (eth0)
bind-interfaces
# Never forward plain names (without a dot or domain part)
domain-needed
# Never forward addresses in the non-routed address spaces.
bogus-priv
# Use the hosts file on this machine
expand-hosts
# Useful for debugging issues
# log-queries
# log-dhcp
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.