25

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
nameserver 192.168.200.53
nameserver 192.168.200.65
search location.company.com
nameserver 127.0.1.1
search location.company.com
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
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 at 20:26
29

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

or

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 192.168.1.5 then using host:

host test
test.xyz.com has address 192.168.1.5

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
Server:     192.168.1.11
Address:    192.168.1.11#53

Name:   test.xyz.com
Address: 192.168.1.5

Here 192.168.1.11 is your local DNS server which has the IP address for the host test.xyz.com (notice the full form) that is 192.168.1.5. The DNS server will resolve the hostname test.xyz.com to IP 192.168.1.5 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.

  • 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 192.168.200.103 $ 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
14

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

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.