3

i want to have a dockerized Dnsmasq network-wide DNS-Server-solution on my Debian 10 system.

Problem:

sudo lsof -i -P -n | grep LIST
dnsmasq  ... TCP 192.168.122.1:53 (LISTEN)

There is already an instance of dnsmasq listening for local DNS-Service. But i want to use the docker instance (pls dont ask me to use the build in dnsmasq, bc the docker one has a web interface).

In the docker-instance dnsmasq web-interface i get:

⁣⁣dnsmasq: failed to create listening socket for port 53: Address in use

So its clearly, that i have to disable dnsmasq. I wen threw this thread:

https://mmoapi.com/post/how-to-disable-dnsmasq-port-53-listening-on-ubuntu-18-04

  • setting "DNSStublistener=no"
  • worked, but after reboot i got the same problem.

So obviously there is something else that i don´t understand. This problem is linked to this Thread:

How to correctly disable systemd-resolved on port 53 for avoiding clash with dnsmasq in Ubuntu 20.04…?

  • Same problem, but no real stress-free solution, so i assume, that it´s worth to have a new thread about it for the post-networkmanager-solution-era.

So, how can i disable that, without stumbeling into new problems?

Edit: found a solution How do I limit dnsmasq listening to only one interface?

saying

  • add -bind interface to config for use of multiple DNS-Servers (man page although says that)

BUT

  • got a problem, bc there is no /etc/dnsmasq.conf file?

2 Answers 2

2

I've had the same issue, except I wanted to setup pihole, and libvirt engaging dnsmasq got very much in the way. Two addendums to NASNewbie2k18's answer:

  1. Adding <dns> <dns enable="no"/> </dns> to the default.conf file through virsh net-edit default didn't help, as the change was getting removed from the file after saving. Instead I had to add <dns enable='no'/>, so without the extra <dns> tags. That freed up one bind after reboot.
  2. Second bind was on 10.0.3.1:53, which is done by lxc-net. After changing USE_LXC_BRIDGE to false in the /etc/default/lxc-net file and restarting the lxc-net service with systemctl restart, that last bind was released, and I was finally able to launch pihole.
1

I used to help myself.

  1. I found the process and looked up the destination of the conf file with the Classic SysAdmin: How to Kill a Process from the Linux Command Line tutorial:
    ps aux | grep dnsmasq
    
  2. I edited the file (e.g., nano /var/lib/libvirt/dnsmasq/default.conf) and changed the bind-dynamic to bind-interfaces
  1. Rebooted to see whether it was helpful.

  2. It wasn’t because the default.conf file is auto-generated, so it said I have to use

    virsh net-edit default
    

    to edit the default settings. Another problem occurred because, before v5.6 of libvirt, passing custom options was not allowed. But after that there is a special xml-phrase that I used:

       <dnsmasq:options>
         <dnsmasq:option value="foo=bar"/>
         <dnsmasq:option value="cname=*.foo.example.com,master.example.com"/>
       </dnsmasq:options>
    

    Solution was found in custom dnsmasq (or custom options) with libvrt?; I tried that, but it didn’t work.

  3. I ended up disabling DNS for the default network in the XML-File using

    <dns> <dns enable="no"/> </dns>
    

    Following the instructions on the man page (you write in a tmp XML and safe, and when everything’s fine, it takes it as the new normal).

  4. DNS for that port was disabled and my second dnsmasq server got up and is running.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .