Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that numerous technical details are set forth in order to provide a better understanding of the present application in various embodiments of the present invention. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments. The following embodiments are divided for convenience of description, and should not be construed as limiting the specific implementation manner of the present invention, and the embodiments are not contradictory.
Fig. 1 is a schematic view of an application scenario of a data transmission method according to an embodiment of the present application. As shown in fig. 1, the scenario includes afirst network device 102 and asecond network device 104, where thefirst network device 102 receives a data packet from a User to network Interface (UNI), and then sends the data packet to thesecond network device 104 through thefirst network device 102, and thesecond network device 104 receives the data packet and then forwards the data packet to the UNI. Thefirst network device 102 and thesecond network device 104 perform data transmission based on a Multi-Protocol Label Switching (MPLS) static tunnel.
When a data message is sent based on a static tunnel, a data transmission path is a fixed path, and if data transmission is still performed according to a conventional method, a field carrying address information for validity verification is required in the data message during each transmission, which may cause the data transmission process to be inconvenient.
Fig. 2a is a schematic flow chart of a data transmission method in an embodiment, and this embodiment relates to a specific process of how to conveniently send a data packet in a configuration-free manner. The following describes implementation details of the data transmission method of the present embodiment in detail, and the following is only provided for easy understanding and is not necessary for implementing the present embodiment. As shown in fig. 2a, the method comprises:
step 101, when a data message needs to be sent based on a static tunnel, determining whether to allow sending the data message in a configuration-free manner.
The configuration-free mode is used for indicating that a preset field is not required to be encapsulated in a data message to be sent when the data message is sent; the preset field refers to a field carrying address information for validity verification.
Tunneling is a way of passing data between networks by using the infrastructure of the internetwork, and the data (or payload) transmitted using tunneling can be data frames or packets of different protocols. Tunneling re-encapsulates these data frames or packets of different protocols so that data can be routed between the two endpoints of the tunnel through the public internet. The logical path through which the encapsulated packet passes over the public internetwork is called a tunnel. A static tunnel is a fixed logical path through which data packets are transmitted between two endpoints. Generally, when sending a data packet through a tunneling technique, an Address Resolution Protocol (ARP) of a next hop of a multi-Protocol label switching network is usually obtained first, and a MAC-IN-MAC header encapsulated IN the data packet is obtained according to DMAC information IN the APR of the next hop, so that a network device receiving the data packet determines validity of the data packet according to the DMAC information IN the MAC-IN-MAC header. However, the inventor finds that in the static tunnel, a logic path through which the data packet is transmitted on the network is a fixed path, and the validity of the data packet does not need to be verified through DMAC information in the next hop APR, so that the security of data transmission can also be ensured.
In the stage of configuring the parameters, the two network devices on the static tunnel can configure the configuration-free mode of transmitting the data message without performing validity verification through the preset field when transmitting the data message based on the static tunnel according to the requirements. When the data message needs to be sent based on the static tunnel, whether the data message is allowed to be sent in a configuration-free mode or not can be judged first, and a judgment result is obtained. The preset field is a field carrying address information for validity verification, and it should be noted that the address information for validity verification may be address information in a next hop APR, and may include Virtual Local Area Network (VLAN) and DMAC information.
And 102, when the data message is allowed to be sent in a configuration-free mode, replacing the preset field with the self-defined field and packaging the self-defined field in the data message, and sending the data message.
When the data message is allowed to be sent in a configuration-free mode, the field of the address information for validity verification can be replaced by a self-defined field, the data message is packaged in the data message, and the data message is sent based on a static tunnel. The custom field may be a field obtained according to a setting instruction input by a user, and the length of the custom field may be the same as that of the preset field, as shown in fig. 2b, or may be shorter than the preset field. In one case, the custom field may also be an empty field as shown in FIG. 2 b.
According to the data transmission method, when the data message needs to be sent based on the static tunnel, whether the data message is allowed to be sent in a configuration-free mode is determined, wherein when the configuration-free mode indicates that the data message is sent, a preset field is not required to be packaged in the sent data message, the preset field is a field carrying address information used for validity verification, and when the data message is allowed to be sent in the configuration-free mode, the data message with the preset field replaced by a custom field is sent, namely, when the data message is sent in the configuration-free mode, the address information used for validity verification is not required to be obtained based on an address resolution protocol to form the preset field; the data message can be sent only by encapsulating the custom field in the data message, thereby reducing the processing burden of the data message to be sent and improving the convenience of sending the data message.
In one embodiment, after determining whether to allow the data packet to be sent in a configuration-exempt manner, the method further includes: and if the data message is not allowed to be sent in a configuration-free mode, encapsulating the preset field in the data message and sending the data message.
The embodiment shown in fig. 2a describes how to conveniently send data packets in a configuration-free manner, however, the device in the network used for sending data packets is often also used for receiving data packets. In one embodiment, the configuration-free manner is further used to indicate that when the data packet is received, the received data packet does not need to be subjected to validity verification according to the preset field, which is described in detail below with reference to fig. 3. Fig. 3 is a schematic flow chart of a data transmission method in another embodiment, which describes how to conveniently receive a data packet in a configuration-free manner. As shown in fig. 3, the method further comprises:
step 201, when the data message needs to be received based on the static tunnel, it is determined whether to allow the data message to be received in a configuration-free manner.
Step 202, if the data message is allowed to be received in a configuration-free manner, when a self-defined field is encapsulated in the data message, the data message is received.
When the data message needs to be received based on the static tunnel, whether the data message is allowed to be received in a configuration-free mode or not can be determined, and the data message encapsulated with the custom field is received when the data message is allowed to be received in the configuration-free mode. In the conventional method, a network address corresponding to address information used for validity verification is generally used only for validity verification without carrying other services in order to ensure network security. That is, there is no other traffic that can be carried on the network address, resulting in a waste of resources. When the data message is allowed to be received in a non-configuration mode, the received data message is not encapsulated with the preset field, and the network address corresponding to the address information in the preset field can bear other services. Optionally, the received data packet is validated according to the custom field. Optionally, the preset field is a MAC-IN-MAC header. The MAC-IN-MAC header includes Virtual Local Area Network (VLAN) and DMAC information IN an ARP message.
In one embodiment, after determining whether to allow the data packet to be received in a configuration-exempt manner, the method further includes: and if the data message is not allowed to be received in a configuration-free mode, receiving the data message when a preset field is encapsulated in the data message.
When the configuration-free mode is further used for indicating that when the received data message is received and the validity of the received data message is not required to be verified according to the preset field, when the data message is required to be received based on the static tunnel, whether the data message is allowed to be received in the configuration-free mode is determined, and when the data message is allowed to be received in the configuration-free mode, the data message encapsulated with the self-defined field is received, so that when the data message is allowed to be received in the configuration-free mode, the validity of the received data message is not required to be verified according to the preset field, namely, the validity of the data message is not required to be verified according to the address information specially used for validity verification in the traditional method, in order to ensure the network security, the network address corresponding to the address information used for validity verification generally does not carry other services and only serves as validity verification, the data transmission method provided by the present application is adopted, the equipment corresponding to the address information specially used for validity verification in the traditional method can bear other services, and the waste of resources is avoided.
When a network device sends or receives a data packet, the network device usually sends or receives the data packet through a communication port on the network device, and when the communication port specifically sends or receives the data packet, the communication port is often divided into a plurality of logical sub-ports to respectively send or receive different data packets. The communication port is usually a physical port, such as a network port, and the logical sub-port usually means that the physical port is divided into a plurality of logical sub-ports, for example, the network port a is divided into 3 logical sub-ports, and data packets are sent to 3 different addresses through the 3 logical sub-ports, respectively, and the network port a is a superior port of the 3 logical sub-ports. Correspondingly, when the configuration-free function of the network device is set to be in an open state, all communication ports used for sending or receiving data messages on the network device and the configuration-free functions of the corresponding logic sub-ports of the communication ports are usually opened; when the configuration-free function of a physical port is set to an open state, the configuration-free function of all the logical sub-ports corresponding to the physical port is usually opened; setting the hands-free function of a logical sub-port to an on state generally means that only the hands-free function of the logical sub-port is turned on.
In one embodiment, a possible implementation method for determining whether to allow a data packet to be sent or received in a configuration-free manner includes: determining whether a configuration-free function of the network equipment is started; and when the configuration-free function of the network equipment is started, the data message is allowed to be sent or received in a configuration-free mode.
The configuration-free function of the network device means that when the network device sends or receives a data message, the sent or received data message does not need to carry a field of address information for validity verification. When judging whether the configuration-free function of the network device is started, whether the configuration-free function of the network device is started can be determined by reading the configuration parameter indicating whether the configuration-free function is started in the network device. The configuration parameters may be stored in a service storage entity, such as a Field Programmable Gate Array (FPGA) chip or a Network Processing (NP) chip. The network device may first read the configuration parameters stored in the service storage entity and convert the configuration parameters into parameters suitable for the data structure of the network device, so as to determine whether the configuration-free function of the network device is turned on. When the configuration-free function of the network equipment is started, the network equipment is allowed to send or receive the data message in a configuration-free mode when sending or receiving the data message.
When the data message is received in a configuration-free manner, optionally, the received data message is subjected to validity verification according to the custom field. When the network equipment receives the data message encapsulated with the custom field, the legality of the received data message can be verified according to the custom field, the legality of the received data message does not need to be verified according to the preset field, namely, the legality does not need to be verified by identifying the address information in the traditional method, so that the equipment corresponding to the address information specially used for legality verification in the traditional method can bear other services, and the waste of resources is avoided.
In one embodiment, determining whether to allow the data packet to be sent or received in a configuration-free manner may also be performed by determining whether a configuration-free function of a transmission port to which the data packet is assigned is turned on.
Optionally, when the configuration-free function of the network device is not opened, obtaining a transmission port to which the data message is assigned, and determining whether the configuration-free function of the transmission port is opened; the transmission port is a port in the network equipment; when the configuration-free function of the transmission port is opened, the data message is allowed to be sent or received in a configuration-free mode.
In one case, when the configuration-free function of the network device is not turned on, the data packet is sent or received through the transmission port pre-designated by the label protocol, and at this time, it may be further determined whether the configuration-free function of the transmission port is turned on, so as to determine whether to send or receive the data packet in a configuration-free manner. When the configuration-free function of the transmission port is opened, the data message is determined to be allowed to be sent or received in a configuration-free mode. The transmission port is a port used for sending or receiving data messages in the network equipment.
According to the data transmission method, when the configuration-free function of the network equipment is not started, the appointed transmission port of the data message is determined, and whether the configuration-free function of the transmission port is started or not is judged, so that when the data message is transmitted through the transmission port, whether the data message can be transmitted or received in a configuration-free mode or not can be flexibly determined according to whether the configuration-free function of the transmission port is started or not, and the flexibility of mode selection for transmitting or receiving the data message is improved.
Optionally, the transmission port has a corresponding upper port and is a sub-port of the upper port.
When the transmission port is a logical sub-port of a physical port on the network device, the logical sub-port has a corresponding upper port, that is, the logical sub-port is a physical port on the network device. Whether the configuration-free function of the transmission port is started or not is judged, whether the configuration-free function of the logic sub-port is started or not is judged, whether the configuration-free function of the superior port of the logic sub-port is started or not is judged, and the method is not limited in the embodiment of the present application.
When the transmission port has an upper port, that is, the transmission port is a logical sub-port of the physical port, before determining whether the configuration-free function of the transmission port is turned on, it may also be determined whether the configuration-free function of the upper port is turned on. Optionally, determining whether the configuration-free function of the superior port is started; when the configuration-free function of the upper-level port is not started, the step of determining whether the configuration-free function of the transmission port is started is carried out; when the configuration-free function of the upper-level port is started, the data message is allowed to be sent or received in a configuration-free mode.
When the non-configuration function of the upper-level port is not opened, whether the non-configuration function of the transmission port is opened or not is determined, when the non-configuration function of the transmission port is opened, the data message is allowed to be sent or received in a non-configuration mode, and when the non-configuration function of the transmission port is not opened, the data message is not allowed to be sent or received in the non-configuration mode. When the configuration-free function of the port is started, the data message is directly determined to be allowed to be sent or received in a configuration-free mode without judging whether the configuration-free function of the transmission port is started or not.
In the data transmission method, when the transmission port has the upper port, whether the configuration-free function of the upper port is started is determined, and when the configuration-free function of the upper port is not started, whether the configuration-free function of the transmission port is started is determined, so that when the configuration-free function of the transmission port is determined to be started, the configuration-free function of the upper port is not started, in other words, when the configuration-free function of the upper port is started, whether the configuration-free function of the sub-port below the upper port is started is not required to be determined, and the efficiency of determining whether the transmission port sends or receives the data message in a configuration-free manner is improved.
In one embodiment, as shown in fig. 4, includes:
step 301, judging whether a configuration-free function of the network equipment is started; if yes, go to step 302, if no, go to step 303;
step 302, sending or receiving data messages in a configuration-free mode;
step 303, judging whether the transmission port has an upper port and is a sub-port of the upper port; if yes, go to step 304, otherwise go to step 305;
step 304, judging whether the non-configuration function of the superior port is started, if so, executingstep 302; if not, go to step 305;
305, judging whether the configuration-free function of the appointed transmission port of the data message is started; if yes, go to step 302.
The implementation principle and technical effect of the data transmission method are similar to those of the method embodiments, and are not described herein again.
Optionally, the length of the custom field is smaller than the length of the preset field.
It should be noted that the length of the custom field is smaller than that of the preset field, and in a possible case, the custom field may also be a null field. When the self-defined field is a null field, the data message can be directly transmitted through the label of the MPLS when being transmitted or received, and the transmission or the reception of the data message is completed; when the custom field is not a null field, the field stored in the service forwarding entity can be read, the custom field is determined, and the custom field is encapsulated in the data message to transmit or receive the data message.
According to the data transmission method, the length of the custom field is smaller than that of the preset field, so that communication resources occupied by transmitting the data message encapsulated with the custom field are smaller than those occupied by transmitting the data message encapsulated with the preset field, and particularly in a transmission scene with huge number of data messages, the communication resources are effectively saved.
Optionally, the information carried in the custom field is different from address information of any device in the network. When the legitimacy verification is carried out through the custom field, because the legitimacy verification is not required to be carried out according to the address information specially used for the legitimacy verification in the traditional method, and in order to ensure the network security in the traditional method, the network address corresponding to the address information used for the legitimacy verification does not generally bear other services and only serves as the legitimacy verification, the data transmission method provided by the application is adopted, and because the information carried in the custom field is the same as the address information of any device in the network equipment, any device in the network can bear other services, and the waste of resources is avoided.
The above examples are merely illustrative for easy understanding, and do not limit the technical aspects of the present invention.
The steps of the above methods are divided for clarity, and the implementation may be combined into one step or split some steps, and the steps are divided into multiple steps, so long as the same logical relationship is included, which are all within the protection scope of the present patent; it is within the scope of the patent to add insignificant modifications to the algorithms or processes or to introduce insignificant design changes to the core design without changing the algorithms or processes.
Another embodiment of the invention relates to an electronic device, as shown in fig. 5, comprising at least oneprocessor 401; amemory 402 communicatively coupled to the at least oneprocessor 401; thememory 402 stores instructions executable by the at least oneprocessor 401 to cause the at least oneprocessor 401 to perform the method steps illustrated in the above-described method class embodiments.
Where thememory 402 and theprocessor 401 are coupled by a bus, which may include any number of interconnected buses and bridges that couple one or more of the various circuits of theprocessor 401 and thememory 402 together. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by theprocessor 401 may be transmitted over a wireless medium via an antenna, which may receive the data and transmit the data to theprocessor 401.
Theprocessor 401 is responsible for managing the bus and general processing and may provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Andmemory 402 may be used to store data used byprocessor 401 in performing operations.
Another embodiment of the present invention relates to a computer-readable storage medium storing a computer program. The computer program realizes the above-described method embodiments when executed by a processor.
That is, as can be understood by those skilled in the art, all or part of the steps in the method for implementing the embodiments described above may be implemented by a program instructing related hardware, where the program is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples for carrying out the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.