DNSMASQ listen on other interfaces

In my container i’m bringing up an additional interface called sl0. I need to have dnsmasq listen to port 53 on that interface as well. Normally I would do this by adding:

echo "interface=sl0" >> /etc/dnsmasq.conf

However, this doesn’t work in my container. I read that I should be using dbus for this, however I cannot find an Dbus API call to add this interface. Maybe i’m just not looking at the right place, I got the API from: https://github.com/imp/dnsmasq/blob/master/dbus/DBus-interface

I did look at Pi-Hole project, DNSMASQ_LISTENING, and using “bind-interface” but I didn’t get it working with these settings either.

Hopefully someone can point me in the right direction, would be great it’s possible with dbus.

You only need to use D-Bus or a library that runs on top of it if you need to communicate with a process running on the host OS. In the case like yours involving dnsmasq, you may just start dnsmasq from the container with the parameters you need. It won’t interfere with the dnsmasq running on the host OS.

So I would like to not install dmasq on my container it self, but talk over dbus and instrcut dnsmasq on the host to also bind a nameserver on interface sl0. An interface which is brought up inside a container. Hope i’m making sense of what I mean :slight_smile:

But looking at the docs, it seems like the dbus api to dnsmasq is only for DHCP related stuff. Hopefully i’m not looking at the right docs.

Do you know if it’s possible to tell dnsmasq over dbus to listen to other interfaces?

Dnsmasq does not provide a D-Bus API for binding to an interface. It only allows doing that from configuration or command line. Since the configuration is not available to be modified from a container, the only option is to start dnsmasq in the container. Here is one example I found through a GitHub search: https://github.com/FlowLeaf/edge-grow-pi/tree/master/dnsmasq.