[Samba] DNS issue with clean install of samba 4.5.12-Debian

Rowland Penny rpenny at samba.org
Fri Dec 15 10:02:32 UTC 2017


On Fri, 15 Dec 2017 09:58:03 +0100
"L.P.H. van Belle via samba" <samba at lists.samba.org> wrote:

> Hai Mike, 
> 
> I post it to the list so everybody can learn from it. 
> 
> > Why you use "hostname -i" ?
> man hostname wil tell.. But i'll try to explain it a bit. 
> Read the Description, its also about how the hostnames are resolved
> within the systemfuntions. Like gethostname and gethostbyname 
> 
> > root at ad51:~# hostname -i
> > 127.0.0.1
> > root at ad51:~# hostname -I
> > 172.16.214.151 
> 
> Hostname -i , works only if the hostname can be resolved. 
> Hostname -I , Displays all network addresses of the host. ( but not
> 127.0.0.1 ) Now remembering that. 
> 
> Imo, hostname -i and hostname -I should imo not resolve to
> localhost/127.0.0.1/::1 If thats the case then your resolving might
> be faulty. 
> 
> What is localhost. 
> localhost = 127.0.0.1
> localhost = ::1 
> Localhost.localdomain = 127.0.0.1

There is no such thing as 'localdomain', this is something that
somebody came up with, my suggestion is to not use it.

> ip6-localhost ip6-loopback = ::1 
> 
> Last, but this one should be in the DNS zone. 
> localhost.primary.domain.tld = 127.0.0.1

No it shouldn't. localhost has its own zone, as does 127.0.0.0
(reverse), see /etc/bind/named.conf.default-zones

> 
> The following. 
> /etc/hostname contains name of the machine, as known to applications
> that run locally. 
> 
> /etc/hosts and DNS associate names with IP?addresses. 
> And myname may be mapped to whichever IP?address the machine can
> access itself, but mapping it to 127.0.0.1 is unæsthetic.
> Not /etc/hosts, but /bin/hostname serves another function with -f
> because /etc/hosts can override the common sense. 

/etc/hosts is the old way of doing things (and I mean really old), all
that should be in /etc/hosts is 127.0.0.1 and the computers ipaddress
and what they point to, anything else should be found from dns.

> 
> 
> Now per example. 
> 
> A good /etc/hosts = (empty)  but then you must have a dns server
> running. A minimal /etc/hosts only has :
> 127.0.0.1       localhost
> ::1		    localhost ip6-localhost ip6-loopback
> 
> And as extra with dhcp (optional) 
> 127.0.1.1       hostname hostname.localdomain 

Nope, this just causes problems, if you have '127.0.1.1' in /etc/hosts,
I would remove it.

> Or 
> 127.0.0.1       localhost hostname hostname.localdomain ( not
> recommended ) 

As in don't use it ;-)

> 
> Or bit more. 
> 192.168.0.1		computername.internal.domain.tld
> 1.2.3.4		computername.domain.tld
> 
> Basicly any FQDN must be resolvable where it is used.

True, but it should just be the computers own info.

> 
> Now a practical use, like a webserver. 
> Lets say you have this in /etc/hosts 
> 127.0.0.1       localhost
> ::1		    localhost ip6-localhost ip6-loopback
> 192.168.0.1		computername.internal.domain.tld
> 1.2.3.4		computername.domain.tld

Ah, now this is different, here you are associating another IP with the
computers FQDN, but wouldn't you be better doing this with a CNAME ?

Rowland



More information about the samba mailing list