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?

  • 1
    thanx, but WHY did this disapear in the first place ? – Jess Oct 10 '18 at 14:34
  • @Jess 18.04 adopted what 16.04 GNOME did, since they switched back to GNOME. This has an answer at this other thread which quotes the GNOME team's reasoning for having a 'weak' setup. – Thomas Ward Oct 10 '18 at 14:44

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.

  • Would be good if this answer made mention: restarting NetworkManager after using nm-connection-editor seems to be required for changes to take effect, e.g. sudo systemctl restart NetworkManager Until now I'd always just hand edited /etc/resolv.conf, but this old unix technique is apparently no longer allowed. In my case I just rebooted when I noticed changes weren't taking effect, which worked, but later found restarting NetworkManager is best; Reference: github.com/ansible/ansible/issues/17843 – erco Jun 4 at 23:16

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 :

host www

Which will resolve the IP to www.example.com

  • 1
    You can also do nm-connection-editor and get the GUI editor that everyone came to love in 16.04. – Thomas Ward Oct 10 '18 at 14:47

Ubuntu 18.04 uses Netplan for networking.

$ vi /etc/netplan/50-cloud-init.yaml

            addresses: []
            dhcp4: no
            dhcp6: no
                    addresses: [,]
                    search: [home.com, lab.com]
$ sudo netplan apply
$ cat /etc/resolv.conf

(the latter shows your search domains home.com and lab.com)


But don't do as I did, and mistake it for an "additive" setup:

            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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.