A method for packet forwarding based on equal-cost multi-path, wherein the method is applied to a network comprising a first network device and a second network device, N equal-cost paths exist between the first network device and the second network device, wherein N is a positive integer greater than or equal to 2, and a same hash algorithm is configured on the first network device and the second network device respectively; and the method comprises: determining, by the first network device, a packet that needs to be sent to the second network device, and performing calculation on characteristic information in the packet by using the hash algorithm to obtain a hash value; determining, by the first network device according to a correspondence between hash values and path identifiers that is acquired in advance, a path identifier corresponding to the hash value, wherein a method in which the first network device acquires the correspondence between hash values and path identifiers is the same as a method in which the second network device acquires the correspondence between hash values and path identifiers; and forwarding, by the first network device, the packet to the second network device through a path that corresponds to the path identifier, wherein the path is one of the N equal-cost paths; characterized in that: when the first network device acquires the correspondence between hash values and path identifiers, the method further comprises: determining, by the first network device, routing information of each path of the N equal-cost paths; obtaining, by the first network device, a next-hop router identifier in the routing information of each path of the N equal-cost paths; using, by the first network device, the next-hop router identifier of each path as a path identifier of the path, and sequencing the N equal-cost paths according to the path identifier of each path of the N equal-cost paths to obtain a result obtained by the sequencing; and determining, by the first network device according to the result obtained by the sequencing, a path identifier corresponding to each hash value to obtain the correspondence between hash values and path identifiers. determining, by the first network device, a packet that needs to be sent to the second network device, and performing calculation on characteristic information in the packet by using the hash algorithm to obtain a hash value; determining, by the first network device according to a correspondence between hash values and path identifiers that is acquired in advance, a path identifier corresponding to the hash value, wherein a method in which the first network device acquires the correspondence between hash values and path identifiers is the same as a method in which the second network device acquires the correspondence between hash values and path identifiers; and forwarding, by the first network device, the packet to the second network device through a path that corresponds to the path identifier, wherein the path is one of the N equal-cost paths; characterized in that: when the first network device acquires the correspondence between hash values and path identifiers, the method further comprises: determining, by the first network device, routing information of each path of the N equal-cost paths; obtaining, by the first network device, a next-hop router identifier in the routing information of each path of the N equal-cost paths; using, by the first network device, the next-hop router identifier of each path as a path identifier of the path, and sequencing the N equal-cost paths according to the path identifier of each path of the N equal-cost paths to obtain a result obtained by the sequencing; and determining, by the first network device according to the result obtained by the sequencing, a path identifier corresponding to each hash value to obtain the correspondence between hash values and path identifiers. determining, by the first network device, routing information of each path of the N equal-cost paths; obtaining, by the first network device, a next-hop router identifier in the routing information of each path of the N equal-cost paths; using, by the first network device, the next-hop router identifier of each path as a path identifier of the path, and sequencing the N equal-cost paths according to the path identifier of each path of the N equal-cost paths to obtain a result obtained by the sequencing; and determining, by the first network device according to the result obtained by the sequencing, a path identifier corresponding to each hash value to obtain the correspondence between hash values and path identifiers.