3

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?

Phil Hollenback
  • 14,947
  • 4
  • 35
  • 52
Arindam Paul
  • 133
  • 4

2 Answers2

3

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.

Phil Hollenback
  • 14,947
  • 4
  • 35
  • 52
  • 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 06 '11 at 07:26
0

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

Lucas Kauffman
  • 16,880
  • 9
  • 58
  • 93
Liz Q
  • 1