[Samba] Domain member workstations on DHCP

Rowland penny rpenny at samba.org
Sun Feb 14 09:40:58 UTC 2016

On 14/02/16 03:38, Stuart Longland wrote:
> Hi all,
> We're in the process of rolling out Samba4 on our network, with Active
> Directory and I've been re-configuring the Linux workstations that
> currently were joined to the old NT4-style domain.
> It hit me in particular when I read this bit:
>> Local hostname resolution
>> During the Domain join, Samba tries to register/update the hosts name and IP in your AD DNS. This requires that "net" can resolve both, either via DNS or /etc/hosts. To verify, run
>> # getent hosts M1
>>      M1.samdom.example.com    M1
>> The commands output must show the correct LAN interface IP (not 127.*.*.*!) and the hostname including the AD DNS zone. Additional alias names are optional. If you get a different output, fix it in your DNS or by adding/changing the /etc/hosts entry:
>>      M1.samdom.example.com    M1
> (source https://wiki.samba.org/index.php/Setup_Samba_as_an_AD_Domain_Member)
> Now to proceed I just put in the IP address of the workstation at the
> time into /etc/hosts, but it feels wrong doing it this way.  This will
> work for now but I expect this will change sometime.
> The machine is not a server, it just needs winbind for local user logins.
> It doesn't seem to join without me putting that entry in /etc/hosts.  I
> haven't tried removing it (following the domain join) to see if it still
> works.
> What is the correct procedure here?

It all depends on how your Unix workstations get their dns info, you 
need the line in /etc/hosts if they use a fixed ip, but if they get 
their dns info from dhcp, you don't.
If you do use dhcp, you must ensure that the dhcp server sends the 
correct info.

To show this, from this netbook that uses dhcp and is joined to a domain:

rowland at debnet:~$ getent hosts debnet   debnet.samdom.example.com

and /etc/hosts only contains this:

rowland at debnet:~$ cat /etc/hosts    localhost

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

If your Unix workstations are running Ubuntu (and possibly other OS), 
you may find a line starting '', if so, remove it and stop 
network-manager using dnsmasq. Also note that must only point 
to 'localhost'.


More information about the samba mailing list