Ubuntu – How to disable LLMNR in Netplan

netplannetworkingsystemd-networkd

I found How can I disable LLMNR in systemd-resolved? useful for demonstrating how to disable LLMNR in systemd-networkd. However, ubuntu 18.04 uses netplan to configure the network rather than systemd-networkd (which manages it instead). So this solution doesn't work.

How netplan works is it directly manipulates the /run/systemd/network/*.network files using the keys in the /etc/netplan/*.yaml files (please see documentation on netplan.io site). According to netplan, you can set the relevant keys in the yaml file in netplan to configure hosts the way you would have had you used systemd-networkd instead (via /etc/systemd/network/). But I see no keys to control the LLMNR setting per interface.

How can I continue using netplan to configure my network (ala systemd-networkd), and have this value in the run files generated by netplan to properly control this setting?

What doesn't work:

  • Setting LLMNR=no to /etc/systemd/resolved.conf (this is a global setting, running systemd-resolve --status still shows LLMNR setting: yes)
  • Managing /var/run/systemd/network/*.network files after netplan has (they're dynamically created, so my changes are obliterated on reboot, service restart, etc)

Best Answer

To disable LLMNR, add the following to /etc/systemd/resolved.conf:

[Resolve]
LLMNR=false
Related Question