Noah
Noah

Reputation: 21

Disable or change port number for libvirt dnsmasq service on ubuntu host

How can I disable or change the port number for the libvirt dnsmasq service?

I need to make port 53 available on the main host.

❯ sudo lsof -i | grep dns dnsmasq 2458 libvirt-dnsmasq 3u IPv4 38663 0t0 UDP *:bootps dnsmasq 2458 libvirt-dnsmasq 5u IPv4 38666 0t0 UDP :domain dnsmasq 2458 libvirt-dnsmasq 6u IPv4 38667 0t0 TCP :domain (LISTEN)

Cheers

Upvotes: 2

Views: 1250

Answers (2)

doks
doks

Reputation: 1

I'd like to add to brunorcabral's answer.

As stated, In the network configuration XML (called default) it is enough to add the <dns enable="no"/> line.

However, in my case, the virtual machines retain Internet access.

Make sure the configuration has a <forward> element with an attribute "mode" set to "nat" and an <ip> element with a <dhcp> subelement and a configured range.

All of the above applies to the default configuration. This means that if you haven’t changed anything, you just need to add that line with DNS disabling and everything should work as expected.

But if you created other configurations or heavily modified the default one, have fun with the documentation. Everything works fine in libvirt. Unlike Incus/LXD, where to disable dns, you need to specify a setting for the dnsmasq configuration through a special option, which looks like:

incus|lxc network set incusbr0|lxdbr0 raw.dnsmasq="port=0"

Upvotes: 0

brunorcabral
brunorcabral

Reputation: 144

Almost a year, but I just got into same situation.

Open "Virt-Manager", select a connection, then in the menu select Edit, then "Connection Details", it will open a new window. Go to the tab "Virtual Networks". Stop the networks. This will already remove port 53 from listening ports. If needed to start the network, one may add <dns enable="no"> to the XML (and apply), but the VMs won't connect.

I don't know how to make the VMs connect having dns disabled, in my case I don't need to have the networks started all the time, so, stopping the Virtual Networks is enough for me.

Upvotes: 0

Related Questions