3

I've been going in circles for a while trying to figure this out. I have a number of Ubuntu machines (some virtual) on a Windows network. From a Windows machine, I can ping or nslookup the Ubuntu machines, but not the reverse unless the Ubuntu machines specify fully qualified DNS names. But I can't seem to get the qualification suffix from the Ubuntu environment.

An example will clarify what is going on. Assume the Windows machine is called Win1, the Ubuntu machine Ubu1, and the network suffix is .notlocalatall.

On Win1:
$ echo %USERDNSDOMAINNAME%
notlocalatall
$ nslookup Ubu1
[...]
Name:    Ubu1.notlocalatall
Address: 131.132.32.14
$ nslookup Ubu1.notlocalatall
[...]
Name:    Ubu1.notlocalatall
Address: 131.132.32.14
$ ping Ubu1
[works normally, with 0% packet loss]
$ ping Ubu1.notlocalatall
[works normally, with 0% packet loss]

On Ubu1:
$ hostname -d
[blank]
$ nslookup Win1
[...]
** server can't find Win1: SERVFAIL
$ nslookup Win1.notlocalatall
[...]
Name:    Win1.notlocalatall
Address: 131.132.32.167
$ ping Win1
ping: unknown host Win1
$ ping Win1.notlocalatall
[works normally, with 0% packet loss]

For ssh purposes, I could live with having to specify the DNS suffix, but I need to get it from some command or bit of script.

And no, the solution is not to edit /etc/hosts, because the whole thing runs under DHCP.

Ubu1 is running Ubuntu 12.04.5 LTS and the Network control panel's Options: IPv4 Parameters are set to "Automatic (DHCP)".

3

1 Answer 1

1

You need to configure your DHCP server so it set on the DHCP client the domain-search

http://linux.die.net/man/5/dhcp-options

option domain-search domain-list; The domain-search option specifies a 'search list' of Domain Names to be used by the client to locate not-fully-qualified domain names. The difference between this option and historic use of the domain-name option for the same ends is that this option is encoded in RFC1035 compressed labels on the wire. For example:

option domain-search "example.com", "sales.example.com", "eng.example.com";

This way when you perform an nslookup it will try with all the specified domains until it finds a valid response (or until loop through all them).

So if you perform nslookup server1 if will try to query dns for

  1. server1.example.com
  2. server1.sales.example.com
  3. eng.example.com
3
  • I cannot configure the DHCP server. I can configure the Ubuntu clients, however. Could you give an actual example of the command line expected? Something like $ sudo dhclient option domain-search "notlocalatall", I suppose?
    – Urhixidur
    Commented Apr 17, 2015 at 20:43
  • You can try this askubuntu.com/a/141193 Commented Apr 17, 2015 at 21:29
  • Tried it, didn't work. Jim Hurne's answer, right below the one at the other end of that link, turns out to be the right one.
    – Urhixidur
    Commented Apr 18, 2015 at 2:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .