Q: I am runing Red Hat Enterprise Linux 7 Workstation and am having a hard time adding search domains. My work has several domains and I want to be able to use the short names. I have tried the network settings and don't see a place to add search domains. I have also added "search domain1 domain2" to resolv.conf but it gets replaced every reboot by Network Manager. Any help?
A: This is because Gnome does not give you a place to enter search domains in their Network Settings GUI. Also, the /etc/resolv.conf file is generated every time the Network Manager process starts or restarts which overwrites the manual changes.
Let's start with why someone would want to add search domains. Let's say your office used a domain of example.com. So the servers are named similar to server1.example.com. If you add example.com to your search domains, you would be able to access the servers using the short name "server1". The search domains are automatically appended to the end of host names. If you add multiple search domains they will append one by one until they resolve in DNS.
So, to fix this you have two options...
You can run the Network Manager GUI configuration tool by running the following command:
Once the Network Manager Connection Editor opens, select the network adapter you want to change the settings for and click edit. Go to the IPv4 Settings page and enter the domains in "search domains" field (separate multiple domains with a comma).
or use the Network Manager Command Line Interface (nmcli). First run nmcli to find the name of the interface like so:
virbr0: connected to virbr0
bridge, 52:54:00:7B:B3:F0, sw, mtu 1500
em1: connected to em1
"Intel Ethernet Connection (3) I218-LM"
ethernet (e1000e), 83:7B:FB:41:6B:78, hw, mtu 1500
"Intel Wireless 7265 (Dual Band Wireless-N 7265)"
wifi (iwlwifi), 62:EF:10:F9:3B:BE, hw
loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536
tun, 52:54:00:7B:B3:F0, sw, mtu 1500
servers: 192.168.16.40 192.168.16.10
sudo nmcli con mod em1 ipv4.dns-search "domain1.local,domain2.local,domain3.local"
sudo nmcli con show em1 | grep dns-search
sudo systemctl restart NetworkManager
# Generated by NetworkManager
This site uses Akismet to reduce spam. Learn how your comment data is processed.