Discussion:
[Dnsmasq-discuss] Reload dnsmasq when systemd-networkd.service receives a new IPv6 prefix and assigns IPv6 address for it
M. Buecher
2017-09-02 11:50:58 UTC
Permalink
Hi everybody,

dnsmasq is used in my small LAN at home and it provides static interface
ids to a few servers for Global Unicast Addresses (GUA, 2000::/3) too.
The GUA prefix from my ISP is advertised via RA by my router (M+O+A
flags set).
As the prefix from my ISP changes from time to time I restart dnsmasq
manually so that it reads the new prefix via the dhcp-range constructor
method.
Of course I would prefer that this would happen automatically.

Has anyone setup such an similar automatic reloading on a new prefix?

OS is Raspbian 9.0 "Stretch" (Debian derivative).
Network config via systemd-networkd.service and *not* Debian's default
ifupdown legacy compatibility networking.service.
Another possible alternative would be dhcpcd [https://roy.marples.name].

Kind regards
Maddes
[Match]
Name=en*

[Network]
IPv6AcceptRA=yes
LinkLocalAddressing=ipv6
IPv6Token=::a:b:c:d
IPv6PrivacyExtensions=yes

[Address]
## ULA
Address=fd00:1:2:3:a:b:c:d/64
[Unit]
Description=dnsmasq - A lightweight DHCP and caching DNS server
Requires=network.target
Wants=nss-lookup.target
Before=nss-lookup.target
After=network.target

[Service]
Type=forking
PIDFile=/run/dnsmasq/dnsmasq.pid

# Test the config file and refuse starting if it is not valid.
ExecStartPre=/usr/sbin/dnsmasq --test

# We run dnsmasq via the /etc/init.d/dnsmasq script which acts as a
# wrapper picking up extra configuration files and then execs dnsmasq
# itself, when called with the "systemd-exec" function.
ExecStart=/etc/init.d/dnsmasq systemd-exec

# The systemd-*-resolvconf functions configure (and deconfigure)
# resolvconf to work with the dnsmasq DNS server. They're called liek
# this to get correct error handling (ie don't start-resolvconf if the
# dnsmasq daemon fails to start.
ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf
ExecStop=/etc/init.d/dnsmasq systemd-stop-resolvconf


ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
David Kerr
2017-09-02 16:01:28 UTC
Permalink
On AstLinux (www.astlinux-project.org) we use wide-dhcpv6 as our client to
obtain IPv6 from the ISP. In the conf file for that we specify a
script "/etc/dhcp6c.script" that is called whenever the ISP updates IPv6
and we can act on any changes to the delegated prefixes. Our script file
is here...
https://github.com/astlinux-project/astlinux/blob/master/package/wide-dhcpv6/dhcp6c.script

AstLinux uses dnsmasq for internal interface dhcp server, dns and router
advertisements. We do not restart dnsmasq when prefix changes (have not
found a need to do that) but no reason why you could not.

David
Post by M. Buecher
Hi everybody,
dnsmasq is used in my small LAN at home and it provides static interface
ids to a few servers for Global Unicast Addresses (GUA, 2000::/3) too.
The GUA prefix from my ISP is advertised via RA by my router (M+O+A flags
set).
As the prefix from my ISP changes from time to time I restart dnsmasq
manually so that it reads the new prefix via the dhcp-range constructor
method.
Of course I would prefer that this would happen automatically.
Has anyone setup such an similar automatic reloading on a new prefix?
OS is Raspbian 9.0 "Stretch" (Debian derivative).
Network config via systemd-networkd.service and *not* Debian's default
ifupdown legacy compatibility networking.service.
Another possible alternative would be dhcpcd [https://roy.marples.name].
Kind regards
Maddes
Post by M. Buecher
[Match]
Name=en*
[Network]
IPv6AcceptRA=yes
LinkLocalAddressing=ipv6
IPv6Token=::a:b:c:d
IPv6PrivacyExtensions=yes
[Address]
## ULA
Address=fd00:1:2:3:a:b:c:d/64
Post by M. Buecher
[Unit]
Description=dnsmasq - A lightweight DHCP and caching DNS server
Requires=network.target
Wants=nss-lookup.target
Before=nss-lookup.target
After=network.target
[Service]
Type=forking
PIDFile=/run/dnsmasq/dnsmasq.pid
# Test the config file and refuse starting if it is not valid.
ExecStartPre=/usr/sbin/dnsmasq --test
# We run dnsmasq via the /etc/init.d/dnsmasq script which acts as a
# wrapper picking up extra configuration files and then execs dnsmasq
# itself, when called with the "systemd-exec" function.
ExecStart=/etc/init.d/dnsmasq systemd-exec
# The systemd-*-resolvconf functions configure (and deconfigure)
# resolvconf to work with the dnsmasq DNS server. They're called liek
# this to get correct error handling (ie don't start-resolvconf if the
# dnsmasq daemon fails to start.
ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf
ExecStop=/etc/init.d/dnsmasq systemd-stop-resolvconf
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Loading...