SCIENTIFIC-LINUX-USERS Archives

March 2016

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Wed, 16 Mar 2016 15:02:56 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (104 lines)
On Wed, Mar 16, 2016 at 1:53 PM, Loris Bennett
<[log in to unmask]> wrote:
> Tom H <[log in to unmask]> writes:
>> On Tue, Mar 15, 2016 at 1:42 PM, Nico Kadel-Garcia <[log in to unmask]> wrote:
>>> On Tue, Mar 15, 2016 at 8:32 AM, Nico Kadel-Garcia <[log in to unmask]> wrote:
>>>
>>>> The problem is that the $HOSTNAME for the system isn't published in
>>>> DNS, nor is it the first hostname for a line in /etc/hosts, so the
>>>> "hostname --fqdn" is not finding it associated with your IP addresses.
>>>> The usual approach for portable laptops is to put a line like this in
>>>> /etc/hosts somewhere.
>>>>
>>>> 127.0.0.1 mymachine.mydomain
>>
>> On SL6, I've adopted the Debian approach:
>>
>> # cat /etc/hosts
>> 127.0.0.1 localhost
>> 127.0.1.1 tadmin.test.cluster tadmin
>>
>> # cat /etc/sysconfig/network
>> NETWORKING=yes
>> HOSTNAME=tadmin
>>
>> # hostname
>> tadmin
>>
>> # hostname -s
>> tadmin
>>
>> # hostname -f
>> tadmin.test.cluster
>>
>> # hostname -d
>> test.cluster
>
> This is what my set-up looks like, too.

It can't be because then (1) "/etc/hosts" would differ on tadmin01 and
tadmin02 and (2) "hostname" on tadmin02 would return "tadmin02".


>> On SL7, libnss_myhostname does the job of the second "/etc/hosts" line
>> (but with 127.0.0.2) automatically.
>>
>> To the OP:
>>
>> Where are you setting the domainname?
>
> # cat /etc/sysconfig/network-scripts/ifcfg-eth0
> DEVICE=eth0
> ONBOOT=yes
> BOOTPROTO=none
> IPADDR=10.141.235.253
> NETMASK=255.255.0.0
> DOMAIN=test.cluster
> USERCTL=no

That "DOMAIN" sets up a "search test.cluster" in "/etc/resolv.conf",
which doesn't set the dns domainname:

==> cat /etc/host.conf
multi on

==> cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
#127.0.1.1   tadmin.test.cluster tadmin
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

==> grep hosts /etc/nsswitch.conf
#hosts:     db files nisplus nis dns
hosts:      files dns

==> cat /etc/resolv.conf
nameserver 8.8.8.8
search test.cluster

==> cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=tadmin

==> cat /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO="none"
DEVICE="eth0"
DNS1="8.8.8.8"
DOMAIN="test.cluster"
GATEWAY="192.168.1.1"
IPADDR="192.168.1.111"
NETMASK="255.255.255.0"
ONBOOT="yes"
TYPE="Ethernet"

==> hostname
tadmin

==> hostname -s
tadmin

==> hostname -f
hostname: Unknown host

==> hostname -d
hostname: Unknown host

ATOM RSS1 RSS2