A path switching method, wherein the method comprises: obtaining (S305), by a network device, first constraint information of a first path, wherein the first path is a packet forwarding path of the network device, the first constraint information is used to indicate whether the first path meets a constraint condition of a target service, and the network device is a head node on the first path; obtaining (S307), by the network device, second constraint information of a second path, wherein the second constraint information is used to indicate whether the second path meets the constraint condition, and the second path and the first path have the same head node and a same tail node; and determining (S308), by the network device based on the first constraint information and the second constraint information, whether to switch the packet forwarding path from the first path to another path, wherein the determining (S308), by the network device based on the first constraint information and the second constraint information, whether to switch the first path comprises: determining, by the network device based on the first constraint information, that the first path does not meet the constraint condition, determining, based on the second constraint information, that the second path meets the constraint condition, characterized by determining that duration after the second path changes from not meeting the constraint condition to meeting the constraint condition is less than a duration threshold, and skipping switching, by the network device, the packet forwarding path to the second path. obtaining (S305), by a network device, first constraint information of a first path, wherein the first path is a packet forwarding path of the network device, the first constraint information is used to indicate whether the first path meets a constraint condition of a target service, and the network device is a head node on the first path; obtaining (S307), by the network device, second constraint information of a second path, wherein the second constraint information is used to indicate whether the second path meets the constraint condition, and the second path and the first path have the same head node and a same tail node; and determining (S308), by the network device based on the first constraint information and the second constraint information, whether to switch the packet forwarding path from the first path to another path, wherein the determining (S308), by the network device based on the first constraint information and the second constraint information, whether to switch the first path comprises: determining, by the network device based on the first constraint information, that the first path does not meet the constraint condition, determining, based on the second constraint information, that the second path meets the constraint condition, characterized by determining that duration after the second path changes from not meeting the constraint condition to meeting the constraint condition is less than a duration threshold, and skipping switching, by the network device, the packet forwarding path to the second path. determining, by the network device based on the first constraint information, that the first path does not meet the constraint condition, determining, based on the second constraint information, that the second path meets the constraint condition, characterized by determining that duration after the second path changes from not meeting the constraint condition to meeting the constraint condition is less than a duration threshold, and skipping switching, by the network device, the packet forwarding path to the second path. <EOS>