How to set ipv4.dns-search persistently with NetworkManager

Solution Verified - Updated -

Issue

  • We require use of the search option in /etc/resolv.conf. We use Azure, and it does not allow search to be configured, only nameserver. Azure sets a default search 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 command nmcli 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.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content