With Network Manager in Red Hat 7, I am seeing an issue where the old/wrong search domain is being used after changing the hostname. In /etc/resolv.conf, I see:
# Generated by NetworkManager search **ec2.internal** d.sample.com nameserver 172.31.0.2
When I type
hostname, I see my desired output:
[root@testing01 ~]# hostname testing01.d.sample.com
But instead of replacing the search domains, it is appending the new domain name to the search domains. I want to completely get rid of ec2.internal and give this domain the ax altogether. Editing the
/etc/resolv.conf file directly gets clobbered by Network Manager. I don't want to disable Network Manager, and I'd rather not disable NM's management of
/etc/resolv.conf unless I absolutely have to.
So, 1) Why does NM keep reverting my search domain and 2) how can I fix this using nmcli or command line tools only?