MPI Init hangs

I am trying to run a benchmarking program using mpirun. I see a weird behaviour.

The nodes which are in the same subnet runs the mpi fine but the nodes which are in different subnet hangs on MPI_INIT. All the nodes are able to ssh to each other.

Is there a limit to the number of hops MPI search from one node to another?