aboutsummaryrefslogtreecommitdiff
path: root/etc/local.d/02-dnsmasq.start
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2022-02-23 20:19:37 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2022-02-23 20:43:27 -0500
commit12192865c3ca0e1c2139afabab508e0087b14982 (patch)
tree26ea5454dc976e87186e369685a1ac987bab2a61 /etc/local.d/02-dnsmasq.start
downloadalpine-home-router-12192865c3ca0e1c2139afabab508e0087b14982.tar.gz
alpine-home-router-12192865c3ca0e1c2139afabab508e0087b14982.tar.xz
Diffstat (limited to 'etc/local.d/02-dnsmasq.start')
-rwxr-xr-xetc/local.d/02-dnsmasq.start23
1 files changed, 23 insertions, 0 deletions
diff --git a/etc/local.d/02-dnsmasq.start b/etc/local.d/02-dnsmasq.start
new file mode 100755
index 0000000..25b736c
--- /dev/null
+++ b/etc/local.d/02-dnsmasq.start
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Generate dnsmasq configuration
+. /etc/local.d/vars.sh
+conf="/etc/dnsmasq.conf"
+
+cat > "$conf" <<EOF
+no-resolv
+$(for server in $dns_servers ; do printf 'server=%s\n' $server ; done)
+domain-needed
+except-interface=$wan
+expand-hosts
+domain=$domain
+dhcp-range=$dhcp_range
+# This is the default
+#dhcp-leasefile=/var/lib/misc/dnsmasq.leases
+dhcp-authoritative
+EOF
+
+echo "Generated dnasmasq config:"
+
+cat $conf
+
+. /etc/local.d/vars_end.sh