I recently installed Ubuntu GNOME on my work computer, replacing Windows 7, because I will be doing a lot of Linux development work.

Many of our configuration and development scripts use shortened URLs for servers on the company network. That is, they use http://server rather than http://server.location.company.com. I never had problems with these URLS in Windows, but I have not been able to get them to work correctly in Ubuntu. It is not feasible for me to simply type the entire fully-qualified URL because the shortened form is used all over the place in various scripts, but I am able to access the long-form URLs.

When I connect to the company's VPN using the Dell SonicWall NetExtender VPN Client, the shortened URLS do work correctly.

Based on the research I have done so far, I think that I need to configure location.company.com as a search domain on Ubuntu, but my attempts at doing this have failed so far. Here is what I have tried:

  • In the "Network Connections" app, edit my wireless connection. Under the IPv4 tab, select Automatic (DHCP) addresses only. Then type in location.company.com as a search domain, and put our DNS server in as well. This made no noticeable difference.
  • Modifying dhclient.conf as described here.
  • Running dpkg-reconfigure resolvconf to make sure that it dynamically updates resolv.conf.

I am also worried that at this point I have tried several different things and they could be interfering with each other. I know that some parts of this configuration changed in the last couple of years with Ubuntu, and it can be hard to find the most current information. It is not completely clear to me how network-manager, resolvconf, dhclient, and other configuration files work together in the newest versions of Ubuntu.

So, my question: How can I configure my computer to make the short-form URLs work correctly in Ubuntu 14.10?

Or, which network configuration programs should I be using to do this, how should I configure them, and how can I verify that they are working correctly?

Thanks for your help! Let me know if I can provide any additional info.

Edit: Here is my /etc/resolv.conf, which I believe was generated by resolvconf.

# Add Company Nameservers and Domain
search location.company.com
search location.company.com
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
search hsd1.co.comcast.net
  • Did you ever solve this? – Hitechcomputergeek Mar 31 '16 at 13:05
  • Quick Update: At some point I did a clean install of a more recent version of Ubuntu. Maybe 16.04? Anyway, I haven't had any issues and haven't had to reconfigure anything since then, and I'm now on 18.10. – mkasberg Feb 8 '19 at 20:26

Search domain means the domain that will be automatically appended when you only use the hostname for a particular host or computer. This is basically used in a local network.

Lets say you have a domain name like xyz.com (it may be available globally or may be local only) and you have 100 computers in the LAN. Now you want this domain name to be automatically appended when you look for any computer by just hostname of the computer. If the domain name to be appended is xyz.com then the search domain should look like:

dns-search xyz.com ##If you put this into /etc/network/interfaces


search xyz.com ##If you put this into /etc/resolvconf/resolv.conf.d/base|head|tail

Now how do you check if its working properly, just use ping or any DNS resolving program like host, nslookup , dig.

For example if a host is test having the IP then using host:

host test
test.xyz.com has address

Now as dig does not use the search list/domain by default you need to use it like dig +search test to enable appending search domain.

Using nslookup:

nslookup test

Name:   test.xyz.com

Here is your local DNS server which has the IP address for the host test.xyz.com (notice the full form) that is The DNS server will resolve the hostname test.xyz.com to IP but will not resolve anything for only test as it does not have any entry like so.

So, what search domain is doing in our case is that it is automatically appending a domain name to make it a FQDN when we are just using the hostname to look up a computer.

  • 1
    by default dig doesn't auto append the domain stuff like the other do. However, "dig +search test" does. – Doug Smythies Feb 11 '15 at 4:11
  • @DougSmythies: added.. – heemayl Feb 11 '15 at 15:20
  • I modified /etc/resolvconf/resolv.conf.d/base with nameserver and search entries. I'm now seeing the following behavior: $ host server server.location.company.com is an alias for server001.location.company.com. server001.location.company.com has address $ ping server ping: unknown host server. Any idea what could be causing this? – mkasberg Feb 11 '15 at 17:07
  • 3
    @mkasberg: Certain portion is missing in your last message..also note that after making any change in resolvconf run sudo resolvconf -u. – heemayl Feb 11 '15 at 17:12
  • @mkasberg: Put it in /etc/resolvconf/resolv.conf.d/head..You DNS server has the entry for server.location.company.com, right? – heemayl Feb 11 '15 at 17:59

I'm runnig Bionic Beaver and my resolv.conf says:

# This file is managed by man:systemd-resolved(8). Do not edit.

so my solution was to edit /etc/systemd/resolved.conf , option Domains= according to docs and then restart systemd-resolved:

service systemd-resolved restart

I was looking for a solution to this issue for Ubuntu Focal 20.04, as my local domain was not appending to hostnames.

On most unix-like OS like Solaris, Debian, etc. the solution is to add a line with 'search domain.name' to /etc/resolv.conf but modern Ubuntu releases use systemd-resolved now, so I had to figure out what to do.

Thankfully, it's still only one line - just using the resolvectl command now instead of editing a text file:

# resolvectl domain <ifname> domain.name

(you can find your ifname by invoking ip addr or resolvectl status)

Note: This change is not permanent, for a permanent solution please see the update below

To verify it's working, make sure domain is listed by systemd-resolved by invoking:

user@host:/$ resolvectl status | tail

DefaultRoute setting: yes
       LLMNR setting: yes
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
  Current DNS Server:
         DNS Servers:
          **DNS Domain: domain.name**

and that it's in the auto-generated /etc/resolv.conf by invoking:

user@host:/$ tail /etc/resolv.conf

options edns0
**search domain.name**

And try ssh or http using a hostname instead of a FQDN to see if the configured local domain resolves automatically.

I think my solution is the easiest and least confusing option - it's probably worth at least trying first in case it works for you before exploring the solutions posed in other answers.

Update 2-20-2020:

I noticed this change is not permanent. As per this question DNS set to systemd's - how to change permanently? I learned that the permanent configuration is stored in /etc/systemd/resolved.conf - just uncomment Domains= and write your domain in there:


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.