Is there a way to set up local dnsmasq without a container?

WaitingForGuacamole

New Member
Apr 17, 2024
3
0
1
Background: I know that simple SDN zones use DNSMasq for DHCP (only, I _think_, from looking at `/etc/dnsmask.d/<zone-name>/*.conf`). I also know that it sets up a DNSMasq instance for each zone, and that you're instructed to disable the default instance.

Here's the thing, though - I'd love to register my VM hosts in a DNS zone, maybe even the proxmox host itself - preferably at the node level where the IP is fixed and well known. I could do this in an LXC, but any time if got redeployed I'd have to change client configurations.

Is it possible to enable the default instance in a way that does not collide with the DHCP instances? I've set `listen-address=127.0.0.1,192.168.0.13` in `/etc/dnsmasq.conf`, and that latter interface does not overlap any zones. No matter what I do, DNSMasq complains about port 53 already in use.

Am I barking up the wrong tree, or if this is easily done?
 
Last edited:
Some config I've tried:
Code:
/etc/default/dnsmasq contains:

CONFIG_DIR=''
DNSMASQ_OPTS="--conf-file=/etc/dnsmasq.conf"

[CODE]

[CODE]
/etc/dnsmasq.conf contains:

port=53
domain-needed
bogus-priv
strict-order

local=/my.local.domain/

domain=my.local.domain

# have tried with and without localhost
listen-address=127.0.0.1,192.168.0.13

# try to prevent collisions with SDN zone DHCP DNSMasq instances
no-dhcp-interface=vmbr0,lo
Result on start:

Code:
> sudo systemctl status dnsmasq.service
× dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
     Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Fri 2024-04-19 14:51:15 MDT; 10s ago
    Process: 8231 ExecStartPre=/etc/init.d/dnsmasq checkconfig (code=exited, status=0/SUCCESS)
    Process: 8238 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2)
        CPU: 12ms

Apr 19 14:51:15 lab systemd[1]: Starting dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server...
Apr 19 14:51:15 lab dnsmasq[8238]: dnsmasq: failed to create listening socket for port 53: Address already in use
Apr 19 14:51:15 lab dnsmasq[8238]: failed to create listening socket for port 53: Address already in use
Apr 19 14:51:15 lab systemd[1]: dnsmasq.service: Control process exited, code=exited, status=2/INVALIDARGUMENT
Apr 19 14:51:15 lab dnsmasq[8238]: FAILED to start up
Apr 19 14:51:15 lab systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Apr 19 14:51:15 lab systemd[1]: Failed to start dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server.

Code:
sudo lsof | grep :domain
dnsmasq    1074                   dnsmasq    6u     IPv4              45796      0t0        UDP 172.16.0.1:domain
dnsmasq    1074                   dnsmasq    7u     IPv4              45797      0t0        TCP 172.16.0.1:domain (LISTEN)
dnsmasq    1074                   dnsmasq   13u     IPv6              46032      0t0        UDP [fe80::4062:77ff:feba:2220]:domain
dnsmasq    1074                   dnsmasq   14u     IPv6              46033      0t0        TCP [fe80::4062:77ff:feba:2220]:domain (LISTEN)
dnsmasq    1077                   dnsmasq    6u     IPv4              25877      0t0        UDP 172.17.0.1:domain
dnsmasq    1077                   dnsmasq    7u     IPv4              25878      0t0        TCP 172.17.0.1:domain (LISTEN)
dnsmasq    1077                   dnsmasq   13u     IPv6              40428      0t0        UDP [fe80::7887:b4ff:fe34:1535]:domain
dnsmasq    1077                   dnsmasq   14u     IPv6              40429      0t0        TCP [fe80::7887:b4ff:fe34:1535]:domain (LISTEN)

172.16.0.1/16 and 172.17.0.1/16 are SDN zone subnets.

Note: this works if I set the port above to 5353. It's only a conflict where I leave it at the default (which I want).
 
Last edited:
I got it working - found a switch in one of the zone configs and copied it over to /etc/default/dnsmasq:

Code:
DNSMASQ_OPTS="--conf-file=/etc/dnsmasq.conf --bind-dynamic"

If you don't specify either --bind-dynamic or --bind-interfaces, DNSMasq will automatically attempt to bind the wildcard address.