Operating System - HP-UX
1832267 Members
3385 Online
110041 Solutions
New Discussion

Re: problem in /etc/hosts file

 
Salm
Frequent Advisor

problem in /etc/hosts file

Hi
If I use hostname command and nslookup shows diffrent name and Uname shows diffrent

I'm aslo getting error from Data base team that thye have diffrent hosts name in the profile soem oracle inctanse for example yp0 have 2 profile one shows short hosts name and and other show long ( original name )

thoseare total 4 servers rx2620 and 11.23 OS Installed . before that I had a problem 2 servers was showing shor names and two was showing long name . I corrected with hosts name command now all four server shows right name with hostname command and ns lookup but show diffrenst short name when run uname -a command.

I did not run /sbin/init.d/swagentd stop and start. BCZ their data base is running and I'm not sure it will effect on these databases .

Any one can help me to solve this problem ?

11 REPLIES 11
Ivan Krastev
Honored Contributor

Re: problem in /etc/hosts file

Can you post the content of the /etc/hosts and /etc/nsswitch.conf.

Check also permissions of these files.


regards,
ivan
Geoff Wild
Honored Contributor

Re: problem in /etc/hosts file

In your /etc/hosts file should be something like:

10.8.1.5 hostname hostanme.yourdomain.com

your nsswitch.conf should have something like:

hosts: dns [NOTFOUND=CONTINUE] files

Make sure that your /etc/resolv.conf has the correct info as well...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Salm
Frequent Advisor

Re: problem in /etc/hosts file

Hi Just check it

thier is not /etc/resolve.conf file and no nsswitch.conf file exists .

They did not provide me dns information as well. while the ywill be DNS client in the future .

In the /etc/hosts file their is 4 valn are ,user,utility,managment,data. for which Vlan should have entry for fully qualified name ??

follwing is error from dba guys .

PX1 has a couple of different issues. It has 2 start profiles with different host names. The instance profile does not contain the host name as I know it but a shorter version of the host name. There were a couple of incorrect parameters which I have corrected. Could you resolve the host name issue and restart the system?

PX8 does not have the profile changes. Also, it has duplicate start profiles, one with a short hostname and one with a long hostname. It has an instance profile with a short hostname.








Salm
Frequent Advisor

Re: problem in /etc/hosts file

output
Ivan Krastev
Honored Contributor

Re: problem in /etc/hosts file

See correct syntax for your hosts file - http://docs.hp.com/en/B2355-60103/hosts.4.html

For example in your file you have many ip's pointed to one name:
172.19.138.55 camcps04
172.19.139.55 camcps04
130.178.250.55 camcps04

And change lines like this:
130.178.250.54 camccsd0cps03a cps03a camccsd0cps03 camccsd0cps03.gotd.gm.com

to:

130.178.250.54 camccsd0cps03.gotd.gm.com camccsd0cps03a cps03a camccsd0cps03

regards,
ivan
Steven E. Protter
Exalted Contributor

Re: problem in /etc/hosts file

Shalom,

/etc/hosts will not be used for hostname lookups until /etc/nsswitch.conf tells it to do so.

After a HP-UX install, there are a few candidate nsswitch files in /etc

Take the one that best suits your needs and copy to /etc/nsswitch.conf and then files lookups will start to work.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Salm
Frequent Advisor

Re: problem in /etc/hosts file

Thanks steven and Ivan

Syntex should be same as you mentioned ?? if I change syntex will this file read in diffrent way ???

Just aksing for my knowledge .


Bill Hassell
Honored Contributor

Re: problem in /etc/hosts file

Here are the rules:

- no resolv.conf and no nsswitch.conf, then only /etc/hosts will provide addresses.

- no nsswitch.conf but a resolv.conf file, then /etc/hosts will never be used.

- nsswitch.conf controls when hosts or DNS (or NIS, etc) will be used. Read the man page for switch.

nslookup provides very little information about the steps, so a better tool is nsquery. Use it like this:

nsquery hosts www.hp.com

NOTE: uname is unrelated to network names. While it is a very good idea to make them the same, read the man page for uname where it talks about hostname versus uname. This is important to understand when you have multiple LAN cards.


Bill Hassell, sysadmin
Salm
Frequent Advisor

Re: problem in /etc/hosts file

Thanks bill

When I use sam to modify lan cards I got this msg at the window

system name and the node name differ. The suggested value is listed XXXXXX If the suggested value is okay, press the OK button and the names xx
xxl be reset.Pressing Cancel Button will continue with Current Name Settings.

what is diffrend b/t system name and node mane ??? how can correct them ??
J. Bravo
Respected Contributor

Re: problem in /etc/hosts file

Hi:

Check the variable HOSTNAME (system name) in netconf and compare it with the node name associated in the /etc/hosts file.

Regards;

J. Bravo.
Bill Hassell
Honored Contributor

Re: problem in /etc/hosts file

If you check the man page for uname, you'll see that uname refers to the 8 character UUCP name. Most HP-UX systems will stay with an 8 character hostname but outside of the local server, this can be too limiting. Thus an Internet hostname can be provided.

The easiest way set this feature is to search for /etc/rc.config.d/netconf:

grep NAME= /etc/rc.config.d/netconf

If your system has different hostname versus uname -n, then there will be a NODENAME= entry as well as a HOSTNAME= entry. You can make remove the NODENAME entry and now the HOSTNAME value will set both values. This will make the change permanent on reboot.

To change your system right now, issue the two commands:

hostname server_name
uname -S server_name

NOTE: the server_name must be less than 8 characters. If you need a longer name for network access, then set NODENAME to the shortname (uname -n) and HOSTNAME to the long name. Note that a fully qualified domain name such as server_name.domain.com wil be truncated to just the simple hostname when you reboot. It is not recommended to use an FQDN for the hostname command.

Note that you can keep short names and add li=ong names to your /etc/hosts file and also into your DNS server if used.


Bill Hassell, sysadmin