host alias not working: host not found

Hello,

I am working on HP-UX , and in the /etc/hosts file we have setup an alias:

aa.bb.cc.dd devmach2.unix.org devmach2 devma2v

The alias devma2v does not work. Error when pinging devma2v
ping: unknown host devma2v

For devmach2 the ping works fine , returning the correct IP (aa.bb.cc.dd)/
What could be the problem?

Thank you.

Well - the file /etc/nsswitch.conf was missing!!! That's why it didn't work.

That kind of thing works for me. What is the dns entry in your /etc/nsswitch.conf file?

On this specific machine (the machine is part of a network - a big one) - no such file:
/etc/nsswitch.conf: No such file or directory

Thanks.

Wow! What version of HP-UX are you using? According to the nsswitch.conf man page, no nsswitch file results in (for hosts):
hosts: nis [NOTFOUND=return] files

This would imply that you are using nis. Only if nis was unavailable (as in during system startup) would the hosts file be referenced. But I've never seen a system without a nsswitch.conf file.

Are you using nis? If so and if your version of hp-ux supports nsswitch.conf, you might try briefly putting a nsswitch.conf file into place with a single line:
hosts: nis [NOTFOUND=continue] files

Thanks for your help.
It seems someone has moved the /etc/nsswitch.conf file to save and that's why it didn't work.
The file was restored and the alias is working fine.
Thank you again! :slight_smile: