[Dnsmasq-discuss] listening on multiple ports at the same time
Geert Stappers
stappers at stappers.nl
Tue Dec 6 22:04:53 UTC 2022
On Tue, Dec 06, 2022 at 08:40:57PM +0000, Simon Kelley wrote:
> On 06/12/2022 18:51, Gordon Shawn wrote:
> > can dnsmasq listen on different ports(e.g. 53, 5353,5354,5355) in the
> > same time with a single process running? each port can have its own
> > configuration. so far I invoke multiple dnsmasq processes to do that. if
> > they can share with one process I can save some memory.
>
> That's not supported.
>
> Multiple processes is the best way to go.
>
File systemd at .service ( see below
or https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blob;f=debian/systemd@.service;hb=HEAD )
seems to be intented for it. But I never understood how to use. I did
get that %i is some placeholder gets expanded, didn't get how to
translate it to further configuration item.
Groeten
Geert Stappers
------8<----8<----8<------
[Unit]
Description=dnsmasq (%i) - 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.%i.pid
# Test the config file and refuse starting if it is not valid.
ExecStartPre=/etc/init.d/dnsmasq checkconfig "%i"
# 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 "%i"
# The systemd-*-resolvconf functions configure (and deconfigure)
# resolvconf to work with the dnsmasq DNS server. They're called like
# 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 "%i"
ExecStop=/etc/init.d/dnsmasq systemd-stop-resolvconf "%i"
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
------>8---->8---->8------
--
Silence is hard to parse
More information about the Dnsmasq-discuss
mailing list