Multi-network card routing processing method and device, electronic equipment and storage medium

By automatically configuring multi-NIC routing, the problem of multi-NIC network connectivity in traditional secure containers is solved, achieving efficient and secure multi-NIC network connections, while being compatible with single-NIC configurations, thus improving processing efficiency and accuracy.

CN116896484BActive Publication Date: 2026-11-20BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310721490.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-16
Publication Date
2026-11-20
Estimated Expiration
2043-06-16

AI Technical Summary

Technical Problem

Traditional security containers only support single network interface cards (NICs), which cannot meet the needs of users configuring multiple NICs, leading to network connectivity issues. Furthermore, manual configuration poses security risks and is inefficient.

Method used

By obtaining container type information, the system automatically configures multi-NIC routing, uses hook processes to select the NICs to be configured in the lightweight virtual machine, generates policy routing configuration code, and achieves network connectivity for multiple NICs.

Benefits of technology

No manual operation is required, reducing security risks, improving processing efficiency and accuracy, and is compatible with single network card configuration, saving manpower and time costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116896484B_ABST
    Figure CN116896484B_ABST
Patent Text Reader

Abstract

The disclosure provides a multi-network card routing processing method and device, electronic equipment and storage medium, relates to the fields of artificial intelligence such as edge computing and container technology, and can be applied to an intelligent cloud scene. The method can include: obtaining container type information, the container type information being type information of a currently started container sent when a start operation of a container group in a virtual machine where an agent process executes, the container group including a base container and a business container, and the container group being a secure container type container group; in response to determining that the currently started container is the base container according to the container type information, determining M network cards configured for the container group, M being a positive integer greater than one, selecting a network card to be configured from the M network cards as a target network card, obtaining network card information of the target network card, and completing policy routing configuration for the target network card according to the obtained network card information. The scheme disclosed in the disclosure can improve processing efficiency and the accuracy of processing results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to multi-NIC routing processing methods, apparatuses, electronic devices and storage media in the fields of edge computing and container technology. Background Technology

[0002] Edge computing products can provide more lightweight container services for heterogeneous application and service scenarios. Among them, secure containers (Katacontainers) have been widely used in various scenarios due to their good balance between the isolation and security of virtual machines and the simplicity and lightweight nature of containers. Traditional secure containers only support implementations with a single network interface card (NIC), which is a public network interface card (NIC), also known as an external network interface card. However, in practical applications, users may need to configure multiple NICs, which in turn involves network connectivity issues across multiple NICs. Summary of the Invention

[0003] This disclosure provides a method, apparatus, electronic device, and storage medium for multi-NIC routing processing.

[0004] A multi-NIC routing processing method includes:

[0005] Obtain container type information, which is the type information of the currently started container sent when the agent process executes the startup operation of the container group in the virtual machine. The container group includes basic containers and business containers, and the container group is a container group of the security container type.

[0006] In response to determining that the currently started container is the base container based on the container type information, a multi-NIC routing configuration operation is performed, including: determining M NICs configured for the container group, where M is a positive integer greater than one; selecting a NIC to be configured from the M NICs as the target NIC; obtaining the predetermined NIC information of the target NIC; and completing the policy routing configuration for the target NIC based on the NIC information.

[0007] A multi-NIC routing processing method includes:

[0008] In response to the confirmation that the virtual machine has started successfully, the startup operation of the container group corresponding to the virtual machine is executed. The container group includes basic containers and business containers, and the container group is a container group of the security container type.

[0009] Specifically, for the currently started container, its container type information is sent to the hook process. The hook process determines that the currently started container is the base container based on the container type information, and then completes the policy routing configuration for the target network card according to the predetermined network card information of the target network card. The target network card is a network card to be configured selected from M network cards configured for the container group, where M is a positive integer greater than one.

[0010] A multi-NIC routing processing device includes: an information acquisition module and a routing configuration module;

[0011] The information acquisition module is used to acquire container type information. The container type information is the type information of the currently started container sent when the agent process executes the startup operation of the container group in the virtual machine. The container group includes basic containers and business containers. The container group is a container group of the security container type.

[0012] The routing configuration module is used to perform a multi-NIC routing configuration operation in response to determining that the currently started container is the base container based on the container type information. The operation includes: determining M NICs configured for the container group, where M is a positive integer greater than one; selecting a NIC to be configured from the M NICs as the target NIC; obtaining the predetermined NIC information of the target NIC; and completing the policy routing configuration for the target NIC based on the NIC information.

[0013] A multi-NIC routing processing device includes: a container processing module and an information processing module;

[0014] The container processing module is used to execute the startup operation of the container group corresponding to the virtual machine in response to determining that the virtual machine has started successfully. The container group includes a basic container and a business container. The container group is a container group of the security container type.

[0015] The information processing module is used to send the container type information of the currently started container to the hook process. After the hook process determines that the currently started container is the base container based on the container type information, it completes the policy routing configuration for the target network card according to the predetermined network card information of the target network card. The target network card is a network card to be configured selected from M network cards configured for the container group, where M is a positive integer greater than one.

[0016] An electronic device, comprising:

[0017] At least one processor; and

[0018] A memory communicatively connected to the at least one processor; wherein,

[0019] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described above.

[0020] A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the methods described above.

[0021] A computer program product includes a computer program / instructions that, when executed by a processor, implement the method described above.

[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0023] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0024] Figure 1 This is a flowchart of the first embodiment of the multi-NIC routing processing method described in this disclosure;

[0025] Figure 2 This is a flowchart of the second embodiment of the multi-NIC routing processing method described in this disclosure;

[0026] Figure 3 This is a schematic diagram of the composition structure of the first embodiment 300 of the multi-NIC routing processing device described in this disclosure;

[0027] Figure 4 This is a schematic diagram of the composition structure of the second embodiment 400 of the multi-NIC routing processing device described in this disclosure;

[0028] Figure 5 A schematic block diagram of an electronic device 500 that can be used to implement embodiments of the present disclosure is shown. Detailed Implementation

[0029] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0030] Furthermore, it should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0031] Figure 1 This is a flowchart of the first embodiment of the multi-NIC routing processing method described in this disclosure. Figure 1 As shown, the specific implementation methods are as follows.

[0032] In step 101, container type information is obtained. Container type information is the type information of the currently started container sent by the agent process (kata-agent) when it performs the startup operation of the container group (Pod) in the virtual machine. The container group includes the basic (pause) container and the business container. The container group is a container group of the security container type.

[0033] In step 102, in response to determining that the currently started container is a pause container based on the container type information, a multi-NIC routing configuration operation is performed, including: determining M NICs to be configured for the container group, where M is a positive integer greater than one; selecting the NIC to be configured from the M NICs as the target NIC; obtaining the predetermined NIC information of the target NIC; and completing the policy routing configuration for the target NIC based on the obtained NIC information.

[0034] As mentioned earlier, in practical applications, users may need to configure multiple network cards, such as three network cards corresponding to different operators, in order to distribute access clients from different operators to achieve low latency and high availability.

[0035] Correspondingly, multiple network interface cards (NICs) need to achieve network connectivity. However, traditional implementations only support network connectivity for a single NIC; that is, only one NIC's network connectivity is automatically configured, while the others cannot. Therefore, the usual approach is to enable privileged mode when the user creates the container group and then manually configure the policy routing for the remaining NICs to achieve network connectivity. However, enabling privileged mode poses security risks to other services, and is also time-consuming, labor-intensive, error-prone, and inefficient.

[0036] The scheme described in the above method embodiment can automatically implement the policy routing configuration of the target network card to be configured, thereby automatically realizing the network connectivity of the target network card without manual operation. Moreover, it is transparent and imperceptible to the user, does not require enabling privileged mode, thereby reducing security risks, and has no intrusion on the existing architecture. In addition, it saves manpower and time costs, improves processing efficiency, and improves the accuracy of processing results.

[0037] The virtual machines described in this disclosure typically refer to lightweight virtual machines (Kata-VMs). Before starting a secure container, the lightweight virtual machine must be started first; that is, the lightweight virtual machine containing the container group must be started, and the container group is a secure container group. During the startup process of the lightweight virtual machine, the multiple network interfaces configured for the container group can be configured as startup parameters in the lightweight virtual machine as part of the startup parameters of the open-source component (QEMU-KVM) that starts the virtual machine. Correspondingly, after the lightweight virtual machine starts successfully, according to traditional implementation methods, network connectivity will be automatically configured for one network interface, while the remaining network interfaces will be unable to achieve network connectivity.

[0038] In practical applications, after a lightweight virtual machine starts successfully, it uses the kata-agent to start various containers in the container group, including pause containers and service containers. The pause container starts before the service containers. There is usually one pause container, while there can be multiple service containers. The pause container is used for container group initialization, such as initializing network and storage space. Afterward, the service containers are started, and each service container is attached to the pause container to achieve resource sharing.

[0039] Preferably, Figure 1 The execution entity in the illustrated embodiment can be a hook process. Both the kata-agent and the hook process reside within a lightweight virtual machine. When starting each container, the kata-agent can invoke the hook process and pass the type information of the currently started container to the hook process. Correspondingly, the hook process can... Figure 1 The following steps are performed as shown.

[0040] If the hook process determines that the currently started container is a pause container based on the obtained container type information, it can perform multi-NIC routing configuration operations. Specifically, it can determine the M NICs configured for the container group, select the NIC to be configured from the M NICs as the target NIC, obtain the NIC information of the target NIC, and complete the policy routing configuration for the target NIC based on the NIC information.

[0041] For example, M network interface cards (NICs) configured for the container group can be obtained through scanning. The specific value of M can be determined according to actual needs, such as 3. In addition, preferably, the selected target NICs may include: NICs other than the predetermined NICs among the M NICs, where the predetermined NIC is the first NIC among the M NICs added (inserted) into the lightweight virtual machine.

[0042] Assuming M is 3, then 3 network cards will be added to the lightweight virtual machine in sequence. The first network card added can be used as the pre-defined network card, and its network connectivity can be automatically configured in the traditional way. For the second and third network cards added, they can be used as target network cards, and the network card information of the target network cards can be obtained. Then, the policy routing configuration for the target network cards can be completed based on the network card information to achieve network connectivity of the target network cards.

[0043] Correspondingly, if only one network interface card (NIC) is configured, then there is no target NIC, and its network connectivity can be automatically configured directly according to the traditional implementation method. In other words, the solution described in this disclosure is compatible with both single-NIC and multi-NIC configurations and will not affect the traditional implementation method.

[0044] The solution described in this disclosure does not impose any restrictions on how to obtain the network card information of the target network card. For example, it can be achieved through Container Network Interface (CNI) technology.

[0045] Preferably, the method of configuring policy routing for a target network card based on network card information may include: for any target network card, performing the following processing: generating policy routing configuration code corresponding to the target network card based on the network card information of the target network card, and completing the policy routing configuration for the target network card by executing the policy routing configuration code.

[0046] Preferably, the policy routing configuration code can be rendered using network interface card information and a pre-generated generic code template.

[0047] Preferably, the network interface card (NIC) information may include: Internet Protocol (IP) information, netmask information, gateway (GW) information, and NIC name (dev). Accordingly, the IP information, netmask information, gateway information, and NIC name can be filled into the corresponding slots in the general code template to obtain the policy routing configuration code.

[0048] In other words, a general code template can be generated in advance. After obtaining the above network card information of the target network card, the general code template can be filled with the above network card information to obtain the required policy routing configuration code.

[0049] For example, a general code template could be shown below:

[0050] Add a route (routeadd) - net [IP information] netmask [mask information] gw [gateway information] dev [NIC name];

[0051] Assume the network card information of target network card 1 includes:

[0052] IP information: 192.168.0.0;

[0053] Mask information: 255.255.255.0;

[0054] Gateway information: 192.168.2.1;

[0055] Network interface name: eth1;

[0056] The policy routing configuration code corresponding to target network card 1 can be obtained as follows:

[0057] routeadd-net192.168.0.0netmask255.255.255.0gw192.168.2.1deveth1;

[0058] Assume the network card information of target network card 2 includes:

[0059] IP information: 192.168.0.1;

[0060] Mask information: 255.255.255.1;

[0061] Gateway information: 192.168.2.2;

[0062] Network interface name: eth2;

[0063] The policy routing configuration code corresponding to target network card 2 can be obtained as follows:

[0064] routeadd-net192.168.0.1netmask255.255.255.1gw192.168.2.2deveth2.

[0065] As can be seen, the above processing can efficiently and accurately generate the policy routing configuration code corresponding to the target network card. Then, the policy routing configuration of the target network card can be realized by executing the policy routing configuration code, that is, the network connectivity of the target network card can be realized.

[0066] Preferably, while obtaining container type information, the hook process can also obtain function configuration information from kata-agent. In response, it can determine that the currently started container is a pause container based on the container type information, and determine that the user has enabled the multi-NIC routing configuration function based on the function configuration information, and can perform multi-NIC routing configuration operations.

[0067] Users can pre-set function configuration information (storage location is not limited) according to actual needs, such as setting it to true or false, or setting it to 1 or 0. Taking 1 or 0 as an example, 1 can indicate that the multi-NIC routing configuration function is enabled, and 0 can indicate that the multi-NIC routing configuration function is not enabled / disabled (i.e., turned off). Correspondingly, while passing container type information to the hook process, kata-agent can also pass function configuration information to the hook process. Accordingly, the hook process will only execute the multi-NIC routing configuration operation when it determines that the currently started container is a pause container and the user has enabled the multi-NIC routing configuration function.

[0068] In other words, users can choose whether to enable the multi-NIC routing configuration function according to their actual needs, which is very flexible and convenient.

[0069] In addition, preferably, in response to the failure to obtain function configuration information and the determination that the currently started container is a business container based on the container type information, the current processing can be exited; and in response to the acquisition of function configuration information and the determination that the user has not enabled the multi-NIC routing configuration function based on the function configuration information, the current processing can be exited.

[0070] When any business container is started, kata-agent will also call the hook process and pass the container type information to the hook process. Accordingly, the hook process can exit the current processing directly, that is, it will not perform multi-NIC routing configuration operations and exit the process.

[0071] Since the service containers are attached to the pause container, the multi-NIC routing configuration operation has already been performed when the pause container is started. This is equivalent to initializing the connectivity of each NIC. Therefore, each service container can use it directly afterward without having to perform the multi-NIC routing configuration operation again.

[0072] In addition, if the hook process determines that the user has not enabled the multi-NIC routing configuration function based on the obtained function configuration information, then regardless of whether the currently started container is a pause container or a business container, it can directly exit the current processing, thereby meeting the user's configuration requirements.

[0073] Figure 2 This is a flowchart of a second embodiment of the multi-NIC routing processing method described in this disclosure. Figure 2As shown, the specific implementation methods are as follows.

[0074] In step 201, in response to determining that the virtual machine has started successfully, the startup operation of the container group corresponding to the virtual machine is performed. The container group includes a pause container and a business container. The container group is a container group of the security container type.

[0075] In step 202, for the currently started container, its container type information is sent to the hook process. The hook process determines that the currently started container is a pause container based on the container type information, and then completes the policy routing configuration for the target network card according to the predetermined network card information of the target network card. The target network card is the network card to be configured selected from the M network cards configured for the container group, where M is a positive integer greater than one.

[0076] The scheme described in the above method embodiment can automatically implement the policy routing configuration of the target network card to be configured, thereby automatically realizing the network connectivity of the target network card without manual operation. Moreover, it is transparent and imperceptible to the user, does not require enabling privileged mode, thereby reducing security risks, and has no intrusion on the existing architecture. In addition, it saves manpower and time costs, improves processing efficiency, and improves the accuracy of processing results.

[0077] In practical applications, Figure 2 The execution entity of the method embodiment shown can be kata-agent.

[0078] Preferably, kata-agent can also send function configuration information to the hook process, so that the hook process can determine that the currently started container is a pause container based on the container type information and determine that the user has enabled the multi-NIC routing configuration function based on the function configuration information, and then complete the policy routing configuration for the target NIC based on the NIC information of the target NIC.

[0079] Suppose there are 3 network cards. In the traditional implementation, only one of these 3 network cards is connected to the network. If you use the IP rule display (ipruleshow) command to view it, you can see that there is only one routing table. However, after adopting the solution described in this disclosure, you can see 3 routing tables using the ipruleshow command, each corresponding to one of the 3 network cards. That is, all 3 network cards are connected to the network.

[0080] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this disclosure. Secondly, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this disclosure. Furthermore, for parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0081] The above is an introduction to the method embodiments. The following describes the solution described in this disclosure further through device embodiments.

[0082] Figure 3 This is a schematic diagram of the structural composition of the first embodiment 300 of the multi-NIC routing processing device described in this disclosure. Figure 3 As shown, it includes: an information acquisition module 301 and a routing configuration module 302.

[0083] The information acquisition module 301 is used to acquire container type information. The container type information is the type information of the currently started container sent when kata-agent performs the startup operation of the container group in the virtual machine. The container group includes pause containers and business containers. The container group is a container group of the security container type.

[0084] The routing configuration module 302 is used to perform multi-NIC routing configuration operations in response to determining that the currently started container is a pause container based on the container type information. This includes: determining M NICs to be configured for the container group, where M is a positive integer greater than one; selecting the NIC to be configured from the M NICs as the target NIC; obtaining the predetermined NIC information of the target NIC; and completing the policy routing configuration for the target NIC based on the obtained NIC information.

[0085] By adopting the solution described in the above-described device embodiment, the policy routing configuration of the target network card to be configured can be automatically realized, thereby automatically realizing the network connectivity of the target network card without manual operation. Moreover, it is transparent and imperceptible to the user, does not require enabling privileged mode, thereby reducing security risks, and has no intrusion on the existing architecture. In addition, it saves manpower and time costs, improves processing efficiency, and improves the accuracy of processing results.

[0086] Preferably, the target network interface card (NIC) includes: the network interface cards other than the predetermined network interface card (NIC) among the M NICs, where the predetermined network interface card is the first NIC among the M NICs added to the virtual machine.

[0087] Preferably, the routing configuration module 302 may perform the following process to complete the policy routing configuration for the target network card based on the network card information: for any target network card, generate the policy routing configuration code corresponding to the target network card based on the network card information, and complete the policy routing configuration for the target network card by executing the policy routing configuration code.

[0088] Preferably, the routing configuration module 302 can use network card information and pre-generated general code templates to render policy routing configuration code.

[0089] Preferably, the network interface card (NIC) information may include: IP information, subnet mask information, gateway information, and NIC name. Accordingly, the routing configuration module 302 can fill the IP information, subnet mask information, gateway information, and NIC name into the corresponding slots in the general code template to obtain the policy routing configuration code.

[0090] In other words, a general code template can be generated in advance. After obtaining the above network card information of the target network card, the general code template can be filled with the above network card information to obtain the required policy routing configuration code.

[0091] Preferably, while acquiring container type information, the information acquisition module 301 can also acquire function configuration information from kata-agent. Correspondingly, the routing configuration module 302 determines that the currently started container is a pause container based on the container type information and determines that the user has enabled the multi-NIC routing configuration function based on the function configuration information, and can perform multi-NIC routing configuration operations.

[0092] Alternatively, preferably, the routing configuration module 302 exits the current processing in response to not obtaining function configuration information and determining that the currently started container is a service container based on the container type information; and in response to obtaining function configuration information and determining that the user has not enabled the multi-NIC routing configuration function based on the function configuration information.

[0093] Figure 4 This is a schematic diagram of the structural composition of the second embodiment 400 of the multi-NIC routing processing device described in this disclosure. Figure 4 As shown, it includes: a container processing module 401 and an information processing module 402.

[0094] The container processing module 401 is used to execute the startup operation of the container group corresponding to the virtual machine in response to the determination that the virtual machine has started successfully. The container group includes a pause container and a business container. The container group is a container group of the security container type.

[0095] The information processing module 402 is used to send the container type information of the currently started container to the hook process. After the hook process determines that the currently started container is a pause container based on the container type information, it completes the policy routing configuration for the target network card according to the predetermined network card information of the target network card. The target network card is the network card to be configured selected from M network cards configured for the container group, where M is a positive integer greater than one.

[0096] By adopting the solution described in the above-described device embodiment, the policy routing configuration of the target network card to be configured can be automatically realized, thereby automatically realizing the network connectivity of the target network card without manual operation. Moreover, it is transparent and imperceptible to the user, does not require enabling privileged mode, thereby reducing security risks, and has no intrusion on the existing architecture. In addition, it saves manpower and time costs, improves processing efficiency, and improves the accuracy of processing results.

[0097] Preferably, the information processing module 402 can also send the function configuration information to the hook process, so that the hook process can determine that the currently started container is a pause container based on the container type information and determine that the user has enabled the multi-NIC routing configuration function based on the function configuration information, and then complete the policy routing configuration for the target NIC based on the NIC information of the target NIC.

[0098] Figure 3 and Figure 4 The specific workflow of the device embodiment shown can be found in the relevant descriptions in the foregoing method embodiments, and will not be repeated here.

[0099] The solutions described in this disclosure can be applied to the field of artificial intelligence, particularly edge computing and container technology. Artificial intelligence is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It involves both hardware and software technologies. Artificial intelligence hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. Artificial intelligence software technologies mainly include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.

[0100] Furthermore, the collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0101] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0102] Figure 5A schematic block diagram of an electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0103] like Figure 5 As shown, device 500 includes a computing unit 501, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 502 or a computer program loaded from storage unit 508 into random access memory (RAM) 503. RAM 503 may also store various programs and data required for the operation of device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. Input / output (I / O) interface 505 is also connected to bus 504.

[0104] Multiple components in device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0105] The computing unit 501 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as those described in this disclosure. For example, in some embodiments, the methods described in this disclosure can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed on device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the methods described in this disclosure can be performed. Alternatively, in other embodiments, the computing unit 501 can be configured to perform the methods described in this disclosure by any other suitable means (e.g., by means of firmware).

[0106] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0107] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0108] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0109] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0110] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0111] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0112] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0113] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A multi-NIC routing processing method, comprising: Obtain container type information, which is the type information of the currently started container sent when the agent process executes the startup operation of the container group in the virtual machine. The container group includes basic containers and business containers, and the container group is a container group of the security container type. In response to determining that the currently started container is the base container based on the container type information, a multi-NIC routing configuration operation is performed, including: determining M NICs configured for the container group, where M is a positive integer greater than one; selecting a NIC to be configured from the M NICs as the target NIC; obtaining the predetermined NIC information of the target NIC; and completing the policy routing configuration for the target NIC based on the NIC information, including: for any target NIC, performing the following processing: generating policy routing configuration code corresponding to the target NIC based on the NIC information of the target NIC; and completing the policy routing configuration for the target NIC by executing the policy routing configuration code.

2. The method according to claim 1, wherein, The target network interface card (NIC) includes: the network interface cards other than the predetermined network interface card among the M network interface cards, wherein the predetermined network interface card is the first network interface card among the M network interface cards added to the virtual machine.

3. The method according to claim 1, wherein, The process of generating the policy routing configuration code corresponding to the target network interface card includes: using the network interface card information and a pre-generated general code template to render the policy routing configuration code.

4. The method according to claim 3, wherein, The network interface card (NIC) information includes: Internet Protocol (IP) information, subnet mask (subnet mask) information, gateway information, and NIC name; The step of rendering the policy routing configuration code using the network interface card information and a pre-generated general code template includes: filling the Internet Protocol information, the mask information, the gateway information, and the network interface card name into the corresponding slots in the general code template to obtain the policy routing configuration code.

5. The method according to any one of claims 1 to 4, further comprising: While obtaining the container type information, functional configuration information from the agent process is also obtained; In response to determining that the currently started container is the base container based on the container type information, and determining that the user has enabled the multi-NIC routing configuration function based on the function configuration information, the multi-NIC routing configuration operation is executed.

6. The method according to claim 5, further comprising: In response to the failure to obtain the function configuration information, and based on the container type information, determining that the currently started container is the business container, the current processing is terminated; In addition, in response to obtaining the function configuration information and determining that the user has not enabled the multi-NIC routing configuration function based on the function configuration information, the current process is exited.

7. A multi-NIC routing processing method, comprising: In response to the confirmation that the virtual machine has started successfully, the startup operation of the container group corresponding to the virtual machine is executed. The container group includes basic containers and business containers, and the container group is a container group of the security container type. Specifically, for the currently started container, its container type information is sent to the hook process. The hook process determines that the currently started container is the base container based on the container type information, and then completes the policy routing configuration for the target network card according to the predetermined network card information of the target network card. The target network card is a network card to be configured selected from M network cards configured for the container group, where M is a positive integer greater than one. The policy routing configuration for any target network card includes: generating the policy routing configuration code corresponding to the target network card based on the network card information of the target network card, and then completing the policy routing configuration for the target network card by executing the policy routing configuration code.

8. The method according to claim 7, further comprising: The function configuration information is sent to the hook process, which is used by the hook process to determine that the currently started container is the base container based on the container type information and to determine that the user has enabled the multi-NIC routing configuration function based on the function configuration information, and then to complete the policy routing configuration for the target NIC based on the NIC information of the target NIC.

9. A multi-NIC routing processing device, comprising: Information acquisition module and routing configuration module; The information acquisition module is used to acquire container type information. The container type information is the type information of the currently started container sent when the agent process executes the startup operation of the container group in the virtual machine. The container group includes basic containers and business containers. The container group is a container group of the security container type. The routing configuration module is used to perform a multi-NIC routing configuration operation in response to determining that the currently started container is the base container based on the container type information. This includes: determining M NICs configured for the container group, where M is a positive integer greater than one; selecting a NIC to be configured from the M NICs as the target NIC; obtaining the predetermined NIC information of the target NIC; and completing the policy routing configuration for the target NIC based on the NIC information. This includes: for any target NIC, performing the following processing: generating policy routing configuration code corresponding to the target NIC based on the NIC information; and completing the policy routing configuration for the target NIC by executing the policy routing configuration code.

10. The apparatus according to claim 9, wherein, The target network interface card (NIC) includes: the network interface cards other than the predetermined network interface card among the M network interface cards, wherein the predetermined network interface card is the first network interface card among the M network interface cards added to the virtual machine.

11. The apparatus according to claim 9, wherein, The routing configuration module uses the network card information and a pre-generated general code template to render the policy routing configuration code.

12. The apparatus according to claim 11, wherein, The network interface card (NIC) information includes: Internet Protocol (IP) information, subnet mask (subnet mask) information, gateway information, and NIC name; The routing configuration module fills the Internet Protocol information, the mask information, the gateway information, and the network interface card name into the corresponding slots in the general code template to obtain the policy routing configuration code.

13. The apparatus according to any one of claims 9 to 12, wherein, The information acquisition module is further configured to acquire, while acquiring the container type information, functional configuration information from the agent process; The routing configuration module is further configured to, in response to determining that the currently started container is the basic container based on the container type information, and determining that the user has enabled the multi-NIC routing configuration function based on the function configuration information, execute the multi-NIC routing configuration operation.

14. The apparatus according to claim 13, wherein, The routing configuration module is further configured to: exit the current processing in response to not obtaining the function configuration information and determining that the currently started container is the service container based on the container type information; and exit the current processing in response to obtaining the function configuration information and determining that the user has not enabled the multi-NIC routing configuration function based on the function configuration information.

15. A multi-NIC routing processing device, comprising: Container processing module and information processing module; The container processing module is used to execute the startup operation of the container group corresponding to the virtual machine in response to determining that the virtual machine has started successfully. The container group includes a basic container and a business container. The container group is a container group of the security container type. The information processing module is used to send the container type information of the currently started container to the hook process. After the hook process determines that the currently started container is the base container based on the container type information, it completes the policy routing configuration for the target network card according to the predetermined network card information of the target network card. The target network card is a network card to be configured selected from M network cards configured for the container group, where M is a positive integer greater than one. The policy routing configuration of any target network card includes: generating the policy routing configuration code corresponding to the target network card according to the network card information of the target network card, and then completing the policy routing configuration for the target network card by executing the policy routing configuration code.

16. The apparatus according to claim 15, wherein, The information processing module is further configured to send function configuration information to the hook process, so that the hook process determines, based on the container type information, that the currently started container is the basic container and based on the function configuration information, that the user has enabled the multi-NIC routing configuration function, and then completes the policy routing configuration for the target NIC based on the NIC information of the target NIC.

17. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.

18. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-8.

19. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the method of any one of claims 1-8.

Citation Information

Patent Citations

  • Network card communication method and device of AI training platform, equipment and medium

    CN114584504A

  • Multi-network card container self-defined routing configuration method and device and medium

    CN115987869A