I have a Raspberry Pi running Rasbian connected to a Windows Server based network. This is a corporate (education) network that has its own intranet consisting of all connected computing systems and also has a publicly accessible website. For the purpose of this question, the domain will be named exampledomain.com.

On this intranet, connected Windows computers can append a DNS suffix to their hostname through configuration on the network adapter (steps listed here). This would allow a computer with the name comp1 to be addressable by comp1 or comp1.ns.exampledomain.com from the local network (i.e. ipconfig lists ns.exampledomain.com as the connection-specific suffix).

The Problem

I have a Raspberry Pi 2 that has the hostname comppi that I need to be accessible by the address comppi.ns.exampledomain.com. The Pi is currently accessible by its hostname comppi, by using comppi.local or by IP address.

Access via the hostname was achieved by installing samba to the RPi using sudo apt-get -y install samba. This was the easy way to setup avahi on the RPi.

I have no access to the DHCP/DNS servers involved. But I should be able to achieve this result without needing to. (As it can be done from a Windows computer just fine without)

I will also note that I have poor understanding of the /etc/dhcp/dhclient.conf file even after reading the associated man pages. I'm probably missing something trivial.

Current Attempts

  • Tried changing the hostname directly to comppi.ns.exampledomain.com in all places in below files.
  • Tried changing the hostname line to send host-name = "comppi.ns.exampledomain.com" in /etc/dhcp/dhclient.conf.
  • Tried adding the line append domain-name = "ns.exampledomain.com" to /etc/dhcp/dhclient.conf user Jordan over on askubuntu.com. However I think this is just adding ns.exampledomain.com to outgoing hostname resolves when they fail.

Technical Info

  • OS: Raspbian GNU/Linux 8 (jessie) (Note: this was the lite version)
  • Pi: Raspberry Pi 2
  • Hostname: comppi


Contents of /etc/network/interfaces unchanged.

Contents of /etc/hostname:


Contents of /etc/hosts:       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters       comppi comppi.ns.exampledomain.com

Contents of /etc/dhcp/dhclient.conf:

# Configuration file for /sbin/dhclient, which is included in Debian's
#       dhcp3-client package.

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

#send host-name = gethostname();
send host-name = "comppi"
append domain-name = "ns.exampledomain.com"
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
  • Cheers for the shift @goldilocks, I couldn't figure out where I should put this. On a separate note regarding the edit made, I still think suffix (add to end) works better than prefix (add to beginning) in this instance. Jun 7 '16 at 16:12
  • I see your point -- in fact this was my pre-coffee semantic confusion when I read "append" in the second paragraph, which is one of those words I often get backward (read as "prepend") for whatever reason.
    – goldilocks
    Jun 7 '16 at 16:16
  • Okay I fixed that here. All apologies.
    – goldilocks
    Jun 7 '16 at 16:19
  • Cheers. Was about to comment saying that I couldn't override your changes. All fixed now. Jun 7 '16 at 16:20

Windows clients automatically register their names in DNS when part of Active Directory (which seems to be true in your case). This uses a process called Dynamic DNS (DDNS). The easiest way to register linux machines with a Windows DDNS will be to use Samba to join your linux machine to Windows Domain. This would require the rights to join Windows Domain. A lot of guides on the Internet can give you details on how to join Windows domain from linux, but here are the steps in brief:

First add domain information in /etc/krb5.conf


    .ns.exampledomain.com = NS.EXAMPLEDOMAIN.COM
    ns.exampledomain.com = NS.EXAMPLEDOMAIN.COM

Then configure smb.conf for domain joining

security = ADS

Then run net ads join -U windowsuser where windowsuser is any user with rights to join domain.

This would join your machine to Windows domain and at the same time register the machine's IP address in Windows DNS allowing others to reach your machine using both comppi.ns.exampledomain.com and comppi names

  • from what I can tell, the computer is part of an AD network (one is present and it is not registered to the domain. Nor do I have an account that can authenticate with the domain controller/AD server either. Both the computer and RPi are simply connected to the LAN and assigned an IP address by the network. The Windows PC takes the extra step of requesting to either the DHCP/DNS (not sure which) that the hostname is appended with ns.exampledomain.com (see OP) and the request results in the computer being addressable by comp1.ns.exampledomain.com (by a DNS A Record). Jun 10 '16 at 20:14
  • To coexist in a network where AD lives does not make your clients AD aware or part of the AD environment. To have a real AD client, you need to have a 'computer account' on the domain controller like 'HOST$'. IMHO I don't think you need Samba only to register a DNS address.
    – fcm
    Jun 17 '16 at 14:53
  • Samba is needed to join AD from a Linux machine. The default AD integrated DNS setting is to only allow AD authenticated machines to register/update. So in a default AD setup, Samba is needed to register a DNS address, or ask a DNS admin to add manual A records which is not possible in OPs case. Jun 17 '16 at 15:00

So, to resolve the comppi.ns.exampledomain.com on your network, you will need help from your DHCP server admin and here is why. At the bottom of this answer the Linux option

Windows environment

Unless additional software is installed, a LINUX client is not AD (Active Directory) aware. So, must rely on DHCP server to update the DNS Server on a properly configured Windows environment.
For the DHCP server to register a hostname on the local DNS server, must have dynamic updates authorized. This setting is not user configurable, your network admin should modify it, and yes, you will need this to work.
DHCP Server Along with the IP address from your DHCP server, you also receive the domain suffix for this network; the suffix is stored by your host and will be used later. Please note than unless your DHCP server and DNS server are on the same box, dynamic updates will require the DHCP server to authenticate with your DNS server.

At this point the DHCP server should do the DNS network registration for you. It is not under the client host control, however your host must request that. Currently Debian request the DNS registration automatically.

On windows your can force a re-registration with ipconfig /registernds.

On a local network, a host can find your using two 'legal' names and methods: the plain hostname and the hostname plus the domain. The suffix '.local' if often ignored and is used to avoid the addition of another suffix.

1 The first method doesn't use the DNS: using LAN broadcasts the host ask 'who know this name', the subject host will answer with a MAC address and IP.

Every few seconds, hosts broadcast their names so other sharing the LAN will learn about their presence. Often this broadcast are filtered by switch/routers, so unless you are on the same switch it's hard to make it reliable.
enter image description here

2 The second method is to send a request to the LAN designated DNS server, with the 'plain' hostname and also the hostname with the LAN suffix.

Home router and intranets are not public, so the use of generic DNS (, on your default DNS server will not resolve your local hosts at all. Every local host with a DHCP assigned address will be 'remembered' by your router.

On your host you can add one or more suffixes that you want when resolving a DNS address (using Linux host or dig and on windows nslookup)

enter image description here

I will recommend to have setup your hostname properly. On /etc/hostname and also on /etc/hosts (for ::1 and and then run . /etc/init.d/hostname.sh.

Manually updating DNS Server from Linux

There is another option that only requires manual cooperation on the client. The use of a little known utility nsupdate. This will add the functionality you require to register on a valid DNS Server. It follows RFC published protocols related to DNS.


$ nsupdate -v
>delete video.domain.com. a
>delete  git.domain.com. a
>delete  gateway.domain.com. a
>add  video.domain.com. 600 a
>add  git.domain.com. 600 a
>add  gateway.domain.com. 600 a

You can create a simple file with your dynamically obtained IPV4 or IPv6 addresses and run on 'post-up' script on /etc/network/interfaces

  • Your answers seem to have a blend of what is happening. Option 1 - this works reliably on the same subnet. However the solution required uses the *.ns.exampledomain.com part to force IP address resolution at the DNS/domain controller in order to cross subnets eliminating the switch problem whilst not relying on a volatile IP address. Option 2 - in the screenshot provided, the "DNS Suffix for this connection" is "ns.exampledomain.com" and "Use this connection's DNS suffix in DNS registration" is checked. This configuration is what I am trying to replicate on the RPi. Jun 10 '16 at 20:23
  • The reason this ended up being chose as the answer is in part due to the server side settings mentioned at the start. It turns out that on the network, there existed a 'public' DNS manager for ns.exampledomain.com that was used for most DNS purposes including Windows clients who were configured to use it. There was also another hidden manager that was responsible for a hidden otherns.exampledomain.com that is used with clients on Mac/Unix/etc to handle their form of DNS requests. Jun 15 '16 at 15:08

On a Raspberry Pi here, also running Raspbian Jessie, the DHCP client is /sbin/dhcpcd. Unfortunately this uses a different configuration file that does not allow one to specify a DNS suffix.

ps -ef | grep -i [d]hcp
root       720     1  0 10:16 ?        00:00:00 /sbin/dhcpcd -q -w

Fortunately this system came installed with resolvconf, which does have a configuration file /etc/resolvconf.conf that permits the specification of a DNS suffix:


I'm not at all sure why two Jessie Pis should have different installation configurations, but that's possibly a question for another day. For comparison, here is a different example of the DHCP client process, as seen on some of my Debian Wheezy systems:

# This uses /etc/dhcp/dhclient.conf and is not what I have on my Pi
ps -ef | grep -i [d]hcp
root      1683     1  0 09:58 ?        00:00:00 dhclient -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0

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.