Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 

ssh picking up wrong IP

Go to solution
Super Advisor

ssh picking up wrong IP

I am running HP-UX 11.31 and trying to do an ssh from one server to another, but it is picking up

the wrong IP address...


I have the host coded in /etc/hosts file:  odcign1-0

and nslookup shows it correctly:

=>nslookup odcign1-0
Using /etc/hosts on:  tmovdb02

looking up FILES
Name:    odcign1-0



The /etc/nsswitch.conf file also specifies to check hosts first:

hosts:        files [NOTFOUND=continue UNAVAIL=continue TRYAGAIN=continue] dns


But when I do an ssh it is picking up an old IP from dns, and not using hosts file entry...


=>ssh -v odcign1-0
OpenSSH_5.6p1+sftpfilecontrol-v1.3-hpn13v7, OpenSSL 0.9.8o 01 Jun 2010
HP-UX Secure Shell-A.05.60.003, HP-UX Secure Shell version
debug1: Reading configuration data /opt/ssh/etc/ssh_config
debug1: Connecting to odcign1-0 [] port 22.
debug1: connect to address port 22: Connection refused
ssh: connect to host odcign1-0 port 22: Connection refused



Any ideas as to why ?? I've requested our network group to remove the enty from DNS, but that could take

a few days....

Honored Contributor

Re: ssh picking up wrong IP

Do you have a file named like ~/.ssh/config in the home directory of the user running the "ssh" command? The old IP address might be defined in there, with something like:

Host odcign1-0

 The system-wide SSH client configuration file, /opt/ssh/etc/ssh_config might contain similar settings too.


Also make sure that the user running the ssh command is allowed to read /etc/hosts, /etc/nsswitch.conf and /etc/resolv.conf. I've seen cases where some of these files have been restricted to root only, causing the hostname lookup use unexpected sources. (For example, if /etc/nsswitch.conf is not readable for non-root users, their hostname resolution will use the factory default order: first DNS, then NIS (if configured) and /etc/hosts as the last source, as documented in the example file /etc/nsswitch.hp_defaults.)