Linux NetworkManager - Adding a search domain using nmcli or nmtui
Actually, I just want to add my search domain to the network settings (search domain or dns search) under Arch-Linux and Fedora. This used to be very easy via Settings -> Network. Unfortunately, this was removed from the settings at some point. My environment is Gnome 43.3 and 46.
Like many other Linux distributions, my Arch or Fedora Linux is managed via the Network Manager. So this tip applies to all those who manage their network via NetworkManager (nmcli) (Ubuntu with ifupdown, Debian, Fedora, etc.).
Endeavour Arch Linux comes with the nmcli and nmtui commands installed by default. If you do not have at least nmcli installed, you are not using NetworkManager. You can use the nmcli for the "search domain" setting, or the simpler nmtui with a shell GUI.
Tested with:
With the command:
or
you can then check the settings.
You must then restart the NetworkManager:
Fedora Install:
Start nmtui:
1) Select Edit connection
2) Select IPv4 configuration “Display”
3) Enter the relevant domain under “Search domains” and then select “OK”.
In newer versions of Ubuntu, the Network Configuration Abstraction Layer Netplan runs to provide the network (from version 20.04 for a new installation). When upgrading, the old network configuration is simply carried over. Under 'Netplan', the file '/etc/network/interfaces' is unfortunately no longer available (ifupdown has been replaced by netplan).
This is the 'Search Domain' configuration under 'Netpan':
followed by one:
That's all
Like many other Linux distributions, my Arch or Fedora Linux is managed via the Network Manager. So this tip applies to all those who manage their network via NetworkManager (nmcli) (Ubuntu with ifupdown, Debian, Fedora, etc.).
Endeavour Arch Linux comes with the nmcli and nmtui commands installed by default. If you do not have at least nmcli installed, you are not using NetworkManager. You can use the nmcli for the "search domain" setting, or the simpler nmtui with a shell GUI.
Tested with:
- Endeavor Arch Linux (Gnome 43.3)
- Fedora 40 (Gnome 46)
nmcli
sudo nmcli con show
NAME UUID TYPE DEVICE
Wired connection 1 7708dd93-ea55-398a-9dd1-b5be2c65d4b6 ethernet enp4s0
lo e6140168-f933-434b-883b-8095ee9b9488 loopback lo
sudo nmcli con mod 'Wired connection 1' ipv4.dns-search "searchdomain.tld"
With the command:
sudo nmcli con show 'Wired connection 1' | grep dns-search
resolvectl
You must then restart the NetworkManager:
systemctl restart NetworkManager
nmtui
Fedora Install:
sudo dnf install nmtui
Start nmtui:
[root@frank-endeavour ~]# nmtui
1) Select Edit connection
2) Select IPv4 configuration “Display”
3) Enter the relevant domain under “Search domains” and then select “OK”.
Update for Ubuntu
In newer versions of Ubuntu, the Network Configuration Abstraction Layer Netplan runs to provide the network (from version 20.04 for a new installation). When upgrading, the old network configuration is simply carried over. Under 'Netplan', the file '/etc/network/interfaces' is unfortunately no longer available (ifupdown has been replaced by netplan).
This is the 'Search Domain' configuration under 'Netpan':
vi /etc/netplan/00-installer-config.yaml
network:
ethernets:
enp4s0:
addresses:
- 192.168.0.4/24
dhcp4: false
gateway4: 192.168.0.1
nameservers:
addresses:
- 192.168.0.1
search:
- searchdomain.tld
version: 2
followed by one:
sudo netplan generate
sudo netplan apply
That's all
Please also mark the comments that contributed to the solution of the article
Content-ID: 671377
Url: https://rootdb.com/tutorial/linux-networkmanager-adding-a-search-domain-using-nmcli-or-nmtui-671377.html
Printed on: March 14, 2025 at 06:03 o'clock