[Dnsmasq-discuss] Run multiple processes (with diff port #'s, interface bindings) concurrently?

Geert Stappers stappers at stappers.nl
Wed Jul 8 06:27:44 BST 2020


On Tue, Jul 07, 2020 at 06:29:33PM -0500, Johnny Utahh wrote:
> Can dnsmasq run 2 or more different processes (with diff port numbers and
> interface bindings) concurrently within the same OS/machine?

Yes, it can. That is the reason there is debian/systemd at .service
---------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<--------


> Any known problems with this?
> 
> The following post claims multiple instances can run, but does not mention
> multiple port #'s (which is my use-case's key issue):
> https://stackoverflow.com/a/13296605/605356

Not visited   (not left my email  environment)

 
> I'll be testing this later by running multiple 'dnsmasq --conf-file=<file>'
> commands.
> 
> environment:
> Ubuntu 20.04
> dnsmasq 2.80
> 
> Thanks,

Feel free to report your milage here.
As in: It is up you to prevent "but does not mention multiple port #'s"


> ~J


Groeten
Geert Stappers
-- 
Silence is hard to parse



More information about the Dnsmasq-discuss mailing list