A network resource configuration method, apparatus, device, medium and product

By running resource configuration scripts on the server, network resources are automatically acquired and configured, solving the problems of low efficiency and high cost of manual configuration and achieving efficient and accurate network resource allocation.

CN119583338BActive Publication Date: 2025-11-18AGRICULTURAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411698149.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-11-18
Estimated Expiration
2044-11-25

AI Technical Summary

Technical Problem

In existing technologies, server network resource configuration relies on manual login to the management interface, resulting in low configuration efficiency and high costs.

Method used

By running a resource configuration script on the first server, obtaining the Internet Protocol addresses of multiple second servers connected to it, determining the target sequence number of the target server, and searching for the network resources to be allocated from the network resource file based on the target sequence number, the network resources of the target server are automatically configured.

Benefits of technology

It enables automated configuration of server network resources, improving configuration efficiency, ensuring configuration accuracy, and reducing costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583338B_ABST
    Figure CN119583338B_ABST
Patent Text Reader

Abstract

The application discloses a network resource configuration method, device, equipment, medium and product. The method comprises the following steps: obtaining a protocol address file associated with a first server based on a resource configuration script corresponding to the first server; determining a target serial number of a target server corresponding to each internet protocol address in the protocol address file; determining a to-be-allocated network resource corresponding to the target server based on the target serial number and a predetermined network resource file; and updating network configuration information in the target server based on the to-be-allocated network resource. The application solves the problem of low configuration efficiency and high cost caused by manually logging into a server management interface to configure network resources in the prior art, realizes automatic configuration of server network resources, improves configuration efficiency and ensures configuration accuracy, and reduces the cost of network resource configuration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer processing technology, and in particular to a method, apparatus, device, medium, and product for configuring network resources. Background Technology

[0002] Nowadays, in order to achieve remote monitoring of servers, it is usually necessary to configure the server with corresponding network resources, such as IP (Internet Protocol) addresses, gateways, and other network resources, so that the server can use the allocated network resources to join the network and achieve remote monitoring of the server.

[0003] Currently, configuring network resources for servers typically relies on manually logging into the management interface of each server to modify configuration information. This manual, offline method of configuring network resources suffers from low efficiency and high cost. Summary of the Invention

[0004] This invention provides a method, apparatus, device, medium, and product for configuring network resources, which enables automated configuration of server network resources while improving configuration efficiency and ensuring configuration accuracy, thereby reducing the cost of network resource configuration.

[0005] According to one aspect of the present invention, a method for configuring network resources is provided, the method comprising:

[0006] Based on the resource configuration script corresponding to the first server, obtain the protocol address file associated with the first server; wherein, the protocol address file includes the Internet protocol addresses of multiple second servers connected to the first server;

[0007] For each Internet Protocol address in the protocol address file, determine the target sequence number of the target server corresponding to the Internet Protocol address; wherein, the target server is a server in the second server;

[0008] Based on the target sequence number and a pre-determined network resource file, determine the network resources to be allocated corresponding to the target server; wherein, the network resource file includes at least one network resource to be configured corresponding to the server corresponding to the sequence number to be compared;

[0009] The network configuration information in the target server is updated based on the network resources to be allocated.

[0010] According to another aspect of the present invention, a network resource configuration apparatus is provided, the apparatus comprising:

[0011] The address acquisition module is used to acquire a protocol address file associated with the first server based on a resource configuration script corresponding to the first server; wherein the protocol address file includes the Internet Protocol addresses of a plurality of second servers connected to the first server;

[0012] The target sequence number acquisition module is used to determine the target sequence number of the target server corresponding to each Internet Protocol address in the protocol address file; wherein the target server is one of the servers in the second server;

[0013] The network resource determination module is used to determine the network resources to be allocated corresponding to the target server based on the target sequence number and a pre-determined network resource file; wherein, the network resource file includes at least one network resource to be configured corresponding to the server corresponding to the sequence number to be compared;

[0014] The network resource configuration module is used to update the network configuration information in the target server based on the network resources to be allocated.

[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0016] At least one processor; and a memory communicatively connected to said at least one processor; wherein,

[0017] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the network resource configuration method according to any embodiment of the present invention.

[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the network resource configuration method according to any embodiment of the present invention.

[0019] According to another aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements a network resource configuration method as described in any embodiment of the present invention.

[0020] The technical solution of this invention, through a resource configuration script corresponding to a first server, obtains the protocol address file associated with the first server; determines the target sequence number of the target server corresponding to the Internet Protocol address; the target server is a server among the second servers; based on the target sequence number and a pre-determined network resource file, determines the network resources to be allocated corresponding to the target server; the network resource file includes at least one network resource to be configured corresponding to the server with the sequence number to be compared; and updates the network configuration information in the target server based on the network resources to be allocated. This solves the problems of low configuration efficiency and high cost in the prior art of configuring network resources by manually logging into the server management interface. It realizes that by running a resource configuration script in the first server, obtaining the Internet Protocol addresses of multiple second servers connected to the first server, and then determining the target sequence number of the target server corresponding to the Internet Protocol address, the target sequence number is used to uniquely identify the server, ensuring that the corresponding network resources correspond one-to-one with the server, and guaranteeing the correctness of network resource allocation. Furthermore, based on the target sequence number, the network resources to be allocated corresponding to the target server are searched from the network resource file, and the network resources to be allocated are configured in the target server. This realizes the automatic configuration of server network resources, improves the efficiency of server network resource configuration, and achieves the technical effect of reducing network resource configuration costs.

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

[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a flowchart of a network resource configuration method according to Embodiment 1 of the present invention;

[0024] Figure 2 This is a schematic diagram of a network resource configuration method provided according to Embodiment 1 of the present invention;

[0025] Figure 3 This is a schematic diagram of a network resource configuration device according to Embodiment 2 of the present invention;

[0026] Figure 4This is a schematic diagram of the structure of an electronic device that implements the network resource configuration method of this invention. Detailed Implementation

[0027] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0029] Before introducing this technical solution, the application scenarios can be described first. The technical solution provided by the embodiments of this invention can be applied to any scenario where network resources need to be configured for a device. For example, when it is necessary to configure relevant information for a server, or to change the relevant configuration information of the server, the technical solution provided in this embodiment can be used for implementation. It should be noted that the technical solution provided in this embodiment can be integrated into a script file, which can be run on the first server to execute the network resource configuration method provided in this embodiment, thereby automating the configuration of corresponding network resources for each server connected to the first server.

[0030] Example 1

[0031] Figure 1 This is a flowchart of a network resource configuration method according to Embodiment 1 of the present invention. This embodiment is applicable to any situation requiring network resource configuration for a device. The method can be executed by a network resource configuration device, which can be implemented in hardware and / or software. The network resource configuration device can be configured in a first server, which can be a Linux server. Figure 1 As shown, the method includes:

[0032] S110. Based on the resource configuration script corresponding to the first server, obtain the protocol address file associated with the first server.

[0033] The resource configuration script contains the logic code for configuring network resources. The protocol address file includes the Internet Protocol addresses of multiple second servers connected to the first server. A second server can be a server for which network resources need to be configured. For example, a second server could be a PC (Personal Computer) server.

[0034] In this embodiment, a resource configuration script can be run on the first server. Based on the storage address of the protocol address file associated with the first server in the resource configuration script, the protocol address file is read from the storage address to retrieve the Internet protocol addresses of multiple second servers connected to the first server.

[0035] To ensure that the first server can accurately configure network resources to the second servers connected to it, before retrieving the protocol address file associated with the first server based on the resource configuration script corresponding to the first server, the Internet Protocol addresses of multiple second servers connected to the first server can be obtained. The Internet Protocol address of each second server is then sequentially written into the protocol address file, and a resource configuration script corresponding to the first server is created. The first storage address of the protocol address file is filled into the first query statement in the resource configuration script, and the second storage address of the network resource file is filled into the second query statement in the resource configuration script. This allows the resource configuration script to be run based on the first server, retrieving each Internet Protocol address in the protocol address file sequentially based on the first storage address, and retrieving the network resource file based on the second storage address.

[0036] In this configuration, each Internet Protocol address corresponds to at least one second server. The first storage address represents the file storage path of the protocol address file. The second storage address represents the file storage path of the resource file. The network resource file includes at least one network resource to be configured corresponding to the server with the sequence number to be compared. The sequence number to be compared can be a unique identifier in the server's hardware system. The network resource to be configured can be a network resource that needs to be configured for the corresponding server. Optionally, the network resource may include, but is not limited to, Internet Protocol addresses, subnet masks, default gateways, MAC (Media Access Control) addresses, virtual LANs, network interfaces, routing information, etc.

[0037] Specifically, the interface used to access the baseboard management controller can be invoked to read the Internet Protocol (IP) address of each second server connected to the first server, and the IP address of each second server can be written sequentially row-wise into a protocol address file. Simultaneously, a script file can be created on the first server and given executable permissions, serving as a resource configuration script. The executable permissions allow the script file to run on the first server. Further, the first storage address of the protocol address file can be filled into the first query statement in the resource configuration script, so that when the first query statement is executed, each IP address in the protocol address file is retrieved sequentially using the first storage address in the first query statement. Simultaneously, the second storage address of the network resource file can be filled into the second query statement in the resource configuration script, so that when the second query statement is executed, the network resource file is read from the second storage address in the second query statement.

[0038] For example, see Figure 2 You can use a Linux server that is network reachable from all the second servers as the first server; write the serial numbers of all the second servers, as well as their management IPs, gateways, subnet masks, and other configuration information (i.e., the network resources to be configured) into a network resource file, with each second server's configuration information on a separate line; name the network resource file A1; use a preset command (such as the Ipmi command) to obtain the management IP addresses (i.e., Internet Protocol addresses) of all the second servers, and write all the IP addresses into a protocol address file, with each IP address on a separate line, named A2. The file path (i.e., the first storage address) can be defined by yourself, such as using the variable LIST to store the file path, such as LIST = / * / A2.txt; create a script file on the Linux server terminal as the resource configuration script, named A3; add a declaration (e.g., the declaration is #! / bin / bash) to the first line of the resource configuration script, which specifies that the Bash interpreter should be used to execute this resource configuration script.

[0039] S120. For each Internet Protocol address in the protocol address file, determine the target sequence number of the target server corresponding to the Internet Protocol address.

[0040] The target server is the server in the second server group. The target sequence number is used to identify the uniqueness of the target server.

[0041] In this embodiment, each Internet Protocol address in the protocol address file can be traversed, and then IPMI (Intelligent Platform Management Interface) can be called to obtain the serial number of the target server corresponding to the Internet Protocol address as the target serial number.

[0042] For example, see [link to example]. Figure 2 You can use a for loop to traverse and read each Internet Protocol address in the protocol address file. During each loop iteration, you can use the command-line tool based on the IPMI specification to query the server's SMBIOS information (including product information such as system manufacturer, serial number, and motherboard version), and then obtain the target server's serial number from the SMBIOS information.

[0043] It should be noted that before network resource configuration, the same Internet Protocol address may correspond to one or more second servers. When the first server communicates with a second server using an Internet Protocol address, multiple second servers may be communicating with it. To ensure the accuracy of network resource configuration, a preemptive mechanism can be used to obtain the target sequence number of only one second server at a time. Network resources are then configured for that second server based on the target sequence number. After configuring the network resources for that second server, the server then communicates with the next second server based on the Internet Protocol address to obtain the target sequence number of the next second server.

[0044] In this embodiment, for each Internet Protocol address in the protocol address file, the target sequence number of the target server corresponding to the Internet Protocol address is determined, including: for the first Internet Protocol address, determining the target sequence number of the target server corresponding to the Internet Protocol address; for Internet Protocol addresses after the first one, after the network configuration information in the target server corresponding to the previous Internet Protocol address is updated, obtaining the target sequence number of the target server corresponding to the current Internet Protocol address.

[0045] Specifically, upon obtaining the first Internet Protocol address (IPA) from the address file, a preemptive mechanism is used to communicate with a second server corresponding to that IPA. This second server is the target server. The target server's target sequence number is obtained, and based on this sequence number and a pre-defined network resource file, the corresponding network resources are configured for that target server. After configuring the network resources for the target server—that is, after the network configuration information in the target server corresponding to the previous IPA is updated—the next IPA is read from the address file and used as the current IPA. The target sequence number corresponding to this current IPA is then obtained. This process is repeated to iterate through each target server, obtaining its target sequence number and configuring the corresponding network resources based on it and the pre-defined network resource file.

[0046] In this embodiment, determining the target serial number of the target server corresponding to the Internet Protocol address includes: connecting to the Baseboard Management Controller (BMC) of the target server corresponding to the Internet Protocol address based on a preset command line; and obtaining the server serial number in the Baseboard Management Controller as the target serial number of the target server. The preset command line can be the ipmitool command based on the IPMI specification, used to interact with a second server that supports IPMI.

[0047] See also Figure 2 The IPMI interface can be made to communicate with the baseboard management controller of the target server through the ipmitool command. Then, the baseboard management controller can be accessed and the server serial number can be obtained from the baseboard management controller. This server serial number can be used as the target serial number of the target server.

[0048] The advantage of this method is that it allows you to query the target serial number of the target server by executing a preset command line. You can obtain the serial number without entering the target server's operation interface. Based on the obtained serial number, you can determine the resources that need to be configured on the server, which improves both the accuracy and convenience of network resource configuration.

[0049] S130. Based on the target sequence number and a pre-determined network resource file, determine the network resources to be allocated corresponding to the target server.

[0050] In this embodiment, the network resource file can be searched for a network resource corresponding to the target server based on the target sequence number. If a network resource is found, it is used as a network resource to be allocated to the target server.

[0051] Optionally, based on the target sequence number and a pre-determined network resource file, the network resource to be allocated corresponding to the target server is determined, including: searching the pre-determined network resource file for a matching sequence number; if a matching sequence number exists, the network resource to be configured corresponding to the found matching sequence number in the network resource file is determined as the network resource to be allocated corresponding to the target server.

[0052] The network resources to be allocated include at least one of the following: Internet Protocol address, gateway information, and subnet mask information. The Internet Protocol address is the server's unique identifier within the network. Gateway information refers to the router address used by the server to access external networks (such as the Internet). Subnet mask information defines the network subnet where the server resides.

[0053] See also Figure 2 The system compares the obtained target sequence number with the sequence number to be compared in the network resource file. If they match, the network resource to be configured for the server corresponding to the matching sequence number in the network resource file is used as the network resource to be allocated to the target server. If not, the cursor moves to the next Internet Protocol address in the protocol address file, and the process of determining the target sequence number of the target server corresponding to the Internet Protocol address and the network resource to be allocated to the target server continues until all Internet Protocol addresses in the protocol address file have been traversed. The advantage of this setup is that it allows for automatic allocation and management of network resources based on the server's sequence number. That is, based on the sequence number obtained from the network resource file, the network resource configuration for each second server can be completed sequentially, improving network resource configuration efficiency while ensuring configuration accuracy.

[0054] S140. Update the network configuration information in the target server based on the network resources to be allocated.

[0055] In this embodiment, the ipmitool command can be used to change the network configuration information in the target server to the network resource to be allocated. For example, if a matching sequence number is found, the ipmitool command is used to modify the network configuration information of the target server, such as the management IP, gateway, and subnet mask, to the corresponding network resource to be allocated in the network resource file.

[0056] To manage the configuration results of network resources, after updating the network configuration information in the target server based on the network resources to be allocated, the update results can be redirected and written to a preset backtracking file to check the update results in the preset backtracking file and confirm whether the network resources of all target servers are configured correctly.

[0057] For example, after each update of the network configuration information on the target server, the modified network configuration information can be output using the ipmitool command as the update result. This result can then be redirected and written to a result file (i.e., a preset backtracking file) to confirm whether the network configuration information has been modified correctly. The technical solution provided in this embodiment achieves backtracking of update issues by outputting the update result as a log to a specified file, facilitating subsequent management and maintenance of the configuration information.

[0058] To ensure users are promptly informed of the server's network resource configuration status, a preset prompt message can be displayed after all target servers' network configuration information is updated, thus informing users whether the configuration operation is complete.

[0059] For example, a notification message (i.e., a preset notification message) can be added to the end of the resource configuration script to be displayed after the network configuration information on all target servers is updated. For instance, the preset notification message could be "Configuration completed successfully!".

[0060] The technical solution of this invention, through a resource configuration script corresponding to a first server, obtains the protocol address file associated with the first server; determines the target sequence number of the target server corresponding to the Internet Protocol address; the target server is a server among the second servers; based on the target sequence number and a pre-determined network resource file, determines the network resources to be allocated corresponding to the target server; the network resource file includes at least one network resource to be configured corresponding to the server with the sequence number to be compared; and updates the network configuration information in the target server based on the network resources to be allocated. This solves the problems of low configuration efficiency and high cost in the prior art of configuring network resources by manually logging into the server management interface. It achieves this by running a resource configuration script in the first server to obtain the Internet Protocol addresses of multiple second servers connected to the first server, and then determining the target sequence number of the target server corresponding to the Internet Protocol address. The target sequence number is used to uniquely identify the server, ensuring the correctness of network resource allocation. Furthermore, based on the target sequence number, the network resources to be allocated corresponding to the target server are searched from the network resource file, and the network resources to be allocated are configured in the target server. This achieves automated configuration of server network resources while improving the efficiency of server network resource configuration, thus reducing the technical effect of network resource configuration costs.

[0061] Example 2

[0062] Figure 3 This is a schematic diagram of a network resource configuration device according to Embodiment 2 of the present invention. Figure 3As shown, the device includes: an address acquisition module 210, a target serial number determination module 220, a network resource determination module 230, and a network resource configuration module 240.

[0063] The system includes: an address acquisition module 210, used to acquire a protocol address file associated with the first server based on a resource configuration script corresponding to the first server; wherein the protocol address file includes Internet Protocol addresses of multiple second servers connected to the first server; a target sequence number determination module 220, used to determine a target sequence number of a target server corresponding to each Internet Protocol address in the protocol address file; wherein the target server is one of the second servers; a network resource determination module 230, used to determine a network resource to be allocated corresponding to the target server based on the target sequence number and a pre-determined network resource file; wherein the network resource file includes at least one network resource to be configured corresponding to a server with a sequence number to be compared; and a network resource configuration module 240, used to update the network configuration information in the target server based on the network resource to be allocated.

[0064] The technical solution of this embodiment obtains the protocol address file associated with the first server based on the resource configuration script corresponding to the first server; determines the target sequence number of the target server corresponding to the Internet Protocol address; the target server is a server among the second servers; determines the network resources to be allocated corresponding to the target server based on the target sequence number and a pre-determined network resource file; the network resource file includes at least one network resource to be configured corresponding to the server with the sequence number to be compared; and updates the network configuration information in the target server based on the network resources to be allocated. This solves the problems of low configuration efficiency and high cost in the prior art of configuring network resources by manually logging into the server management interface. It realizes that by running the resource configuration script in the first server, obtaining the Internet Protocol addresses of multiple second servers connected to the first server, and then determining the target sequence number of the target server corresponding to the Internet Protocol address, the target sequence number is used to uniquely identify the server to ensure the correctness of network resource allocation. Furthermore, based on the target sequence number, the network resources to be allocated corresponding to the target server are searched from the network resource file, and the network resources to be allocated are configured in the target server. This realizes the automated configuration of server network resources while improving the efficiency of server network resource configuration and achieving the technical effect of reducing network resource configuration costs.

[0065] Optionally, based on the above-described apparatus, the apparatus may further include:

[0066] An Internet Protocol address acquisition unit is used to acquire the Internet Protocol addresses of a plurality of second servers connected to the first server; wherein the same Internet Protocol address corresponds to at least one second server;

[0067] The script creation unit is used to write the Internet protocol address of each second server into the protocol address file in sequence, and to create a resource configuration script corresponding to the first server.

[0068] The resource configuration script determination unit is used to fill the first storage address of the protocol address file into the first query statement in the resource configuration script, and fill the second storage address of the network resource file into the second query statement in the resource configuration script, so as to run the resource configuration script based on the first server, obtain each Internet protocol address in the protocol address file in sequence based on the first storage address, and obtain the network resource file based on the second storage address.

[0069] Based on the above-mentioned device, optionally, the target sequence number determination module 220 is used to determine the target sequence number of the target server corresponding to the first Internet Protocol address; and for the Internet Protocol addresses located after the first one, after the network configuration information in the target server corresponding to the previous Internet Protocol address is updated, to determine the target sequence number of the target server corresponding to the current Internet Protocol address.

[0070] Based on the above-mentioned device, optionally, the target serial number determination module 220 includes:

[0071] A connection unit is used to connect to the baseboard management controller of the target server corresponding to the Internet protocol address based on a preset command line;

[0072] The target serial number determination unit is used to obtain the server serial number in the baseboard management controller as the target serial number of the target server.

[0073] Based on the above-mentioned device, optionally, a network resource determination module 230 is used to search from a pre-determined network resource file for whether there is a matching sequence number to be compared with the target sequence number; if there is, the network resource to be configured corresponding to the found matching sequence number in the network resource file is determined as the network resource to be allocated corresponding to the target server; wherein, the network resource to be allocated includes at least one of Internet Protocol address, gateway information and mask information.

[0074] Optionally, based on the above-described apparatus, the apparatus may further include: an update result writing unit, used to redirect the update result to a preset backtracking file.

[0075] Optionally, based on the above-described device, the device may further include: a preset prompt information determination unit, used to determine and display preset prompt information.

[0076] The network resource configuration apparatus provided in this embodiment of the invention can execute the network resource configuration method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0077] Example 3

[0078] Figure 4 This is a schematic diagram of the structure of an electronic device implementing the network resource configuration method of embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), 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 invention described and / or claimed herein.

[0079] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0080] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0081] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 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 processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as methods for configuring network resources.

[0082] In some embodiments, the network resource configuration method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the network resource configuration method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the network resource configuration method by any other suitable means (e.g., by means of firmware).

[0083] 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), payload-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.

[0084] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0085] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. 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 fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0086] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device 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 electronic device. 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).

[0087] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations 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., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0088] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0089] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the network resource configuration method provided in any embodiment of this invention.

[0090] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof. Programming languages ​​include object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0091] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0092] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. 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 invention should be included within the scope of protection of this invention.

Claims

1. A method for configuring network resources, characterized in that, include: Obtain the Internet Protocol (IP) addresses of a plurality of second servers connected to the first server; wherein the same IP address corresponds to at least one second server; Write the Internet Protocol address of each of the second servers into the protocol address file in sequence, and create a resource configuration script corresponding to the first server; The first storage address of the protocol address file is filled into the first query statement in the resource configuration script, and the second storage address of the network resource file is filled into the second query statement in the resource configuration script, so that when the resource configuration script is run based on the first server, each Internet protocol address in the protocol address file is obtained sequentially based on the first storage address, and the network resource file is obtained based on the second storage address; Based on the resource configuration script corresponding to the first server, obtain the protocol address file associated with the first server; wherein, the protocol address file includes the Internet protocol addresses of multiple second servers connected to the first server; For each Internet Protocol address in the protocol address file, determine the target sequence number of the target server corresponding to the Internet Protocol address; wherein, the target server is a server in the second server; Based on the target sequence number and a pre-determined network resource file, determine the network resources to be allocated corresponding to the target server; wherein, the network resource file includes at least one network resource to be configured corresponding to the server corresponding to the sequence number to be compared; The network configuration information in the target server is updated based on the network resources to be allocated.

2. The method according to claim 1, characterized in that, For each Internet Protocol address in the protocol address file, determining the target sequence number of the target server corresponding to the Internet Protocol address includes: For the first Internet Protocol address, determine the target sequence number of the target server corresponding to the Internet Protocol address; For the Internet Protocol address following the first one, after the network configuration information in the target server corresponding to the previous Internet Protocol address is updated, the target sequence number of the target server corresponding to the current Internet Protocol address is determined.

3. The method according to claim 1, characterized in that, Determining the target sequence number of the target server corresponding to the Internet Protocol address includes: A baseboard management controller that connects to the target server corresponding to the Internet protocol address based on a preset command line; Obtain the server serial number in the baseboard management controller and use it as the target serial number of the target server.

4. The method according to claim 1, characterized in that, The step of determining the network resources to be allocated corresponding to the target server based on the target sequence number and a pre-determined network resource file includes: Search a pre-determined network resource file for a matching sequence number to be compared. If it exists, the network resource to be configured corresponding to the found matching sequence number in the network resource file is determined as the network resource to be allocated corresponding to the target server. The network resources to be allocated include at least one of Internet Protocol address, gateway information, and subnet mask information.

5. The method according to claim 1, characterized in that, After updating the network configuration information in the target server based on the network resources to be allocated, the method further includes: The update results are redirected and written to a pre-defined backtracking file.

6. The method according to claim 1, characterized in that, After the network configuration information in all the target servers is updated, the method further includes: Determine and display the preset prompt message.

7. A network resource configuration device, characterized in that, include: An Internet Protocol address acquisition unit is used to acquire the Internet Protocol addresses of a plurality of second servers connected to a first server; wherein the same Internet Protocol address corresponds to at least one second server; The script creation unit is used to write the Internet protocol address of each second server into the protocol address file in sequence, and to create a resource configuration script corresponding to the first server. The resource configuration script determination unit is used to fill the first storage address of the protocol address file into the first query statement in the resource configuration script, and fill the second storage address of the network resource file into the second query statement in the resource configuration script, so as to run the resource configuration script based on the first server, obtain each Internet protocol address in the protocol address file in sequence based on the first storage address, and obtain the network resource file based on the second storage address; The address acquisition module is used to acquire a protocol address file associated with the first server based on a resource configuration script corresponding to the first server; wherein the protocol address file includes the Internet Protocol addresses of a plurality of second servers connected to the first server; The target sequence number determination module is used to determine the target sequence number of the target server corresponding to each Internet Protocol address in the protocol address file; wherein the target server is one of the servers in the second server; The network resource determination module is used to determine the network resources to be allocated corresponding to the target server based on the target sequence number and a pre-determined network resource file; wherein, the network resource file includes at least one network resource to be configured corresponding to the server corresponding to the sequence number to be compared; The network resource configuration module is used to update the network configuration information in the target server based on the network resources to be allocated.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the network resource configuration method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method for configuring network resources according to any one of claims 1-6.

Citation Information

Patent Citations

  • Equipment access method and device, computer readable storage medium and electronic equipment

    CN116192626A

  • Network resource change method and device, equipment and storage medium

    CN117176576A