Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have one machine with two ips,

Something like this, (/etc/hosts)

10.204.65.18    blahdb01.us.oracle.com blahdb01
10.204.63.56    blah01.us.oracle.com   blah01

Now, whenever I do,

ssh blah01

It automatically connects to,

blahdb01

Now I wanna know where this behavior is getting populated. If I want to stop this... I want to map blah01 to blah01 only ... What can be done?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

First check your ~/.ssh/config file and see if you have any Hostname lines that are causing this. Then, try using dig or nslookup on blah01 and see if that shows anything interesting.

Note that /etc/nsswitch.conf can be used to change how the machine does name resolution so you should check that too.

Finally, a tool like strace can be used to examine how the program you are using is trying to open and read files to do name resolution. For example:

strace -eopen,read -f -o /tmp/ssh-strace.txt ssh blah01

then look at /tmp/ssh-strace.txt and see if there's anything interesting in there about which files are being opened and read - that might provide a clue to what path is being followed.

share|improve this answer
    
Thanks a lot :) :) .. strace helped to resolve this. Actually all request id going through dns server (/etc/resolv.conf) which in turn has CNAME pointing to blahdb01... I am thinking of removing dns from the /etc/nsswitch.conf –  Arindam Paul May 6 '11 at 7:26

Check /etc/resolv.conf - its possible that you have a 'search' line which will automatically complete things using that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.