A cloud server multi-elastic network card routing automatic configuration method and device

By combining the Udev device manager and DHCP client with the DHCP Hook mechanism, the cloud server's multi-elastomer network card routing is automatically configured, solving the network disconnection problem caused by the cloud server's multiple network cards using the same default routing table, and improving configuration efficiency and accuracy.

CN119966871BActive Publication Date: 2025-10-17SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510066620.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2025-10-17
Estimated Expiration
2045-01-16

AI Technical Summary

Technical Problem

In the existing technology, multiple elastic network cards of a cloud server use the same default routing table, resulting in network disconnection, and manual configuration is inefficient and prone to errors.

Method used

The Udev device manager and DHCP client are combined with the DHCP Hook mechanism to automatically configure the routing of multiple elastic network cards in the cloud server. This includes creating a separate routing table and specifying the egress when a network card is added, and clearing the configuration when it is removed.

Benefits of technology

Under the premise that the operating system supports hot plugging, the network card availability can be ensured without manual operation, which improves the configuration efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119966871B_ABST
    Figure CN119966871B_ABST
Patent Text Reader

Abstract

The application particularly relates to a cloud server multi-elastic network card routing automatic configuration method and device. The cloud server multi-elastic network card routing automatic configuration method, when a new elastic network card is added after the cloud server is started, a Udev device manager persistently adds a device name of the new elastic network card, and a custom script provided in a device event notification calling scheme is used to realize input of a network card management configuration file of the new elastic network card device; after receiving the device event notification sent by the Udev device manager, the custom script calls a DHCP client, triggers a DHCP Hook mechanism, and configures and manages the corresponding network card device. The cloud server multi-elastic network card routing automatic configuration method and device can realize the availability of the network card without additional manual operation under the premise that the operating system supports hot plug, save the time for manual configuration when the elastic network cards of the cloud server are operated in batches, and improve the accuracy of the configuration.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of cloud servers, and in particular to a cloud server multi-elastic network card routing automatic configuration method and device. BACKGROUND

[0002] Cloud computing is one of the hottest topics in the field of IT infrastructure in recent years, and its virtualization abstraction of computing, network, storage and other resources provides users with extremely convenient resource usage and flexible resource expansion capabilities.

[0003] At present, the tenant cloud server provided by the cloud platform can be associated with multiple elastic network cards to provide services, and the communication of the cloud server in different networks can be realized. However, since the multiple elastic network card devices of the Linux operating system of the cloud server use the same default routing table, when the first device recognized by the operating system is started, the system points to the first device through the default route configured by the dynamic host configuration protocol service. Without human intervention, the network traffic in the incoming direction of other elastic network card devices will also match the default route and finally point to the first network card device, which will cause the network to be inaccessible due to the inconsistency of the MAC addresses of the receiving and transmitting packet devices.

[0004] The network traffic in the incoming direction of the same elastic network card can be sent out by the network card through the manual configuration of the policy route, so that multiple elastic network cards on the same cloud server can be accessed. However, manual configuration of the multiple elastic network cards of a large number of cloud servers is time-consuming and inefficient, and manual input errors may cause the elastic network card to be unavailable.

[0005] In order to improve the configuration efficiency and reduce the operation and maintenance cost, the present application provides a cloud server multi-elastic network card routing automatic configuration method and device. SUMMARY

[0006] The present application provides a simple and efficient cloud server multi-elastic network card routing automatic configuration method and device to overcome the defects of the prior art.

[0007] The present application is realized by the following technical solutions:

[0008] A cloud server multi-elastic network card routing automatic configuration method, when the cloud server is started and a new elastic network card is added, the Udev device manager persistently adds the device name of the new elastic network card, and calls the custom script provided in the device event notification calling scheme to realize the entry of the network card management configuration file of the new elastic network card device;

[0009] After the custom script receives the device event notification sent by the Udev device manager, the DHCP client is called to trigger the DHCP Hook mechanism to configure and manage the corresponding network card device for policy routing.

[0010] When the cloud server adds an elastic network card, the automatic routing configuration steps are as follows:

[0011] Step S1.1, when the cloud server first mounts the elastic network card or the cloud server starts, the Udev device manager detects the elastic network card device, and adds the detected elastic network card device event notification to the corresponding network card policy routing configuration tool of the scheme;

[0012] Step S1.2, when the network card policy routing configuration tool receives the message of adding a network card, the elastic network card is pulled up by calling the Linux system command;

[0013] Step S1.3, use the DHCP client to request the configuration of the elastic network card IP address information from the DHCP server;

[0014] Step S1.4, when the DHCP client receives the message, the DHCP Hook mechanism is triggered to judge the message type, and if the message type is binding to obtain a lease or update a lease, the corresponding elastic network card is configured for policy routing.

[0015] In the step S1.4, the DHCP client configures the elastic network card for policy routing, and the steps are as follows:

[0016] Step S1.4.1, create a separate routing table for the elastic network card;

[0017] Step S1.4.2, add a default route in the new routing table, and specify the corresponding elastic network card as the exit;

[0018] Step S1.4.3, add a policy route, and point the exit of all traffic entering from the added elastic network card to the elastic network card.

[0019] After the above steps are completed, the IP of the elastic network card can be accessed from outside the cloud server.

[0020] When the elastic network card on the cloud server is removed, the related configuration added by the scheme when adding the elastic network card also needs to be cleaned, otherwise it will be left. The processing steps are as follows:

[0021] Step S2.1, after the Udev device manager detects that the elastic network card device is removed, the corresponding device file is deleted, and the device event is notified to the script of the network card policy routing configuration tool;

[0022] Step S2.2, when the script receives the notification, call the DHCP client to release the lease of the corresponding elastic network card;

[0023] Step S2.3, when the DHCP client receives the message of releasing the lease of the elastic network card, trigger the DHCP hook, and the elastic network card policy routing configuration tool executes the command to clean up the policy routing and routing table added for the elastic network card, so as to avoid the residual configuration affecting the subsequent use.

[0024] When the above steps are executed, the configuration newly added when the elastic network card is added is cleaned up.

[0025] A cloud server multi-elastic network card routing automatic configuration device, comprising a Udev device manager, a network card policy routing configuration tool and a DHCP client;

[0026] The Udev device manager is responsible for persistently adding the device name of the elastic network card when detecting the elastic network card device, and notifying the custom script provided in the calling scheme of the detected elastic network card device addition event to the network card policy routing configuration tool of the corresponding scheme;

[0027] The network card policy routing configuration tool is responsible for raising the elastic network card by calling the Linux system command when receiving the message of adding the network card, and recording the network card management configuration file of the added elastic network card device in the script, and calling the DHCP client;

[0028] The DHCP client is responsible for configuring and managing the policy routing of the corresponding network card device by triggering the DHCP Hook mechanism.

[0029] The Udev device manager is also responsible for deleting the corresponding device file after detecting the removal of the elastic network card device, and notifying the script of the network card policy routing configuration tool of the device event;

[0030] The script of the network card policy routing configuration tool is responsible for releasing the lease of the corresponding elastic network card after receiving the notification.

[0031] The DHCP client is responsible for initiating a request to the DHCP server to configure the IP address information of the elastic network card, triggering the DHCP Hook mechanism, and judging the message type. If the message type is binding to obtain the lease or update the lease, the corresponding elastic network card is configured with the policy routing.

[0032] In addition, the DHCP client is also responsible for triggering the DHCP hook when receiving the message of releasing the lease of the elastic network card, and the elastic network card policy routing configuration tool executes the command to clean up the policy routing and routing table added for the elastic network card, so as to avoid the residual configuration affecting the subsequent use.

[0033] The DHCP client is responsible for policy routing configuration of the elastic network card, and the steps are as follows:

[0034] Step S1.4.1, creating a separate routing table for the elastic network card;

[0035] Step S1.4.2, adding a default route in the newly created routing table, and specifying the egress as the corresponding elastic network card;

[0036] Step S1.4.3, adding a policy route, and pointing the egress of all traffic entering from the newly added elastic network card to the elastic network card.

[0037] A cloud server multi-elastic network card routing automatic configuration device, characterized by comprising a memory and a processor; the memory is used to store a computer program, and the processor is used to execute the computer program to realize the method steps described above.

[0038] A readable storage medium, characterized in that the readable storage medium stores a computer program, and the computer program is executed by a processor to realize the method steps described above.

[0039] The cloud server multi-elastic network card routing automatic configuration method and device can realize the availability of the network card without additional manual operation under the premise that the operating system supports hot plug, save the time of manual configuration when operating the elastic network cards of the cloud server in batches, and improve the accuracy of configuration. BRIEF DESCRIPTION OF DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiment or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.

[0041] Figure 1 is a schematic diagram of the cloud server multi-elastic network card routing automatic configuration method of the present application. Figure 1 Figure 2 is a schematic diagram of the network card pull-out configuration tool automatic cleaning of the network card residual data method of the present application.

[0042] Figure 1 is a schematic diagram of the cloud server multi-elastic network card routing automatic configuration method of the present application. Figure 2 Figure 2 is a schematic diagram of the network card pull-out configuration tool automatic cleaning of the network card residual data method of the present application. DETAILED DESCRIPTION

[0043] In order to better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in combination with the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work should fall within the scope of protection of the present application.

[0044] The tenant cloud server provided by the cloud platform can be associated with multiple elastic network cards to meet the needs of multi-network card device access or network output. Since the cloud server mostly provides a Linux operating system, the Linux operating system puts all these network card devices into the default network space when processing multi-elastic network card devices, and uses the same default routing table. This will cause only one default route to exist in the default routing table, and when a random address accesses the multiple elastic network cards of the device, the same routing rule is matched, and the traffic can only be sent out from the same network card device. This will cause the accessed destination MAC address and the returned source MAC address to be inconsistent, resulting in communication failure.

[0045] The dynamic host configuration protocol (DHCP) service of the Linux operating system generally supports the Hook mechanism to insert custom code or scripts in the workflow of the DHCP protocol, so as to perform specific operations when specific DHCP events occur. The network card management tools used by the mainstream distribution Linux operating system all integrate the DHCP client and support the DHCP hook mechanism.

[0046] Udev is a Linux subsystem for dynamic device detection and management, which has been provided since Linux kernel version 2.6. It propagates information about devices or changes in their state to the user space when devices are added to or removed from the system at startup.

[0047] The main functions and features of Udev include:

[0048] 1. Dynamic device node management: Udev automatically creates or deletes corresponding device nodes when devices are connected to the system or removed.

[0049] 2. Rule files: Udev uses rule files (usually located in the / etc / udev / rules.d / directory) to determine how to name device nodes and perform which operations (such as setting permissions, ownership, etc.).

[0050] 3). Device event notification: Udev can trigger events when devices are added, removed, or properties change, and other system components (such as daemons or scripts) can receive these events and perform corresponding operations.

[0051] 4). Support for persistent device naming: By using rule files, Udev can assign persistent names to devices, which will not change even if the physical connection order of the devices or the system is restarted.

[0052] The cloud server multi-elastic card routing automatic configuration method, after the cloud server starts, when a new elastic card is added, the Udev device manager adds the device name of the new elastic card persistently, and calls the custom script provided in the device event notification calling scheme to realize the entry of the network card management configuration file of the new elastic card device.

[0053] After receiving the device event notification sent by the Udev device manager, the custom script calls the DHCP client to trigger the DHCP Hook mechanism to configure and manage the corresponding network card device.

[0054] When the cloud server adds a new elastic card, the routing automatic configuration steps are as follows:

[0055] Step S1.1, when the cloud server first mounts the elastic card or the cloud server starts, the Udev device manager detects the elastic card device and adds the detected elastic card device event notification to the corresponding scheme of the network card policy routing configuration tool;

[0056] Step S1.2, when the network card policy routing configuration tool receives the message of adding a new network card, it calls the Linux system command to start the elastic card;

[0057] Step S1.3, use the DHCP client to request the configuration of the elastic card IP address information from the DHCP server;

[0058] Step S1.4, when the DHCP client receives the message, it triggers the DHCP Hook mechanism to judge the message type, and if the message type is binding to obtain a lease or update a lease, it performs policy routing configuration on the corresponding elastic card.

[0059] In the step S1.4, the DHCP client performs policy routing configuration on the elastic card, and the steps are as follows:

[0060] Step S1.4.1, create a separate routing table for the elastic card;

[0061] Step S1.4.2, add a default route in the new routing table, and specify the corresponding elastic card as the exit;

[0062] Step S1.4.3, add policy routing, point all the traffic from the newly added elastic network card to the elastic network card.

[0063] After the above steps are completed, the IP of the elastic network card can be accessed from outside the cloud server.

[0064] When the elastic network card on the cloud server is removed, the related configuration added by the scheme when adding the elastic network card also needs to be cleaned, otherwise it will be left. The processing steps are as follows:

[0065] Step S2.1, after the Udev device manager detects that the elastic network card device is removed, the corresponding device file is deleted, and the device event is notified to the script of the network card policy routing configuration tool;

[0066] Step S2.2, when the script receives the notification, call the DHCP client to release the lease of the corresponding elastic network card;

[0067] Step S2.3, when the DHCP client receives the message of releasing the lease of the elastic network card, triggers the DHCP hook, and the elastic network card policy routing configuration tool executes the command to clean up the policy routing and routing table added for the elastic network card, so as to avoid residual configuration affecting subsequent use.

[0068] When the above steps are executed, the configuration added by the scheme when adding the elastic network card is cleaned up.

[0069] The cloud server multi-elastic network card routing automatic configuration device comprises a Udev device manager, a network card policy routing configuration tool and a DHCP client;

[0070] The Udev device manager is responsible for persistently adding the device name of the elastic network card when detecting the elastic network card device, and notifying the custom script provided in the calling scheme through device event to add the detected elastic network card device to the network card policy routing configuration tool of the corresponding scheme;

[0071] The network card policy routing configuration tool is responsible for calling the Linux system command to pull up the elastic network card when receiving the message of adding the network card, and recording the network card management configuration file of the newly added elastic network card device in the script, and calling the DHCP client;

[0072] The DHCP client is responsible for configuring and managing the policy routing of the corresponding network card device through the DHCP Hook mechanism.

[0073] The Udev device manager is also responsible for deleting the corresponding device file after detecting that the elastic network card device is removed, and notifying the script of the network card policy routing configuration tool of the device event;

[0074] The script of the network card policy routing configuration tool is responsible for receiving the notification and calling the DHCP client to release the lease of the corresponding flexible network card.

[0075] The DHCP client is responsible for initiating a request to the DHCP server to configure the IP address information of the flexible network card, triggering the DHCPHook mechanism, judging the message type, and if the message type is binding to obtain the lease or update the lease, performing policy routing configuration on the corresponding flexible network card.

[0076] In addition, the DHCP client is also responsible for triggering DHCPook when receiving the message of releasing the lease of the flexible network card, and the flexible network card policy routing configuration tool executes the command to clean up the policy routing and routing table added for the flexible network card, so as to avoid residual configuration affecting subsequent use.

[0077] The DHCP client is responsible for policy routing configuration of the flexible network card, and the steps are as follows:

[0078] Step S1.4.1, creating a separate routing table for the flexible network card;

[0079] Step S1.4.2, adding a default route in the newly created routing table, and specifying the egress as the corresponding flexible network card;

[0080] Step S1.4.3, adding policy routing, and pointing the egress of all traffic entering from the newly added flexible network card to the flexible network card.

[0081] The cloud server multi-flexible network card routing automatic configuration device includes a memory and a processor; the memory is used to store a computer program, and the processor is used to execute the computer program to realize the method steps described above.

[0082] The readable storage medium has a computer program stored thereon, and the computer program is executed by the processor to realize the method steps described above.

[0083] The cloud server multi-flexible network card routing automatic configuration method and device, when the cloud server starts or adds a flexible network card, triggers the interface of the Linux system event notification subsystem udev, ensures the start of the flexible network card. When the Linux operating system detects the flexible network card device, through the network card device management system, the hook method provided by the dynamic host management protocol service of the system can receive the basic information of the network card, and the newly added flexible network card device is configured by the policy routing configuration tool to make the network traffic entering through the flexible network card sent out from the same flexible network card.

[0084] The cloud server multi-elastic network card routing automatic configuration method and device use the elastic network card policy routing automatic configuration based on the Linux device event notification subsystem Udev and the dynamic host configuration protocol system, and no manual intervention is needed in the configuration process. The method and device can ensure that the network card can be automatically started in the Linux system regardless of whether a network management service is installed, can reduce the complexity and the error probability of the configuration of the use of the multiple elastic network cards of the cloud server, and thus improve the use efficiency of the multiple elastic network cards.

[0085] The above-described embodiments are only one of the specific embodiments of the present application, and the usual changes and replacements made by those skilled in the art within the technical scheme of the present application should be included in the protection scope of the present application.

Claims

1. A method for automatically configuring routing for multiple elastic network cards in a cloud server, characterized by: When a new ENI is added after the cloud server is started, the Udev device manager persistently adds the ENI device name and calls the custom script provided in the solution through device event notification to implement the entry of the ENI management configuration file for the newly added ENI device. After receiving the device event notification from the Udev device manager, the custom script calls the DHCP client, triggers the DHCPHook mechanism, and configures and manages policy routing for the corresponding network card device. When a new elastic network interface card is added to a cloud server, the routing automatic configuration steps are as follows: Step S1.1: When the cloud server mounts the ENIC for the first time or the cloud server starts, the Udev device manager detects the ENIC device and notifies the network card policy routing configuration tool of the corresponding solution of the detected ENIC device addition event; Step S1.2: When the network card policy routing configuration tool receives the message of the newly added network card, it calls the Linux system command to start the elastic network card; Step S1.3: Use the DHCP client to send a request to the DHCP server to configure the IP address information of the elastic network card; Step S1.4: When the DHCP client receives the message, the DHCP Hook mechanism is triggered to determine the message type. If the message type is to bind and obtain a lease or renew a lease, the corresponding elastic network interface card is configured with policy routing. The DHCP client configures policy routing for the ENI. The steps are as follows: Step S1.4.

1. Create a separate routing table for the elastic network interface card. Step S1.4.

2. Add a default route to the newly created routing table and specify the egress as the corresponding elastic network interface card. Step S1.4.3: Add a policy route to direct the egress of all traffic entering from the newly added elastic network card to the elastic network card.

2. The method for automatically configuring routing for multiple elastic network cards in a cloud server according to claim 1, wherein: When an ENI is removed from a cloud server, the following steps are performed: Step S2.1: After the Udev device manager detects that the ENIC device has been removed, it deletes the corresponding device file and notifies the script of the network card policy routing configuration tool of the device event. Step S2.2: When the script receives the notification, it calls the DHCP client to release the lease of the corresponding elastic network interface card. Step S2.3: When the DHCP client receives the message that the ENIC lease is released, the DHCP hook is triggered, and the ENIC policy routing configuration tool executes commands to clear the policy routing and routing table added for the ENIC to prevent residual configuration from affecting subsequent use.

3. A cloud server multi-elastic network card routing automatic configuration device, characterized by: Used to implement the method according to claim 1 or 2, comprising a Udev device manager, a network card policy routing configuration tool and a DHCP client; The Udev device manager is responsible for persistently adding the device name of the elastic network card when it is detected, and calling the custom script provided in the solution through device event notification to notify the network card policy routing configuration tool of the corresponding solution of the detected elastic network card device addition event; The network card policy routing configuration tool is responsible for calling the Linux system command to start the elastic network card when receiving the message of the newly added elastic network card, entering the network card management configuration file of the newly added elastic network card device in the script, and calling the DHCP client; The DHCP client is responsible for configuring and managing the policy routing of the corresponding network card device by triggering the DHCP Hook mechanism.

4. The cloud server multi-elastic network card routing automatic configuration device according to claim 3, characterized in that: The Udev device manager is also responsible for deleting the corresponding device files after detecting that the elastic network card device is removed, and notifying the script of the network card policy routing configuration tool of the device event; The script of the network card policy routing configuration tool is responsible for calling the DHCP client after receiving the notification to release the lease of the corresponding elastic network card.

5. The cloud server multi-elastic network card routing automatic configuration device according to claim 3, characterized in that: The DHCP client is responsible for initiating a request to the DHCP server to configure the IP address information of the elastic network card, triggering the DHCP hook mechanism, and judging the message type. If the message type is binding to obtain a lease or renewing a lease, the corresponding elastic network card is configured with policy routing; In addition, the DHCP client is also responsible for triggering the DHCP hook when receiving the elastic network card lease release message, and the elastic network card policy routing configuration tool executes commands to clear the policy routing and routing table added for the elastic network card to prevent residual configuration from affecting subsequent use.

6. A cloud server multi-elastic network card routing automatic configuration device, characterized by: The method comprises a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the method according to any one of claims 1 to 2 when executing the computer program.

7. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.

Citation Information

Patent Citations

  • Network communication management method and device of cloud platform, equipment and storage medium

    CN115664920A

  • Lease file-based IP setting method and system

    WO2014194680A1