Operating System - HP-UX
1834033 Members
3192 Online
110063 Solutions
New Discussion

can telnet to ipaddr but not to name in /etc/hosts

 
SOLVED
Go to solution
David DiBiase
Frequent Advisor

can telnet to ipaddr but not to name in /etc/hosts

its been a while since I installed a new machine.
I went to run swinstall and it couldnt find the target machine. I tested telnet from that machine. can telnet to an IPaddr but not a host in the /etc/hosts file. Can anyone tell me what I forgot or more-likely fat-fingered
12 REPLIES 12
Luk Vandenbussche
Honored Contributor
Solution

Re: can telnet to ipaddr but not to name in /etc/hosts

Do you use a DNS

Can send the contents of

/etc/resolv.conf
/etc/nsswitch.conf
Torsten.
Acclaimed Contributor

Re: can telnet to ipaddr but not to name in /etc/hosts

Hi David,

Check the nslookup tool output

nslookup

It is telling you about where to get the information (e.g. using hosts file or DNS) and the results, if there were any.

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!   
HGN
Honored Contributor

Re: can telnet to ipaddr but not to name in /etc/hosts

Hi

Can you do a nslookup on the remote host where you are able to connect, if not then you need to check the resolv.conf and nsswitch.conf file. In nsswitch.conf you should have files and dns (if you are using dns).

Rgds

HGN
Doug O'Leary
Honored Contributor

Re: can telnet to ipaddr but not to name in /etc/hosts

Hey,

If you don't have a nsswitch.conf but do have a resolv.conf, hp will default to using DNS for name resolution.

If that's the case, do the following:

cp /etc/nsswitch.files /etc/nsswitch.conf
perl -pi -e '/^hosts:\s+.*/hosts: files [ notfound=continue tryagain=continue ] dns

HTH;

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
TwoProc
Honored Contributor

Re: can telnet to ipaddr but not to name in /etc/hosts

It's a name issue. The name/ip address in the host file is probably not agreeing with where you're going.

ping the machine by hostname and see if it agrees with the ip address in the hosts file.
Even if the ping fails, it will usually tell you the address of what it is you're trying to hit.
We are the people our parents warned us about --Jimmy Buffett
David DiBiase
Frequent Advisor

Re: can telnet to ipaddr but not to name in /etc/hosts

contents of both files. nameservers are verified on another HP.

[triumph{root}:/]>cat /etc/resolv.conf
domain danahertm.com
nameserver 129.196.218.22
nameserver 129.196.128.126
[triumph{root}:/]>cat /etc/nsswitch.conf
aliases: files
automount: files
group: files
hosts: files
netgroup: files
networks: files
passwd: files
protocols: files
publickey: files[NOTFOUND=return UNAVAIL=continue]
rpc: files
services: files
ipnodes: files[NOTFOUND=return UNAVAIL=return TRYAGAIN=return] files
[triumph{root}:/]>
Doug O'Leary
Honored Contributor

Re: can telnet to ipaddr but not to name in /etc/hosts

Oops; didn't finish the perl command: Try:

perl -pi -e 's/^hosts:.*/hosts: files [ notfound=continue tryagain=continue ] dn
s/g' nsswitch.conf

sorry 'bout that.

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Torsten.
Acclaimed Contributor

Re: can telnet to ipaddr but not to name in /etc/hosts

Hi David,

your nameservers are configured, but not used.
nsswitch.conf should look like this:

...
hosts: dns [NOTFOUND=continue] files
...

(first ask DNS server, than looks up the hosts file - configure as you like)

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!   
TwoProc
Honored Contributor

Re: can telnet to ipaddr but not to name in /etc/hosts

Wow, your resolv.conf says that you're resolving with your own host file. So - is the hostname in the /etc/hosts file twice?
We are the people our parents warned us about --Jimmy Buffett
Bharat Katkar
Honored Contributor

Re: can telnet to ipaddr but not to name in /etc/hosts

Hi David,

1. Your nsswitch.conf should atleast look like this:

triumph{root}:/]>cat /etc/nsswitch.conf
aliases: files
automount: files
group: files
hosts: files dns
netgroup: files
networks: files
passwd: files
protocols: files
publickey: files[NOTFOUND=return UNAVAIL=continue]
rpc: files
services: files
ipnodes: files[NOTFOUND=return UNAVAIL=return TRYAGAIN=return] files
[triumph{root}:/]>

2. Check your hostname with hostname command.
# hostname
Does return the same name that you specified in /etc/hosts
If not you may have to set hostname first. You can use "set_parms hostname" command for the same but this will reboot the server.

3. Verify your /etc/resolv.conf file and see that you only have domain name and nameservers information in that.

Hope that helps.
Regards,
You need to know a lot to actually know how little you know
David DiBiase
Frequent Advisor

Re: can telnet to ipaddr but not to name in /etc/hosts

ran cat -vet on nsswitch.conf found garbage.
manually rebuilt per this thread (many thanks)
Now I can telnet by name. Now onto swinstall !!

Again - Many thanks
David DiBiase
Frequent Advisor

Re: can telnet to ipaddr but not to name in /etc/hosts

closing thread