A device virtualization method, comprising: determining virtual information of a virtual device based on device information of a local device and device information of a peer device, wherein the local device and the peer device are a plurality of first devices in a Multichassis Link Aggregation Group, MC-LAG, the device information comprises a bridge Identification, ID, and a port Identification, ID, and the virtual information comprises a virtual bridge Identification, ID, and a target port Identification, ID; characterized by switching an extended protocol message with the peer device, wherein the extended protocol message comprises a message receiving port Identification, ID, and a path cost, the extended protocol message is generated based on a Spanning Tree Protocol, STP, message received by the local device; and determining a role and state of the port of the local device based on the virtual information and the extended protocol message of the peer device in combination with a protocol message received by the local device; determining a master device and a slave device based on the device information of the local device and the device information of the peer device; wherein determining (S1 10) virtual information of a virtual device based on device information of a local device and device information of a peer device comprises: taking a bridge Identification, ID, of the master device as the virtual bridge ID; and in response to the port ID of the port of the master device being inconsistent with that of the slave device in the MC-LAG, taking the port ID of the port of the master device in the MC-LAG as the target port ID. determining virtual information of a virtual device based on device information of a local device and device information of a peer device, wherein the local device and the peer device are a plurality of first devices in a Multichassis Link Aggregation Group, MC-LAG, the device information comprises a bridge Identification, ID, and a port Identification, ID, and the virtual information comprises a virtual bridge Identification, ID, and a target port Identification, ID; characterized by switching an extended protocol message with the peer device, wherein the extended protocol message comprises a message receiving port Identification, ID, and a path cost, the extended protocol message is generated based on a Spanning Tree Protocol, STP, message received by the local device; and determining a role and state of the port of the local device based on the virtual information and the extended protocol message of the peer device in combination with a protocol message received by the local device; determining a master device and a slave device based on the device information of the local device and the device information of the peer device; wherein determining (S1 10) virtual information of a virtual device based on device information of a local device and device information of a peer device comprises: taking a bridge Identification, ID, of the master device as the virtual bridge ID; and in response to the port ID of the port of the master device being inconsistent with that of the slave device in the MC-LAG, taking the port ID of the port of the master device in the MC-LAG as the target port ID. taking a bridge Identification, ID, of the master device as the virtual bridge ID; and in response to the port ID of the port of the master device being inconsistent with that of the slave device in the MC-LAG, taking the port ID of the port of the master device in the MC-LAG as the target port ID.