Since Ubuntu 18.04 , network GUI to setup network doesn't include any more the search domain field.
How can we set it again in a manner that resist to reboot?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
Per my other answer focusing on 16.04 GNOME (which 18.04 basically has inherited), you can fix this by using the old-style Network Editor by running
nm-connection-editor, which is the older Network Manager editing GUI we all love.
Basically, however, for 16.04 and onwards, the GNOME team for Ubuntu made some decisions about the older network editing menu, providing a trimmed down one for the average end user. Per Jeremy Bicha, from the #ubuntu-gnome IRC channel back in April:
jbicha: sorry it's hidden by default because most people don't need two network GUIs and the one in the Settings app should be easier to use for most people
The idea was basically that the 'most common options' that people would have to edit would be in the 'easier' settings GUI. But for more advanced users, they can still call
nm-connection-editor to edit things like Search domains and such.
Note that the answer for 16.04 applies for 18.04. You can still use the other answer I wrote as a basis for solving this in 18.04.
(Note that you will need to disconnect and reconnect the network connection to get the search domain updates to apply, by the way. You do not need to restart all of the Network Manager services just to make this apply, just disconnect and reconnect your cable, and the updated profile configuration will apply)
Ubuntu 18.04 uses Netplan for networking.
$ vi /etc/netplan/50-cloud-init.yaml ethernets: ens224: addresses: [192.168.86.30/24] dhcp4: no dhcp6: no gateway4: 192.168.86.1 nameservers: addresses: [192.168.86.10, 192.168.86.11] search: [home.com, lab.com] $ sudo netplan apply $ cat /etc/resolv.conf
(the latter shows your search domains home.com and lab.com)
It's possible to set it through CLI with :
nmcli c show nmcli c modify "Wired connection 1" ipv4.dns-search "example.com" nmcli c down "Wired connection 1" && nmcli c up "Wired connection 1"
We can check it by looking at
/etc/resolv.conf and trying to resolve a hostname without the domain like so :
Which will resolve the IP to
But don't do as I did, and mistake it for an "additive" setup:
ethernets: ens224: nameservers: search: [home.com, lab.com] $ sudo netplan apply
In an attempt to overwrite the "search" line in /etc/resolv.conf and expect that this is the only thing that will change. The above seems to remove alle the original settings from ens224 including whatever makes it work. So after the apply, the server was no longer reachable.
Yes, my own fault for not reading the manual. You have now been warned.