[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: set domain name in Debian `



Hi,

On Sat, Nov 12, 2016 at 02:00:11AM -0700, Glenn English wrote:
> (Resend. Accidentally sent to a human instead of to the list...)

I responded off-list to Glenn since that one arrived first and I
wasn't sure if Glenn intended the contents of their /etc/hosts to be
private. Later I saw this copy on-list.

> > On Nov 11, 2016, at 11:45 PM, Andy Smith <andy@strugglers.net> wrote:
> > 
> > Okay. So I think we should focus on why "hostname -f" returns the
> > wrong/outdated info. I'm not sure yet.
> > 
> > Out of interest what does "hostname -d" return?
> 
> slsware.dmz

The system thinks Glenn's domain name is "slsware.dmz". Glenn wants it
to be "slsware.org" (I think).

> cat /etc/hostname: srv

Glenn has set the host name to be "srv".

I am 95% confident that the reason that Glenn's system thinks the
FQDN is "www.slsware.dmz" is because the first instance of "srv" in
the /etc/hosts is:

> > 192.168.2.203	www.slsware.dmz 		wsd srv

"hostname" returns what is in /etc/hostname (unless changed agfter
system startup).

"hostname -f" returns the part up to the first dot from whatever is
returned by resolving "hostname" against /etc/hosts.

"hostname -d" returns the part after the first dot from whatever is
returned by resolving "hostname" against /etc/hosts.

I think that if Glenn placed a line higher up that read:

192.168.2.203   srv.slsware.org srv

then the desired result would be achieved.

I would also add that this is a fairly large hosts file which is
ripe for causing confusion. I would generally recommend keeping
hosts files small, containing only enough information as needed for
bootstrapping, and using DNS for everything else. The rest of the
systems on the Internet (and maybe intranet) will be using DNS, and
it is desirable for there to be one source of truth.

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting


Reply to: