Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

/etc/hosts Changed after server's reboot

BennariM
Visitor

/etc/hosts Changed after server's reboot

Hi All,

 

I faced a problem every time i reboot my server, the corresponding entry of my server on its local /etc/hosts is being changed and the FQDN is removed, Example:

 

Server RLRSDB:

 

#hostname

RLRSDB

 

#uname -n

RLRSDB

 

RLRSDB:/#pg /etc/hosts

 

127.0.0.1                localhost       loopback

192.168.1.20        rlrs01.sysinf.one.intra rlrs01
192.168.1.21        rlrs02.sysinf.one.intra rlrs02
192.168.1.22        rlrs03.sysinf.one.intra rlrs03
192.168.1.23        rlrsdb.sysinf.one.intra rlrsdb

 

-->After reboot the '/etc/hosts' will b like this:

 

127.0.0.1                localhost       loopback

192.168.1.23        rlrsdb

192.168.1.20        rlrs01.sysinf.one.intra rlrs01

192.168.1.21        rlrs02.sysinf.one.intra rlrs02
192.168.1.22        rlrs03.sysinf.one.intra rlrs03

 

Any help?

 

 

 

P.S. This thread has been moved from Servers > Integrity Servers to HP-UX > networking - HP Forum Moderator

4 REPLIES
S_Logan
HPE Pro

Re: /etc/hosts Changed after server's reboot

Hi Moderator,

 

Please move this post to HPUX - System Adminsitration.

 

Thank you

I work for HPE

If you feel this solution was helpful please click the KUDOS! thumb below!
Robert_Jewell
Honored Contributor

Re: /etc/hosts Changed after server's reboot

Perhaps a script is running at startup that is checking and modifying the host file?  Does this happen if you boot into single-user mode?

 

-Bob

----------------
Was this helpful? Like this post by giving me a thumbs up below!
Patrick Wallek
Honored Contributor

Re: /etc/hosts Changed after server's reboot

Check your startup scripts in /sbin/init.d and see if there is anything there that is modifying the hosts file.

 

A start may be doing something like:

 

# cd /sbin/init.d

# grep /etc/hosts *

 

to look for any occurrences of /etc/hosts in the files in /sbin/init.d.  If you find anything then you will need to investigate that file further to see what it is doing.

BennariM
Visitor

Re: /etc/hosts Changed after server's reboot

/sbin/init.d#grep /etc/hosts *
swconfig:# if /etc/hosts is saved, set to the empty
swconfig: msg star "Setting up temporary hostname in '/etc/hosts'"
swconfig: Hosts_Saved="/etc/hosts.swconfig.$$"
swconfig: mv -f /etc/hosts ${Hosts_Saved}
swconfig: msg error "Failed to save '/etc/hosts'"
swconfig: { print }' < ${Hosts_Saved} > /etc/hosts
swconfig: in '/etc/hosts'."
swconfig:# unhack_hostname - undo /etc/hosts changes
swconfig:# the contents of /etc/hosts
swconfig: msg star "Restoring '/etc/hosts' to its original contents."
swconfig: mv -f ${Hosts_Saved} /etc/hosts
swconfig: msg error "Unable to restore '/etc/hosts' file
swm.config:# if /etc/hosts is saved, set to the empty
swm.config: msg star "Setting up temporary hostname in '/etc/hosts'"
swm.config: Hosts_Saved="/etc/hosts.swconfig.$$"
swm.config: mv -f /etc/hosts ${Hosts_Saved}
swm.config: msg error "Failed to save '/etc/hosts'"
swm.config: { print }' < ${Hosts_Saved} > /etc/hosts
swm.config: in '/etc/hosts'."
swm.config:# unhack_hostname - undo /etc/hosts changes
swm.config:# the contents of /etc/hosts
swm.config: msg star "Restoring '/etc/hosts' to its original contents."
swm.config: mv -f ${Hosts_Saved} /etc/hosts
swm.config: msg error "Unable to restore '/etc/hosts' file