How do I specify the order that Network-Manager populates /etc/resolv.conf

5,233

Set ipv4.dns-priority of at least one of the profiles, to specify the relative order.

For example

nmcli connection modify "$PROFILE" ipv4.dns-priority 5

and reactivate the connection.

See the manual nm-settings(5) for details.

Share:
5,233

Related videos on Youtube

PolkaRon
Author by

PolkaRon

Updated on September 18, 2022

Comments

  • PolkaRon
    PolkaRon over 1 year

    Network Manager is posting the correct name servers and search domains into /etc/resolv.conf when I restart the network. However, it is not in an order I like. How can I tell Network Manager to prioritize the nameservers and search domain information of a certain interface over another?

    Example:

    What I get:

    # cat /etc/resolv.conf 
    # Generated by NetworkManager
    search silatria.org relinq.org pripylen.org acarime.org
    nameserver 120.052.0.2
    nameserver 120.052.0.1
    nameserver 10.66.66.1 
    

    What I want

    # Generated by NetworkManager
    search acarime.org silatria.org relinq.org pripylen.org 
    nameserver 10.66.66.1  
    nameserver 120.052.0.2
    nameserver 120.052.0.1
    

    acarime.org & nameserver 10.66.66.1 belongs to my network interface enp3s0 120.052.0.2.1, 120.052.0.1 & silatria.org relinq.org pripylen.org belongs to my network interface enp4s0

    • user2948306
      user2948306 over 5 years
      It would be nice to have the version of rhel / rpm -q NetworkManager here, e.g. just in case there's a feature for it but it was added later.
  • PolkaRon
    PolkaRon about 5 years
    Thanks, this worked!