I have configured a three-node replica set in MongoDB; replication is in sync.
I am able to connect to each server individually, and using each server's private IP address I can to connect to the replica set like this:
mongo --host rs0/10.X.X.X:27017,10.X.X.X:27017,10.X.X.X:27017 -u root -p abc123 --authenticationDatabase admin
But when I try to connect to the replica set using the servers' public IP addresses, like this:
mongo --host rs0/52.X.X.X:27017,52.X.X.X:27017,52.X.X.X:27017 -u root -p abc123 --authenticationDatabase admin
I get an error: "No primary detected for set rs0".