Data forwarding method, apparatus, and storage medium
Patent Information
- Application Number
- CN202311181734.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-13
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2043-09-13
AI Technical Summary
[0004]本申请提供一种数据转发方法、装置及存储介质,用于解决现有技术中报文头的字节较多的问题
基于上述任一方面,本申请实施例提供了一种数据转发方法,可以先获取业务报文。然后基于业务报文的出接口、入接口的属性信息,以及业务报文的报文头的类型,确定业务报文的转发方式。本申请通过预设一种新型的报文头类型,并根据业务报文的出接口和入接口的属性信息,确定转发添加新型报文头的业务报文转发路径,以使得在保证业务报文正常转发的前提下,减少业务报文转发过程中的报文头字节数。
Smart Images

Figure CN117354394B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a data forwarding method, apparatus and storage medium. Background Technology
[0002] With the widespread application of server virtualization technology, the scale of virtual networks built by virtual servers is also increasing. Therefore, the information transmission between virtual servers has become an obstacle to the development of server virtualization due to limitations in the network specifications of virtual networks.
[0003] Current information transmission methods use Virtual Extensible Local Area Network (VXLAN) encapsulation technology to add VXLAN service packets to the raw data transmitted by the virtual server. The virtual server can then determine the source and destination addresses of the original data based on the information in the VXLAN service packets. However, because VXLAN service packets are relatively long, they consume a significant amount of network bandwidth, and excessively long VXLAN service packets may also increase the probability of packet loss. Summary of the Invention
[0004] This application provides a data forwarding method, apparatus, and storage medium to solve the problem of excessively large message header bytes in the prior art.
[0005] To achieve the above objectives, this application adopts the following technical solution: Firstly, a data forwarding method is provided, including: obtaining a business message; determining the forwarding method of the business message based on the attribute information of the outgoing and incoming interfaces of the business message, as well as the type of the message header of the business message.
[0006] Optionally, based on the attribute information of the outgoing and incoming interfaces of the service message, and the type of the service message header, the forwarding method of the service message is determined, including: under a first preset condition, forwarding the service message according to a first forwarding method; wherein, the first preset condition includes: the incoming interface has a first binding relationship, the outgoing interface does not have a first binding relationship, and the service message does not contain a first type of header; the first forwarding method includes: adding a first type of header to the service message, modifying the sending address of the service message to the media access control MAC address bound to the outgoing interface, and modifying the receiving address of the service message to the MAC address bound to the incoming interface of the next switch; the first type of header is a header carrying a preset identifier; the preset identifier includes: network authentication code NID and security identifier code SID; the first binding relationship is the binding relationship between the outgoing interface, the incoming interface and the preset identifier.
[0007] Optionally, determining the forwarding method of a service message based on the attribute information of the outgoing and incoming interfaces of the service message, as well as the type of the service message header, further includes: forwarding the service message according to the second forwarding method under a second preset condition; wherein the second preset condition includes: the incoming interface does not have a first binding relationship, the outgoing interface does not have a first binding relationship, and the service message contains a first type of header; the second forwarding method includes: modifying the sending address of the service message to the media access control MAC address bound to the outgoing interface, and modifying the receiving address of the service message to the MAC address bound to the incoming interface of the next switch.
[0008] Optionally, based on the attribute information of the outgoing and incoming interfaces of the service message, and the type of the service message header, the forwarding method of the service message is determined, including: under a third preset condition, forwarding the service message according to the third forwarding method; wherein, the second preset condition includes: the incoming interface does not have a first binding relationship, the outgoing interface has a first binding relationship, and the service message contains a first type of header; the third forwarding method includes: deleting the first type of header contained in the service message, modifying the sending address of the service message to the media access control MAC address bound to the outgoing interface, and modifying the receiving address of the service message to the MAC address bound to the ingoing interface of the next virtual machine.
[0009] Optionally, it also includes: when the first preset condition is met, determining whether the preset identifier bound to the ingress interface is consistent with any preset identifier in the preset forwarding table; the preset forwarding table is used to record the correspondence between the preset forwarding rules and the preset identifiers; when the preset identifier bound to the ingress interface is inconsistent with any preset identifier in the preset forwarding table, discarding the service message.
[0010] Optionally, before obtaining the interface information of the first interface in the target switch, the method further includes: obtaining a preset transmission path; the preset transmission path is a pre-defined transmission information path between multiple switches; based on the preset transmission path, determining the preset identifier corresponding to the preset transmission path; and inputting the preset identifier into a preset routing table to generate a preset forwarding table.
[0011] Secondly, a data forwarding device is provided, comprising: an acquisition unit and a determination unit. The acquisition unit is used to acquire service packets; the determination unit is used to determine the forwarding method of the service packets based on the attribute information of the outgoing and incoming interfaces of the service packets, and the type of the packet header of the service packets.
[0012] Optionally, the determining unit is specifically used for: forwarding service packets according to a first forwarding method under a first preset condition; wherein, the first preset condition includes: the ingress interface has a first binding relationship, the egress interface does not have a first binding relationship, and the service packet does not contain a first type packet header; the first forwarding method includes: adding a first type packet header to the service packet, modifying the sending address of the service packet to the media access control MAC address bound to the egress interface, and modifying the receiving address of the service packet to the MAC address bound to the ingress interface of the next switch; the first type packet header is a packet header carrying a preset identifier; the preset identifier includes: network authentication code NID and security identifier code SID; the first binding relationship is the binding relationship between the egress interface, the ingress interface and the preset identifier.
[0013] Optionally, the determining unit is specifically used to: forward service packets according to a second forwarding method under a second preset condition; wherein, the second preset condition includes: the ingress interface does not have a first binding relationship, the egress interface does not have a first binding relationship, and the service packet contains a first type of packet header; the second forwarding method includes: modifying the sending address of the service packet to the media access control MAC address bound to the egress interface, and modifying the receiving address of the service packet to the MAC address bound to the ingress interface of the next switch.
[0014] Optionally, the determining unit is specifically used for: forwarding service packets according to a third forwarding method under a third preset condition; wherein, the second preset condition includes: the ingress interface does not have a first binding relationship, the egress interface has a first binding relationship, and the service packet contains a first type of packet header; the third forwarding method includes: deleting the first type of packet header contained in the service packet, modifying the sending address of the service packet to the media access control MAC address bound to the egress interface, and modifying the receiving address of the service packet to the MAC address bound to the ingress interface of the next virtual machine.
[0015] Optionally, the determining unit is further configured to: when the first preset condition is met, determine whether the preset identifier bound to the ingress interface is consistent with any preset identifier in the preset forwarding table; the preset forwarding table is used to record the correspondence between the preset forwarding rules and the preset identifiers; when the preset identifier bound to the ingress interface is inconsistent with any preset identifier in the preset forwarding table, discard the service message.
[0016] Optionally, before obtaining the interface information of the first interface in the target switch, the obtaining unit is also used to obtain a preset transmission path; the preset transmission path is a pre-defined transmission information path between multiple switches; the determining unit determines the preset identifier corresponding to the preset transmission path based on the preset transmission path; and inputs the preset identifier into a preset routing table to generate a preset forwarding table.
[0017] Thirdly, a data forwarding device is provided, including a memory and a processor; the memory is used to store computer execution instructions, and the processor is connected to the memory via a bus; when the data forwarding device is running, the processor executes the computer execution instructions stored in the memory, so that the data forwarding device performs the data forwarding method described in the first aspect.
[0018] The data forwarding device can be a network device or a component of a network device, such as a chip system within the network device. The chip system supports the network device in implementing the functions involved in the first aspect and any of its possible implementations, such as acquiring, determining, and sending the data and / or information involved in the aforementioned data forwarding method. The chip system includes a chip, but may also include other discrete devices or circuit structures.
[0019] Fourthly, a computer-readable storage medium is provided, comprising computer-executable instructions that, when executed on a computer, cause the computer to perform the data forwarding method described in the first aspect.
[0020] Fifthly, a computer program product is also provided, which includes computer instructions that, when executed on a data forwarding device, cause the data forwarding device to perform the data forwarding method as described in the first aspect above.
[0021] It should be noted that the aforementioned computer instructions may be stored, in whole or in part, on the first computer-readable storage medium. The first computer-readable storage medium may be packaged together with the processor of the data forwarding device, or it may be packaged separately from the processor of the data forwarding device; this application embodiment does not limit this.
[0022] The descriptions of the second, third, fourth, and fifth aspects in this application can be referenced to the detailed description of the first aspect; and the beneficial effects of the second, third, fourth, and fifth aspects can be referenced to the analysis of the beneficial effects of the first aspect, which will not be repeated here.
[0023] In the embodiments of this application, the names of the aforementioned data forwarding devices do not limit the devices or functional modules themselves. In actual implementation, these devices or functional modules may appear under other names. As long as the functions of each device or functional module are similar to those of this application, they fall within the scope of this application and its equivalents.
[0024] The technical solution provided in this application brings at least the following beneficial effects: Based on any of the above aspects, embodiments of this application provide a data forwarding method, which first obtains a service message. Then, based on the attribute information of the outgoing and incoming interfaces of the service message, as well as the type of the service message header, the forwarding method of the service message is determined. This application determines the forwarding path of the service message with the new header by pre-setting a new header type and based on the attribute information of the outgoing and incoming interfaces of the service message, thereby reducing the number of header bytes in the service message forwarding process while ensuring normal forwarding of the service message. Attached Figure Description
[0025] Figure 1 A schematic diagram illustrating the composition of a VXLAN service packet provided in an embodiment of this application; Figure 2 A schematic diagram illustrating the composition of the VXLAN service packet header provided in this application embodiment. Figure 3 This is a schematic diagram of the structure of a data forwarding system provided in an embodiment of this application; Figure 4 A schematic diagram of a hardware structure of a data forwarding device provided in an embodiment of this application; Figure 5 A schematic diagram of another hardware structure of the data forwarding device provided in the embodiments of this application; Figure 6 A flowchart illustrating a data forwarding method provided in an embodiment of this application; Figure 7 A flowchart illustrating yet another data forwarding method provided in an embodiment of this application; Figure 8 A flowchart illustrating yet another data forwarding method provided in an embodiment of this application; Figure 9 A flowchart illustrating yet another data forwarding method provided in an embodiment of this application; Figure 10 A flowchart illustrating yet another data forwarding method provided in an embodiment of this application; Figure 11 A flowchart illustrating yet another data forwarding method provided in an embodiment of this application; Figure 12 A flowchart illustrating yet another data forwarding method provided in an embodiment of this application; Figure 13 This is a schematic diagram of a data forwarding device provided in an embodiment of this application. Detailed Implementation
[0026] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0027] It should be noted that in the embodiments of this application, the words "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the words "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0028] To facilitate a clear description of the technical solutions of the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish the same or similar items with essentially the same function and effect. Those skilled in the art can understand that the terms "first" and "second" are not intended to limit the quantity or execution order.
[0029] Before providing a detailed introduction to the data forwarding method provided in this application, let me briefly introduce the background of this application.
[0030] Server virtualization technology is becoming increasingly widely used due to its advantages such as low cost and flexible deployment. A single server can virtualize multiple virtual machines, and each virtual machine is equivalent to a host. In this case, the number of hosts in the same virtual network changes dramatically.
[0031] However, the size of virtual machines in a virtual network is limited by network specifications, the migration range of virtual machines is limited by network architecture, and the more virtual machines there are in a virtual network, the worse the network isolation capability of the virtual network becomes.
[0032] To address this issue, existing technologies have proposed a Virtual Extensible Local Area Network (VXLAN) technology, which can effectively solve the aforementioned problems. VXLAN technology uses a 24-bit (background intelligent transfer service) VXLAN network identifier (VNI) for network isolation, so that the network isolation of virtual networks is not limited by the number of virtual machines.
[0033] Furthermore, in this virtual network, apart from network edge devices, other devices do not need to recognize the media access control address (MAC) address of the virtual machine, thereby reducing the address learning pressure on each device in the virtual network and improving the device performance of the devices in the virtual network.
[0034] The following, combined with Figure 1 This section explains the Layer 2 network structure and related terminology of VXLAN networks.
[0035] 1. Internet Protocol version 6 (IPv6) over IPv6 VXLAN message format.
[0036] Outer Ethernet Header: External Ethernet header.
[0037] Outer IPv6 Header: External IPv6 header.
[0038] Outer UDP Header: External UDP header.
[0039] VXLAN Header: VXLAN header.
[0040] Inner Ethernet Header: Internal Ethernet header.
[0041] Inner IPv6 Header: Internal IPv6 header.
[0042] Payload: Ethernet data payload, which is the actual data, excluding the FCS field of the original frame.
[0043] In summary, the external Ethernet header, external IPv6 header, external UDP header, and VXLAN header constitute the VXLAN encapsulated message header. The internal Ethernet header, internal IPv6 header, and Ethernet payload constitute the original service message. The VXLAN encapsulated message header and the original service message constitute the IPv6 over IPv6 VXLAN message format.
[0044] 2. The external Ethernet header includes the following parts.
[0045] MAC DA: Outer Destination MAC Address.
[0046] MAC SA: Outer Source MAC Address.
[0047] 802.1Q Tag: A tag used to indicate that the service message supports Virtual Local Area Network (VLAN).
[0048] Ethernet Type: Ethernet data type.
[0049] 3. The VXLAN header includes the following parts.
[0050] VAXLAN Flags field: VXLAN Flags (8 bits), with a value of 00001000.
[0051] VAXLAN network identifier (VNI): 24 bits, used to represent information about a virtual local area network.
[0052] Reserved: Reserved field, 8 bits, used to reserve some storage space for future expansion.
[0053] 4. The external UDP header includes the following parts.
[0054] The sender's port number: Source port.
[0055] The receiver's port number: Destport (VXLAN port).
[0056] Size of data within a UDP segment: UDP length.
[0057] UDP data checksum: UDP checksum.
[0058] 5. The external IPv6 header includes the following parts.
[0059] IP SA: The source IP address is the IP address of the local VTEP of the VXLAN tunnel.
[0060] IP DA: The destination IP address is the IP address of the remote VTEP of the VXLAN tunnel.
[0061] Protocol: Multiple IPv6 protocols.
[0062] In summary, existing technologies extend Layer 2 virtual LANs by employing MAC-in-UDP encapsulation, thereby decoupling the physical and virtual networks. In this scenario, tenants can plan their own virtual LANs without considering physical network address and broadcast domain limitations, significantly reducing the complexity of virtual LAN management.
[0063] However, IPv6 service packets using this data forwarding method need to be encapsulated using VXLAN when passing through nodes in the data center. After the service packet encapsulation is completed, the original IPv6 service packet will have a 74-byte header added.
[0064] Combination Figure 2 This section explains the header structure of IPv6 over IPv6 vxlan.
[0065] In the server, the original service packet consists of an internal Ethernet header (14 bytes), an internal IPv6 header (40 bytes), and an Ethernet payload. When the original service packet arrives at the spine switch from the leaf switch, an external header is added. This external header includes: an external Ethernet header (18 bytes), an external IPv6 header (40 bytes), an external UDP header (8 bytes), and a VXLAN header (8 bytes).
[0066] In this scenario, an excessively long header reduces the payload ratio of the aforementioned IPv6 service packets, requiring higher network bandwidth to transmit the data within them. Furthermore, an increased header length reduces the number of service packets that switches in the virtual network can handle, leading to a higher probability of packet loss. Additionally, a longer header increases the identification cost for intermediate nodes in the virtual LAN; during packet forwarding, these nodes consume more hardware resources to decipher the inner information of the service packets.
[0067] To address the aforementioned issues, this application provides a data forwarding method that first acquires the service message. Then, based on the attribute information of the service message's outgoing and incoming interfaces, as well as the type of the service message's header, the forwarding method for the service message is determined. This application pre-defines a new header type and, based on the attribute information of the service message's outgoing and incoming interfaces, determines the forwarding path for the service message with the new header, thereby reducing the number of header bytes during the forwarding process while ensuring normal forwarding of the service message.
[0068] This data forwarding method is applicable to data forwarding systems. Figure 3 One structure of this data forwarding system is shown. For example... Figure 3 As shown, the data forwarding system includes: electronic device 101, leaf switch 102, leaf switch 103, spine switch 104, virtual machine device 105, virtual machine device 106, and virtual machine device 107.
[0069] Leaf switch 102 includes interface 1 and interface 2, spine switch 104 includes interface 3 and interface 4, and leaf switch 103 includes interface 5, interface 6 and interface 7.
[0070] The network identifier (NID) bound to interface 1 has a security identifier (SID) ratio of 1:0. The NID bound to interface 6 has a SID ratio of 1:0. The NID bound to interface 7 has a SID ratio of 1:1.
[0071] The IPv6 address of virtual machine device 105 is 2001::1, the IPv6 address of virtual machine device 106 is 2002::1, and the IPv6 address of virtual machine device 107 is 2003::1. Among them, electronic device 101 is connected to leaf switch 102, leaf switch 103 and spine switch 104 respectively; leaf switch 102 is connected to virtual machine device 105; leaf switch 103 is connected to virtual machine device 106 and virtual machine device 107 respectively; and spine switch 104 is connected to leaf switch 102 and leaf switch 103 respectively.
[0072] In practical applications, electronic device 101 can connect to multiple leaf switches 102, multiple leaf switches 103, and multiple spine switches 104. Leaf switches 102 can connect to multiple virtual machine devices 105, multiple virtual machine devices 106, and multiple virtual machine devices 107. Spine switches 104 can connect to multiple leaf switches 102 and multiple leaf switches 103. For ease of understanding, this application uses the following examples: one electronic device 101 connected to one leaf switch 102, one electronic device 101 connected to one leaf switch 103, one electronic device 101 connected to one spine switch 104, one leaf switch 102 connected to one virtual machine device 105, one leaf switch 103 connected to one virtual machine device 106, one leaf switch 103 connected to one virtual machine device 107, one spine switch 104 connected to one leaf switch 102, and one spine switch 104 connected to one leaf switch 103.
[0073] Optionally, the physical device of electronic device 101 can be a terminal, a server, or other types of electronic devices.
[0074] Optionally, when the physical device of electronic device 101 is a terminal, the terminal can be a device that provides voice and / or data connectivity to a user, a handheld device with wireless connectivity, or other processing devices connected to a wireless modem. The terminal can communicate with one or more core networks via a radio access network (RAN). The terminal can be a mobile terminal, such as a mobile phone (or "cellular" phone) and a computer with a mobile terminal, or a portable, pocket-sized, handheld, computer-embedded, or vehicle-mounted mobile device that exchanges voice and / or data with the radio access network, such as a mobile phone, tablet computer, laptop computer, netbook, or personal digital assistant (PDA).
[0075] Optionally, when the physical device of electronic device 101 is a server, the server can be one of the servers in a server cluster (composed of multiple servers), a chip in the server, a system-on-a-chip in the server, or a virtual machine (VM) deployed on a physical machine. This application embodiment does not limit this.
[0076] The basic hardware structure of electronic devices 101 in the data forwarding system is similar, both including Figure 4 or Figure 5 The data forwarding device shown includes the following components. Figure 4 and Figure 5 Taking the data forwarding device shown as an example, the hardware structure of electronic device 101 will be introduced.
[0077] like Figure 4 The diagram shown is a hardware structure schematic of a data forwarding device provided in an embodiment of this application. The data forwarding device includes a processor 21, a memory 22, a communication interface 23, and a bus 24. The processor 21, memory 22, and communication interface 23 are connected via the bus 24.
[0078] Processor 21 is the control center of the data forwarding device. It can be a single processor or a collective term for multiple processing elements. For example, processor 21 can be a general-purpose central processing unit (CPU) or other general-purpose processors. Among them, the general-purpose processor can be a microprocessor or any conventional processor.
[0079] As one embodiment, processor 21 may include one or more CPUs, for example Figure 4 CPU0 and CPU1 are shown in the diagram.
[0080] The memory 22 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0081] In one possible implementation, the memory 22 can exist independently of the processor 21. The memory 22 can be connected to the processor 21 via a bus 24 and is used to store instructions or program code. When the processor 21 calls and executes the instructions or program code stored in the memory 22, it can implement the data forwarding method provided in the following embodiments of this application.
[0082] In this embodiment, the software programs stored in memory 22 differ among the data forwarding devices, resulting in different functions implemented by each device. The functions performed by each device will be described in conjunction with the following flowchart.
[0083] In another possible implementation, the memory 22 can also be integrated with the processor 21.
[0084] Communication interface 23 is used for the data forwarding device to connect with other devices via a communication network, which may be Ethernet, wireless access network, wireless local area network (WLAN), etc. Communication interface 23 may include a receiving unit for receiving data and a sending unit for sending data.
[0085] Bus 24 can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0086] Figure 5 Another hardware structure of the data forwarding device in an embodiment of this application is shown. For example... Figure 5 As shown, the data forwarding device may include a processor 31 and a communication interface 32. The processor 31 is coupled to the communication interface 32.
[0087] The functions of processor 31 can be referred to in the description of processor 21 above. In addition, processor 31 also has a storage function, and can perform the functions of memory 22 mentioned above.
[0088] The communication interface 32 is used to provide data to the processor 31. The communication interface 32 can be an internal interface of the data forwarding device, or it can be an external interface of the data forwarding device (equivalent to communication interface 23).
[0089] It should be pointed out that, Figure 4 (or Figure 5 The structure shown in the diagram does not constitute a limitation on the data forwarding device, except... Figure 4 (or Figure 5 In addition to the components shown in the diagram, the data forwarding device may include more or fewer components than shown in the diagram, or combine certain components, or have different component arrangements.
[0090] The data forwarding method provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0091] like Figure 6 As shown, the data forwarding method provided in this application embodiment is applied to an electronic device, and the data forwarding method includes: S601-S602.
[0092] S601. Electronic equipment acquires service messages.
[0093] Optionally, a service message can be a data unit exchanged and transmitted within a virtual local area network (VLAN), i.e., a data block that any switch node needs to send at one time. A service message contains complete data information to be sent, and its length is unlimited and variable.
[0094] For example, in combination Figure 3 When virtual machine device 105 sends data to virtual machine device 106, it can first send the corresponding service message to leaf switch 102. Then, leaf switch 102 receives the service message and sends it to electronic device 101. In this way, electronic device 101 can obtain the service message sent by virtual machine device 105.
[0095] S602. The electronic device determines the forwarding method of the service message based on the attribute information of the outgoing and incoming interfaces of the service message and the type of the message header.
[0096] Optionally, one implementation of the electronic device determining the forwarding method of a service message based on the attribute information of the outgoing and incoming interfaces of the service message, as well as the type of the message header, is as follows: when the incoming interface of the switch where the service message is currently located has a first binding relationship, the outgoing interface does not have a first binding relationship, and the service message does not contain a first type of message header, the electronic device forwards the aforementioned service message according to the first forwarding method.
[0097] For example, in combination Figure 3 Suppose that virtual machine device 105 sends a service message to virtual machine device 106, and the current switch where the service message is located is leaf switch 102. Leaf switch 102 contains interface 1 and interface 2. Interface 1 is bound to an NID:SID of 1:0 (meaning interface 1 has a first binding relationship), while interface 2 is not bound to an NID:SID (meaning interface 2 does not have a first binding relationship). In this case, the service message does not contain a first-type header. Electronic device 101 can add a first-type header to the service message, modify the sending address of the service message to the media access control (MAC) address of interface 2, and modify the receiving address of the service message to the MAC address of interface 3 in spine switch 104.
[0098] Optionally, another implementation of the electronic device determining the forwarding method of the service message based on the attribute information of the outgoing and incoming interfaces of the service message and the type of the message header is as follows: when the incoming interface of the switch where the service message is currently located does not have a first binding relationship, the outgoing interface does not have a first binding relationship, and the service message contains a first type of message header, the electronic device forwards the above-mentioned service message according to the second forwarding method.
[0099] For example, in combination Figure 3 Suppose virtual machine device 105 sends a service message to virtual machine device 106, and the current switch where the service message is located is spine switch 104. It is known that spine switch 104 contains interface 3 and interface 4, neither of which has a first binding relationship. In this case, the service message contains a first type of message header. Electronic device 101 can modify the sending address of the service message to the MAC address of interface 4, and modify the receiving address of the service message to the MAC address of interface 5 in leaf switch 103.
[0100] Optionally, another way for the electronic device to determine the forwarding method of the service message based on the attribute information of the outgoing and incoming interfaces of the service message and the type of the message header is as follows: when the incoming interface of the switch where the service message is currently located does not have a first binding relationship, the outgoing interface has a first binding relationship, and the service message contains a first type of message, the electronic device forwards the above-mentioned service message according to the third forwarding method.
[0101] For example, in combination Figure 3 Suppose that virtual machine device 105 sends a service message to virtual machine device 106, and the current switch where the service message is located is leaf switch 103. Leaf switch 103 contains interface 5 and interface 6. Interface 5 does not have a first binding relationship, while interface 6 does. The service message contains a first type header. In this case, electronic device 101 can modify the sending address of the service message to the MAC address of interface 6 and the receiving address of the service message to the MAC address of virtual machine device 106.
[0102] Optionally, referring to Table 1, a service message containing a Type 1 header can be shown. This service message is an extension of the standard IPv6 header, adding a Destination Option Header (DOH) header (also known as a Type 1 header) between the user header and the payload. This DOH header conforms to the definition of Requests for Comments (RFC) 8200, and the option definition for determining the option of a service message containing a Type 1 header is defined as 0x53. The NID is 4 bytes, representing the tenant's identity information, equivalent to a traditional VPN, where virtual machines under different tenants (or different NIDs) cannot access each other. The SID is 2 bytes, representing a security group, used to further isolate different virtual machines within the same tenant. When the receiving device cannot recognize the DOH header, the service message with the unrecognizable DOH header can be discarded.
[0103] For example, in combination Figure 3Virtual machine device 105 is connected to interface 1 with an NID:SID bound to 1:0; virtual machine device 106 is connected to interface 6 with an NID:SID bound to 1:0; and virtual machine device 107 is connected to interface 7 with an NID:SID bound to 1:1. In this case, electronic device 101 can determine that virtual machine devices 105, 106, and 107 belong to the same tenant, and that virtual machine devices 105 and 106 belong to the same security group. Therefore, virtual machine device 105 can communicate with virtual machine device 106, but virtual machine device 107 cannot communicate with either virtual machine device 105 or virtual machine device 106.
[0104] Table 1
[0105] In this embodiment of the application, by using a pre-set novel message format and data forwarding method, the number of bytes in the header of the service message is reduced, thereby improving the payload ratio of the service message transmitted in the virtual local area network while ensuring the transmission capacity of the service message transmitted in the virtual local area network.
[0106] In some embodiments, combined with Figure 6 ,like Figure 7 As shown, in S602 above, the method by which the electronic device determines the forwarding method of the service message based on the attribute information of the outgoing and incoming interfaces of the service message and the type of the message header of the service message specifically includes: S701.
[0107] S701. Under the first preset conditions, the electronic device forwards service messages according to the first forwarding method.
[0108] The first preset condition includes: the inbound interface has a first binding relationship, the outbound interface does not have a first binding relationship, and the business message does not contain a first type of message header.
[0109] The first forwarding method includes: adding a first type of message header to the service message, modifying the sending address of the service message to the media access control MAC address bound to the outgoing interface, and modifying the receiving address of the service message to the MAC address bound to the incoming interface of the next switch.
[0110] The first type of message header carries a predefined identifier. The predefined identifiers include NID and SID. The first binding relationship is the binding relationship between the outgoing interface, the incoming interface, and the predefined identifier.
[0111] Optionally, under the first preset condition, the specific steps for the electronic device to forward service packets according to the first forwarding method are similar to those in S602. The specific steps for the electronic device to forward service packets according to the first forwarding method can be found in S602, and will not be elaborated further here.
[0112] In this embodiment, a first-type header can be added to service packets that do not carry a first-type header using a first forwarding method. The added first-type header corresponds to the NID:SID bound to the ingress interface. This method allows electronic devices to determine the transmission path for service packet forwarding without configuring a large VXLAN header.
[0113] In some embodiments, combined with Figure 7 ,like Figure 8 As shown, in S602 above, the method by which the electronic device determines the forwarding method of the service message based on the attribute information of the outgoing and incoming interfaces of the service message and the type of the message header of the service message specifically includes: S801.
[0114] S801. Under the second preset conditions, the electronic device forwards service messages according to the second forwarding method.
[0115] The second preset condition includes: the ingress interface does not have a first binding relationship, the egress interface does not have a first binding relationship, and the business message contains a first type of message header.
[0116] The second forwarding method includes: modifying the sending address of the service packet to the media access control MAC address bound to the outgoing interface, and modifying the receiving address of the service packet to the MAC address bound to the incoming interface of the next switch.
[0117] Optionally, under the second preset condition, the specific steps for the electronic device to forward service packets according to the second forwarding method are similar to those in S602. The specific steps for the electronic device to forward service packets according to the second forwarding method can be found in S602, and will not be elaborated further here.
[0118] In this embodiment, the interface information corresponding to the next node in the service packet can be determined based on the information in the first type of packet header using a second forwarding method. This method allows electronic devices to determine the transmission path for service packet forwarding without configuring a large VXLAN packet header.
[0119] In some embodiments, combined with Figure 8 ,like Figure 9 As shown, in the above S602, the method by which the electronic device determines the forwarding method of the service message based on the attribute information of the outgoing and incoming interfaces of the service message and the type of the message header of the service message specifically includes: S901.
[0120] S901. Under the third preset condition, the electronic device forwards the service message according to the third forwarding method.
[0121] The second preset condition includes: the ingress interface does not have a first binding relationship, the egress interface has a first binding relationship, and the business message contains a first type of message header.
[0122] The third forwarding method includes: deleting the first type of message header contained in the service message, modifying the sending address of the service message to the media access control MAC address bound to the outgoing interface, and modifying the receiving address of the service message to the MAC address bound to the ingoing interface of the next virtual machine.
[0123] Optionally, under the third preset condition, the specific steps for the electronic device to forward service packets according to the third forwarding method are similar to those in S602. The specific steps for the electronic device to forward service packets according to the third forwarding method can be found in S602, and will not be elaborated further here.
[0124] In this embodiment, the interface information corresponding to the next node in the service packet can be determined based on the information in the first type packet header using a third forwarding method, and the first type packet header contained in the service packet can be removed. In this way, electronic devices can determine the transmission path for service packet forwarding without configuring a large VXLAN packet header.
[0125] In some embodiments, combined with Figure 9 ,like Figure 10 As shown, the data forwarding method also includes: S1001-S1002.
[0126] S1001. When the first preset condition is met, the electronic device determines whether the preset identifier bound to the input interface is consistent with any preset identifier in the preset forwarding table.
[0127] The preset forwarding table is used to record the correspondence between pre-set forwarding rules and preset identifiers.
[0128] S1002. When the preset identifier bound to the ingress interface is inconsistent with any preset identifier in the preset forwarding table, the electronic device discards the service message.
[0129] Specifically, when the preset identifier bound to the ingress interface (also known as the identifier corresponding to the first binding relationship) is inconsistent with the preset identifier stored in the preset forwarding table, it indicates that the service packet is not forwarded by the switch. Therefore, the service packet needs to be discarded to avoid forwarding errors.
[0130] In this embodiment of the application, the system compares the preset identifier in the forwarding table with the preset identifier bound to the ingress interface to determine whether the service message has been forwarded incorrectly.
[0131] In some embodiments, combined with Figure 10 ,like Figure 11As shown, before the electronic device obtains the interface information of the first interface in the target switch, the data forwarding method further includes: S1101-S1103.
[0132] S1101, The electronic device obtains the preset transmission path.
[0133] The preset transmission path is a pre-defined transmission path between multiple switches.
[0134] For example, in combination Figure 3 Leaf switch 102 and virtual machine 105 can be configured with static routing protocols or other dynamic routing protocols. Leaf switch 103 and spine switch 104 can be configured as BGP neighbors. Spine switch 104 can be configured as a route reflector (RR), and leaf switches can be configured as routing clients. In this scenario, the electronic device can control leaf switch 103 to send the routing information of virtual machine 105 (including 2001::1, with NID:SID attributes of 1:0) to spine switch 104 according to the table formats in Tables 3 and 4, and modify the next hop to itself. Then, the electronic device can record this preset transmission path in the routing information base and the preset forwarding table.
[0135] Table 2 illustrates one style of the updated routing information database: Table 2
[0136] Referring to Table 3, a style of an extended table for recording NIDs is shown: Table 3
[0137] Referring to Table 4, a style of an extended table for recording SIDs is shown: Table 4
[0138] S1102. The electronic device determines the preset identifier corresponding to the preset transmission path based on the preset transmission path.
[0139] For example, in combination Figure 3 Assume that the address of virtual machine device 105 is 2001::1, and the ingress interface of leaf switch 103 has a first binding relationship, with the bound NID:SID being 1:0. In this case, the electronic device can use 1:0 and 2001::1 as the preset identifier corresponding to this forwarding path.
[0140] S1103. The electronic device inputs the preset identifier into the preset routing table and generates a preset forwarding table.
[0141] Optionally, Table 5 shows the data structure of a preset forwarding table.
[0142] Table 5
[0143] Optionally, when the first preset condition is met, one implementation of the electronic device determining whether the preset identifier bound to the ingress interface matches any preset identifier in the preset forwarding table is as follows: When the first preset condition is met, the electronic device sends a Border Gateway Protocol (BGP) update command (also known as a route advertisement) to both the leaf switch and the spine switch. After receiving the BGP update command, the electronic device controls the leaf switch and the spine switch to update the routing information base (RIB) and the preset forwarding information base (FIB) according to the extended content.
[0144] The extended content includes: an extended table recording NIDs and an extended table recording SIDs.
[0145] In this embodiment, the electronic device can pre-configure forwarding rules and set a corresponding preset identifier for each forwarding rule. This ensures that correct forwarding can be completed without a long VXLAN header.
[0146] In some embodiments, Figure 12 This diagram illustrates an overall flowchart of yet another data forwarding method provided in an embodiment of this application. Figure 12 As shown, the overall process of the data forwarding method provided in this application embodiment includes: S1201-S1213. The specific implementation process of steps S1201-S1213 has been described in the above embodiment and will not be repeated here.
[0147] The foregoing mainly describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, it includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0148] This application embodiment can divide the data forwarding device into functional modules according to the above method example. For example, each function can be divided into its own functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. Optionally, the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0149] like Figure 13 The diagram shown is a structural schematic of a data forwarding device provided in an embodiment of this application. This data forwarding device can be used to perform... Figures 6-12 The data forwarding method shown. Figure 13 The data forwarding device shown includes: an acquisition unit 1301 and a determination unit 1302.
[0150] The acquisition unit 1301 is used to acquire service messages; the determination unit 1302 is used to determine the forwarding method of the service message based on the attribute information of the outgoing and incoming interfaces of the service message and the type of the message header of the service message.
[0151] Optionally, the determining unit 1302 is specifically used to: forward service packets according to a first forwarding method under a first preset condition; wherein, the first preset condition includes: the ingress interface has a first binding relationship, the egress interface does not have a first binding relationship, and the service packet does not contain a first type packet header; the first forwarding method includes: adding a first type packet header to the service packet, modifying the sending address of the service packet to the media access control MAC address bound to the egress interface, and modifying the receiving address of the service packet to the MAC address bound to the ingress interface of the next switch; the first type packet header is a packet header carrying a preset identifier; the preset identifier includes: network authentication code NID and security identifier code SID; the first binding relationship is the binding relationship between the egress interface, the ingress interface and the preset identifier.
[0152] Optionally, the determining unit 1302 is specifically used to: forward service packets according to a second forwarding method under a second preset condition; wherein, the second preset condition includes: the ingress interface does not have a first binding relationship, the egress interface does not have a first binding relationship, and the service packet contains a first type of packet header; the second forwarding method includes: modifying the sending address of the service packet to the media access control MAC address bound to the egress interface, and modifying the receiving address of the service packet to the MAC address bound to the ingress interface of the next switch.
[0153] Optionally, the determining unit 1302 is specifically used to: forward service packets according to a third forwarding method under a third preset condition; wherein, the second preset condition includes: the ingress interface does not have a first binding relationship, the egress interface has a first binding relationship, and the service packet contains a first type of packet header; the third forwarding method includes: deleting the first type of packet header contained in the service packet, modifying the sending address of the service packet to the media access control MAC address bound to the egress interface, and modifying the receiving address of the service packet to the MAC address bound to the ingress interface of the next virtual machine.
[0154] Optionally, the determining unit 1302 is further configured to: when the first preset condition is met, determine whether the preset identifier bound to the ingress interface is consistent with any preset identifier in the preset forwarding table; the preset forwarding table is used to record the correspondence between the preset forwarding rules and the preset identifiers; when the preset identifier bound to the ingress interface is inconsistent with any preset identifier in the preset forwarding table, discard the service packet.
[0155] Optionally, before obtaining the interface information of the first interface in the target switch, the acquisition unit 1301 is also used to obtain a preset transmission path; the preset transmission path is a pre-defined transmission information path between multiple switches; the determination unit 1302 determines the preset identifier corresponding to the preset transmission path based on the preset transmission path; and inputs the preset identifier into the preset routing table to generate a preset forwarding table.
[0156] This application also provides a computer-readable storage medium, which includes computer-executable instructions. When the computer-executable instructions are run on a computer, the computer performs the data forwarding method provided in the above embodiments.
[0157] This application also provides a computer program that can be directly loaded into a memory and contains software code. After being loaded and executed by a computer, the computer program can implement the data forwarding method provided in the above embodiments.
[0158] Those skilled in the art will recognize that, in one or more of the examples above, the functions described in this application can be implemented using hardware, software, firmware, or any combination thereof. When implemented in software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer-readable storage media and communication media, wherein communication media include any medium that facilitates the transmission of a computer program from one place to another. Storage media can be any available medium accessible to a general-purpose or special-purpose computer.
[0159] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0160] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the shown or discussed mutual couplings or direct couplings or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms. Units described as separate components may or may not be physically separate; components shown as units may be one physical unit or multiple physical units, i.e., they may be located in one place or distributed in multiple different places. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0161] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0162] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A data forwarding method, characterized in that, include: Obtain business messages; Based on the attribute information of the outgoing and incoming interfaces of the service message, and the type of the service message header, the forwarding method of the service message is determined, including: Under the first preset conditions, the service message is forwarded according to the first forwarding method; The first preset condition includes: the ingress interface has a first binding relationship, the egress interface does not have the first binding relationship, and the service message does not contain a first type of message header; The first forwarding method includes: adding the first type of packet header to the service packet, modifying the sending address of the service packet to the media access control MAC address bound to the outgoing interface, and modifying the receiving address of the service packet to the MAC address bound to the ingoing interface of the next switch; The first type of message header is a message header carrying a preset identifier; the preset identifier includes: Network Authentication Code (NID) and Security Identifier (SID); the first binding relationship is the binding relationship between the outgoing interface, the incoming interface and the preset identifier; Under the second preset conditions, the service message is forwarded according to the second forwarding method; The second preset condition includes: the ingress interface does not have the first binding relationship, the egress interface does not have the first binding relationship, and the service message contains a first type of message header; The second forwarding method includes: modifying the sending address of the service packet to the media access control MAC address bound to the outgoing interface, and modifying the receiving address of the service packet to the MAC address bound to the incoming interface of the next switch; Under the third preset condition, the service message is forwarded according to the third forwarding method; The third preset condition includes: the ingress interface does not have the first binding relationship, the egress interface has the first binding relationship, and the service message contains a first type message header; The third forwarding method includes: deleting the first type of packet header contained in the service packet, modifying the sending address of the service packet to the media access control MAC address bound to the outgoing interface, and modifying the receiving address of the service packet to the MAC address bound to the ingoing interface of the next virtual machine.
2. The method according to claim 1, characterized in that, Also includes: When the first preset condition is met, it is determined whether the preset identifier bound to the ingress interface is consistent with any preset identifier in the preset forwarding table; The preset forwarding table is used to record the correspondence between the preset forwarding rules and the preset identifier; When the preset identifier bound to the ingress interface is inconsistent with any preset identifier in the preset forwarding table, the service message is discarded.
3. The method according to claim 2, characterized in that, Also includes: Obtain a preset transmission path; the preset transmission path is a pre-defined transmission information path between multiple switches; Based on the preset transmission path, determine the preset identifier corresponding to the preset transmission path; The preset identifier is input into the preset routing table to generate the preset forwarding table.
4. A data forwarding device, characterized in that, include: Acquiring and determining units; The acquisition unit is used to acquire service messages; The determining unit is used to determine the forwarding method of the service message based on the attribute information of the outgoing and incoming interfaces of the service message and the type of the message header of the service message. The determining unit is specifically used for: Under the first preset conditions, the service message is forwarded according to the first forwarding method; The first preset condition includes: the ingress interface has a first binding relationship, the egress interface does not have the first binding relationship, and the service message does not contain a first type of message header; The first forwarding method includes: adding the first type of packet header to the service packet, modifying the sending address of the service packet to the media access control MAC address bound to the outgoing interface, and modifying the receiving address of the service packet to the MAC address bound to the ingoing interface of the next switch; The first type of message header is a message header carrying a preset identifier; the preset identifier includes: Network Authentication Code (NID) and Security Identifier (SID); the first binding relationship is the binding relationship between the outgoing interface, the incoming interface and the preset identifier; The determining unit is specifically used for: Under the second preset conditions, the service message is forwarded according to the second forwarding method; The second preset condition includes: the ingress interface does not have the first binding relationship, the egress interface does not have the first binding relationship, and the service message contains a first type of message header; The second forwarding method includes: modifying the sending address of the service packet to the media access control MAC address bound to the outgoing interface, and modifying the receiving address of the service packet to the MAC address bound to the incoming interface of the next switch; The determining unit is specifically used for: Under the third preset condition, the service message is forwarded according to the third forwarding method; The third preset condition includes: the ingress interface does not have the first binding relationship, the egress interface has the first binding relationship, and the service message contains a first type message header; The third forwarding method includes: deleting the first type of packet header contained in the service packet, modifying the sending address of the service packet to the media access control MAC address bound to the outgoing interface, and modifying the receiving address of the service packet to the MAC address bound to the ingoing interface of the next virtual machine.
5. A data forwarding device, characterized in that, It includes a memory and a processor; the memory is used to store computer execution instructions, and the processor is connected to the memory via a bus; when the data forwarding device is running, the processor executes the computer execution instructions stored in the memory, so that the data forwarding device performs the data forwarding method as described in any one of claims 1-3.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer-executable instructions that, when executed on a computer, cause the computer to perform the data forwarding method as described in any one of claims 1-3.
Citation Information
Patent Citations
VXLAN (Virtual eXtensible Local Area Network) message transmission method, network equipment and system
CN116418628A
Packet forwarding method and apparatus, and data center network
US20150271067A1