Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have one machine with two ips,

Something like this, (/etc/hosts) blahdb01   blah01

Now, whenever I do,

ssh blah01

It automatically connects to,


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
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


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.