A method for implementing packet routing on a network, wherein the network comprises one controller, two servers, and at least one switch, wherein the two servers comprises a first server and a second server, the at least one switch comprises a first switch and a second switch, the controller is respectively connected to the first switch and the second switch, the first server is directly connected to the first switch, the second server is directly connected to the second switch, the network comprises at least two subnets, each server of the at least two servers belongs to a subnet of the at least two subnets, and the method comprises: obtaining, by the controller, identifiers of the two servers and network topology information, wherein the network topology information comprises network connection information of the two servers; determining, by the controller, that the two servers are in different subnets, the two servers are under a same router and the two servers are connected respectively to different switches, by using the identifiers of the two servers and according to the network connection information of the two servers, creating, by the controller, a first distributed routing rule, wherein the first distributed routing rule comprises: modify the destination MAC address of the packet into a MAC address of the second server and set a layer-2 network tag field of the packet to be a layer-2 network tag where the second server is located; sending, by the controller, the first distributed routing rule to the first switch to instruct the first switch to: modify the destination MAC address of the packet into a MAC address of the second server and set a layer-2 network tag field of the packet to be a layer-2 network tag where the second server is located, and forward the processed packet to the second server, wherein the layer-2 network tag where the second server is located is to instruct the packet to be transmitted to the second switch directly connected to the second server, and the MAC address of the second server is to instruct the packet to be transmitted to the second server. obtaining, by the controller, identifiers of the two servers and network topology information, wherein the network topology information comprises network connection information of the two servers; determining, by the controller, that the two servers are in different subnets, the two servers are under a same router and the two servers are connected respectively to different switches, by using the identifiers of the two servers and according to the network connection information of the two servers, creating, by the controller, a first distributed routing rule, wherein the first distributed routing rule comprises: modify the destination MAC address of the packet into a MAC address of the second server and set a layer-2 network tag field of the packet to be a layer-2 network tag where the second server is located; sending, by the controller, the first distributed routing rule to the first switch to instruct the first switch to: modify the destination MAC address of the packet into a MAC address of the second server and set a layer-2 network tag field of the packet to be a layer-2 network tag where the second server is located, and forward the processed packet to the second server, wherein the layer-2 network tag where the second server is located is to instruct the packet to be transmitted to the second switch directly connected to the second server, and the MAC address of the second server is to instruct the packet to be transmitted to the second server.