A data transmission method and apparatus based on a virtual switch
By setting up a neighbor table in the virtual switch and updating the MAC address mapping using the IP address and routing information of the target tunnel endpoint, the problems of high difficulty in cache modification and resource waste in VXLAN are solved, and stable packet forwarding is achieved.
Patent Information
- Application Number
- CN202411744412.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-11-30
AI Technical Summary
Existing technologies for finding the peer VTEP MAC address in VXLAN by modifying OVS to add caching functionality present challenges such as high modification difficulty and resource waste, especially when large data packets are transmitted, which requires a large amount of caching and may lead to idle resources.
By setting up a neighbor table in the virtual switch, the IP address and MAC address mapping in the neighbor table are updated using the IP address, subnet segment and routing information of the target tunnel endpoint, ensuring that packet forwarding is not lost and avoiding modifications to OVS.
This technology enables the retrieval of the target MAC address through the neighbor table without modifying OVS, ensuring that packet forwarding is not lost and avoiding resource waste and modification risks.
Smart Images

Figure CN119835203B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cloud network technology, and in particular to a data transmission method and apparatus based on a virtual switch. Background Technology
[0002] In VXLAN (Virtual eXtensible Local Area Network), existing technical solutions can add caching features to the OVS (Open vSwitch) itself. This allows the packet to be cached when the MAC (Media Access Control) address corresponding to the IP (Internet Protocol) address of the peer VTEP (VXLAN Virtual Tunnel Endpoint) cannot be found. The packet is then cached, and the MAC address of the peer VTEP's IP address is queried. After obtaining the MAC address, the cached packet is encapsulated and sent. This caching capability ensures that normal packets are not lost.
[0003] However, existing technical solutions require modifying OVS's capabilities to add caching functionality. Modifying OVS itself is quite difficult and carries the risk of impacting its inherent capabilities. Furthermore, with caching, in situations involving a large volume of instantaneous data packet transmission, if the MAC address of the peer's VTEP IP address has not yet been obtained, a large number of packets need to be cached immediately. This poses a significant challenge to caching capabilities, resulting in a high upper limit on the amount of data that needs to be cached and a large amount of resources allocated to caching. In most cases, this may lead to the idle and wasted resources. Summary of the Invention
[0004] In view of the above problems, a data transmission method and apparatus based on a virtual switch is proposed to overcome or at least partially solve the above problems, comprising:
[0005] A data transmission method based on a virtual switch, wherein the virtual switch has a neighbor table and is located in a local area network (LAN), the LAN including a gateway and multiple tunnel endpoints, the method comprising:
[0006] Based on the IP address, subnet segment, and routing information of the target tunnel endpoint, the subnet segment range of the local area network where the target tunnel endpoint is located and the IP address of the gateway are determined; wherein, the target tunnel endpoint is the tunnel endpoint that forwards the packet to be forwarded through the virtual switch;
[0007] Obtain a list of first IP addresses that are in the same subnet segment as the target tunnel endpoint from the flow table; wherein, the flow table is used to determine the packet forwarding path in the local area network;
[0008] The neighbor table is updated based on the first IP address list and the IP address of the gateway; wherein the neighbor table contains the correspondence between IP addresses and MAC addresses.
[0009] Based on the packet to be forwarded in the virtual switch, determine the target IP address and look up the target MAC address corresponding to the target IP address in the neighbor table;
[0010] The virtual switch forwards the packet to be forwarded to the target MAC address.
[0011] Optionally, when the target IP address is not within the subnet segment, the step of searching for the target MAC address corresponding to the target IP address in the neighbor table includes:
[0012] Obtain the MAC address of the gateway from the neighbor table and use it as the target MAC address.
[0013] Optionally, it also includes:
[0014] After each preset maintenance period, a maintenance operation on the neighbor table is performed once.
[0015] Optionally, the operation of maintaining the neighbor table includes:
[0016] Obtain a list of second IP addresses that are within the same subnet segment as the target tunnel endpoint from the flow table;
[0017] The neighbor table is updated based on the second IP address list and the IP address of the gateway.
[0018] Optionally, it also includes:
[0019] After each preset update time period, a verification operation is performed to check whether other tunnel endpoints within the same subnet segment as the target tunnel endpoint have changed, and the neighbor table is updated based on the verification results.
[0020] Optionally, the verification operation to check whether the IP addresses of the plurality of tunnel endpoints have changed includes:
[0021] Obtain a list of third IP addresses that are in the same subnet segment as the target tunnel endpoint from the flow table;
[0022] Verify whether the IP addresses in the third IP address list are consistent with those in the neighbor table, and obtain the verification result.
[0023] Optionally, updating the neighbor table based on the verification result includes:
[0024] If the verification results are inconsistent, the neighbor table is updated according to the third IP address list;
[0025] If the verification results are consistent, the neighbor table will not be updated.
[0026] A data transmission device based on a virtual switch, wherein the virtual switch is configured with a neighbor table, the virtual switch is located in a local area network (LAN), and the LAN includes a gateway and multiple tunnel endpoints. The device comprises:
[0027] The network segment range and gateway address acquisition module is used to determine the subnet range of the local area network where the target tunnel endpoint is located and the IP address of the gateway based on the IP address, subnet segment, and routing information of the target tunnel endpoint; wherein, the target tunnel endpoint is the tunnel endpoint that forwards the packet to be forwarded through the virtual switch;
[0028] The IP list acquisition module is used to acquire a first list of IP addresses that are in the same subnet segment as the target tunnel endpoint from the flow table; wherein, the flow table is used to determine the packet forwarding path in the local area network;
[0029] The neighbor table update module is used to update the neighbor table based on the first IP address list and the IP address of the gateway; wherein the neighbor table contains the correspondence between IP addresses and MAC addresses;
[0030] The target MAC address determination module is used to determine the target IP address based on the packet to be forwarded in the virtual switch, and to look up the target MAC address corresponding to the target IP address in the neighbor table;
[0031] The packet forwarding module is used to forward the packet to be forwarded to the target MAC address through the virtual switch.
[0032] An electronic device includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the data transmission method based on a virtual switch as described above.
[0033] A readable storage medium storing a computer program that, when executed by a processor, implements the data transmission method based on a virtual switch as described above.
[0034] The embodiments of the present invention have the following advantages:
[0035] In an embodiment of the present invention, the subnet segment range of the local area network where the target tunnel endpoint is located and the IP address of the gateway are determined based on the IP address, subnet segment, and routing information of the target tunnel endpoint. The target tunnel endpoint is a tunnel endpoint that forwards packets to be forwarded through the virtual switch. A first list of IP addresses within the same subnet segment range as the target tunnel endpoint is obtained from the flow table. The flow table is used to determine the packet forwarding path in the local area network. The neighbor table is updated based on the first IP address list and the IP address of the gateway. The neighbor table contains the correspondence between IP addresses and MAC addresses. The target IP address is determined based on the packet to be forwarded in the virtual switch, and the target MAC address corresponding to the target IP address is found in the neighbor table. The packet to be forwarded is forwarded to the target MAC address through the virtual switch. This achieves the goal of obtaining the MAC address corresponding to the target IP address through the neighbor table, thereby ensuring that the forwarding of normal packets is not lost and avoiding the risk that the virtual switch itself may be affected by modifying it to add caching functionality. Attached Figure Description
[0036] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the description of the present invention will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 This is a flowchart of the steps of a data transmission method based on a virtual switch provided in some embodiments of the present invention;
[0038] Figure 2 This is a flowchart illustrating the steps for updating a neighbor table according to some embodiments of the present invention;
[0039] Figure 3 This is a structural block diagram of a data transmission device based on a virtual switch provided in some embodiments of the present invention. Detailed Implementation
[0040] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0041] This application provides a method for identifying fraudulent numbers. The virtual switch is equipped with a neighbor table and is located in a local area network (LAN). The LAN includes a gateway and multiple tunnel endpoints.
[0042] In practical applications, VXLAN (Virtual Extensible Local Area Network) includes OVS (Virtual Switch), multiple VTEPs (VXLAN Tunnel Endpoints), and a gateway. The OVS is configured with a corresponding neighbor table.
[0043] Among them, VXLAN is a virtualized tunnel communication technology, which is an overlay network technology that uses a three-layer network to build a virtual two-layer network; OVS is an open-source virtual switch based on software implementation, supporting protocols such as OpenFlow, mainly used in virtual machine environments, and as a virtual switch, it supports multiple virtualization technologies; OpenFlow is a network communication protocol used in SDN (Software-Defined Networking) architecture for communication between controllers and repeaters to achieve packet forwarding and control separation; VTEP (VXLAN Tunnel Endpoints) is responsible for the encapsulation and decapsulation of VXLAN packets.
[0044] like Figure 1 The diagram illustrates a flowchart of a data transmission method based on a virtual switch, provided by some embodiments of the present invention. Specifically, it may include the following steps:
[0045] Step 101: Based on the IP address, subnet segment, and routing information of the target tunnel endpoint, confirm the subnet segment range of the local area network where the target tunnel endpoint is located and the IP address of the gateway; wherein, the target tunnel endpoint is the tunnel endpoint that forwards the packet to be forwarded through the virtual switch.
[0046] Based on the IP address, subnet segment, and routing information of the target tunnel endpoint, the subnet segment range and the IP address of the local area network gateway where the target tunnel endpoint is located can be determined.
[0047] Specifically, the target VTEP forwards the packets to be forwarded through OVS. The subnet range of the local area network where the target VTEP is located and the IP address of the local area network gateway can be determined by the target VTEP's IP address, subnet segment, and route information.
[0048] Step 102: Obtain a list of first IP addresses that are in the same subnet segment as the target tunnel endpoint from the flow table; wherein the flow table is used to determine the packet forwarding path in the local area network.
[0049] After obtaining the subnet segment range of the local area network where the target tunnel endpoint is located, you can obtain the list of first IP addresses in the same subnet segment range as the target tunnel endpoint from the flow table.
[0050] Specifically, after obtaining the subnet range of the VXLAN where the target VTEP is located, the IP address list of the peer VTEP whose IP address is in the same subnet range as the target VTEP can be obtained from the OpenFlow flow table through the subnet range, i.e., the first IP address list.
[0051] OpenFlow flow tables are a key component of the OpenFlow protocol, used to define and manage how network devices (such as switches and routers) process data packets. An OpenFlow flow table consists of multiple flow entries, each defining how to process data packets, or messages, that match specific conditions.
[0052] Step 103: Update the neighbor table according to the first IP address list and the IP address of the gateway; wherein the neighbor table contains the correspondence between IP addresses and MAC addresses.
[0053] After obtaining the list of first IP addresses within the same subnet segment as the target tunnel endpoint from the flow table, the neighbor table corresponding to OVS can be updated using network diagnostic tools, combined with the previously obtained LAN gateway IP address. The neighbor table, also known as the ARP (Address Resolution Protocol) table, is a data structure in network devices (such as routers, switches, and hosts) used to store the mapping between IP addresses and MAC addresses. It is used in VXLAN to resolve IP addresses to their corresponding MAC addresses for packet forwarding.
[0054] Specifically, after obtaining the first list of VTEP IP addresses that are in the same subnet segment as the target VTEP's IP address from the OpenFlow flow table, the IP addresses in the first list and the gateway IP address in the VXLAN can be pinged sequentially to obtain the MAC addresses corresponding to the IP addresses in the first list and the gateway IP address in the VXLAN. Then, the IP addresses in the first list, the gateway IP address in the VXLAN, and the corresponding MAC addresses are updated and recorded in the neighbor table.
[0055] Ping is a network diagnostic tool used to test network connectivity reachability and latency. By sending ICMP (Internet Control Message Protocol) echo request messages to the target host and waiting for an echo response, it can determine whether the target host is online and the quality of the network connection. In this invention, ping can be used to obtain the MAC address of the corresponding IP address.
[0056] Step 104: Determine the target IP address based on the packet to be forwarded in the virtual switch, and search for the target MAC address corresponding to the target IP address in the neighbor table.
[0057] The target IP address can be determined based on the packets to be forwarded in the virtual switch, and then the target MAC address corresponding to the target IP address can be found in the neighbor table of the virtual switch.
[0058] When the target VTEP forwards packets through OVS, the target IP address can be determined based on the packet, and then the corresponding MAC address, i.e., the target MAC address, can be found from the switch corresponding to OVS using the target IP address.
[0059] In some embodiments of the present invention, when the target IP address is not within the subnet segment, the step of searching for the target MAC address corresponding to the target IP address in the neighbor table includes:
[0060] Obtain the MAC address of the gateway from the neighbor table and use it as the target MAC address.
[0061] Once the target IP address is determined based on the packets to be forwarded in the virtual switch, and the target IP address is not within the local area network subnet segment, the MAC address of the local area network gateway is obtained from the neighbor table and used as the target MAC address.
[0062] Specifically, after determining the target IP address based on the packet to be forwarded by the target VTEP through OVS, if the target IP address is the IP address of a VTEP that is not in the same subnet segment as the target VTEP's IP address, then the MAC address of the gateway in VXLAN is obtained from the neighbor table corresponding to OVS as the target MAC address.
[0063] In VXLAN, a gateway is a crucial network device that acts as a bridge between different VXLANs, allowing packets to be transmitted from one network to another. Gateways are typically used to connect VXLANs to external networks and are responsible for functions such as network address translation, routing, and packet forwarding.
[0064] Step 105: Forward the packet to be forwarded to the target MAC address through the virtual switch.
[0065] After obtaining the target MAC address, the virtual switch can forward the packets to be forwarded to the target MAC address, which can be the peer tunnel endpoint or the local area network gateway.
[0066] Specifically, after OVS obtains the target MAC address of the packet to be sent, it forwards the packet to the target MAC address. This target MAC address can be the peer VTEP or the gateway in VXLAN.
[0067] In some embodiments of the present invention, the solution further includes:
[0068] After each preset maintenance period, a maintenance operation on the neighbor table is performed once.
[0069] Based on the aging time of the OVS neighbor table, the neighbor table needs to be maintained regularly within the aging time. For example, the corresponding neighbor table of OVS needs to be maintained every 10 minutes.
[0070] In some embodiments of the present invention, the operation of maintaining the neighbor table includes:
[0071] Sub-step 11: Obtain a list of second IP addresses from the flow table that are within the same subnet segment as the target tunnel endpoint.
[0072] When maintaining the neighbor table corresponding to the virtual switch, you can first obtain a list of second IP addresses that are in the same subnet segment as the target tunnel endpoint from the flow table.
[0073] Specifically, when maintaining the neighbor table corresponding to OVS, the same method as mentioned above can be used. By using the subnet segment range, the list of IP addresses of the peer VTEPs that are in the same subnet segment range as the target VTEP can be obtained from the OpenFlow flow table, which is the second IP address list.
[0074] Sub-step 12: Update the neighbor table based on the second IP address list and the IP address of the gateway.
[0075] After obtaining the second list of IP addresses, you can use network diagnostic tools to update the neighbor table corresponding to the virtual switch.
[0076] Specifically, after obtaining the second IP address list, the IP addresses in the second IP address list and the IP address of the gateway in the VXLAN can be pinged sequentially to obtain the MAC address corresponding to the IP address in the second IP address list and the IP address of the gateway in the VXLAN. Then, the neighbor table can be updated using the IP address in the second IP address list, the IP address of the gateway in the VXLAN, and the corresponding MAC address.
[0077] In some embodiments of the present invention, the method further includes:
[0078] After each preset update time period, a verification operation is performed to check whether other tunnel endpoints within the same subnet segment as the target tunnel endpoint have changed, and the neighbor table is updated based on the verification results.
[0079] In scenarios where the peer VTEP IP address is increased, such as when a new virtual switch is created or a virtual switch is migrated, the virtual switch may be assigned to a VTEP IP address that does not yet exist in the OpenFlow flow table. The interval from when the OpenFlow flow table is issued to when the virtual switch is actually running and accessible may be measured in minutes. Therefore, a preset update time period within a minute is selected to perform a verification operation on whether other tunnel endpoints in the same subnet segment as the target tunnel endpoint have changed.
[0080] In practical applications, since the OpenFlow flow table changes in real time, in order to obtain the IP address column of the peer VTEP in the OpenFlow flow table that is in the same subnet segment as the target VTEP more promptly, and update the corresponding neighbor table in OVS in a timely manner, the preset update time period can be every 30 seconds to perform a verification operation to check whether the peer VTEP in the same subnet segment as the target VTEP has changed, and update the neighbor table according to the verification result.
[0081] In some embodiments of the present invention, the verification operation of whether the IP addresses of the plurality of tunnel endpoints have changed includes:
[0082] Sub-step 31: Obtain from the flow table a list of third IP addresses that are within the same subnet segment as the target tunnel endpoint.
[0083] You can obtain a list of third IP addresses that are in the same subnet segment as the IP address of the target tunnel endpoint from the flow table.
[0084] Specifically, you can obtain a list of IP addresses of peer VTEPs within the same subnet segment as the target VTEP from the OpenFlow flow table; this is known as the third IP address list.
[0085] Sub-step 32: Verify whether the IP addresses in the third IP address list are consistent with those in the neighbor table, and obtain the verification result.
[0086] After obtaining the third IP address list, you can verify whether the IP addresses in the third IP address list are consistent with the IP addresses in the neighbor table corresponding to OVS, thereby obtaining the verification result.
[0087] In some embodiments of the present invention, updating the neighbor table based on the verification result includes:
[0088] If the verification results are inconsistent, the neighbor table is updated according to the third IP address list.
[0089] If the verification results are inconsistent, the neighbor table corresponding to the virtual switch can be updated using a network diagnostic tool based on the third IP address list.
[0090] Specifically, if the verification results are inconsistent, the MAC addresses corresponding to the IP addresses in the third IP address list can be obtained by pinging them sequentially. Then, the neighbor table can be updated using the IP addresses in the third IP address list and their corresponding MAC addresses.
[0091] If the verification results are consistent, the neighbor table will not be updated.
[0092] If the verification results are consistent, it means that the peer VTEP whose IP address is in the same subnet segment as the target VTEP has not changed, so the neighbor table corresponding to OVS is not updated.
[0093] It should be noted that if changes occur, the neighbors corresponding to OVS will be updated; otherwise, they will not be updated. Specifically, every 30-second preset update interval, a list of IP addresses of peer VTEPs within the same subnet segment as the target VTEP's IP address (the third IP address list) will be retrieved from the OpenFlow flow table and compared with the list retrieved from the OpenFlow flow table for the previous preset update interval.
[0094] In an embodiment of the present invention, the subnet segment range of the local area network where the target tunnel endpoint is located and the IP address of the gateway are determined based on the IP address, subnet segment, and routing information of the target tunnel endpoint. The target tunnel endpoint is a tunnel endpoint that forwards packets to be forwarded through the virtual switch. A first list of IP addresses within the same subnet segment range as the target tunnel endpoint is obtained from the flow table. The flow table is used to determine the packet forwarding path in the local area network. The neighbor table is updated based on the first IP address list and the IP address of the gateway. The neighbor table contains the correspondence between IP addresses and MAC addresses. The target IP address is determined based on the packet to be forwarded in the virtual switch, and the target MAC address corresponding to the target IP address is found in the neighbor table. The packet to be forwarded is forwarded to the target MAC address through the virtual switch. This achieves the goal of obtaining the MAC address corresponding to the target IP address through the neighbor table, thereby ensuring that the forwarding of normal packets is not lost and avoiding the risk that the virtual switch itself may be affected by modifying it to add caching functionality.
[0095] Reference Figure 2 The diagram illustrates a flowchart of steps for updating a neighbor table according to some embodiments of the present invention, which may specifically include the following steps:
[0096] 1. Obtain the subnet segment range of the target vetp's IP address and its next-hop gateway address (i.e., the IP address of the LAN gateway);
[0097] 2. Obtain a list of IP addresses of peer VTEPs within the same subnet segment as the target VTEP from the OpenFlow flow table;
[0098] 3. Verify whether the IP address list obtained this time is consistent with the IP address list obtained last time;
[0099] 4. If the results are consistent, proceed to step 5; otherwise, proceed to step 6.
[0100] 5. Do not update the neighbor table;
[0101] 6. Using the obtained list of IP addresses, update the MAC address corresponding to the IP address of the peer VTEP by pinging (i.e., update the neighbor table of OVS).
[0102] 7. Update the list of IP addresses of peer VTEPs within the same subnet segment as the target VTEP's IP address within the period, as well as the MAC address corresponding to the IP address of the gateway (i.e., the LAN gateway) in VXLAN (i.e., the operation of maintaining the neighbor table corresponding to OVS at preset maintenance time intervals).
[0103] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0104] Reference Figure 3 The diagram illustrates a structural schematic of a data transmission device based on a virtual switch according to some embodiments of the present invention. The virtual switch is configured with a neighbor table and is located in a local area network (LAN). The LAN includes a gateway and multiple tunnel endpoints, and may specifically include the following modules:
[0105] The network segment range and gateway address acquisition module 301 is used to determine the subnet range of the local area network where the target tunnel endpoint is located and the IP address of the gateway based on the IP address of the target tunnel endpoint, the subnet segment, and the routing information; wherein, the target tunnel endpoint is a tunnel endpoint that forwards packets to be forwarded through the virtual switch.
[0106] IP list acquisition module 302 is used to acquire a first IP address list from the flow table that is in the same subnet segment as the target tunnel endpoint; wherein, the flow table is used to determine the packet forwarding path in the local area network;
[0107] The neighbor table update module 303 is used to update the neighbor table according to the first IP address list and the IP address of the gateway; wherein, the neighbor table contains the correspondence between IP addresses and MAC addresses;
[0108] The target MAC address determination module 304 is used to determine the target IP address based on the packet to be forwarded in the virtual switch, and to look up the target MAC address corresponding to the target IP address in the neighbor table;
[0109] The packet forwarding module 305 is used to forward the packet to be forwarded to the target MAC address through the virtual switch.
[0110] In one embodiment of the present invention, when the target IP address is not within the subnet segment, the step of searching for the target MAC address corresponding to the target IP address in the neighbor table includes:
[0111] The target MAC address determination submodule is used to obtain the MAC address of the gateway from the neighbor table as the target MAC address.
[0112] In one embodiment of the present invention, it further includes:
[0113] The neighbor table maintenance module is used to perform a maintenance operation on the neighbor table once every preset maintenance time period.
[0114] In one embodiment of the present invention, the neighbor table maintenance module includes:
[0115] The second IP list acquisition submodule is used to acquire a list of second IP addresses that are in the same subnet segment as the target tunnel endpoint from the flow table.
[0116] The second neighbor table update submodule is used to update the neighbor table based on the second IP address list and the IP address of the gateway.
[0117] In one embodiment of the present invention, it further includes:
[0118] The neighbor table real-time update module is used to perform a verification operation on whether other tunnel endpoints within the same subnet segment as the target tunnel endpoint have changed after each preset update time period, and update the neighbor table according to the verification result.
[0119] In one embodiment of the present invention, the real-time neighbor table update module includes:
[0120] The third IP list acquisition submodule is used to acquire a list of third IP addresses that are in the same subnet segment as the target tunnel endpoint from the flow table;
[0121] The verification result acquisition submodule is used to verify whether the IP addresses in the third IP address list are consistent with those in the neighbor table, and to obtain the verification result.
[0122] In one embodiment of the present invention, the real-time neighbor table update module includes:
[0123] The third neighbor table update submodule is used to update the neighbor table according to the third IP address list when the verification results are inconsistent.
[0124] The neighbor table data maintenance submodule is used to prevent updating the neighbor table if the verification results are consistent.
[0125] In an embodiment of the present invention, the subnet segment range of the local area network where the target tunnel endpoint is located and the IP address of the gateway are determined based on the IP address, subnet segment, and routing information of the target tunnel endpoint. The target tunnel endpoint is a tunnel endpoint that forwards packets to be forwarded through the virtual switch. A first list of IP addresses within the same subnet segment range as the target tunnel endpoint is obtained from the flow table. The flow table is used to determine the packet forwarding path in the local area network. The neighbor table is updated based on the first IP address list and the IP address of the gateway. The neighbor table contains the correspondence between IP addresses and MAC addresses. The target IP address is determined based on the packet to be forwarded in the virtual switch, and the target MAC address corresponding to the target IP address is found in the neighbor table. The packet to be forwarded is forwarded to the target MAC address through the virtual switch. This achieves the goal of obtaining the MAC address corresponding to the target IP address through the neighbor table, thereby ensuring that the forwarding of normal packets is not lost and avoiding the risk that the virtual switch itself may be affected by modifying it to add caching functionality.
[0126] Some embodiments of the present invention also provide an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the method described above.
[0127] Some embodiments of the present invention also provide a computer-readable storage medium on which a computer program is stored, and which, when executed by a processor, implements the method described above.
[0128] Some embodiments of the present invention also provide a computer program product, including a computer program that, when executed by a processor, implements the method described above.
[0129] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0130] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0131] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0132] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0133] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0134] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0135] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0136] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the present invention.
[0137] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes the aforementioned element.
[0138] The above provides a detailed description of a data transmission method and apparatus based on a virtual switch. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A data transmission method based on a virtual switch, characterized in that, The virtual switch has a neighbor table configured, and the virtual switch is located in a local area network (LAN). The LAN includes a gateway and multiple tunnel endpoints. The method includes: Based on the IP address, subnet segment, and routing information of the target tunnel endpoint, the subnet segment range of the local area network where the target tunnel endpoint is located and the IP address of the gateway are determined; wherein, the target tunnel endpoint is the tunnel endpoint that forwards the packet to be forwarded through the virtual switch; Obtain a list of first IP addresses that are in the same subnet segment as the target tunnel endpoint from the flow table; wherein, the flow table is used to determine the packet forwarding path in the local area network; The neighbor table is updated based on the first IP address list and the IP address of the gateway; wherein the neighbor table contains the correspondence between IP addresses and MAC addresses. Based on the packet to be forwarded in the virtual switch, determine the target IP address and look up the target MAC address corresponding to the target IP address in the neighbor table; The virtual switch forwards the packet to be forwarded to the target MAC address.
2. The method according to claim 1, characterized in that, When the target IP address is not within the subnet segment, the step of searching for the target MAC address corresponding to the target IP address in the neighbor table includes: Obtain the MAC address of the gateway from the neighbor table and use it as the target MAC address.
3. The method according to any one of claims 1-2, characterized in that, Also includes: After each preset maintenance period, a maintenance operation on the neighbor table is performed once.
4. The method according to claim 3, characterized in that, The operation of maintaining the neighbor table includes: Obtain a list of second IP addresses that are within the same subnet segment as the target tunnel endpoint from the flow table; The neighbor table is updated based on the second IP address list and the IP address of the gateway.
5. The method according to any one of claims 1-2, characterized in that, Also includes: After each preset update time period, a verification operation is performed to check whether other tunnel endpoints within the same subnet segment as the target tunnel endpoint have changed, and the neighbor table is updated based on the verification results.
6. The method according to claim 5, characterized in that, The verification operation to check whether the IP addresses of the multiple tunnel endpoints have changed includes: Obtain a list of third IP addresses that are in the same subnet segment as the target tunnel endpoint from the flow table; Verify whether the IP addresses in the third IP address list are consistent with those in the neighbor table, and obtain the verification result.
7. The method according to claim 6, characterized in that, The step of updating the neighbor table based on the verification result includes: If the verification results are inconsistent, the neighbor table is updated according to the third IP address list; If the verification results are consistent, the neighbor table will not be updated.
8. A data transmission device based on a virtual switch, characterized in that, The virtual switch has a neighbor table and is located in a local area network (LAN). The LAN includes a gateway and multiple tunnel endpoints. The device includes: The network segment range and gateway address acquisition module is used to determine the subnet range of the local area network where the target tunnel endpoint is located and the IP address of the gateway based on the IP address, subnet segment, and routing information of the target tunnel endpoint; wherein, the target tunnel endpoint is the tunnel endpoint that forwards the packet to be forwarded through the virtual switch; The IP list acquisition module is used to acquire a first list of IP addresses that are in the same subnet segment as the target tunnel endpoint from the flow table; wherein, the flow table is used to determine the packet forwarding path in the local area network; The neighbor table update module is used to update the neighbor table based on the first IP address list and the IP address of the gateway; wherein the neighbor table contains the correspondence between IP addresses and MAC addresses; The target MAC address determination module is used to determine the target IP address based on the packet to be forwarded in the virtual switch, and to look up the target MAC address corresponding to the target IP address in the neighbor table; The packet forwarding module is used to forward the packet to be forwarded to the target MAC address through the virtual switch.
9. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the data transmission method based on a virtual switch as described in any one of claims 1 to 7.
10. A readable storage medium, characterized in that, The readable storage medium stores a computer program that, when executed by a processor, implements the data transmission method based on a virtual switch as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for sending and receiving message
CN107770072A
System and method for dynamic tuning of neighbor aging
US20220224626A1