Operating System - HP-UX
1833788 Members
2375 Online
110063 Solutions
New Discussion

Can I set up machine where the name lookup fails.

 
SOLVED
Go to solution
prateek_1
Advisor

Can I set up machine where the name lookup fails.

hi,

I need to make name lookup(hostname) fail and i can ping the machine in network only by it's IP address.
15 REPLIES 15
Court Campbell
Honored Contributor

Re: Can I set up machine where the name lookup fails.

don't add dns to the hosts line in /etc/nsswitch.conf.
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
prasadb
Super Advisor

Re: Can I set up machine where the name lookup fails.

Also, comment the DNS server entries in /etc/resolv.conf
OldSchool
Honored Contributor

Re: Can I set up machine where the name lookup fails.

If OTHER machines are to access this server by IP only, then don't add entries for the server in question to your DNS server.

If you do, then the name will resolve on other machines that use the DNS database.
prateek_1
Advisor

Re: Can I set up machine where the name lookup fails.

/etc/nsswitch.conf file is not present in /etc dir. here i can only see /etc/nsswitch.compat
file
prasadb
Super Advisor

Re: Can I set up machine where the name lookup fails.

can you see /etc/resolv.conf file there..

give here

#cat /etc/resolv.conf

you must have entry of the DNS servers in this file , then comment the entries
prateek_1
Advisor

Re: Can I set up machine where the name lookup fails.

I commented out each entry in /etc/resolv.conf file ,but i can still able to ping m\c by its hostname.

Re: Can I set up machine where the name lookup fails.

You'll also need to comment out relevant entries in /etc/hosts file.

Duncan

I am an HPE Employee
Accept or Kudo
prateek_1
Advisor

Re: Can I set up machine where the name lookup fails.

I am allready comment out relevant entries in /etc/hosts file.but it still give hostname by hostname command actually i dont need it.
Ivan Krastev
Honored Contributor
Solution

Re: Can I set up machine where the name lookup fails.

Are you pinging the server from other machine ? Change DNS record if yes.

regards,
ivan
OldSchool
Honored Contributor

Re: Can I set up machine where the name lookup fails.

as previously noted: if you do not want other machines to be able to access via hostname, you must not have entries for it in the DNS server(s).

if the are there, they need to be removed.

all of the stuff about resolve.conf and nssswitch only impact the local server's ability to resolve names. you seem to want to not access a specific server by a name (ip only). DNS is providing the name to other systems.
Srimalik
Valued Contributor

Re: Can I set up machine where the name lookup fails.

>I am allready comment out relevant entries in /etc/hosts file.but it still give hostname by hostname command actually i dont need it.

If host name command fails many softwares won't work.

If you want to disable DNS or hostname lookups :

delete /etc/nsswitch.conf
delete /etc/resolve.conf
remove entry for this host from /etc/hosts

After doing this u wont be able to resole any hostname. IP address will work though.

-Sri
abandon all hope, ye who enter here..
Ganesan R
Honored Contributor

Re: Can I set up machine where the name lookup fails.

Hi Prateek,

It is not clear of what you need. "hostname" command is nothing to do with name resolution. It will just provide the name of that server.

If you don't want to ping/access any of the other servers by its name from one server, you should disable name resolution servies on that host. You can try the following.

If you have only "files" entry on nsswitch.conf, remove those entries from /etc/hosts.

If you have DNS or NIS entry on nsswitch entry, either you can disable those services or remove the entry from nsswitch.conf.



Best wishes,

Ganesh.
prateek_1
Advisor

Re: Can I set up machine where the name lookup fails.

Thans All, issue got resolved.
Torsten.
Acclaimed Contributor

Re: Can I set up machine where the name lookup fails.

Please consider to read this too:

http://forums13.itrc.hp.com/service/forums/helptips.do?#33

Have fun!

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Court Campbell
Honored Contributor

Re: Can I set up machine where the name lookup fails.

It would have been easier to just copy /etc/nsswitch.compat to /etc/nsswitch.conf. I shouldn't have assumed you already did that.
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"