A communication method, comprising: generating, by an optical module, a first packet according to a service packet that passes through the optical module, wherein a source address of the first packet is the same as a source address of the service packet, a destination address of the first packet is the same as a destination address of the service packet, the first packet further comprises an identifier of the optical module and feature information, wherein the feature information is used to indicate that a packet comprising the feature information is an optical module management packet, and the first packet is used to snoop whether a first transmission path from the optical module to a network device exists, wherein the optical module is inserted to another network device that is a host device of the optical module; sending, by the optical module, the first packet in a transmission direction of the service packet; and receiving, by the optical module, a second packet sent by the network device, wherein the second packet is used to respond to the first packet, and the second packet is used to indicate that the first transmission path from the optical module to the network device exists, and instruct the optical module to communicate with a network management system by using the network device and the first transmission path, wherein a communication path exists between the network device and the network management system, the second packet comprises the identifier of the optical module and the feature information, and a destination address of the second packet is the same as the source address of the first packet. generating, by an optical module, a first packet according to a service packet that passes through the optical module, wherein a source address of the first packet is the same as a source address of the service packet, a destination address of the first packet is the same as a destination address of the service packet, the first packet further comprises an identifier of the optical module and feature information, wherein the feature information is used to indicate that a packet comprising the feature information is an optical module management packet, and the first packet is used to snoop whether a first transmission path from the optical module to a network device exists, wherein the optical module is inserted to another network device that is a host device of the optical module; sending, by the optical module, the first packet in a transmission direction of the service packet; and receiving, by the optical module, a second packet sent by the network device, wherein the second packet is used to respond to the first packet, and the second packet is used to indicate that the first transmission path from the optical module to the network device exists, and instruct the optical module to communicate with a network management system by using the network device and the first transmission path, wherein a communication path exists between the network device and the network management system, the second packet comprises the identifier of the optical module and the feature information, and a destination address of the second packet is the same as the source address of the first packet.