A Method, Device, Equipment and Storage Medium for Obtaining BMC IP
By conducting connectivity tests when the BMC is connected and disconnected from the current network segment, generating and comparing the address pool, determining the target IP address of the BMC, the problem of difficulty in obtaining the BMC IP address in abnormal situations is solved, and the effect of obtaining the accurate IP address without additional equipment is achieved.
Patent Information
- Application Number
- CN202310199272.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-28
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2043-02-28
AI Technical Summary
In exceptional cases, it is difficult to obtain the Baseboard Management Controller (BMC) Internet Protocol (IP) address, especially when there is no display or server exception.
When the BMC is connected and disconnected from the current network segment, the IP addresses in the current network segment are connected and disconnected, and two address pools are generated, and then the two address pools are compared differently to determine the target IP address of the BMC.
There is no need to prepare a BMC serial port cable or open the chassis to view the MAC address on the motherboard. It can accurately obtain the BMC IP address in abnormal situations, simplifying the operation process.
Smart Images

Figure CN116192807B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and in particular, to a method, apparatus, device, and storage medium for obtaining a BMC IP. Background Art
[0002] A baseboard management controller (BMC) is used to manage a server. Through the BMC, system logs of the server can be viewed, etc. To access the BMC, the Internet Protocol (IP) address of the BMC needs to be obtained. However, in some abnormal situations, such as when there is no available display or the server malfunctions, even if a display is connected, it is impossible to enter the operating system and the Basic Input Output System (BIOS) to obtain the BMC IP of the server.
[0003] In view of the problem of difficultly obtaining the BMC IP in the above abnormal situations, the prior art mainly has the following two solutions:
[0004] (1) Using a BMC serial cable to obtain the BMC IP, that is, connecting the BMC serial cable to the BMC serial port, directly entering the BMC's own system through the user name and password, and directly reading the BMC IP using the ifconfig command. However, this method requires preparing a BMC serial cable;
[0005] (2) Obtaining the BMC IP according to the Media Access Control (MAC) address, that is, viewing the MAC address on the BMC motherboard, entering the Dynamic Host Configuration Protocol (DHCP) server, viewing the IP assigned to the corresponding MAC address, or analyzing the correspondence between the MAC address and the IP within the network segment through software, so as to obtain the BMC IP. However, this method requires opening the chassis to view the MAC address on the motherboard, and the MAC address on the motherboard may be inconsistent with the actual MAC address of the BMC. In addition, there may be obstacles to logging in to the DHCP server. Summary of the Invention
[0006] The present disclosure provides a method, apparatus, device, and storage medium for obtaining a BMC IP to at least solve the above technical problems existing in the prior art.
[0007] According to a first aspect of the present disclosure, a method for obtaining a BMC IP is provided. The method includes: when the baseboard management controller (BMC) is connected to the current network segment, performing a connectivity test on the Internet protocol (IP) addresses within the current network segment to obtain a first test result, and determining the IP addresses indicating successful connectivity in the first test result as a first address pool; when the BMC is disconnected from the current network segment, performing a connectivity test on the IP addresses within the current network segment to obtain a second test result, and determining the IP addresses indicating successful connectivity in the second test result as a second address pool; performing a difference comparison between the first address pool and the second address pool to obtain a target address pool, where the target address pool includes the different IP addresses between the first address pool and the second address pool; and determining a target IP address of the BMC according to the target address pool.
[0008] In an implementable embodiment, the performing a connectivity test on the IP addresses within the current network segment includes: performing a connectivity test on the IP addresses within the current network segment through the nbtsacn command or the ping command.
[0009] In an implementable embodiment, the performing a difference comparison between the first address pool and the second address pool to obtain a target address pool includes: generating a first file according to a first IP address in the first address pool; generating a second file according to a second IP address in the second address pool; and performing a difference comparison between the first file and the second file according to a file comparison command to obtain the target address pool.
[0010] In an implementable embodiment, the performing a difference comparison between the first address pool and the second address pool to obtain a target address pool includes: performing a difference comparison between the first address pool and the second address pool to obtain an initial address pool; determining whether the number of IP addresses in the initial address pool meets a preset threshold to obtain a determination result; if the determination result is yes, determining the initial address pool as the target address pool; if the determination result is no, re-performing a connectivity test on the IP addresses within the current network segment when the BMC is disconnected from the current network segment to obtain a third test result, determining the IP addresses indicating successful connectivity in the third test result as a third address pool, and performing a difference comparison between the first address pool and the third address pool until the determination result is yes.
[0011] In an implementable embodiment, determining the target IP address of the BMC according to the target address pool includes: when the BMC is connected to the current network segment, performing a connectivity test on a test IP address to obtain a fourth test result, where the test IP address is an IP address in the target address pool; if the fourth test result indicates that the test IP address is successfully connected, then when the BMC is disconnected from the current network segment, performing a connectivity test on the test IP address to obtain a fifth test result, and determining the target IP address according to the fifth test result; if the fourth test result indicates that the test IP address fails to connect, then determining another IP address in the target address pool as the test IP address, and when the BMC is connected to the current network segment, performing a connectivity test on the test IP address until the fourth test result indicates that the test IP address is successfully connected.
[0012] In an implementable embodiment, determining the target IP address according to the fifth test result includes: if the fifth test result indicates that the test IP address fails to connect, then determining the test IP address as the target IP address; if the fifth test result indicates that the test IP address is successfully connected, then determining another IP address in the target address pool as the test IP address, and when the BMC is connected to the current network segment, performing a connectivity test on the test IP address until the fifth test result indicates that the test IP address fails to connect.
[0013] In an implementable embodiment, the method further includes: sending a lighting instruction to the BMC according to the target IP address, and when the BMC lights up the positioning light in response to the lighting instruction, determining the target IP address as the correct IP address of the BMC.
[0014] According to a second aspect of the present disclosure, there is provided a BMC IP acquisition device, characterized in that the device includes: a first test module, configured to perform a connectivity test on an Internet protocol (IP) address in the current network segment when a baseboard management controller (BMC) is connected to the current network segment, obtain a first test result, and determine the IP addresses indicating successful connection in the first test result as a first address pool; a second test module, configured to perform a connectivity test on the IP addresses in the current network segment when the BMC is disconnected from the current network segment, obtain a second test result, and determine the IP addresses indicating successful connection in the second test result as a second address pool; a comparison module, configured to perform a difference comparison between the first address pool and the second address pool to obtain a target address pool, where the target address pool includes the different IP addresses between the first address pool and the second address pool; a determination module, configured to determine the target IP address of the BMC according to the target address pool.
[0015] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0016] at least one processor; and
[0017] a memory communicatively connected to the at least one processor; wherein,
[0018] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in the present disclosure.
[0019] According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the method described in the present disclosure.
[0020] A method, apparatus, device and storage medium for obtaining a BMC IP in the present disclosure. When the baseboard management controller (BMC) is connected to the current network segment, a connectivity test is performed on the Internet protocol (IP) addresses in the current network segment to obtain a first test result, and the IP addresses indicating successful connectivity in the first test result are determined as a first address pool; when the BMC is disconnected from the current network segment, a connectivity test is performed on the IP addresses in the current network segment to obtain a second test result, and the IP addresses indicating successful connectivity in the second test result are determined as a second address pool; a difference comparison is performed between the first address pool and the second address pool to obtain a target address pool, and the target address pool includes the different IP addresses between the first address pool and the second address pool; according to the target address pool, the target IP address of the BMC is determined. Thus, the first address pool obtained when the BMC is connected to the current network segment includes the target IP address of the BMC, and the second address pool obtained when the BMC is disconnected from the current network segment does not include the target IP address of the BMC. Taking the different IP addresses between the first address pool and the second address pool as the target address pool, that is, the target address pool includes the target IP address of the BMC. Therefore, finally, the target IP address of the BMC can be determined according to the target address pool. In this way, when obtaining the target IP address of the BMC, there is no need to prepare a BMC serial cable, nor to open the chassis to view the MAC address on the motherboard and log in to the DHCP server.
[0021] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features, and advantages of the exemplary embodiments of the present disclosure will become readily understandable. In the drawings, several embodiments of the present disclosure are shown in an exemplary rather than restrictive manner, wherein:
[0023] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0024] Figure 1 A flowchart showing a method for obtaining a BMC IP in the first embodiment of the present disclosure is shown;
[0025] Figure 2 A flowchart showing a method for obtaining a BMC IP in the fourth embodiment of the present disclosure is shown;
[0026] Figure 3 A schematic structural diagram of a device for obtaining a BMC IP in the sixth embodiment of the present disclosure is shown;
[0027] Figure 4 A schematic diagram of the composition structure of an electronic device in an embodiment of the present disclosure is shown. Detailed implementation manners
[0028] To make the objectives, features, and advantages of the present disclosure more obvious and understandable, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present disclosure.
[0029] Figure 1 A flowchart showing a method for obtaining a BMC IP in the first embodiment of the present disclosure is shown, as Figure 1 shown, the method mainly includes:
[0030] Step S101, when the baseboard management controller BMC is connected to the current network segment, perform a connectivity test on the Internet protocol IP addresses in the current network segment to obtain a first test result, and determine the IP addresses indicating successful connectivity in the first test result as the first address pool.
[0031] In this embodiment, first, it is necessary to test the connectivity of Internet Protocol (IP) addresses within the current network segment when the Baseboard Management Controller (BMC) can work properly and is connected to the current network segment, obtain a first test result, and determine the IP addresses indicating successful connectivity in the first test result as the first address pool. Among them, if the BMC is connected to a network cable, it is considered that the BMC is connected to the current network segment. Specifically, the target IP address of the BMC is included in multiple IP addresses within the current network segment. And because the BMC is connected to the current network segment, the target IP address can be connected during the connectivity test. By determining the IP addresses indicating successful connectivity among multiple first test results as the first address pool, the target IP address of the BMC will surely be included in the first address pool.
[0032] In an implementable manner, the connectivity of IP addresses within the current network segment can be tested through the nbtsacn command or the ping command. When the nbtsacn command is used for the connectivity test, it will send NetBIOS (Network Basic Input / Output System) status queries to each IP address within the current network segment. For each IP address that responds to the NetBIOS status query, the nbtsacn command will list its corresponding IP address, NetBIOS computer name, logged-in user name, MAC address, etc.; when the ping command is used for the connectivity test, it will send test data packets to each IP address within the current network segment, receive the response data of the IP address for the test data packets, and count the response time to test whether the IP address is connected.
[0033] Step S102: When the BMC is disconnected from the current network segment, test the connectivity of IP addresses within the current network segment, obtain a second test result, and determine the IP addresses indicating successful connectivity in the second test result as the second address pool.
[0034] In this embodiment, it is also necessary to test the connectivity of IP addresses within the current network segment when the BMC is disconnected from the current network segment, obtain a second test result, and determine the IP addresses indicating successful connectivity in the second test result as the second address pool. Among them, if the BMC is disconnected from the network cable, it is considered that the BMC is disconnected from the current network segment. Specifically, although the target IP address of the BMC is included in multiple IP addresses within the current network segment, because the BMC is disconnected from the current network segment, the target IP address cannot be connected during the connectivity test. By determining the IP addresses indicating successful connectivity among multiple second test results as the second address pool, the target IP address of the BMC will surely not be included in the second address pool. Preferably, in step S102, the connectivity of IP addresses within the current network segment can also be tested through the nbtsacn command or the ping command.
[0035] Step S103: Compare the first address pool and the second address pool to obtain a target address pool, where the target address pool includes the different IP addresses in the first address pool and the second address pool.
[0036] Step S104: Determine the target IP address of the BMC according to the target address pool.
[0037] In this embodiment, since the target IP address of the BMC must be included in the first address pool and definitely not included in the second address pool, therefore, by comparing the differences between the first address pool and the second address pool and determining the different IP addresses in the first address pool and the second address pool as the target address pool, the target IP address of the BMC must be included in the target address pool, and the target IP address of the BMC can be determined according to the target address pool.
[0038] In an implementable manner, if there is only one IP address in the target address pool, the IP address can be determined as the target IP address of the BMC; if there are multiple IP addresses in the target address pool, for each IP address in the target address pool, respectively conduct a connectivity test on the IP address when the BMC is connected to the current network segment and when the BMC is disconnected from the current network segment. If the IP address is successfully connected when the BMC is connected to the current network segment and the IP address fails to connect when the BMC is disconnected from the current network segment, then the IP address is determined as the target IP address of the BMC.
[0039] In the first embodiment of the present disclosure, the first address pool obtained when the BMC is connected to the current network segment includes the target IP address of the BMC, and the second address pool obtained when the BMC is disconnected from the current network segment does not include the target IP address of the BMC. The different IP addresses in the first address pool and the second address pool are used as the target address pool, that is, the target address pool includes the target IP address of the BMC. Therefore, finally, the target IP address of the BMC can be determined according to the target address pool. In this way, when obtaining the target IP address of the BMC, there is no need to prepare a BMC serial cable, nor to open the chassis to view the MAC address on the motherboard and log in to the DHCP server.
[0040] In the second embodiment of the present disclosure, step S103 mainly includes:
[0041] Generate a first file according to the first IP address in the first address pool; generate a second file according to the second IP address in the second address pool; compare the differences between the first file and the second file according to the file comparison command to obtain the target address pool.
[0042] In this embodiment, when comparing the differences between the first address pool and the second address pool, first, according to the first IP addresses in the first address pool, a first file containing all the first IP addresses can be generated. Then, according to the second IP addresses in the second address pool, a second file containing all the second IP addresses can be generated. Finally, according to the file comparison command, the first file and the second file are compared for differences, and the target address pool is composed of the different IP addresses in the first address pool and the second address pool.
[0043] In an implementable manner, all the first IP addresses in the first address pool can be written into a file to obtain the first file, and the second IP addresses in the second address pool can be written into a file to obtain the second file.
[0044] In an implementable manner, the file comparison command can be the vimdiff command or the grep command. Among them, the vimdiff command can compare the different parts in the first file and the second file and highlight the different parts; the grep command can compare the string data in the first file and the second file and print out the different strings in the first file and the second file.
[0045] In the second embodiment of the present disclosure, generating a first file from the first IP addresses in the first address pool, generating a second file from the second IP addresses in the second address pool, and comparing the first file and the second file for differences according to the file comparison command to obtain the target address pool can improve the efficiency of comparing the differences between the first address pool and the second address pool.
[0046] In the third embodiment of the present disclosure, step S103 further includes:
[0047] Comparing the differences between the first address pool and the second address pool to obtain an initial address pool; judging whether the number of IP addresses in the initial address pool meets a preset threshold to obtain a judgment result; if the judgment result is yes, determining the initial address pool as the target address pool; if the judgment result is no, reconnecting the BMC to the current network segment and performing a connectivity test on the IP addresses in the current network segment to obtain a third test result, determining the IP addresses indicating successful connectivity in the third test result as the third address pool, and comparing the differences between the first address pool and the third address pool until the judgment result is yes.
[0048] In this embodiment, since there is only one target IP address of the BMC, in an ideal state, there should also be only one IP address in the target address pool. However, when performing a connectivity test on the BMC, there will be some interference factors. For example, when the BMC is connected to the current network segment, other devices are also connected to the current network segment, and when the BMC is disconnected from the current network segment, other devices happen to be disconnected from the current network segment as well. In this way, when performing a connectivity test on the IP addresses in the current network segment, other devices will affect the number of IP addresses in the target address pool.
[0049] In this embodiment, in order to ensure that the number of IP addresses in the target address pool meets the preset threshold, first, a difference comparison is performed between the first address pool and the second address pool to obtain an initial address pool, and then it is determined whether the number of IP addresses in the initial address pool meets the preset threshold to obtain a judgment result. If the judgment result is yes, the initial address pool is determined as the target address pool; if the judgment result is no, the IP addresses in the current network segment are re-tested for connectivity with the BMC disconnected from the current network segment to obtain a third test result, and the IP addresses indicating successful connectivity in the third test result are determined as the third address pool. This is equivalent to adjusting the IP addresses in the second address pool to obtain the third address pool, and a difference comparison is performed between the first address pool and the third address pool until the judgment result is yes, and the initial address pool corresponding to when the judgment result is yes is determined as the target address pool. Specifically, the preset threshold can be set according to the actual situation. For example, the preset threshold can be 1 to 3.
[0050] In the third embodiment of the present disclosure, a difference comparison is performed between the first address pool and the second address pool to obtain an initial address pool, and it is determined whether the number of IP addresses in the initial address pool meets the preset threshold to obtain a judgment result. If the judgment result is yes, the initial address pool is determined as the target address pool; if the judgment result is no, the IP addresses in the current network segment are re-tested for connectivity with the BMC disconnected from the current network segment to obtain a third test result, and the IP addresses indicating successful connectivity in the third test result are determined as the third address pool, and a difference comparison is performed between the first address pool and the third address pool until the judgment result is yes. Thus, interference factors can be excluded, and it is ensured that the number of IP addresses in the target address pool meets the preset threshold, facilitating the subsequent determination of the target IP address of the BMC based on the target address pool.
[0051] Figure 2 shows a schematic flow diagram of a method for obtaining a BMC IP in the fourth embodiment of the present disclosure, as Figure 2 shown, step S104 mainly includes:
[0052] Step S201: When the BMC is connected to the current network segment, perform a connectivity test on the test IP address to obtain a fourth test result. Here, the test IP address is an IP address in the target address pool.
[0053] Step S202: If the fourth test result indicates that the test IP address is successfully connected, then when the BMC is disconnected from the current network segment, perform a connectivity test on the test IP address to obtain a fifth test result.
[0054] Step S203: If the fifth test result indicates that the test IP address is not successfully connected, then determine the test IP address as the target IP address.
[0055] Step S204: If the fifth test result indicates that the test IP address is successfully connected, then determine another IP address in the target address pool as the test IP address, and when the BMC is connected to the current network segment, perform a connectivity test on the test IP address until the fifth test result indicates that the test IP address is not successfully connected.
[0056] Step S205: If the fourth test result indicates that the test IP address is not successfully connected, then determine another IP address in the target address pool as the test IP address, and when the BMC is connected to the current network segment, perform a connectivity test on the test IP address until the fourth test result indicates that the test IP address is successfully connected.
[0057] In this embodiment, first, select an IP address from the target address pool as the test IP address. Then, when the BMC is connected to the current network segment, perform a connectivity test on the test IP address to obtain a fourth test result. If the fourth test result indicates that the test IP address is successfully connected, then when the BMC is disconnected from the current network segment, perform a connectivity test on the test IP address to obtain a fifth test result, and determine the target IP address according to the fifth test result; if the fourth test result indicates that the test IP address is not successfully connected, then determine another IP address in the target address pool as the test IP address, and perform a connectivity test on the test IP address again when the BMC is connected to the current network segment until the fourth test result indicates that the test IP address is successfully connected.
[0058] In this embodiment, when determining the target IP address according to the fifth test result, if the fifth test result indicates that the test IP address fails to connect, it proves that the test IP address can be connected when the BMC is connected to the current network segment and cannot be connected when the BMC is disconnected from the current network segment. Then, the test IP address can be determined as the target IP address. If the fifth test result indicates that the test IP address is successfully connected, it proves that the connection status of the test IP address with the BMC network segment is irrelevant and it is not the target IP address. Then, another IP address in the target address pool is determined as the test IP address, and the connectivity test of the test IP address is performed again when the BMC is connected to the current network segment until the fifth test result indicates that the test IP address fails to connect.
[0059] In the fourth embodiment of the present disclosure, for each IP address in the target address pool, if the IP address is successfully connected when the BMC is connected to the current network segment and fails to connect when the BMC is disconnected from the current network segment, then the IP address is determined as the target IP address of the BMC, so that an accurate target IP address can be obtained from the target address pool.
[0060] In the fifth embodiment of the present disclosure, a method for obtaining a BMC IP further includes:
[0061] According to the target IP address, a lighting instruction is sent to the BMC. When the BMC lights up the positioning light in response to the lighting instruction, the target IP address is determined as the correct IP address of the BMC.
[0062] In this embodiment, after obtaining the target IP address of the BMC, a lighting instruction can be sent to the target IP address. If the BMC lights up its own positioning light in response to the lighting instruction, it can be determined that the target IP address is the correct IP address of the BMC. Thus, the target IP address of the BMC can be further verified to ensure that the correct IP address is obtained.
[0063] Figure 3 FIG. shows the structural schematic diagram of a BMC IP obtaining device according to the sixth embodiment of the present disclosure, as Figure 3 shown, the device mainly includes:
[0064] The first test module 10 is used to perform a connectivity test on the Internet Protocol (IP) addresses within the current network segment when the Baseboard Management Controller (BMC) is connected to the current network segment, obtain a first test result, and determine the IP addresses indicating successful connectivity in the first test result as the first address pool; the second test module 11 is used to perform a connectivity test on the IP addresses within the current network segment when the BMC is disconnected from the current network segment, obtain a second test result, and determine the IP addresses indicating successful connectivity in the second test result as the second address pool; the comparison module 12 is used to compare the differences between the first address pool and the second address pool to obtain a target address pool, and the target address pool includes the different IP addresses between the first address pool and the second address pool; the determination module 13 is used to determine the target IP address of the BMC according to the target address pool.
[0065] In an implementable manner, the first test module 10 and the second test module 11 are further used to perform a connectivity test on the IP addresses within the current network segment through the nbtsacn command or the ping command.
[0066] In an implementable manner, the comparison module 12 includes: a first generation sub-module, used to generate a first file according to the first IP address in the first address pool; a second generation sub-module, used to generate a second file according to the second IP address in the second address pool; a first comparison sub-module, used to compare the differences between the first file and the second file according to the file comparison command to obtain the target address pool.
[0067] In an implementable manner, the comparison module 12 includes: a second comparison sub-module, used to compare the differences between the first address pool and the second address pool to obtain an initial address pool; a judgment sub-module, used to judge whether the number of IP addresses in the initial address pool meets a preset threshold to obtain a judgment result; a first determination sub-module, used to determine the initial address pool as the target address pool when the judgment result is yes; a second determination sub-module, used to, when the judgment result is no, re-perform a connectivity test on the IP addresses within the current network segment when the BMC is disconnected from the current network segment, obtain a third test result, determine the IP addresses indicating successful connectivity in the third test result as the third address pool, and compare the differences between the first address pool and the third address pool until the judgment result is yes.
[0068] In an implementable embodiment, the determination module 13 includes: a first test sub-module, configured to perform a connectivity test on a test IP address when the BMC is connected to the current network segment, obtain a fourth test result, where the test IP address is an IP address in the target address pool; a second test sub-module, configured to, if the fourth test result indicates that the test IP address is successfully connected, perform a connectivity test on the test IP address when the BMC is disconnected from the current network segment, obtain a fifth test result, and determine a target IP address according to the fifth test result; a third test sub-module, configured to, if the fourth test result indicates that the test IP address is connected unsuccessfully, determine another IP address in the target address pool as the test IP address, and perform a connectivity test on the test IP address when the BMC is connected to the current network segment until the fourth test result indicates that the test IP address is successfully connected.
[0069] In an implementable embodiment, the second test sub-module is further configured to: if the fifth test result indicates that the test IP address is connected unsuccessfully, determine the test IP address as the target IP address; if the fifth test result indicates that the test IP address is successfully connected, determine another IP address in the target address pool as the test IP address, and perform a connectivity test on the test IP address when the BMC is connected to the current network segment until the fifth test result indicates that the test IP address is connected unsuccessfully.
[0070] In an implementable embodiment, the apparatus further includes: a sending module, configured to send a lighting instruction to the BMC according to the target IP address; a second determination module, configured to, when the BMC lights up the positioning light in response to the lighting instruction, determine the target IP address as the correct IP address of the BMC.
[0071] According to an embodiment of the present disclosure, the present disclosure further provides an electronic device and a readable storage medium.
[0072] Figure 4 FIG. shows a schematic block diagram of an exemplary electronic device 400 that can be used to implement embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, for example, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, for example, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely exemplary and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0073] As Figure 4As shown, device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0074] Multiple components in device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a magnetic disk, an optical disc, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows device 400 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0075] The computing unit 401 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include but are not limited to a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 401 executes the various methods and processes described above, such as a BMC IP acquisition method. For example, in some embodiments, a BMC IP acquisition method can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 408. In some embodiments, part or all of the computer program can be loaded and / or installed onto device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the computing unit 401, one or more steps of the BMC IP acquisition method described above can be executed. Alternatively, in other embodiments, the computing unit 401 can be configured to execute a BMC IP acquisition method in any other appropriate way (e.g., by means of firmware).
[0076] The various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems-on-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that receives data and instructions from a storage system, at least one input device, and at least one output device, and transmits the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0077] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowchart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0078] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection 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 include, 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 a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0079] 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 a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the 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 acoustic input, speech input, or tactile input).
[0080] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.
[0081] A computer system can include a client and a server. The client and the server are generally far from each other and usually interact through a communication network. 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, or a server of a distributed system, or a server incorporating a blockchain.
[0082] 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 recited in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and no limitation is imposed herein.
[0083] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" can explicitly or implicitly include at least one of such features. In the description of this disclosure, "a plurality of" means two or more unless otherwise specifically defined.
[0084] As described above, it is only the specific implementation manner of the present disclosure. However, the protection scope of the present disclosure is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present disclosure can easily think of changes or substitutions, which should all be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims described above.
Claims
1. A method for obtaining BMC IP, characterized in that, The method includes: When the baseboard management controller (BMC) is connected to the current network segment, perform a connectivity test on the Internet Protocol (IP) addresses within the current network segment to obtain a first test result, and determine the IP addresses indicating successful connectivity in the first test result as the first address pool; When the BMC is disconnected from the current network segment, perform a connectivity test on the IP addresses within the current network segment to obtain a second test result, and determine the IP addresses indicating successful connectivity in the second test result as the second address pool; Perform a difference comparison between the first address pool and the second address pool to obtain a target address pool, where the target address pool includes the different IP addresses between the first address pool and the second address pool; Determine the target IP address of the BMC according to the target address pool.
2. The method according to claim 1, characterized in that, The performing a connectivity test on the IP addresses within the current network segment includes: Perform a connectivity test on the IP addresses within the current network segment through the nbtsacn command or the ping command.
3. The method according to claim 1, characterized in that, The performing a difference comparison between the first address pool and the second address pool to obtain a target address pool includes: Generate a first file according to the first IP addresses in the first address pool; Generate a second file according to the second IP addresses in the second address pool; Perform a difference comparison between the first file and the second file according to the file comparison command to obtain the target address pool.
4. The method according to claim 1, characterized in that, The performing a difference comparison between the first address pool and the second address pool to obtain a target address pool includes: Perform a difference comparison between the first address pool and the second address pool to obtain an initial address pool; Judge whether the number of IP addresses in the initial address pool meets a preset threshold to obtain a judgment result; If the judgment result is yes, determine the initial address pool as the target address pool; If the judgment result is no, re-perform a connectivity test on the IP addresses within the current network segment when the BMC is disconnected from the current network segment to obtain a third test result, determine the IP addresses indicating successful connectivity in the third test result as the third address pool, and perform a difference comparison between the first address pool and the third address pool until the judgment result is yes.
5. The method according to claim 1, characterized in that, The determining the target IP address of the BMC according to the target address pool includes: When the BMC is connected to the current network segment, perform a connectivity test on a test IP address, where the test IP address is an IP address in the target address pool, to obtain a fourth test result; If the fourth test result indicates that the test IP address is successfully connected, then perform a connectivity test on the test IP address when the BMC is disconnected from the current network segment to obtain a fifth test result, and determine the target IP address according to the fifth test result; If the fourth test result indicates that the test IP address fails to connect, then determine other IP addresses in the target address pool as new test IP addresses, and perform a connectivity test on the new test IP addresses when the BMC is connected to the current network segment until the fourth test result indicates that the new test IP addresses are successfully connected.
6. The method according to claim 5, characterized in that, Determining the target IP address according to the fifth test result includes: If the fifth test result indicates that the connection of the test IP address fails, determining the test IP address as the target IP address; If the fifth test result indicates that the connection of the test IP address is successful, determining another IP address in the target address pool as a new test IP address, and when the BMC is connected to the current network segment, performing a connection test on the new test IP address until the fifth test result indicates that the connection of the new test IP address fails.
7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: Sending a lighting instruction to the BMC according to the target IP address, and when the BMC lights the positioning light in response to the lighting instruction, determining the target IP address as the correct IP address of the BMC.
8. A device for obtaining BMC IP, characterized in that, The device includes: A first test module, configured to perform a connection test on Internet Protocol (IP) addresses in the current network segment when a baseboard management controller (BMC) is connected to the current network segment, obtain a first test result, and determine the IP addresses indicating successful connection in the first test result as a first address pool; A second test module, configured to perform a connection test on IP addresses in the current network segment when the BMC is disconnected from the current network segment, obtain a second test result, and determine the IP addresses indicating successful connection in the second test result as a second address pool; A comparison module, configured to perform a difference comparison between the first address pool and the second address pool to obtain a target address pool, where the target address pool includes different IP addresses in the first address pool and the second address pool; A determination module, configured to determine the target IP address of the BMC according to the target address pool.
9. An electronic device, characterized in that, Includes: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1-7.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.
Citation Information
Patent Citations
Addition method and device for monitoring configuration
CN105141449A
Query and storage method and device for Internet protocol address and electronic equipment
CN108228834A