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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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? |
| |||
| 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 |
| |||
| 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. |
| |||
| 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 |
| |||
| 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 |
| |||
| 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. |
| ||||
| 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. |