NetworkManager resolv.conf search string

Issues related to configuring your network
Post Reply
hossman12
Posts: 2
Joined: 2020/04/23 13:36:19

NetworkManager resolv.conf search string

Post by hossman12 » 2020/04/23 13:40:18

I need to be able to dynamicly append a search domain to the search string in /etc/resolv.conf. In prior versions I was able to to do this with a dhclient-enter-hooks script. but with NetwrokManager taking control in 8 this no longer functions. I cant figure out how to duplicate the functionality in NetwrokManager.

I have a number of machines that will get the hostname of
host.subdomain.domain.com.

NetworkManager will properly put subdomain.domain.com as the search string.

search subdomain.domain.com

But I also need to have it append dmoain.com to the search string as well if the machine is in a subdomian.

search subdomain.domain.com domain.com

using nmcli con mod ens192 ipv4.dns-search "domain.com" will cause it to be pre-pended to the search string which will not work for me. I need it to be appended.

Also this image will be deployed to a mix of physical and virtual machines so I cannot rely on the interface being consistent. the change also has to survive patching and updating of packages. the way a dhclient-enter-hooks script would.

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: NetworkManager resolv.conf search string

Post by jlehtone » 2020/04/23 16:32:32

Does ipv4.dns-priority affect the order?

hossman12
Posts: 2
Joined: 2020/04/23 13:36:19

Re: NetworkManager resolv.conf search string

Post by hossman12 » 2020/04/27 15:21:32

no that doesn't impact the search string order.

I have been looking into putting a script in dispatcher.d directory to do the same function the enter-hooks script was doing but it appears network Manager executes these scripts before it updates the resolv.conf because I'm ending up with a search string as follows search subdomian.domain.com domain.com subdomain.domain.com My script changes the search string to search subdomian.domain.com domain.com Then network manager is appending another subdomain.domain.com. My script is looking for the action "connectivity-change". I've had the same result when using the action "up" as well.

Post Reply