Unix Technical Forum

/etc/hosntame->/etc/conf.d/hostname

This is a discussion on /etc/hosntame->/etc/conf.d/hostname within the Gentoo Linux Support forums, part of the Unix Operating Systems category; --> Arthur Hagen wrote: > Paul Bredbury <i@hate-spam.com> wrote: >>I'm surprised that Linux by default uses NIS to determine the ...


Go Back   Unix Technical Forum > Unix Operating Systems > Gentoo Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 02-21-2008, 11:04 AM
Paul Bredbury
 
Posts: n/a
Default Re: /etc/hosntame->/etc/conf.d/hostname

Arthur Hagen wrote:
> Paul Bredbury <i@hate-spam.com> wrote:
>>I'm surprised that Linux by default uses NIS to determine the domain
>>name, rather than DNS.

>
>
> It doesn't.
>
> The domain name queries carried out by gethostbyname() and
> gethostbyaddr() use a combination of any or all of the
> name server named(8), a broken out line from /etc/hosts,
> and the Network Information Service (NIS or YP), depending
> upon the contents of the order line in /etc/host.conf.
> (See resolv+(8)). The default action is to query
> named(8), followed by /etc/hosts.
>


I would expect "domainname" to (eventually) read the DNSDOMAIN setting
from /etc/conf.d/domainname, and return "homenetwork" rather than "(none)".

From reading http://lists.debian.org/debian-user/.../msg02814.html I
see that I can make "domainname" return "homenetwork" by running:

echo "homenetwork" > /proc/sys/kernel/domainname

But I would assume that's not the preferred method.

Has anyone managed to get "domainname" to return something other than
"(none)" without using NIS?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 02-21-2008, 11:04 AM
Arthur Hagen
 
Posts: n/a
Default Re: /etc/hosntame->/etc/conf.d/hostname

Paul Bredbury <i@hate-spam.com> wrote:
>
> I would expect "domainname" to (eventually) read the DNSDOMAIN setting
> from /etc/conf.d/domainname, and return "homenetwork" rather than
> "(none)".


Not if the system is told to query NIS, it shouldn't. And
/etc/conf.d/domainname is not a file that is consulted in real time
anyhow, like /etc/hosts is -- it's a Gentoo-abomination that sets the
hostname in the shell that calls it, and no standard utilities will ever
call it, only Gentoo startup scripts do. "domainname" simply uses the
resolver routines, and isn't Gentoo-specific. How the resolver routines
look up a name depends on how you've configured the system.

> Has anyone managed to get "domainname" to return something other than
> "(none)" without using NIS?]


Have you tried removing nis from both /etc/host.conf and
/etc/nsswitch.conf, followed by a dive to single user (or non-network
mode, if Gentoo had had one) and back?

Regards,
--
*Art

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 02-21-2008, 11:04 AM
Paul Bredbury
 
Posts: n/a
Default Re: /etc/hosntame->/etc/conf.d/hostname

Arthur Hagen wrote:
> Have you tried removing nis from both /etc/host.conf and
> /etc/nsswitch.conf, followed by a dive to single user (or non-network
> mode, if Gentoo had had one) and back?


nis is not present in those files - I have an non-customized 2005.0
installation for them:

/etc/host.conf:
order hosts, bind
mdns off
multi off

/etc/nsswitch.conf:
passwd: compat
shadow: compat
group: compat
hosts: files dns
networks: files dns
services: db files
protocols: db files
rpc: db files
ethers: db files
netmasks: files
netgroup: files
bootparams: files
automount: files
aliases: files


Interesting snippets from "man domainname" are:

"domainname - show or set the system's NIS/YP domain name"

"domainname, nisdomainname, ypdomainname will print the name of the
system as returned by the getdomainname(2) function. This is also known
as the YP/NIS domain name of the system."


The simplest answer to all this is that "domainname" only refers to NIS.
So, I'm still surprised that DNS isn't used to calculate the domain
name as shown at a login prompt.

The command "/bin/domainname homenetwork" works - I suppose I could put
that in /etc/conf.d/local.start, to fix the appearance of the PC having
no domain.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 02-21-2008, 11:04 AM
Johan Lindquist
 
Posts: n/a
Default Re: /etc/hosntame->/etc/conf.d/hostname

So anyway, it was like, 16:21 CEST Jun 13 2005, you know? Oh, and, yeah,
Paul Bredbury was all like, "Dude,

> The command "/bin/domainname homenetwork" works - I suppose I could
> put that in /etc/conf.d/local.start, to fix the appearance of the PC
> having no domain.


Or you could just set NISDOMAIN in /etc/conf.d/domainname and let the
/etc/init.d/domainname script set it for you, regardless of whether
you're actually going to use NIS.

--
Time flies like an arrow, fruit flies like a banana. Perth ---> *
16:34:41 up 22 days, 21:12, 9 users, load average: 1.00, 1.01, 1.00
Linux 2.6.11.10 x86_64 GNU/Linux Registered Linux user #261729
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 02-21-2008, 11:04 AM
Anno v. Heimburg
 
Posts: n/a
Default Re: /etc/hosntame->/etc/conf.d/hostname

Paul Bredbury wrote:
> I would expect "domainname" to (eventually) read the DNSDOMAIN setting
> from /etc/conf.d/domainname, and return "homenetwork" rather than
> "(none)".


The "domainname" command, if called without parameters, *always* returns the
NIS domain name. It *does not* look in any other place. Call "domainname
-f" or "domainname -d" to get the FQDN or your domain, respectively.

For more info, call "domainname --help"

Anno
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 02-21-2008, 11:04 AM
Anno v. Heimburg
 
Posts: n/a
Default Re: /etc/hosntame->/etc/conf.d/hostname

Arthur Hagen wrote:
> The domain name queries carried out by gethostbyname() and
> gethostbyaddr() use a combination of any or all of the
> name server named(8), a broken out line from /etc/hosts,
> and the Network Information Service (NIS or YP), depending
> upon the contents of the order line in /etc/host.conf.
> (See resolv+(8)). The default action is to query
> named(8), followed by /etc/hosts.


Yes, but that is not what the domainname command does. It always returns the
NIS domain if called without parameters.

Read "domainname --help"

Anno.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 02-21-2008, 11:04 AM
Paul Bredbury
 
Posts: n/a
Default Re: /etc/hosntame->/etc/conf.d/hostname

Johan Lindquist wrote:
>>The command "/bin/domainname homenetwork" works - I suppose I could
>>put that in /etc/conf.d/local.start, to fix the appearance of the PC
>>having no domain.

>
>
> Or you could just set NISDOMAIN in /etc/conf.d/domainname and let the
> /etc/init.d/domainname script set it for you, regardless of whether
> you're actually going to use NIS.


Yes, setting NISDOMAIN and rebooting does make "domainname" return
something meaningful.

However, at login my PC *still* says "xxxx.(none)". I suppose this is
linked to "dnsdomainname" returning absolutely nothing, although I set
DNSDOMAIN also in /etc/conf.d/domainname.

Running "dnsdomainname homenetwork" gives the response:

"You can't change the DNS domain name with this command. Unless you are
using bind or NIS for host lookups you can change the DNS domain name
(which is part of the FQDN) in the /etc/hosts file."

Ah, I've just found that if /etc/hosts contains:
127.0.0.1 xxxx.homenetwork localhost
Rather than:
127.0.0.1 localhost xxxx.homenetwork

Then "dnsdomainname" immediately starts responding with the proper
answer of "homenetwork". That's funny, I'm sure I've seen it mentioned
several times that "localhost" should be first in the list.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:54 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com