balena-os / meta-balena

A collection of Yocto layers used to build balenaOS images
https://www.balena.io/os
969 stars 116 forks source link

Allow the dnsServers entry of config.json to override DHCP results #2194

Open pdcastro opened 3 years ago

pdcastro commented 3 years ago

The dnsServers entry of config.json allows 8.8.8.8 to be excluded, as documented: https://www.balena.io/docs/reference/OS/configuration/#dnsservers

But it does not allow excluding/overriding results obtained by the device via DHCP. A common need for this is when the user wants to use a locally configured DNS server, in a lab setting for testing and debugging purposes, especially but not limited to the use of openBalena.

Example:

config.json

  ...
  "dnsServers": "192.168.1.200",

In the example above, the current behavior" is that the device will use DNS servers 192.168.1.1 and also** 192.168.1.200 (in no configurable order), assuming that 192.168.1.1 was provided to the device via DHCP.

The desired behavior would be for the device to use DNS server "192.168.1.200" only, ignoring / discarding any DNS servers provided to the device via DHCP.

I think this could be considered a breaking change, so some thought is need as to how to avoid getting devices offline as a result of HUP.

pdcastro commented 3 years ago

FD discussion: https://www.flowdock.com/app/rulemotion/r-resinos/threads/REGBg4LaGTdax-9beRMc8OZJl8n

majorz commented 1 year ago

For ignoring the DNS servers passed through DHCP ipv4.ignore-auto-dns=true and ipv6.ignore-auto-dns=true can be specified inside the NetworkManager connection profile.