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:
"Steven J. Yellin" <[log in to unmask]>
Reply To:
Steven J. Yellin
Date:
Thu, 17 Mar 2016 17:22:16 -0700
Content-Type:
multipart/mixed
Parts/Attachments:
text/plain (3588 bytes)
    I haven't been following this email chain, but I see that you asked:

> Is there any way to tell that the hostname has been set via
>
>  hostname some.random.address
>
> rather via some init script reading /etc/sysconfig/network?
>
     To satisfy my own curiosity I looked on an SL6.7 computer for how 
hostname gets set.
     In /etc/init.d/network, which brings networking up and down, are lines

  cd /etc/sysconfig/network-scripts
  . ./network-functions
  and calls to ifup.

    The ifup script can invoke ifup-eth (in network-scripts), which can 
invoke ifup-post, which can do 'set_hostname $HOSTNAME', where 
set_hostname is one of the functions in the above mentioned 
network-functions.  That function does 'hostname $1'.  So ultimately the 
scripts that bring the network up apparently do the same thing as you 
would do by hand to set the hostname.
    With your current scripts I don't see how you can tell whether the init 
scripts set the hostname or a human did it.  But you could save the 
current ifup-post just in case you want to restore it, and replace it with 
a version that calls net_log, also in network-functions, whenever 
ifup-post invokes set_hostname.  For example, on SL6 I think it would work 
if just before the ifup-post line calling set_hostname you add a line

  net_log "Call set_hostname with hostname ${HOSTNAME}." info

Later you can compare the resulting line in /var/log/messages to what the 
hostname currently is.

Steven Yellin

On Thu, 17 Mar 2016, Loris Bennett wrote:

> Brandon Vincent <[log in to unmask]> writes:
>
>> On Mar 16, 2016 7:56 AM, "Loris Bennett"
>> <[log in to unmask]> wrote:
>>>
>>> Brandon Vincent <[log in to unmask]> writes:
>>>
>>>> On Mar 15, 2016 3:44 AM, "Loris Bennett"
>>>> <[log in to unmask]> wrote:
>>>>> What other files could have an influence on what 'hostname' returns?
>>>>
>>>> Could you post the output of
>>>>
>>>> getent hosts [hostname] and getent hosts [ip] for both systems?
>>>>
>>>> Also please post the hosts line from nsswitch.conf from both machines.
>>>>
>>>> Brandon Vincent
>>>>
>>>
>>> [root@tadmin01 ~]# getent hosts tadmin01
>>> 10.141.235.254 tadmin01.test.cluster tadmin01
>>> [root@tadmin01 ~]# getent hosts 10.141.235.254
>>> 10.141.235.254 tadmin01.test.cluster tadmin01
>>>
>>> [root@tadmin02 ~]# getent hosts tadmin02
>>> 10.141.235.253 tadmin02.test.cluster tadmin02
>>> [root@tadmin02 ~]# getent hosts 10.141.235.253
>>> 10.141.235.253 tadmin02.test.cluster tadmin02
>>>
>>> [root@tadmin01 ~]# grep hosts /etc/nsswitch.conf
>>> #hosts: db files nisplus nis dns
>>> hosts: files dns
>>>
>>> [root@tadmin02 ~]# grep hosts /etc/nsswitch.conf
>>> #hosts: db files nisplus nis dns
>>> hosts: files dns
>>>
>>> Cheers,
>>>
>>> Loris
>>>
>>> --
>>> Dr. Loris Bennett (Mr.)
>>> ZEDAT, Freie Universität Berlin Email [log in to unmask]
>>
>> Looks good. Verify there is no /etc/hostname on the system (or if there is,
>> ensure the contents are correct.
>>
>> Are you using NetworkManager or the traditional network service?
>>
>> These IPs are static, right? Not assigned by DHCP but entered manually.
>>
>> Brandon Vincent
>
> OK, sorry for wasting everyone's time.  I rebooted tadmin02 and now I
> get
>
>  [root@tadmin02 ~]# hostname
>  tadmin02
>
> as expected.  I assume I must have done
>
>  hostname tadmin.test.cluster
>
> at some point.  Which begs the question:
>
> Is there any way to tell that the hostname has been set via
>
>  hostname some.random.address
>
> rather via some init script reading /etc/sysconfig/network?
>
> Thanks for all the help,
>
> Loris
>
> -- 
> This signature is currently under construction.
>

ATOM RSS1 RSS2