A protection switching method, wherein the method comprises: determining, by a first network device, that there is at least one unavailable link in an active Flexible Ethernet, FlexE, link group, and selecting m standby links from preconfigured standby links as protection links, wherein the active FlexE link group comprises a plurality of links that are logically bonded, and m is a positive integer less than or equal to a quantity of unavailable links in the active FlexE link group; sending, by the first network device, a protection switching notification to a second network device, and replacing m unavailable links in the at least one unavailable link with the m protection links, wherein the protection switching notification is used to instruct the second network device to replace the m unavailable links with the m protection links, and the m protection links are in a one-to-one correspondence with the m unavailable links; receiving, by the first network device, a protection switching response sent by the second network device; wherein the replacing, by the first network device, m unavailable links in the at least one unavailable link with the m protection links comprises: if a first protection link in the m protection links belongs to a standby FlexE link group and is used to replace a first unavailable link, deleting, by the first network device, the first unavailable link from the active FlexE link group, and adding the first protection link to the active FlexE link group; wherein any protection link in the standby FlexE link group may be used to provide protection switching for any link in any active FlexE link group; wherein an unavailable link becomes a standby link after being replaced by a protection link and after the unavailable link is restored to available; and wherein when determining that there is at least one unavailable link in the active FlexE link group, the first network device selects the m standby links as protection links from the standby FlexE link group based on the following conditions: there is no preconfigured standby link or selectable standby link in the active FlexE link group, and there is a selectable standby link in the standby FlexE link group. determining, by a first network device, that there is at least one unavailable link in an active Flexible Ethernet, FlexE, link group, and selecting m standby links from preconfigured standby links as protection links, wherein the active FlexE link group comprises a plurality of links that are logically bonded, and m is a positive integer less than or equal to a quantity of unavailable links in the active FlexE link group; sending, by the first network device, a protection switching notification to a second network device, and replacing m unavailable links in the at least one unavailable link with the m protection links, wherein the protection switching notification is used to instruct the second network device to replace the m unavailable links with the m protection links, and the m protection links are in a one-to-one correspondence with the m unavailable links; receiving, by the first network device, a protection switching response sent by the second network device; wherein the replacing, by the first network device, m unavailable links in the at least one unavailable link with the m protection links comprises: if a first protection link in the m protection links belongs to a standby FlexE link group and is used to replace a first unavailable link, deleting, by the first network device, the first unavailable link from the active FlexE link group, and adding the first protection link to the active FlexE link group; wherein any protection link in the standby FlexE link group may be used to provide protection switching for any link in any active FlexE link group; wherein an unavailable link becomes a standby link after being replaced by a protection link and after the unavailable link is restored to available; and wherein when determining that there is at least one unavailable link in the active FlexE link group, the first network device selects the m standby links as protection links from the standby FlexE link group based on the following conditions: there is no preconfigured standby link or selectable standby link in the active FlexE link group, and there is a selectable standby link in the standby FlexE link group. if a first protection link in the m protection links belongs to a standby FlexE link group and is used to replace a first unavailable link, deleting, by the first network device, the first unavailable link from the active FlexE link group, and adding the first protection link to the active FlexE link group; wherein any protection link in the standby FlexE link group may be used to provide protection switching for any link in any active FlexE link group; wherein an unavailable link becomes a standby link after being replaced by a protection link and after the unavailable link is restored to available; and wherein when determining that there is at least one unavailable link in the active FlexE link group, the first network device selects the m standby links as protection links from the standby FlexE link group based on the following conditions: there is no preconfigured standby link or selectable standby link in the active FlexE link group, and there is a selectable standby link in the standby FlexE link group.