A method for configuring master and slave network devices, wherein the master network device uses a local clock to send data and the slave network device uses the clock recovered to send data and the master and slave devices both support synchronous Ethernet, comprising: receiving, by a network device, master-slave state configuration information indicating that the network device is set to manual-Master or manual-Slave; judging, by the network device, if a current state of a port of the network device is down or up and/or whether the received master-slave state configuration information is the same as current master-slave state configuration information of the network device after receiving the master-slave state configuration information; and in case of judging whether the port of the network device is down or up, if the current state of the port is down, performing a first physical-layer auto-negotiation according to the received master-slave state configuration information, and setting a master-slave state configuration mode of the network device to an automatic mode, but performing no physical-layer auto-negotiation for the automatic mode setting; and in case of judging whether the received master-slave state configuration information is the same as current master-slave state configuration of the network device, if the received master-slave state configuration information is different from the current master-slave state configuration information of the network device, performing the first physical-layer auto-negotiation according to the received master-slave state configuration information, and setting the master-slave state configuration mode of the network device to the automatic mode but performing no physical-layer auto-negotiation for the automatic mode setting. receiving, by a network device, master-slave state configuration information indicating that the network device is set to manual-Master or manual-Slave; judging, by the network device, if a current state of a port of the network device is down or up and/or whether the received master-slave state configuration information is the same as current master-slave state configuration information of the network device after receiving the master-slave state configuration information; and in case of judging whether the port of the network device is down or up, if the current state of the port is down, performing a first physical-layer auto-negotiation according to the received master-slave state configuration information, and setting a master-slave state configuration mode of the network device to an automatic mode, but performing no physical-layer auto-negotiation for the automatic mode setting; and in case of judging whether the received master-slave state configuration information is the same as current master-slave state configuration of the network device, if the received master-slave state configuration information is different from the current master-slave state configuration information of the network device, performing the first physical-layer auto-negotiation according to the received master-slave state configuration information, and setting the master-slave state configuration mode of the network device to the automatic mode but performing no physical-layer auto-negotiation for the automatic mode setting.