Operating System - HP-UX
1753444 Members
4795 Online
108794 Solutions
New Discussion юеВ

Re: issue with ssh doing wrong name resolution

 
SOLVED
Go to solution
amithp
Frequent Advisor

issue with ssh doing wrong name resolution

Hi for some reason there a wrong entry in DNS
and we are unable to edit the entry so we are using /etc/hosts for name resolution

Im trying to ssh to a server with /etc/nsswitch.conf having entry
hosts: files [NOTFOUND=continue UNAVAIL=continue TRAYGAIN=continue] dns

But the ssh is resolving the name using DNS.

grep cap1rtr7 /etc/hosts
10.130.145.37 prortr07.unix.gsm1900.org prortr07 cap1rtr7 cap1rtr7.gsm1900.org bil1rtr7

tstsam15:17(/root)# ssh -v cap1rtr7
OpenSSH_3.9, OpenSSL 0.9.7d 17 Mar 2004
HP-UX Secure Shell-A.03.91.009, HP-UX Secure Shell version
debug1: Reading configuration data /opt/ssh/etc/ssh_config
debug1: Connecting to cap1rtr7 [10.130.145.50] port 22.

please help the nslookup is using /etc/hosts only
12 REPLIES 12
Ganesan R
Honored Contributor

Re: issue with ssh doing wrong name resolution

Hi Amithp,

Make another seperate entry in /etc/hosts file for cap1rtr7 like below.

10.130.145.37 cap1rtr7 cap1rtr7.gsm1900.org
Best wishes,

Ganesh.
amithp
Frequent Advisor

Re: issue with ssh doing wrong name resolution

Hi Ganeshan no luck.

It is not working even then.
It is working only when im removein /etc/resolv.conf which we dont want to do
Sunny123_1
Esteemed Contributor

Re: issue with ssh doing wrong name resolution

Hi

What entries you have in your /etc/resolv.conf.Can you post it???


Regards
Sunny
amithp
Frequent Advisor

Re: issue with ssh doing wrong name resolution

tstsam15:17(/root)# more /etc/resolv.conf
search unix.gsm1900.org gsm1900.org voicestream.com .
nameserver 10.1.16.43
nameserver 10.1.16.46
nameserver 10.65.16.41
nameserver 10.133.113.71
retry 1
retrans 1000
Asif Sharif
Honored Contributor

Re: issue with ssh doing wrong name resolution

Salam Amir,

I think it goes to name server for resolving. You need to check /etc/nsswitch.conf.

Regards,
Asif Sharif
Regards,
Asif Sharif
amithp
Frequent Advisor

Re: issue with ssh doing wrong name resolution

[root@tstqat01:/root]# more /etc/nsswitch.conf
#
# /etc/nsswitch.files:
#
# An example file that could be copied over to /etc/nsswitch.conf; it
# does not use any name services.
#
passwd: files
group: files
hosts: files [NOTFOUND=continue UNAVAIL=continue TRYAGAIN=continue] dns
services: files
networks: files
protocols: files
rpc: files
publickey: files
netgroup: files
automount: files
aliases: files
amithp
Frequent Advisor

Re: issue with ssh doing wrong name resolution

sorry it was entry of diff server

hosts: files [NOTFOUND=continue UNAVAIL=continue TRAYGAIN=continue] dns
Ganesan R
Honored Contributor

Re: issue with ssh doing wrong name resolution

Hi,

It is syntax error on your nsswitch.conf file. You should press "tab" after hosts: and put your order like this.

hosts: files [NOTFOUND=continue] dns

It looks you don't have any space between hosts:files
Best wishes,

Ganesh.
Ganesan R
Honored Contributor
Solution

Re: issue with ssh doing wrong name resolution

Hi again,

Check this option with nslookup to find which source nslookup is using for naming resolution.

#nslookup -swtrace cap1rtr7

It should use files first then goto dns. If it is directly going to DNS means it is having some issue with /etc/nsswitch.conf

If it is searching on files first then goes to DNS means it is ok. But if it is not resolving from files means some issue with /etc/hosts file.
Best wishes,

Ganesh.