Is it correct to use IP addresses (instead of hostnames) while configuring Mongo DB cluster? Does it cause any issues? I have been using Mongo DB Cluster for some data analysis (Mongo DB version 2.4.5).

My configuration is as follows:

1) Node1 - mongoconfig server, mongod shard

2) Node2 - mongoconfig server, mongod shard

3) Node3 - mongoconfig server, mongos

4) Node4 - mongos

All the nodes above have a unique hostname at OS level (output of shell command "hostname")

Is it correct to use IP addresses instead of hostnames while configuring this Mongo DB cluster. There are issues that I am facing due to DNS server and I would prefer to configure the entire cluster (addresses of config servers, shards, etc.) using IP addresses instead of hostnames.

Is this the correct way to configure the cluster or will it cause any issues?
Generally it is not recommended to use IP addresses to configure a cluster. You have not mentioned your environment, but it is common for IP addresses to change in many environments with a reboot, or perhaps you will need to move one or more of the nodes to a different host in the future. 

Should that happen, your IP address will change but if you use hostnames (even those in the hosts file rather than DNS) it gives you a layer of abstraction and means you can have the hostname remain the same, not have to alter your database configuration for such a move.

This becomes particularly important for config servers in a sharded environment. An altered IP address is procedurally the same as an altered host name, and as you can see from this procedure, that means that moving a config server will require downtime for your cluster.

With all that said, for testing or for an environment where you can tear everything down and start again (or similar), these concerns do not really apply and you can use IP addresses in your configuration. For any system that will run long term, or any system that will run in production and require minimal interruption, then the use of hostnames over IP addresses is certainly recommended.