Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #174694

Re: set domain name in Debian `

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups linux.debian.user
Subject Re: set domain name in Debian `
Date 2016-11-14 14:30 +0100
Message-ID <sDpuG-7x1-29@gated-at.bofh.it> (permalink)
References (2 earlier) <sCA8N-6SX-1@gated-at.bofh.it> <sCAit-6Wb-11@gated-at.bofh.it> <sCCDE-8uX-5@gated-at.bofh.it> <sCDJo-JU-3@gated-at.bofh.it> <sCJ2p-4hQ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Nov 12, 2016 at 08:50:46AM -0700, Glenn English wrote:
> > On Nov 12, 2016, at 3:25 AM, Andy Smith <andy@strugglers.net> wrote:
> > 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

> But that isn't the first; it's the fourth. A grep of the hosts file:

Andy is correct.  The line that Andy cited is the first instance of
the name "srv" as a SEPARATE WORD all unto itself.

> > root@srv:~# egrep srv /etc/hosts
> > 127.0.0.1	srv.slsware.org

Does not contain "srv" as a whole word.

> > 216.17.203.66	srv.slsware.org		sso

Does not contain "srv" as a whole word.

> > # 192.168.2.203	srv.slsware.dmz 		srv

Is a comment.  Ignored.

> > 192.168.2.203	www.slsware.dmz 		wsd srv

THIS one contains srv as a whole word.  So when you do your "hostname -f"
(which I still contend is a rubbish command which serves no useful
purpose, but it's what you seem to want, so I'll roll with it), it
looks up "srv" in this file as a whole word/field, and finds this line
as the first match.

Therefore hostname -f writes "www.slsware.dmz" to stdout.

> > 192.168.2.203	mail.slsware.dmz 		msd srv
> > 192.168.2.203	ntp.slsware.dmz 		ntp srv
> > 192.168.2.203	ns1.slsware.dmz ns1d		ns1 srv

This is just nonsense.  You've got the whole word "srv" in the file
multiple times.  But it can't resolve to multiple FQDNs using the
"hostname -f" resolution mechanism, which only returns the first match.
The "srv" on these lines is just noise.

I concur with the previous advice to stop using /etc/hosts for this
configuration, and move everything into DNS.

Here's my entire /etc/hosts file from my Internet-facing VPS (originally
imaged by the VPS provider as squeeze, which I have upgraded to wheezy):

greg@remote:~$ cat /etc/hosts
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
199.231.184.176 remote.wooledge.org  remote
::1             localhost ip6-localhost ip6-loopback


This machine acts as a web server for "wooledge.org" and
"mywiki.wooledge.org" and yet neither of those names appears in
/etc/hosts.  Why should they?  They are only meaningful to the web
server.  They are defined in DNS.

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

set domain name in Debian ` Glenn English <ghe2001@gmail.com> - 2016-11-11 21:50 +0100
  Re: set domain name in Debian ` Greg Wooledge <wooledg@eeg.ccf.org> - 2016-11-11 22:00 +0100
    Re: set domain name in Debian ` Glenn English <ghe2001@gmail.com> - 2016-11-11 23:10 +0100
      Re: set domain name in Debian ` Greg Wooledge <wooledg@eeg.ccf.org> - 2016-11-11 23:40 +0100
        Re: set domain name in Debian ` Glenn English <ghe2001@gmail.com> - 2016-11-12 04:50 +0100
      Re: set domain name in Debian ` Joe <joe@jretrading.com> - 2016-11-11 23:50 +0100
        Re: set domain name in Debian ` Glenn English <ghe2001@gmail.com> - 2016-11-12 01:40 +0100
  Re: set domain name in Debian ` Andy Smith <andy@strugglers.net> - 2016-11-12 06:00 +0100
    Re: set domain name in Debian ` Glenn English <ghe2001@gmail.com> - 2016-11-12 07:40 +0100
      Re: set domain name in Debian ` Andy Smith <andy@strugglers.net> - 2016-11-12 07:50 +0100
        Re: set domain name in Debian ` Glenn English <ghe2001@gmail.com> - 2016-11-12 10:20 +0100
          Re: set domain name in Debian ` Andy Smith <andy@strugglers.net> - 2016-11-12 11:30 +0100
            Re: set domain name in Debian ` Brian <ad44@cityscape.co.uk> - 2016-11-12 13:40 +0100
            Re: set domain name in Debian ` Glenn English <ghe2001@gmail.com> - 2016-11-12 17:10 +0100
              Re: set domain name in Debian ` sunrise@mailbug.com - 2016-11-12 19:40 +0100
                Re: set domain name in Debian ` Glenn English <ghe2001@gmail.com> - 2016-11-12 20:30 +0100
              Re: set domain name in Debian ` Greg Wooledge <wooledg@eeg.ccf.org> - 2016-11-14 14:30 +0100
                Re: set domain name in Debian ` Glenn English <ghe2001@gmail.com> - 2016-11-14 23:00 +0100
                Re: set domain name in Debian ` David Wright <deblis@lionunicorn.co.uk> - 2016-11-14 23:40 +0100
                Re: set domain name in Debian ` Greg Wooledge <wooledg@eeg.ccf.org> - 2016-11-15 14:10 +0100
                Re: set domain name in Debian ` Greg Wooledge <wooledg@eeg.ccf.org> - 2016-11-15 15:20 +0100
                Re: set domain name in Debian ` Brian <ad44@cityscape.co.uk> - 2016-11-15 16:00 +0100
                Re: set domain name in Debian ` Greg Wooledge <wooledg@eeg.ccf.org> - 2016-11-15 16:20 +0100
                Re: set domain name in Debian ` Brian <ad44@cityscape.co.uk> - 2016-11-15 16:40 +0100
                Re: set domain name in Debian ` David Wright <deblis@lionunicorn.co.uk> - 2016-11-15 17:10 +0100
                Re: set domain name in Debian ` Brian <ad44@cityscape.co.uk> - 2016-11-15 15:20 +0100
                Re: set domain name in Debian ` Joe <joe@jretrading.com> - 2016-11-15 16:10 +0100
                Re: set domain name in Debian ` Brian <ad44@cityscape.co.uk> - 2016-11-15 16:50 +0100
                Re: set domain name in Debian ` Joe <joe@jretrading.com> - 2016-11-15 17:30 +0100
  Re: set domain name in Debian ` Henrique de Moraes Holschuh <hmh@debian.org> - 2016-11-12 16:50 +0100
    Re: set domain name in Debian ` Glenn English <ghe2001@gmail.com> - 2016-11-12 18:20 +0100
      Re: set domain name in Debian ` Henrique de Moraes Holschuh <hmh@debian.org> - 2016-11-12 19:40 +0100
        Re: set domain name in Debian ` Glenn English <ghe2001@gmail.com> - 2016-11-12 22:40 +0100

csiph-web