MongoDB replicaSet error AuthenticationFailed (code 18)

In order to resemble more of the actual network communication, you should instead use telnet or netcat to see if you can access the listening port from each host to others.
Ping only proof that the ICMP communication works between thoses hosts, but doesn’t proof that you can access the service listening on that specified port. If this is a firewall issue, for example, the firewall might allow ICMP but not the TCP service.