On 2023-05-09 18:20, Andrei Borzenkov wrote:
On 09.05.2023 18:40, Per Jessen wrote:
IOW, you want to keep your static config for /etc/resolv.conf, but you also want the dynamic info (from dhcp or RA) to include in dnsmasq.conf. I have not done a comprehensive search, but I don't see that wicked writes any such file for that use.
Of course it does (strictly speaking, it calls netconfig which writes this file). It is /var/run/dnsmasq-forwarders.conf if you set NETCONFIG_DNS_FORWARDER=dnsmasq.
Telcontar:~ # grep NETCONFIG_DNS_FORWARDER /etc/sysconfig/network/config #NETCONFIG_DNS_FORWARDER='resolver' NETCONFIG_DNS_FORWARDER='dnsmasq' NETCONFIG_DNS_FORWARDER_FALLBACK="yes" Telcontar:~ # cat /var/run/dnsmasq-forwarders.conf ### /run/dnsmasq-forwarders.conf: global dns forwarders ### for use as dnsmasq --resolv-file, autogenerated by netconfig! # # Before you change this file manually, consider to define the # static DNS configuration using the following variables in the # /etc/sysconfig/network/config file: # NETCONFIG_DNS_STATIC_SEARCHLIST # NETCONFIG_DNS_STATIC_SERVERS # NETCONFIG_DNS_FORWARDER # or disable DNS configuration updates via netconfig by setting: # NETCONFIG_DNS_POLICY='' # # See also the netconfig(8) manual page and other documentation. # nameserver 192.168.1.16 Telcontar:~ # The router information is not there. It also needs: NETCONFIG_DNS_POLICY='auto' Then I get: Telcontar:~ # cat /var/run/dnsmasq-forwarders.conf ### /run/dnsmasq-forwarders.conf: global dns forwarders ### for use as dnsmasq --resolv-file, autogenerated by netconfig! # # Before you change this file manually, consider to define the # static DNS configuration using the following variables in the # /etc/sysconfig/network/config file: # NETCONFIG_DNS_STATIC_SEARCHLIST # NETCONFIG_DNS_STATIC_SERVERS # NETCONFIG_DNS_FORWARDER # or disable DNS configuration updates via netconfig by setting: # NETCONFIG_DNS_POLICY='' # # See also the netconfig(8) manual page and other documentation. # nameserver 192.168.1.16 nameserver 2a02:9000::aaaa nameserver 2a02:9000::bbbb Telcontar:~ # (And somehow I'm getting 192.168.1.16, which is not Telcontar. NETCONFIG_DNS_STATIC_SERVERS='127.0.0.1 192.168.1.16' Solved.) But then the file /etc/resolv.conf -> /var/run/netconfig/resolv.conf changes constantly.
What netconfig *also* does in this case (and this seems to be poorly/not documented) is to *also* update /etc/resolv.conf. It does add 127.0.0.1 as the first entry, but it also puts there the same upstream name servers as in /var/run/dnsmasq-forwarders.conf.
There is no way to stop netconfig doing it as long as /etc/resolv.conf remains under control of netconfig. One would need to manage it manually (which should not be a problem as long as it has permanent entry 127.0.0.1). But I believe we already suggested it from the very beginning and this suggestion was rejected for some reasons.
I think I tried all the suggestions posted here :-) What I have now is what I want: 127.0.0.1 in /etc/resolv.conf, and only that one, and a list of external forwarders inside the dnsmasq file. All static. In case you missed it, I only want 127.0.0.1 so that if dnsmasq fails, I get a failure and not a backup machine taking over. This is my desktop machine; on a server to be accessed by other machines, I may want redundancy.
I don't understand why you refuse to use a regular dynamic config, such as what I showed you earlier, but I see wicked has some scripting options, maybe you can build some bespoke solution.
When choosing between relatively good documented netconfig and completely undocumented wicked xml configuration I would certainly prefer netconfig. Although of course it is possible to simply model your own extension on how netconfig extension works, it is not overly complicated.
-- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)