Using telnet and it was pointing to a wrong address. Ping was directing to correct IP address

linux was solving hostname to an incorrect IP address when using telnet

root@linux:~ # telnet host24100
telnet: connect to address Connection refused

It was solving to the correct IP address when using ping

root@linux:~ # ping -c1 host24100
PING ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=127 time=1.32 ms

— ping statistics —
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.321/1.321/1.321/0.000 ms

I’ve restarted nscd service

root@linux:~ # service nscd status
Checking for Name Service Cache Daemon: running

root@linux:~ # service nscd stop
Shutting down Name Service Cache Daemon done

root@linux:~ # service nscd start
Starting Name Service Cache Daemon done

After the restart, it started to point to the correct IP address

root@linux:~ # telnet host24100 24100
Connected to host24100.
Escape character is ‘^]’.
telnet> quit
Connection closed.