Skip to content

Commit

Permalink
enable DNS optionally
Browse files Browse the repository at this point in the history
  • Loading branch information
f18m committed Nov 28, 2024
1 parent 2efb457 commit 8abde61
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 10 deletions.
16 changes: 14 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,25 @@ ingress_port: 8100
panel_icon: mdi:ip-network-outline
panel_title: DHCP
options:
# default lease time for all DHCP clients except those having an IP address reservation.
default_lease: 1h
# the address reservation lease might also be 'infinite' but this is discouraged since
# it means that the dHCP clients will never come back to this server to ACK their IP
# and this makes the whole DHCP server less useful... it's better to force the clients
# to some frequent check-in, since that becomes a basic heartbeat / client health check.
address_reservation_lease: 1h

# network section defines a number of properties that help populate DHCP answers.
network:
# the interface on which the DHCP server will listen for DHCP requests on port 67
interface: enp1s0
# the broadcast IP address to advertise in DHCP answers
broadcast: 192.168.1.255
# the gateway IP address to advertise in DHCP answers
gateway: 192.168.1.254
interface: enp1s0
# the netmask to advertise in DHCP answers
netmask: 255.255.255.0
# dns servers to advertise in DHCP answers
dns:
- 8.8.8.8
- 8.8.4.4
Expand All @@ -49,10 +57,14 @@ options:
#- time3.google.com
# example3: the entry 0.0.0.0 means "the address of the machine running dnsmasq"
#- 0.0.0.0

dns_server:
enable: true

dhcp_range:
start_ip: 192.168.1.50
end_ip: 192.168.1.250
ip_address_reservations:
ip_address_reservations: # TODO: rename to dhcp_ip_address_reservations for consistency around DHCP-related opts
- mac: aa:bb:cc:dd:ee:ff
name: "An-important-host-with-reserved-IP"
ip: 192.168.1.15
Expand Down
36 changes: 29 additions & 7 deletions rootfs/usr/share/tempio/dnsmasq.config
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
# Automatically generated do not edit
# See https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

# To disable dnsmasq's DNS server functionality.
port=0

no-resolv
no-hosts
interface={{ .network.interface }}
keep-in-foreground
log-facility=-
no-poll
user=root


#
# DNS config
#

{{ if ! .dns_server.enable }}
# port=0 disables dnsmasq's DNS server functionality.
port=0
{{ end }}

# do not use the DNS servers specified in /etc/resolv.conf:
no-resolv
#
no-hosts

# list of upstream DNS servers
{{ range .network.dns }}
server={{ . }}
{{ end }}
local=/home/



#
# DHCP config
#

{{ if .log_dhcp }}
log-dhcp # log dhcp related messages
{{ end }}

interface={{ .network.interface }}

# the /data folder for HomeAssistant addons is mounted on the host and is writable, let's save DHCP client list there:
dhcp-leasefile=/data/dnsmasq.leases

Expand Down
2 changes: 1 addition & 1 deletion translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
configuration:
default_lease:
name: Default DHCP lease time
description: This can be given in seconds, minutes (m) or hours (h).
description: This represents the default DHCP lease time for all DHCP clients except those having an IP address reservation. This can be given in seconds, minutes (m) or hours (h) or you can use 'infinite'.
address_reservation_lease:
name: DHCP lease time for IP address reservations
description: This can be given in seconds, minutes (m) or hours (h) or you can use 'infinite'.
Expand Down

0 comments on commit 8abde61

Please sign in to comment.