below u will see different ip selection for command 'ping' and telnet' in linux:
server1@myhost18:~$ telnet host1-26 60020
Trying 192.168.1.126...
Connected to host1-26.
Escape character is '^]'.
quit
|??)org.apache.hadoop.ipc.RPC$VersionMismatch>Server IPC version 3 cannot communicate with client version 13Connection closed by foreign host.
server1@myhost18:~$
server1@myhost18:~$
server1@myhost18:~$ ping host1-26
PING host1-26 (192.168.1.128) 56(84) bytes of data.
64 bytes from host1-26 (192.168.1.128): icmp_req=1 ttl=64 time=0.224 ms
the root cause is there are two hostnames(duplicated) with different ips set in hosts file:
/etc/hosts:
192.168.1.128 host1-26
….
192.168.1.126 host1-26 a-26
so the conclusion is that 'ping' will use the ip first occured,but telnet will use the last one.
(yep,setting like this is a little malformed although;)