Network interface management method and device for distributed system, electronic device, and storage medium
By identifying and creating logical interfaces in distributed systems, establishing interface management tables, processing data packets and updating plug-in and unplug events, the problem of inefficient network interface management in distributed systems is solved, and efficient network interface collaborative processing is achieved.
Patent Information
- Application Number
- CN202211710652.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2042-12-29
AI Technical Summary
In the prior art, effective unified management of network interfaces in distributed systems has not yet been achieved, resulting in low efficiency in collaborative processing of network interfaces between nodes.
Dynamic management of network interfaces in distributed systems is achieved by identifying local external network interfaces and creating logical interfaces, establishing an interface management table, receiving and marking remote mapping relationships, processing data packets, and updating the interface management table during plug-in and unplug events.
It realizes efficient management and message processing of network interfaces in distributed systems, improves the collaborative processing capabilities between nodes, has strong adaptability, and can cope with the plug-in and unplug events of network interfaces.
Smart Images

Figure CN116016516B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a network interface management method and device for a distributed system, an electronic device, and a computer-readable storage medium. Background Art
[0002] Connecting two or more stand-alone devices forms a distributed network. If this distributed network effectively manages the network interfaces of different nodes (stand-alone devices) in the network, allowing each node to manage and use the network interfaces of all nodes, the distributed network becomes a logically distributed system or device. The different nodes in a distributed system can be devices with both network interfaces and business processing capabilities, devices with only business processing capabilities but no network interfaces for external services, or devices that only provide external network interfaces but no business processing capabilities. The specific capabilities required by individual nodes are determined by the overall functional requirements of the system.
[0003] Currently, there is an urgent need for a solution to achieve network interface management of distributed systems. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to provide a network interface management method and device for a distributed system, an electronic device, and a computer-readable storage medium for implementing network interface management of a distributed system.
[0005] In one aspect, the present application provides a network interface management method for a distributed system, which is applied to a node of the distributed system, wherein the distributed system includes multiple nodes, including:
[0006] Identify local external network interfaces, create a local type logical interface for each external network interface, and store a mapping relationship between each external network interface and its corresponding logical interface in a preset interface management table;
[0007] receiving a plurality of mapping relationships from other nodes of the distributed system, and creating a remote-type logical interface for the received mapping relationships;
[0008] Writing the received mapping relationship into the interface management table, and marking the logical interface in the received mapping relationship as a remote type in the interface management table;
[0009] Process the data message according to the interface management table.
[0010] Through the above measures, each node in the distributed system can manage the external network interface of the entire distributed system and the logical interface corresponding to the external network interface according to its own interface management table, and create logical interfaces corresponding to all network interfaces in the distributed system locally, thereby efficiently processing the messages of the entire distributed system based on the interface management table.
[0011] In one embodiment, the method further comprises:
[0012] The mapping relationship corresponding to the local external network interface is sent to other nodes of the distributed system.
[0013] Through this measure, other nodes can save the mapping relationship created by the node, create a logical interface indicated by the mapping relationship, and mark the logical interface in the mapping relationship as a remote type.
[0014] In one embodiment, the method further comprises:
[0015] If an external network interface is plugged or unplugged locally, add or delete the corresponding logical interface according to the plugging or unplugging event;
[0016] Add or delete a corresponding mapping relationship for the external network interface corresponding to the plug-in event in the interface management table; wherein the mapping relationship corresponding to the plug-in event includes a local type logical interface;
[0017] The plug-in and unplug-out events are sent to other nodes of the distributed system.
[0018] Through the above measures, when an external network interface plug-in or unplug-out event occurs locally, the node can update the interface management table and logical interface, and send the plug-in or unplug-out event to other nodes, so that other nodes update their own interface management tables and logical interfaces.
[0019] In one embodiment, the method further comprises:
[0020] If a remote plug-in or unplug-out event is received from another node in the distributed system, adding or deleting a corresponding logical interface according to the remote plug-in or unplug-out event;
[0021] In the interface management table, a corresponding mapping relationship is added or deleted for the external network interface corresponding to the remote plug and unplug event; wherein the mapping relationship corresponding to the remote plug and unplug event includes a remote type logical interface.
[0022] Through the above measures, when a remote plug-in or unplug-out event occurs in other nodes, the node can update the local interface management table and logical interface according to the remote plug-in or unplug-out event sent by other nodes.
[0023] In an embodiment, the processing the data packet according to the interface management table comprises:
[0024] polling all the network interfaces in the local system, if any network interface receives the data packet, judging whether the network interface is an internal network interface or an external network interface;
[0025] if the network interface is an internal network interface, obtaining label information carried by the data packet; wherein the label information indicates an external network interface receiving the data packet;
[0026] in the interface management table, searching for a logical interface corresponding to the external network interface indicated by the label information, and handing over the data packet to the searched logical interface for processing.
[0027] Through the above measures, the data packet exchanged in the distributed system can be indicated by the label information to the external network interface receiving the data packet, so that the logical interface corresponding to the external network interface can be searched for processing the data packet.
[0028] In an embodiment, the method further comprises:
[0029] if the network interface is an external network interface, judging whether the data packet needs to be forwarded to other nodes of the distributed system;
[0030] if not, in the interface management table, searching for a logical interface corresponding to the external network interface, and handing over the data packet to the searched logical interface for processing.
[0031] Through the above measures, for the data packet received by the external network interface, the logical interface corresponding to the external network interface can be directly used for processing.
[0032] In an embodiment, the method further comprises:
[0033] if the data packet needs to be forwarded to other nodes of the distributed system, adding label information to the data packet, the label information indicating the external network interface;
[0034] sending the data packet with the added label information to other nodes through an internal network interface.
[0035] Through the above measures, for the data packet received by the external network interface, the data packet can be processed by other nodes after adding label information to the data packet.
[0036] In an embodiment, the processing the data packet according to the interface management table comprises:
[0037] Obtain the data message sent by the application service, and determine whether the logical interface corresponding to the application service is of the local type;
[0038] If it is a local type, searching the interface management table for an external network interface corresponding to the logical interface, and delivering the data message to the packet sending function of the found external network interface;
[0039] If it is a remote type, the data message is handed over to the packet sending function of the internal network interface.
[0040] Through the above measures, the node can send data messages through the interface management table.
[0041] In another aspect, the present application provides an electronic device, comprising:
[0042] processor;
[0043] a memory for storing processor-executable instructions;
[0044] The processor is configured to execute the above-mentioned network interface management method for the distributed system.
[0045] In addition, the present application provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by a processor to implement the network interface management method of the above-mentioned distributed system. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments of the present application.
[0047] Figure 1 A schematic diagram of an application scenario of a network interface management method for a distributed system provided in one embodiment of the present application;
[0048] Figure 2 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application;
[0049] Figure 3 A flowchart of a network interface management method for a distributed system provided in one embodiment of the present application;
[0050] Figure 4 A schematic diagram of a message processing flow provided in an embodiment of the present application;
[0051] Figure 5 A schematic diagram of message forwarding within a distributed system provided in one embodiment of the present application;
[0052] Figure 6 A schematic diagram of a message processing flow provided in another embodiment of the present application;
[0053] Figure 7 A schematic diagram of the network architecture of a distributed system provided in one embodiment of the present application;
[0054] Figure 8 A block diagram of a network interface management device for a distributed system provided in one embodiment of the present application. DETAILED DESCRIPTION
[0055] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0056] Similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and should not be understood as indicating or implying relative importance.
[0057] Figure 1 Schematic diagram of the application scenario of the network interface management method of the distributed system provided in the embodiment of the present application. Figure 1 As shown, the application scenario includes multiple nodes 20 of a distributed system, each node 20 is peer-to-peer and can execute the network interface management method to manage the network interface on the distributed system. The distributed system of the present application can be a firewall, switch, router, etc.
[0058] like Figure 2 As shown, this embodiment provides an electronic device 1, including: at least one processor 11 and a memory 12, Figure 2 In the example, a processor 11 is used. Processor 11 and memory 12 are connected via bus 10. Memory 12 stores instructions executable by processor 11. Processor 11 executes these instructions, enabling electronic device 1 to perform all or part of the method described in the following embodiments. In one embodiment, electronic device 1 may be node 20, configured to perform the network interface management method for a distributed system.
[0059] The memory 12 can be implemented by any type of volatile or nonvolatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0060] The application further provides a computer readable storage medium, the storage medium storing a computer program, the computer program being executable by the processor 11 to complete the network interface management method of the distributed system provided by the application.
[0061] Referring to Figure 3 The flowchart of the network interface management method of the distributed system provided by an embodiment of the application is shown in Figure 3 The method can include the following steps 310-330.
[0062] Step 310: Identify the local external network interface, and create a local type of logical interface for each external network interface, and store the mapping relationship between each external network interface and its corresponding logical interface in a preset interface management table.
[0063] The application scheme can be applied to any node of the distributed system. When the distributed system is started, each node can initialize DPDK (Data Plane Development Kit), and the node can identify the local network interface (port) through the DPDK. Each node can be configured with a plurality of external network interfaces and internal network interfaces. The external network interface is used to receive and send messages outside the distributed system, and the internal network interface is used to receive and send messages inside the distributed system.
[0064] After a node identifies its own network interface, it can create a RX (Receive) queue and a TX (Transmit) queue for sending and receiving packets. For an external network interface, the node can create a local logical interface for it and, after creating the corresponding logical interface, set the external network interface's transmit and receive queue to the enabled (up) state. For an internal network interface, the node can directly set the internal network interface's transmit and receive queue to the enabled state.
[0065] After creating a logical interface for an external network interface, the node may store a mapping between the external network interface and its corresponding logical interface in a local interface management table. The interface management table may be in the form of an array, a hash table, or the like. The mapping may record a first identifier of the external network interface and a second identifier of the logical interface. Furthermore, the mapping may include the interface type of the logical interface.
[0066] Step 320: Receive several mapping relationships from other nodes in the distributed system, and create a remote-type logical interface for the received mapping relationships.
[0067] Step 330: Write the received mapping relationship into the interface management table, and mark the logical interface in the received mapping relationship as a remote type in the interface management table.
[0068] A node can receive multiple mappings from other nodes in a distributed system. Here, "other nodes" refer to nodes in the distributed system other than the node itself. The mappings created by these other nodes record the external network interfaces on these other nodes. Therefore, the logical interfaces on these mappings are of the remote type. The node can create remote logical interfaces for these received mappings, thereby creating local logical interfaces corresponding to the external network interfaces on these other nodes.
[0069] The node may write the received mapping relationship into the interface management table, and mark the logical interface in the received logical relationship as a remote type.
[0070] After summarizing the mapping relationships sent by all other nodes in the distributed system, the node can record all external network interfaces of the distributed system and the logical interfaces corresponding to all external network interfaces through its own interface management table, and create logical interfaces corresponding to all external network interfaces in the distributed system locally.
[0071] Step 340: Process the data message according to the interface management table.
[0072] The node can process data packets sent to the distributed system and data packets sent from the distributed system according to the interface management table.
[0073] Through the above measures, each node in the distributed system can manage the external network interfaces of the entire distributed system and the logical interfaces corresponding to the external network interfaces according to its own interface management table, and locally create logical interfaces corresponding to all network interfaces in the distributed system, thereby efficiently processing messages of the entire distributed system based on the interface management table. This application solution can effectively manage the network interfaces of distributed systems such as racks and stacks, and has good adaptability.
[0074] In one embodiment, after a node creates a mapping for its local external network interface, it can send the mapping to other nodes in the distributed system via the internal network interface. This allows other nodes to save the mapping created by the node, create the logical interface indicated by the mapping, and mark the logical interface in the mapping as remote.
[0075] In one embodiment, external network interfaces may be plugged or unplugged on each node of a distributed system. In this case, the external network interfaces recorded on each node need to be updated. Plug-in and unplug-out events may include insertion events and unplug-out events. Insertion events may add external network interfaces to a node, while unplug-out events may reduce external network interfaces on a node.
[0076] For any node, if an external network interface is plugged or unplugged, the node can add or delete the corresponding logical interface based on the plugging or unplugging event, and add or delete the corresponding mapping relationship for the external network interface corresponding to the plugging or unplugging event in the interface management table. The mapping relationship corresponding to the plugging or unplugging event includes the local type logical interface.
[0077] On the one hand, if an insertion event occurs corresponding to any external network interface, it means that the node has added the external network interface. The node can create a sending and receiving queue and a local type logical interface for the external network interface, and establish a mapping relationship between the external network interface and the logical interface, and write it into the interface management table.
[0078] On the other hand, if an unplug event occurs corresponding to any external network interface, it means that the external network interface no longer exists on the node. The node can delete the transceiver queue and logical interface corresponding to the external network interface, and delete the mapping relationship corresponding to the external network interface in the interface management table.
[0079] The node can send the plug-in and unplug-out events to other nodes in the distributed system through the internal network interface, so that other nodes can update their own interface management tables and logical interfaces according to the plug-in and unplug-out events.
[0080] Through the above measures, when an external network interface plug-in or unplug-out event occurs locally, the node can update the interface management table and logical interface, and send the plug-in or unplug-out event to other nodes, so that other nodes update their own interface management tables and logical interfaces.
[0081] In one embodiment, if a node receives a remote plug / unplug event sent by another node in the distributed system, it can add or delete a corresponding logical interface based on the remote plug / unplug event and add or delete a corresponding mapping relationship for the external network interface corresponding to the remote plug / unplug event in the interface management table. The mapping relationship corresponding to the remote plug / unplug event includes a remote-type logical interface.
[0082] For any node, the plug-in or unplug-out events sent by other nodes are all remote plug-in or unplug-out events, which indicate that an external network interface on the other node is plugged in or unplugged.
[0083] On the one hand, if the remote plug-in and unplug-out event is a remote insertion event, the remote insertion event can include the mapping relationship created by other nodes. The node can write the mapping relationship into the local interface management table and mark the logical interface in the mapping relationship as a remote type. In addition, the node can create a corresponding logical interface for the mapping relationship.
[0084] On the other hand, if the remote plug-in and unplug event is a remote unplug event, the node can search the interface management table for the external network interface indicated by the remote unplug event, and then delete the found mapping relationship. In addition, the node can delete the local logical interface corresponding to the external network interface.
[0085] Through the above measures, when a remote plug-in or unplug-out event occurs in other nodes, the node can update the local interface management table and logical interface according to the remote plug-in or unplug-out event sent by other nodes.
[0086] In one embodiment, see Figure 4 , is a flow chart of processing messages provided in an embodiment of the present application, such as Figure 4 As shown, the method may include the following steps 410 to 430.
[0087] Step 410: poll all local network interfaces whose transceiver status is enabled. If any network interface receives a data packet, determine whether the network interface is an internal network interface or an external network interface.
[0088] A node can poll all local network interfaces that are enabled for transmission and reception to determine whether their receive queues have received any data packets. It can continue polling for any network interface that has not received any data packets. When any network interface receives a data packet, the node can determine whether the interface is internal or external.
[0089] Step 420: If the network interface is an internal network interface, obtain label information carried by the data message; wherein the label information indicates the external network interface that receives the data message.
[0090] When the network interface receiving the data message is an internal network interface, the node can obtain label information carried by the data message. The label information indicates the external network interface receiving the data message. Exemplarily, the label information can be an interface identifier of the external network interface.
[0091] Step 430: Search the interface management table for a logical interface corresponding to the external network interface indicated by the tag information, and pass the data packet to the found logical interface for processing.
[0092] After obtaining the label information carried by the data packet, the node can search the local interface management table for the external network interface indicated by the label information, thereby determining the logical interface corresponding to the external network interface. The node can then hand over the data packet to the found logical interface for processing.
[0093] Through the above measures, the data packets exchanged in the distributed system can indicate the external network interface receiving the data packets through label information, so that the logical interface corresponding to the external network interface can be found to process the data packets.
[0094] In one embodiment, if the network interface receiving the data packet is an external network interface, the node can determine whether the data packet needs to be forwarded to another node in the distributed system. If the session to which the data packet belongs is established on another node, for example, in a NAT (Network Address Translation) scenario, where the node is responsible for sending and receiving data packets from outside the distributed system and other nodes are responsible for processing the data packets, the data packet needs to be forwarded to the other node for processing.
[0095] In one case, if it is not necessary, the node can search the interface management table for a logical interface corresponding to the external network interface. After finding the logical interface, the node can pass the data message to the found logical interface for processing.
[0096] In another case, if a datagram needs to be forwarded to another node in a distributed system, the node can add label information to the datagram, which indicates the external network interface that received the datagram. The node can then send the labeled datagram to the other node through its internal network interface.
[0097] See also Figure 5 , is a schematic diagram of forwarding messages within a distributed system provided by an embodiment of the present application, such as Figure 5As shown in the figure, node Node2 receives a data packet from external network interface Port3, which needs to be forwarded to node Node1. Node2 adds the label "Src Port3" to the data packet and sends the labeled data packet to node Node1 via its internal network interface. Based on the label information, node Node1 searches its interface management table for logical interface IF3 and directs the data packet to IF3 for processing.
[0098] Through the above measures, the data packets received by the external network interface can be directly processed by the logical interface corresponding to the external network interface, or handed over to other nodes for processing after label information is added to the data packets.
[0099] In one embodiment, see Figure 6 , is a flow chart of processing messages provided by another embodiment of the present application, such as Figure 6 As shown, the method may include the following steps 610 to 630.
[0100] Step 610: Obtain the data message sent by the application service, and determine whether the logical interface corresponding to the application service is of the local type.
[0101] The node can obtain the data message sent by the application service, which is the message to be sent. The node can determine whether the logical interface corresponding to the application service is of the local type.
[0102] Step 620: If it is a local type, search the interface management table for the external network interface corresponding to the logical interface, and send the data message to the packet sending function of the found external network interface.
[0103] In one case, if the logical interface is of local type, the node can search the interface management table for the external network interface corresponding to the logical interface, and after finding the external network interface, hand over the data packet to the packet sending function (xmit function) of the external network interface in DPDK for processing.
[0104] Step 630: If it is a remote type, the data message is handed over to the packet sending function of the internal network interface.
[0105] Alternatively, if the logical interface is remote, the datagram needs to be sent by another node. The node can pass the datagram to the internal network interface's packet sending function in DPDK for processing, thereby sending the datagram to the other node, which then sends it outside the distributed system.
[0106] Through the above measures, the node can send data messages through the interface management table.
[0107] See also Figure 7 , is a schematic diagram of the network architecture of a distributed system provided in an embodiment of the present application, such as Figure 7 As shown, the external network interface of this distributed system is provided by a dedicated switch board. The switch board synchronizes its external network interface information with the service processing board through the inter-node communication module. The service processing board creates a logical interface for the external network interface. Both the service processing board and the switch board can create an interface management table to record the external network interfaces of the entire distributed system and the logical interfaces corresponding to them. This allows the switch board to receive a message and pass it to the service processing board for processing.
[0108] Figure 8 FIG. 1 is a block diagram of a network interface management device for a distributed system according to an embodiment of the present invention. Figure 8 As shown, the device may include:
[0109] Identification module 810, used to identify local external network interfaces, create a local type logical interface for each external network interface, and store the mapping relationship between each external network interface and its corresponding logical interface in a preset interface management table;
[0110] A creation module 820 is configured to receive a plurality of mapping relationships from other nodes of the distributed system and create a remote type logical interface for the received mapping relationships;
[0111] A writing module 830 is configured to write the received mapping relationship into the interface management table, and mark the logical interface in the received mapping relationship as a remote type in the interface management table;
[0112] The processing module 840 is configured to process the data message according to the interface management table.
[0113] In one embodiment, the apparatus further comprises:
[0114] The sending module 850 is configured to send the mapping relationship corresponding to the local external network interface to other nodes of the distributed system.
[0115] In one embodiment, the apparatus further comprises:
[0116] Update module 860 is configured to, if a plug / unplug event of an external network interface occurs locally, add or delete a corresponding logical interface according to the plug / unplug event; and add or delete a corresponding mapping relationship for the external network interface corresponding to the plug / unplug event in the interface management table; wherein the mapping relationship corresponding to the plug / unplug event includes a local type logical interface;
[0117] The sending module 850 is configured to send the plug-in and unplug-out event to other nodes in the distributed system.
[0118] In one embodiment, the apparatus further comprises:
[0119] Update module 860 is used to add or delete a corresponding logical interface according to a remote plug-in / unplug event received from other nodes of the distributed system; and to add or delete a corresponding mapping relationship for the external network interface corresponding to the remote plug-in / unplug event in the interface management table; wherein the mapping relationship corresponding to the remote plug-in / unplug event includes a remote-type logical interface.
[0120] In one embodiment, the processing module 840 is further configured to:
[0121] Polling all local network interfaces whose transceiver status is enabled, if any network interface receives a data message, determining whether the network interface is an internal network interface or an external network interface;
[0122] If the network interface is an internal network interface, obtaining label information carried by the data message; wherein the label information indicates the external network interface for receiving the data message;
[0123] In the interface management table, a logical interface corresponding to the external network interface indicated by the label information is searched, and the data message is handed over to the found logical interface for processing.
[0124] In one embodiment, the processing module 840 is further configured to:
[0125] If the network interface is an external network interface, determining whether the data message needs to be forwarded to other nodes of the distributed system;
[0126] If not, the interface management table is searched for a logical interface corresponding to the external network interface, and the data message is handed over to the found logical interface for processing.
[0127] In one embodiment, the processing module 840 is further configured to:
[0128] If the data message needs to be forwarded to other nodes in the distributed system, adding label information to the data message, where the label information indicates the external network interface;
[0129] The data message with the tag information added is sent to other nodes through the internal network interface.
[0130] In one embodiment, the processing module 840 is further configured to:
[0131] Obtain the data message sent by the application service, and determine whether the logical interface corresponding to the application service is of the local type;
[0132] If it is a local type, searching the interface management table for an external network interface corresponding to the logical interface, and delivering the data message to the packet sending function of the found external network interface;
[0133] If it is a remote type, the data message is handed over to the packet sending function of the internal network interface.
[0134] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned network interface management method of the distributed system, and will not be repeated here.
[0135] In several embodiments provided in this application, the disclosed devices and methods may also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of the devices, methods, and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a portion of code, and the module, program segment, or a portion of code contains one or more executable instructions for implementing the specified logical functions. In some alternative implementations, the functions marked in the boxes may also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes may actually be executed substantially in parallel, or they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, may be implemented using a dedicated hardware-based system that performs the specified functions or actions, or may be implemented using a combination of dedicated hardware and computer instructions.
[0136] In addition, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0137] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
Claims
1. A network interface management method for a distributed system, applied to a node of a distributed system, wherein the distributed system includes a plurality of nodes, characterized in that: A single node is a stand-alone device, which is one of the following devices: a device having both a network interface and business processing capabilities, a device having only business processing capabilities but no network interface for external services, or a device that only provides an external network interface but does not have business processing capabilities; the management method includes: Identify local external network interfaces, create a local type logical interface for each external network interface, and store a mapping relationship between each external network interface and its corresponding logical interface in a preset interface management table; receiving a plurality of mapping relationships from other nodes of the distributed system, and creating a remote-type logical interface for the received mapping relationships; Writing the received mapping relationship into the interface management table, and marking the logical interface in the received mapping relationship as a remote type in the interface management table; Processing data packets according to the interface management table; Processing data packets according to the interface management table includes: polling all local network interfaces whose sending and receiving states are enabled, and if any network interface receives a data packet, determining whether the network interface is an internal network interface or an external network interface; if the network interface is an internal network interface, obtaining label information carried by the data packet; wherein the label information indicates the external network interface that receives the data packet; and searching the interface management table for a logical interface corresponding to the external network interface indicated by the label information, and handing the data packet over to the found logical interface for processing.
2. The method according to claim 1, characterized in that The method further comprises: The mapping relationship corresponding to the local external network interface is sent to other nodes of the distributed system.
3. The method according to claim 1, characterized in that The method further comprises: If an external network interface is plugged or unplugged locally, add or delete the corresponding logical interface according to the plugging or unplugging event; Add or delete a corresponding mapping relationship for the external network interface corresponding to the plug-in event in the interface management table; wherein the mapping relationship corresponding to the plug-in event includes a local type logical interface; The plug-in and unplug-out events are sent to other nodes of the distributed system.
4. The method according to claim 3, characterized in that The method further comprises: If a remote plug-in or unplug-out event is received from another node in the distributed system, adding or deleting a corresponding logical interface according to the remote plug-in or unplug-out event; In the interface management table, a corresponding mapping relationship is added or deleted for the external network interface corresponding to the remote plug and unplug event; wherein the mapping relationship corresponding to the remote plug and unplug event includes a remote type logical interface.
5. The method according to claim 1, wherein The method further comprises: If the network interface is an external network interface, determining whether the data message needs to be forwarded to other nodes of the distributed system; If not, the interface management table is searched for a logical interface corresponding to the external network interface, and the data message is handed over to the found logical interface for processing.
6. The method according to claim 1, characterized in that The method further comprises: If the data message needs to be forwarded to other nodes in the distributed system, adding label information to the data message, where the label information indicates the external network interface; The data message with the tag information added is sent to other nodes through the internal network interface.
7. The method according to claim 1, characterized in that The processing of the data message according to the interface management table includes: Obtain the data message sent by the application service, and determine whether the logical interface corresponding to the application service is of the local type; If it is a local type, searching the interface management table for an external network interface corresponding to the logical interface, and delivering the data message to the packet sending function of the found external network interface; If it is a remote type, the data message is handed over to the packet sending function of the internal network interface.
8. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing processor-executable instructions; The processor is configured to execute the network interface management method for a distributed system according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and the computer program can be executed by a processor to implement the network interface management method of a distributed system according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device as well as network equipment for managing logical interface
CN102148751A