How to set ipv4.dns-search persistently with NetworkManager
Issue
- We require use of the
search
option in/etc/resolv.conf
. We use Azure, and it does not allowsearch
to be configured, onlynameserver
. Azure sets a defaultsearch
field, which we'd like to override.
# cat /etc/resolv.conf
; generated by /usr/sbin/dhclient-script
search foo.example.com
nameserver 192.168.0.1
nameserver 192.168.0.2
nameserver 192.168.0.3
- We are using NetworkManager to set
dns-search
by running commandnmcli con mod eno1 ipv4.dns-search "bar.example.com"
, which works in runtime, but it is not persistent. - Need a persistent way to change/override default
search
parameter in/etc/resolv.conf
Environment
- Red Hat Enterprise Linux (RHEL) 9
- Red Hat Enterprise Linux (RHEL) 8
- Red Hat Enterprise Linux (RHEL) 7
- NetworkManager
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.