For further research on the gravity mechanism of the routing protocol in complex networks, we introduce the concept of routing awareness depth, which is represented by p. On this basis, we define the calculation formula of the gravity of the transmission route for the packet, and propose a routing strategy based on the gravitational field of the node and the routing awareness depth. In order to characterize the efficiency of the method, we introduce an order parameter, η, to measure the throughput of the network by the critical value of phase transition from free flow to congestion, and use the node betweenness centrality, B, to test the transmission efficiency of the network and congestion distribution. We simulate the network transmission performance under different values of the routing awareness depth, ρ. Simulation results show that if the value of the routing awareness depth p is too small, then the gravity of the route is composed of the attraction of very few nodes on the route, which cannot improve the capacity of the network effectively. If the value of the routing awareness depth ρ is greater than the network's average distance (l), then the capacity of the network may be improved greatly and no longer change with the sustainable increment of routing awareness depth p, and the routing strategy performance enters into a constant state. Moreover, whatever the value of the routing awareness depth p, our algorithm always effectively balances the distribution of the betweenness centrality and realizes equal distribution of the network load.