Provided is a routing method and device for congestion avoidance. The method comprises the steps of receiving LSA messages sent by all first network elements in a network, structuring a global network topological graph, receiving NCA messages sent by all the first network elements in the network, obtaining global congestion information, obtaining the optimal path of other nodes in a network accessed by each node, obtaining the maximum inflow speed allowed by the optimal path, removing all nodes in congestion states in the network from the topological graph to obtain a network topological graph of a non-congestion state according to the global congestion information, obtaining the optimal path in non-congestion according to the network topological graph of the non-congestion state, obtaining a forwarding strategy according to the obtained optimal path, the maximum inflow speed of the optimal path and the optimal path in the non-congestion, sending the forwarding strategy to the corresponding first network elements to enable the first network elements to obtain flow chart entries according to the forwarding strategy, and carrying out storage. Therefore, congestion is avoided, and data transmission efficiency is improved.