Replica Set in MongoDB by using IPs instead of domains?
From your primary machine run the following command

mongo --host COM2 --port 27018 


You should be able to connect to the MongoDB running in the secondary node using the above command. If it fails to connect, check the following configuration settings


Check the bindIp settings of the secondary node configuration file, it should allow connection from 192.168.1.1:27018.
Check the port number 27018 is accepting inbound connections in the secondary node. If not add an entry in IP Table.
Check if secondary nodes hosts file is updated with primary machines DNS name
and IP Address.


Follow the same for Primary node as well and try to connect to each machine from other machine using the first command. If everything working fine you should be able to set up your replica set.