cancel
Showing results for 
Search instead for 
Did you mean: 

entries in the /etc/hosts file

SOLVED
Go to solution
Narendra Uttekar
Regular Advisor

entries in the /etc/hosts file

Hi,

Please can you let me know the best practice to follow the format to add the entries in /etc/hosts file for HP-UX 11.31. Need to add 5 SAP servers in /etc/hosts file just in case if DNS server is unavailable. And also please let us know what is the difference between these 2 hosts files.

 

Format-1

127.0.0.1      localhost         loopback
9.11.153.39    hostname.company.pvt        hostname 

 

Format-2

127.0.0.1      localhost         loopback
9.11.153.39    hostname          hostname.company.pvt

 

 

Thanks,

Narendra

 

 

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

 

3 REPLIES
Patrick Wallek
Honored Contributor
Solution

Re: entries in the /etc/hosts file

I always preferred putting the fully qualified host name first and then any aliases after that, like your first example.

 

According to the man page for hosts:

 

<QUOTE>

/etc/hosts should contain a single line for each host with the following information:

 

internet_address           official_host_name              aliases

 

<SNIP>

 

If your system is in a domain naming environment, an official host name consists of the full domain extended host name. For example:

 

192.45.36.5         hpdxsg.xsg.hp.com          hpdxsg              testhost

</QUOTE>

 

If you do an 'nslookup'  the results will be slightly different depending on how you have it in /etc/hosts.

 

For example, based on your first example, your nslookup results (if it looks in /etc/hosts) would be:

 

# nslookup hostname

Using /etc/hosts on:  hostname

 

looking up in FILES

Name: hostname.company.pvt

Address: 9.11.153.39

Aliases: hostname

 

Based on your 2nd example, your nslookup results would be:

# nslookup hostname

Using /etc/hosts on:  hostname

 

looking up in FILES

Name: hostname

Address: 9.11.153.39

Aliases: hostname.company.pvt

 

Narendra Uttekar
Regular Advisor

Re: entries in the /etc/hosts file

Hi Patrick,

Thanks for your reply i do have some more questions as below,

 

I know if i change the host entries in /etc/hosts file will not require any service restart. The change will take immediate effect once i save the entries in /etc/hosts file.

 

Do the problem as below still exist or it has been fixed as when we do some changes in /etc/resolv.conf file we have to restart the SAP application.

 

Presently, HP-UX does not have a Name Service Cache Daemon ; thus, for example, there is no running daemon that can be sent a signal to re-read the contents of the /etc/resolv.conf file.

For this reason, all applications that are compiled and linked to the resolver library under HP-UX, and thus read the /etc/resolv.conf file when started, must be restarted in order for the modifications to the /etc/resolv.conf file to take effect for these applications.

Enhancement Requests have been submitted to HP for the implementation of the Name Service Cache Daemon on HP-UX (QXCR1000519742 and QXCR1000509951).

 

Thanks,

Narendra

Patrick Wallek
Honored Contributor

Re: entries in the /etc/hosts file

As far as I know the Name Service Cache daemon has not yet been implemented in HP-UX.