A communication method, wherein the method comprises: determining, by a first in-domain device, an address length, wherein the "in-domain" refers to being in a local area network; receiving, by the first in-domain device, a data packet; extracting, by the first in-domain device, an address from the data packet based on the address length; and forwarding, by the first in-domain device, the data packet based on the address; wherein the determining, by a first in-domain device, an address length comprises: determining, by the first in-domain device, an address length preset in the first in-domain device as a first length; and receiving, by the first in-domain device, a message from a second in-domain device, wherein the message comprises a field indicating a second length, the second length is an address length preset in the second in-domain device, and the first in-domain device and the second in-domain device are connected to each other; determining, by the first in-domain device based on the field, whether the first length is greater than or equal to the second length; and if the first length is greater than or equal to the second length, determining, by the first in-domain device, the first length as the address length; or if the first length is less than the second length, determining, by the first in-domain device, the second length as the address length, and sending the message to a third in-domain device, wherein the third in-domain device and the first in-domain device are connected to each other. determining, by a first in-domain device, an address length, wherein the "in-domain" refers to being in a local area network; receiving, by the first in-domain device, a data packet; extracting, by the first in-domain device, an address from the data packet based on the address length; and forwarding, by the first in-domain device, the data packet based on the address; wherein the determining, by a first in-domain device, an address length comprises: determining, by the first in-domain device, an address length preset in the first in-domain device as a first length; and receiving, by the first in-domain device, a message from a second in-domain device, wherein the message comprises a field indicating a second length, the second length is an address length preset in the second in-domain device, and the first in-domain device and the second in-domain device are connected to each other; determining, by the first in-domain device based on the field, whether the first length is greater than or equal to the second length; and if the first length is greater than or equal to the second length, determining, by the first in-domain device, the first length as the address length; or if the first length is less than the second length, determining, by the first in-domain device, the second length as the address length, and sending the message to a third in-domain device, wherein the third in-domain device and the first in-domain device are connected to each other. determining, by the first in-domain device, an address length preset in the first in-domain device as a first length; and receiving, by the first in-domain device, a message from a second in-domain device, wherein the message comprises a field indicating a second length, the second length is an address length preset in the second in-domain device, and the first in-domain device and the second in-domain device are connected to each other; determining, by the first in-domain device based on the field, whether the first length is greater than or equal to the second length; and if the first length is greater than or equal to the second length, determining, by the first in-domain device, the first length as the address length; or if the first length is less than the second length, determining, by the first in-domain device, the second length as the address length, and sending the message to a third in-domain device, wherein the third in-domain device and the first in-domain device are connected to each other.