Network card network configuration method and device, storage medium and electronic equipment
By directly acquiring and configuring the network parameters of smart network cards at the hardware level through BMC, the problem of low network configuration efficiency of network cards in large-scale server clusters is solved, and efficient and stable network initialization and management are achieved.
Patent Information
- Application Number
- CN202511320223.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-16
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2045-09-16
AI Technical Summary
In large-scale server clusters, configuring static IP addresses for smart network interface cards (NICs) is inefficient and has a high error rate. In particular, it is impossible to configure them effectively without an operating system or network services, which affects the efficiency and stability of network configuration.
The hardware address of the target network card is obtained by the Baseboard Management Controller (BMC), the target network address is determined, and the corresponding register value is directly written into the register of the network card, bypassing the operating system and driver to achieve hardware-level network parameter configuration.
It improves the efficiency and security of network card configuration, reduces configuration error rate, enhances configuration stability and overall system performance, and is especially suitable for automated deployment in large-scale data centers.
Smart Images

Figure CN120825469B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of network configuration, and more particularly to a method and apparatus for configuring a network interface card (NIC), a storage medium, and an electronic device. Background Technology
[0002] In the deployment and network initialization of large-scale server clusters, automated testing and configuration are crucial steps to ensure network stability and improve operational efficiency. Smart network interface cards (NICs), with their powerful data processing and network management capabilities, have become core components of data center architectures. They can perform network management and data processing tasks at the hardware level, reducing host load and improving network efficiency and security.
[0003] However, with the increasing complexity of data center networks, efficiently and securely configuring these smart network interface cards (NICs) in batches, especially their static IP addresses, has become a challenge. Current NIC configuration methods often require loading specific drivers and configuring them within the operating system. In large-scale server clusters, such as those with 256 NICs, the time required to configure static IP addresses via network protocols like SSH / Telnet increases significantly, and the error rate also rises. Furthermore, in situations such as system crashes, network configuration cannot be performed, impacting efficiency. In short, current NIC configuration methods suffer from low efficiency. Summary of the Invention
[0004] This application provides a method and apparatus for configuring a network interface card (NIC), a storage medium, and an electronic device, to at least solve the problem of low efficiency in the configuration methods of NICs in the related art.
[0005] This application provides a method for configuring a network interface card (NIC), including: obtaining the target hardware address corresponding to the target NIC, wherein the target hardware address is used to indicate the target NIC;
[0006] The target network address of the target network card is determined based on the hardware address, and the value of the first register is determined based on the target network address. The target network address is used to indicate the digital tag of the target network card, and the value of the first register is used to indicate the target network address.
[0007] Write the value of the first register to the register of the target network card, where the register of the target network card is used to set the network parameters of the target network card.
[0008] This application also provides a network interface card (NIC) network configuration device, including: a hardware address acquisition module, used to acquire the target hardware address corresponding to the target NIC, wherein the target hardware address is used to indicate the target NIC;
[0009] The network address determination module is used to determine the target network address of the target network card based on the hardware address, and to determine the first register value according to the target network address, wherein the target network address is used to indicate the digital tag of the target network card, and the first register value is used to indicate the target network address;
[0010] The register writing module is used to write the first register value into the register of the target network card, where the register of the target network card is used to set the network parameters of the target network card.
[0011] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for executing the computer program to implement the configuration method of any of the above-described network interface cards (NICs).
[0012] This application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of any of the above-described network interface card (NIC) network configuration methods.
[0013] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described network interface card (NIC) network configuration methods.
[0014] This application obtains the target hardware address corresponding to the target network interface card (NIC), where the target hardware address indicates the target NIC; determines the target network address of the target NIC based on the hardware address, and determines the first register value based on the target network address, where the target network address indicates the digital tag of the target NIC, and the first register value indicates the target network address; and writes the first register value into the register of the target NIC, where the register of the target NIC is used to set the network parameters of the target NIC. The server's Baseboard Management Controller (BMC) can obtain the hardware address of the target NIC in the server, thereby determining the network address of the target NIC in the server, and can obtain the corresponding first register value based on the network address. The BMC can directly write the first register value into the register through the configuration space, thereby realizing network configuration of the NIC through the hardware side. Network configuration can be achieved without relying on the server's operating system and drivers, increasing the application scenarios of network configuration and improving configuration efficiency. It can solve the technical problem of low efficiency in current NIC network configuration methods, achieving the technical effect of improving network configuration efficiency. Attached Figure Description
[0015] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a schematic diagram of the hardware environment for an optional network interface card (NIC) configuration method according to an embodiment of this application;
[0017] Figure 2 This is a flowchart of an optional network interface card (NIC) configuration method according to an embodiment of this application;
[0018] Figure 3 This is a schematic diagram of an optional network interface card (NIC) configuration method according to an embodiment of this application;
[0019] Figure 4 This is a schematic diagram of another optional network interface card (NIC) network configuration method according to an embodiment of this application;
[0020] Figure 5 This is a structural block diagram of an optional network interface card (NIC) network configuration device according to an embodiment of this application. Detailed Implementation
[0021] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0022] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0023] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0024] According to one aspect of the embodiments of this application, a method for configuring a network interface card (NIC) network is provided. As an optional implementation, the above-described NIC network configuration method can be applied to, but is not limited to, applications such as... Figure 1 The configuration system for the network interface card (NIC) in the hardware environment shown. The configuration system for the NIC may include, but is not limited to, a baseboard management controller (BMC) 102, an out-of-band management port 104, a high-speed switch (PCIe Switch) 106, NIC 108, NIC 2 110, and NIC 3 112.
[0025] Specifically, the BMC and PCIe Switch are connected via the motherboard's internal PCIe bus (x1 or x4), with the BMC acting as the root-complex. NC-SI or RGMII out-of-band channels can also be used, depending on the motherboard configuration. The PCIe Switch and network cards (NIC 1, NIC 2, and NIC 3) are connected, with each smart NIC serving as a PCIe endpoint on a downstream port of the Switch. The Switch supports SR-IOV, allowing for the creation of several virtual virtual functions (VFs) for each physical function (PF) for concurrent configuration. The IPMI Tool (out-of-band management port) can be accessed by the administrator through the system.
[0026] The Baseboard Management Controller (BMC) 102 can be a standalone microcontroller integrated on the server motherboard (commonly ASPEED AST2500 / AST2600, Nuvoton NPCM7xx, etc.). It has its own ARM / RISC-V core, RAM, Flash, and MAC, and the BMC can continue to function even if the main CPU is powered off or the operating system crashes. The AST2600 comes with 4-lane PCIe Gen2 and can be directly used as a root-complex to connect a PCIe switch.
[0027] The high-speed switch (PCIe Switch) 106 can be a single high-speed switching chip (Broadcom PEX8900, Microchip Switchtec, Intel IFS series) that expands one upstream port into N downstream ports, each with independent PCIe configuration space. It can expand a single PCIe port of the BMC to ≥256 downstream ports, corresponding to 256 network interface cards (NICs).
[0028] Network card 1 (108), network card 2 (110), and network card 3 (112) are just examples; there is no limit to the specific number of network cards.
[0029] The embodiments of this application provide a method for configuring a network interface card (NIC). Figure 2 This is a flowchart of an optional network interface card (NIC) network configuration method according to an embodiment of this application; the NIC network configuration method can be executed by the BMC, such as... Figure 2 As shown, the network configuration method for this network card includes:
[0030] Step S202: Obtain the target hardware address corresponding to the target network card, wherein the target hardware address is used to indicate the target network card;
[0031] It should be noted that the target network interface card (NIC) refers to the specific network interface card (NIC) that needs to be configured or managed, and can refer to a smart NIC based on a Data Processing Unit (DPU). The target hardware address typically refers to the MAC address, a unique hardware address that identifies a network interface and is used for communication and identification purposes below the network layer. In automated testing systems and methods, the target hardware address is used to explicitly indicate the specific NIC that needs to be operated. A MAC address, or Media Access Control Address, is a unique identifier assigned to a network interface controller (NIC) for identifying and addressing devices within a local area network (LAN). A BMC, or Baseboard Management Controller, is a microprocessor located on a server motherboard used to monitor and manage system hardware status, providing remote management capabilities.
[0032] In an optional implementation, during the configuration or management process, the automated system first needs to identify the specific network interface card (NIC). To do this, it needs to obtain the NIC's MAC address. The MAC address, as a unique identifier for a network interface, helps the automated system locate the target NIC and thus perform operations on it.
[0033] In automated configuration processes, especially in out-of-band management modes without operating system intervention, the BMC plays a crucial role. It is responsible not only for monitoring server health but also for initializing and configuring network hardware. When performing batch configuration of smart network interface cards (NICs) such as Virtual Functions (VFs), the BMC obtains the MAC address of each VF on the smart NIC through some means.
[0034] In an optional implementation, the smart network interface card (NIC) typically stores the MAC address information for each virtual function (VF). The base station control (BMC) can read this MAC address information by directly accessing the smart NIC's PCIe configuration space or a specific management interface. Specifically, the BMC can directly query the smart NIC's hardware registers, such as the MAC address register, to obtain the hardware address of the target VF.
[0035] In some cases, MAC addresses may be pre-configured in the BMC's memory before deployment, or stored in a database accessible to the BMC, such as a MAC-IP mapping database. In this mode, the BMC does not need to directly access the smart NIC's hardware registers; instead, it retrieves the target VF's MAC address information from its own storage. This approach is particularly useful when offline configuration or pre-planning of the network is required.
[0036] Regardless of the method used, the process of the BMC acquiring the MAC address occurs at the hardware level and is independent of the operating system. This means that even without an operating system or network services, the BMC can still effectively identify and configure the VF on the smart NIC, enabling automated batch testing and configuration, which greatly improves the efficiency and security of large-scale network device management in data centers. In this way, the BMC becomes a bridge connecting network hardware and automated configuration systems, ensuring effective management and control of smart NICs in any environment.
[0037] Step S204: Determine the target network address of the target network card based on the hardware address, and determine the first register value according to the target network address, wherein the target network address is used to indicate the digital tag of the target network card, and the first register value is used to indicate the target network address;
[0038] It should be noted that the target network address refers to the IP address of the target network card. This digital label is used to uniquely identify network devices at the network layer and is a key parameter in network communication. The first register value refers to the hardware control register value inside the smart network card used to store and represent the target network address (i.e., IP address). These values can be read or written through specific hardware instructions to complete the network address configuration.
[0039] In an optional implementation, the corresponding IP address is determined using a known hardware address (MAC address), and then the IP address is further converted into a recognizable value in the smart network interface card's hardware control register, i.e., the first register value. The purpose of this is to ensure that each target network interface card can obtain and store the correct IP address, enabling network initialization configuration without operating system intervention.
[0040] In an optional implementation, the target network address (IP address) corresponding to the hardware address (MAC address) of each target network card is determined based on a predefined MAC-IP mapping table. This typically requires a mapping database or algorithm that can associate MAC addresses with predefined IP addresses. The determined target network address (IP address) is then converted into a register value at the smart network card hardware level, i.e., the first register value. This conversion process involves converting the IP address from a common dotted decimal format (e.g., 192.168.1.10) to a hexadecimal data format so that the network card's hardware control registers can accept and store it.
[0041] This approach allows for direct hardware-level operation, bypassing dependencies on operating systems and network services, enabling efficient initialization and network address configuration of smart network interface cards (NICs). This is particularly crucial for large-scale automated testing and deployment in data center environments. Furthermore, this method enhances the stability and security of NIC configuration, reducing error rates and the risk of configuration failures.
[0042] Step S206: Write the first register value into the target network card's register, where the target network card's register is used to set the target network card's network parameters.
[0043] It should be noted that the first register value refers to the network configuration parameters that have been converted into a hardware-understandable format. For example, the IPv4 address 192.168.1.100 / 24 is converted to the hexadecimal register value 0xC0A80164, while the MTU (Maximum Transmission Unit) value of 9000 is converted to the register value 0x2328. The target network card's registers can be hardware units inside the smart network card used to store and control network parameters, such as control registers 0xA000 to 0xA003 used to store the IPv4 address, and 0xB010 used to set the MTU size.
[0044] In an optional implementation, during the automated configuration process, the pre-coded network parameters (i.e., the first register value) are written into a specific hardware register to directly set the network interface card's (NIC) network parameters at the hardware level. This direct writing to the hardware register bypasses the operating system, enabling a more direct and efficient configuration method.
[0045] Example 1:
[0046] Assuming that automated batch configuration of DPU-based smart network interface cards is being performed, the following are examples of steps S202 to S206:
[0047] Step S202: Obtain the MAC address of the target network card;
[0048] BMC uses ipmitool to read the MAC address control register of the smart network card through the IPMI raw instruction to obtain the MAC address of each VF, for example 00:1B:44:11:22:33.
[0049] Step S204: Convert network parameters to register values;
[0050] For network parameters that need to be configured, such as the IP address 192.168.1.100 / 24, convert it to the hexadecimal register value 0xC0A80164; MTU9000 is also converted to 0x2328.
[0051] Step S206: Write network parameters to the target register.
[0052] The BMC uses the ipmitool tool and the IPMI raw instruction to write 0xC0A80164 into control registers 0xA000 to 0xA003, and writes 0x2328 into MTU control register 0xB010.
[0053] In this embodiment, the BMC acts as the core component of automated configuration. It obtains the MAC address of the target network card at the hardware level (step S202) and then converts the network parameters into register values (step S204). Finally, by directly writing to the hardware register (step S206), network parameter configuration without operating system intervention is achieved, enabling the smart network card to complete initialization in a zero-contact environment, which is particularly suitable for large-scale automated deployment scenarios in cloud computing data centers.
[0054] This application obtains the target hardware address corresponding to the target network interface card (NIC), where the target hardware address indicates the target NIC; determines the target network address of the target NIC based on the hardware address, and determines the first register value based on the target network address, where the target network address indicates the digital tag of the target NIC, and the first register value indicates the target network address; and writes the first register value into the register of the target NIC, where the register of the target NIC is used to set the network parameters of the target NIC. The server's Baseboard Management Controller (BMC) can obtain the hardware address of the target NIC in the server, thereby determining the network address of the target NIC in the server, and can obtain the corresponding first register value based on the network address. The BMC can directly write the first register value into the register through the configuration space, thereby realizing network configuration of the NIC through the hardware side. Network configuration can be achieved without relying on the server's operating system and drivers, increasing the application scenarios of network configuration and improving configuration efficiency. It can solve the technical problem of low efficiency in current NIC network configuration methods, achieving the technical effect of improving network configuration efficiency. The BMC not only improves configuration efficiency but also enhances configuration security and stability because hardware-level operations are not affected by operating system crashes or other software problems. Furthermore, since configuration operations are performed directly at the hardware level, CPU resource consumption is reduced, further improving the overall performance and resource utilization of the data center.
[0055] In an optional implementation, the target network address of the target network card is determined based on the hardware address, and the first register value is determined based on the target network address, including one of the following:
[0056] 1) Look up the target network address in the address mapping table based on the target network address, and generate a first register value based on the target network address, wherein the target network address is used to indicate the correspondence between the hardware address and the network address of at least one network card;
[0057] 2) Receive the first configuration information sent by the network configuration module, and determine the first register value from the first configuration information.
[0058] It's important to note that an address mapping table is a database or list that records the correspondence between MAC addresses and IP addresses. This allows you to find the IP address a network interface card (NIC) should have based on its MAC address, making it a crucial data structure for automated network configuration. The network configuration module refers to the software module responsible for generating or sending network configuration information. It may reside on the management server in the data center and is responsible for overall network planning and resource allocation. The initial configuration information includes the target NIC's network parameters, such as IP address, subnet mask, and MTU. These parameters are converted into register values and directly written to the hardware.
[0059] In an optional implementation, the BMC can look up the corresponding IP address information in a pre-established address mapping table based on the MAC address of the target network card, and then convert these network parameters (such as IP address, subnet mask and MTU) into the corresponding register value, i.e. the first register value, to directly configure the network card hardware.
[0060] In an optional implementation, the system receives first configuration information sent by a network configuration module. In this case, the specific details of the network configuration (e.g., IP address, subnet mask, and MTU) are not determined by the BMC itself, but are sent by a dedicated network configuration module. After receiving such configuration information, the BMC directly extracts the required network parameters and converts them into first register values for subsequent hardware write operations.
[0061] In optional implementations, whether configuration information is received via an address mapping table or from a network configuration module, the core objective is to ensure that the smart network interface card (NIC) obtains the correct network parameters, which are stored in specific control registers in a hardware-understandable format. In this way, NIC configuration is no longer dependent on the operating system. Even when the server is powered off or the system is not booted, network parameters can be set via out-of-band management channels, which is particularly important for automated batch deployment in hyperscale data centers.
[0062] In an optional implementation, after obtaining the target hardware address corresponding to the target network card, at least one of the following is also included:
[0063] 1) Write the second register value corresponding to the target hardware address into the register of the target network card, wherein the second register value is used to indicate the target hardware address;
[0064] 2) Write the value of the third register into the register of the target network card, where the value of the third register is used to indicate the number of bits in the subnet mask of the target network card;
[0065] 3) Write the value of the fourth register to the register of the target network card. The value of the fourth register is used to indicate the maximum value of the target network card's data transmission.
[0066] It should be noted that the second register value refers to the representation of the MAC address in the hardware control register of the smart network card, that is, the register value used to store the MAC address at the hardware level. The third register value is the hardware control register value used in network configuration to represent the number of bits in the subnet mask, which directly determines the range and mode of network communication. The fourth register value is the hardware control register value used to set the MTU (Maximum Transmission Unit). The MTU determines the maximum data packet size that the network card can transmit at one time, affecting the efficiency and compatibility of network transmission.
[0067] In an optional implementation, after obtaining the hardware address (i.e., MAC address) of the target network card, the automated configuration process further includes at least one of the following:
[0068] The MAC address is converted from a common binary or hexadecimal format to a hardware-recognizable control register value and written to the smart network card's hardware register via direct hardware access (such as IPMI instructions or PCIe bus access), ensuring that the MAC address is configured correctly at the hardware level.
[0069] The subnet mask bit length is converted into a hardware control register value and written directly to the smart network card's register to ensure that the network card can understand and execute network segmentation rules and process data packets correctly.
[0070] The MTU size is converted into a hardware control register value and written to the relevant registers of the smart network card to ensure that the network card sends and receives data according to the set maximum transmission unit size, thereby optimizing network transmission efficiency and compatibility.
[0071] In an optional implementation, once the MAC address of the target network card is obtained, the next step involves converting other key network parameters of the network card, such as the MAC address itself, the number of bits in the subnet mask, and the MTU (Maximum Transmission Unit) size, into hardware-readable register values and writing them directly into the network card's hardware control register. This process ensures that the network card can still obtain all the necessary network parameters even when the operating system is not running or network services are unavailable, thus achieving complete offline pre-configuration.
[0072] Example 2:
[0073] Assuming the network card is configured with MAC address 00:1B:44:11:22:33, convert the ip addr command parameters to the network card control register values:
[0074] For example, 192.168.1.100 / 24 → register 0xA000 - 0xA003 = 0xC0A80164;
[0075] MTU 9000 → Register 0xB010 = 0x2328;
[0076] Execute ipmitool -H out of band<BMC_IP> raw 0x30 0xC3\\;
[0077] 00 1B 44 11 22 33\\ # MAC address;
[0078] C0 A8 01 64\\ # IP address 192.168.1.100;
[0079] 18\\ # Subnet mask (24 bits);
[0080] 00 00 23 28 # MTU9000;
[0081] Specifically:
[0082] 0x30 is an IPMI domain identifier, while 0xC3 is a custom IPMI command used to write network configuration.
[0083] 00 1B 44 11 22 33 is the MAC address of the target network card, represented in hexadecimal form.
[0084] C0 A8 01 64 is the hexadecimal register value converted from the IPv4 address 192.168.1.100.
[0085] 18 is the register value of the 24-bit subnet mask in hexadecimal representation.
[0086] 00 00 23 28 is the hexadecimal register value converted from MTU9000.
[0087] 0x30 0xC3 can be a command indicating the writing of network interface card (NIC) configuration. An IPMI message has a maximum size of 16 bytes because this is used to improve throughput during batch concurrency. As shown above, byte offsets 0–5 (00 1B 44 11 2233) indicate the target NIC MAC address, used for unique identification across multiple NICs. Byte offsets 6–9 (C0 A8 01 64) indicate the IPv4 address, used to indicate 192.168.1.100. Byte offset 10 (18) indicates the subnet mask length. Byte offsets 13–14 (23 28) indicate the MTU. Byte offset 15 (00) indicates CRC8 checksum, which will be explained later.
[0088] Through the above-described implementation method of this application, not only the MAC address, but also all network parameters, including the subnet mask bit width and MTU, are directly configured into the hardware control register of the smart network card, realizing true hardware-level configuration and improving the efficiency, accuracy and security of configuration, which is especially suitable for large-scale automated deployment scenarios in data centers.
[0089] In an optional implementation, before looking up the target network address in the address mapping table based on the target network address, the method includes: obtaining a preset network address set and candidate hardware addresses corresponding to at least one candidate network interface card, wherein the preset network address set is used to indicate the network address corresponding to each of the at least one candidate network interface card; and generating an address mapping table by mapping the at least one candidate hardware address to the network address in the preset network address set.
[0090] It's important to note that the preset network address set can be a predefined list of IP addresses used to assign to candidate network interface cards (NICs), ensuring consistency and predictability in network configuration. Candidate NICs can be smart NICs to be configured or tested; the term "candidate" indicates that they are NICs that may be assigned specific IP addresses in the future. Candidate hardware addresses can be the MAC addresses of the candidate NICs, i.e., the physical layer address of each NIC, used to uniquely identify the device in communications below the network layer. The address mapping table establishes a table or database that maps candidate hardware addresses to network addresses in the preset network address set; it is the foundation for automated network configuration.
[0091] In an optional implementation, before using the target network address (i.e., IP address) to look up the hardware address (MAC address), the system needs to first obtain a preset set of network addresses and the MAC addresses of each candidate network card, and establish a MAC-IP mapping table based on this information to ensure that each MAC address has a corresponding IP address.
[0092] Creating a reliable MAC-IP mapping table is a crucial step in the automated batch configuration of smart network interface cards (NICs). It ensures that each NIC has a unique IP address and provides the necessary data foundation for subsequent out-of-band operations.
[0093] In an optional implementation, the system collects the hardware addresses (MAC addresses) of all candidate network interface cards (NICs) and pre-planned network addresses (IP addresses). For example, the system has two candidate NICs with MAC addresses 00:11:22:33:44:55 and 00:11:22:33:44:56, and the preset set of network addresses includes 192.168.1.10 / 24 and 192.168.1.11 / 24.
[0094] Next, the system maps the MAC address of each candidate network interface card to its preset IP address, generating a mapping table. In this example, the mapping table is as follows:
[0095] MAC Address|Network Address;
[0096] 00:11:22:33:44:55|192.168.1.10 / 24;
[0097] 00:11:22:33:44:56|192.168.1.11 / 24;
[0098] In an optional implementation, to ensure the security of the address mapping table, the system uses the AES-256 encryption standard to encrypt the mapping table, ensuring that even if the mapping table is accessed without authorization, its contents cannot be easily deciphered. The encrypted mapping table is stored in a secure area within the BMC, such as Flash or secure RAM.
[0099] After the mapping table is established and improved, the system also needs to perform VLAN (Virtual Local Area Network) partitioning and gateway planning. This is to ensure connectivity and security between different network environments (such as external and internal networks). For example, the system can partition 192.168.1.0 / 24 into an external network VLAN, specifying the external network gateway as 192.168.1.1; and partition 172.23.1.0 / 24 into an internal network VLAN, specifying the internal network gateway as 172.23.1.1.
[0100] The above-described implementation methods of this application ensure that network configuration and management of smart network interface cards (NICs) can be completed without operating system intervention, which greatly improves the speed and security of large-scale network device deployment in data center environments. Creating encrypted MAC-IP mapping tables and planning VLANs and gateways not only prevents the leakage of configuration information but also ensures effective management and isolation of network traffic, avoiding potential security threats and resource abuse.
[0101] In an optional implementation, after obtaining the target hardware address corresponding to the target network card, the process includes: receiving second configuration information sent by a network configuration module, wherein the second configuration information is used to indicate the configuration information of at least one reference network card, and the at least one reference network card includes the target network card; determining the register value of the reference network address corresponding to each reference network card according to the second configuration information; and writing the register value of at least one reference network address into the register of the corresponding reference network card.
[0102] It should be noted that the network configuration module is a system component responsible for network planning and configuration information generation. It typically runs on the data center's management server and coordinates and manages the configuration operations of large-scale network devices. The second configuration information includes configuration details for multiple reference network interface cards (NICs), including but not limited to IP addresses, subnet masks, and MTUs. This information is generated by the network configuration module and sent to the BMC. Reference NICs refer to smart NICs that require network parameter configuration, including all NICs that need network initialization, including the target NIC. The register value of the reference network address converts the network address (such as an IP address) of the reference NIC into a format readable by the smart NIC's hardware control registers, i.e., a hexadecimal value. For example, 192.168.1.200 is converted to 0xC0A801C8.
[0103] The information sent by the network configuration module contains the configuration requirements of all reference network cards. The BMC needs to parse this information, determine the network address register value of each network card, and then configure the network parameters by directly writing to the hardware register.
[0104] In an optional implementation, after receiving the second configuration information from the network configuration module, the BMC extracts the configuration parameters of all reference network cards from the second configuration information, such as IP address, subnet mask, MTU, etc. Based on the configuration parameters, the BMC converts the network address into a hexadecimal register value, which is then directly written to the hardware control register of the smart network card. The BMC uses specific commands of the IPMI protocol, through the ipmitool tool, to write the register value of the reference network address into the corresponding register of each reference network card.
[0105] In small-scale network deployments, the initial configuration of smart network interface cards (NICs) by the BMC can be implemented using traditional routing configuration methods. Before configuring new network parameters, the BMC needs to clear any old routes that conflict with the new configuration to avoid network chaos. Based on the second configuration information, the BMC configures routing rules for each NIC with both internal and external network segments to adapt to the access needs of different network environments. The BMC uses ipmitool to concurrently configure multiple NICs via IPMI raw commands, reducing manual intervention and improving efficiency. For example, a loop structure can be used to batch configure NICs. To prevent configuration loss due to server restarts, the BMC writes the configuration commands to the / etc / rc.local script, ensuring that these network configuration commands are automatically executed when the system starts.
[0106] Example 3:
[0107] In small-scale deployments, such as configuring the network on a relatively small server cluster (e.g., 10 or fewer servers), a simpler traditional routing configuration method can be used. This method focuses on using IPMI (Intelligent Platform Management Interface) commands for batch, concurrent hardware-level network configuration, while ensuring that the configuration information remains effective after a server restart. The following is a detailed analysis of this configuration process:
[0108] Before making any new configurations, it's essential to clean up any existing old routing rules on the server to avoid conflicts between new and old rules, which could lead to network configuration chaos. This step ensures a clean network configuration environment, making subsequent configuration processes smoother.
[0109] For servers that support dual networks or multiple network cards, separate network rules need to be configured for each, including but not limited to IP address, subnet mask, gateway, and MTU (Maximum Transmission Unit). These rules ensure that each network card can independently access the preset network environment, thereby achieving network redundancy and load balancing.
[0110] IPMI provides a standard management interface that allows the system to control server hardware out-of-band. In this application, hardware-level network configuration is achieved through IPMI batch configuration commands. The specific commands are as follows:
[0111] for i in range(10):
[0112] ipmitool -H<BMC_IP> raw 0x30 0xC4 \\;
[0113] $(mac[i]) $(ip[i]) $(mask[i]) $(mtu[i]);
[0114] ipmitool is a tool for sending IPMI commands, enabling remote control of server hardware status, including network configuration.
[0115] -H<BMC_IP> Specify the BMC IP address of the target server. The BMC is a microprocessor on the server that monitors the server's health status and can receive and execute IPMI commands from the management platform.
[0116] In the command 0x30 0xC4, "raw" indicates that a native IPMI message is being sent, "0x30" is the network function group code of the BMC, and "0xC4" is a specific command code used to set network configuration information (such as IP address, subnet mask, etc.).
[0117] $(mac[i]), $(ip[i]), $(mask[i]), and $(mtu[i]) represent the MAC address, IP address, subnet mask, and MTU value of the i-th network interface card (NIC) of the server to be configured, respectively. By iterating through the script, network configuration can be performed on multiple servers within the cluster simultaneously, greatly improving configuration efficiency.
[0118] After completing the network configuration, to ensure that the configuration information remains effective after a server restart, the configuration commands need to be persistently stored. The most common practice is to write the aforementioned IPMI configuration commands into the server's startup script, typically located in the ` / etc / rc.local` file. This way, whenever the server restarts, these configuration commands will be re-executed, thereby restoring the network configuration information and maintaining the connectivity and correctness of the server's network.
[0119] For small-scale server clusters, using IPMI commands for hardware-level network configuration is an efficient and straightforward approach. With prior preparation, including removing potentially conflicting routes and establishing clear network rules, coupled with the concurrent execution of IPMI commands, network configuration for multiple servers can be completed quickly. Finally, by writing critical configuration commands into the server's startup script, the persistence of the configuration and network continuity after system restarts are ensured, providing a stable and reliable network foundation for small-scale deployments.
[0120] In an optional implementation, for automated batch deployment scenarios in hyperscale data centers, the BMC and network configuration module adopt a more efficient approach: utilizing PXE (Preboot Execution Environment) technology, the server is booted over the network, with a TFTP server providing the pxelinux.0 boot file to guide the server into the Kickstart configuration process. The network configuration module generates a Kickstart response file (ks.cfg) for each server, pre-configuring partition information, a list of installed software packages, and network parameter configurations for the smart network interface cards (NICs). Based on the configuration information in the ks.cfg file, the BMC simultaneously writes network parameters for multiple reference NICs, significantly improving the efficiency of large-scale deployments. Similar to small-scale deployments, the BMC writes the configuration commands to the / etc / rc.local file, ensuring that the network configuration takes effect automatically after the server restarts.
[0121] Example 4:
[0122] When deploying servers in batches of 50 or more nodes in a data center or enterprise network, traditional manual configuration or individual login configuration methods are inefficient and prone to errors. The following is a detailed explanation of this solution:
[0123] Set up a DHCP / TFTP server;
[0124] The Dynamic Host Configuration Protocol (DHCP) server is responsible for automatically assigning IP addresses to server nodes in the network, providing the necessary network communication capabilities for PXE booting. In the initial phase of a large-scale deployment, each node needs to obtain a temporary IP address to download boot files and configuration information. The DHCP server needs to be configured to allocate a specific pool of IP addresses, as well as boot information pointing to the pxelinux.0 file on the TFTP server. This is typically achieved by editing the DHCP server's configuration file (such as dhcpd.conf) to ensure that each node automatically obtains the necessary information upon startup.
[0125] A TFTP (Trivial File Transfer Protocol) server is used to transfer small files, such as the boot file pxelinux.0, over a network. During the PXE boot process, the server node needs to download pxelinux.0 from the TFTP server to begin the automated configuration process. The pxelinux.0 boot file and the Kickstart file (ks.cfg), along with any other necessary boot images (such as the kernel and initialization ramdisk), are placed on the TFTP server. The TFTP server is configured to serve these files for specific MAC addresses or IP address ranges.
[0126] Generate Kickstart response file;
[0127] The Kickstart file (ks.cfg) is a text file containing all the configuration information needed to automate the installation of a Linux operating system. It allows administrators to pre-configure partition structures, package installation lists, system settings (such as root password and time zone), and network configurations (including IP parameters for multiple network cards). The ks.cfg file should specifically list the network parameters for all servers, including static IP addresses, subnet masks, default gateways, VLAN information, etc. Furthermore, it can also include the server partition layout, the packages to be installed, etc., thus achieving fully automated system installation and configuration.
[0128] Parallel configuration execution;
[0129] When the server nodes start, they obtain a temporary IP address from the DHCP server via PXE and download the boot file pxelinux.0 from the TFTP server. The pxelinux.0 file will guide the server to download the Kickstart answer file, initiating the automated installation and configuration process.
[0130] The instructions in the Kickstart file will be executed by the bootloader to automatically install the selected Linux distribution and configure the server's hardware partitions, software packages, and network settings according to the configuration information in the ks.cfg file. For servers with multiple network interface cards (NICs), Kickstart will automatically assign IP addresses based on pre-defined parameters.
[0131] By using PXE and TFTP servers, boot files and Kickstart configurations can be provided to multiple server nodes simultaneously. This means the entire deployment process can be performed in parallel on multiple servers, significantly reducing the time required for large-scale deployments.
[0132] To ensure that the configuration remains effective after a system reboot, the network configuration information needs to be written to persistent storage. This is typically achieved in the Kickstart file using commands such as `ifdown ens1f0; ifup ens1f0`. However, for higher control and compatibility, the configuration steps can also be written to ` / etc / rc.local` or the corresponding system initialization script. Writing network configuration commands to system startup scripts like ` / etc / rc.local` ensures that the configuration information is automatically reapplied every time the system reboots, preventing network configuration from becoming invalid after a restart and improving system stability and ease of maintenance.
[0133] Through the above-described embodiments of this application, the large-scale automated batch deployment scheme of this application achieves seamless integration from network infrastructure setup to automated installation and configuration of server nodes using PXE+Kickstart technology. From setting up DHCP and TFTP servers to generating detailed Kickstart response files and parallel configuration execution, the scheme ensures high efficiency and reliability for static IP pre-configuration of BF3 smart network cards in environments without network connectivity. By persistently storing configuration information, the scheme further guarantees configuration persistence after system restarts, reduces maintenance workload, and improves the efficiency and security of large-scale data center network deployments.
[0134] In an optional implementation, after writing the first register value into the register of the target network card, the process includes: obtaining a reference register value for a target location in the register of the target network card, wherein the target location is used to indicate the location where the first register value is written into the register of the target network card; determining the target network address based on the address mapping table and the target hardware address, and generating the first register value based on the target network address; and determining that the target network card configuration is complete if the first register value and the reference register value are the same.
[0135] It should be noted that the reference register value for the target location is a predefined location in the hardware control register of the smart network card used to store specific network parameters. For example, the register used to store the IP address may be marked as 0xA000 to 0xA003, while the register storing the MTU may be 0xB010.
[0136] In an optional implementation, an important check is performed after the first register value (i.e., the hardware value corresponding to the network parameter, such as the register value of the IP address) is written—reading the reference register value of the target location in the register of the target network card and comparing it with the expected first register value to confirm whether the configuration is successful.
[0137] In configuring a smart network interface card (NIC) at the hardware level, writing network parameters is only the first step; ensuring these parameters are correctly set is crucial. After writing the first register value to the target NIC's control register, the system performs the following steps: Using a specific IPMI command (such as `ipmitool raw 0x30 0x00`), it reads the value at the target location in the NIC's control register as a reference register value. Based on a pre-established address mapping table and the target NIC's hardware address (MAC address), it regenerates the first register value, i.e., the hardware representation of the network parameters. The read reference register value is compared with the generated first register value. If they match, the target NIC's network parameters are considered successfully configured; otherwise, the configuration command needs to be re-executed until the configuration is correct.
[0138] Example 5:
[0139] Suppose we are configuring a smart network interface card (NIC) on a server with a hardware address (MAC address) of 00:11:22:33:44:55. According to the address mapping table, the network parameters that should be configured are 192.168.1.10 / 24 and MTU 9000. Registers 0xA000 to 0xA003 of the target NIC should already have the IP address register value 0xC0A8010A written to them, while 0xB010 should have the MTU register value 0x2328 written to it. The BMC uses the ipmitool tool to read the register values 0xA000 to 0xA003 and the register value 0xB010 using the raw command as reference values. Based on the address mapping table and the target hardware address 00:11:22:33:44:55, the IP address register value 0xC0A8010A and the MTU register value 0x2328 are recalculated. The read register value is compared with the regenerated first register value. If the value of 0xA000 to 0xA003 is equal to 0xC0A8010A, and the value of 0xB010 is equal to 0x2328, the system can confirm that the network parameters of the target network card are configured successfully.
[0140] In an optional implementation, during the automated batch configuration of smart network interface cards (NICs), a CRC32 checksum mechanism can be used to verify the integrity of the configuration data to ensure the accuracy of network parameter configuration. Specifically, after network parameters (such as IP address, subnet mask, MTU, etc.) are converted into hardware control register values and written to the NIC's hardware control register via the BMC, the system reads these register values again and calculates a new checksum using the CRC32 algorithm. This newly generated checksum is compared with the previously calculated and stored checksum. If they match, it indicates that the configuration data was not corrupted or altered during the writing process, and the configuration is successful; if they do not match, it indicates that there may be an error during the configuration process, requiring a retry or troubleshooting.
[0141] In the hardware-level configuration of smart network interface cards (NICs), especially in large-scale automated deployment environments, unexpected errors and data corruption can occur at every stage of data transmission and hardware write operations. CRC32, by calculating and comparing checksums, can immediately detect data integrity after configuration, which is crucial for timely detection and correction of configuration errors. Particularly in complex environments with unstable networks or multi-path configurations, CRC32 provides additional security, ensuring that NIC configuration remains accurate and consistent even under harsh conditions.
[0142] Suppose that when configuring a server's smart network interface card (NIC), parameters such as IP address, subnet mask, and MTU have been written as a series of register values into the NIC's hardware control register. To ensure the accuracy of these configuration values, the system employs a CRC32 checksum mechanism: the IP address 192.168.1.100 is converted to register value 0xC0A80164, the subnet mask 255.255.255.0 (24 bits) is converted to 0x00000018, and the MTU 9000 is converted to 0x00002328. These values are then written into the corresponding registers using the ipmitool tool. Before writing the configuration, the system calculates a CRC32 checksum based on these register values, for example, 0x1B90C4C5, and stores it in a secure location, such as the BMC's memory. After the configuration operation is complete, the system reads all register values from the hardware control register and recalculates the checksum using the same CRC32 algorithm. The newly calculated CRC32 checksum is then compared with the previously stored checksum. If they match, it means that the configuration data has not changed during transmission and writing, and the configuration is successful; otherwise, if the checksum does not match, it means that an error occurred during the configuration process, which may be due to hardware write failure, data transmission error, or hardware failure. In this case, the system will start a retry mechanism to try to reconfigure until it succeeds or the maximum number of retries is reached.
[0143] The above-described embodiments of this application ensure the accuracy of hardware configuration, effectively preventing configuration errors or omissions even in complex data center environments, and guaranteeing the normal operation and management of network devices. Through CRC32 verification, the automated testing system can effectively identify data integrity issues during the configuration process, ensuring that each configuration parameter is accurately written into the hardware control register of the smart network card, thereby improving the success rate of configuration and the overall network stability of the data center.
[0144] In an optional implementation, after writing the first register value into the register of the target network card, the process includes: reading a checksum at a preset location in the register of the target network card when the first register value is written into the register of the target network card; determining that the target network card configuration is complete when the checksum indicates that the target network card configuration is complete; incrementing the checksum failure value by one and reading the checksum when the checksum indicates that the target network card configuration has failed; and determining that the target network card configuration has failed when the checksum failure value is greater than a preset failure value.
[0145] It's important to note that the checksum is a hardware register value used to monitor the configuration status during the smart network interface card (NIC) configuration process. By reading this value, it's possible to determine whether the configuration is complete or if any errors occurred during configuration. The preset location is a specific register location in the smart NIC hardware used to store configuration status information, such as bit 0 of register 0xD000, used to monitor whether the configuration was successful. The preset failure value can be the system-preset maximum allowed number of consecutive checksum failures. Once this number is exceeded, the NIC configuration is considered failed; for example, allowing 3 retries.
[0146] In an optional implementation, after writing the first register value (i.e., the hardware representation of the network configuration parameters), the system reads the value at a preset location on the target network card via IPMI instructions to monitor the configuration status. If the read checksum indicates that the configuration has been successful (e.g., the value of bit 0 of 0xD000 is 1), the system determines that the configuration process of the target network card has been completed. If the checksum indicates that the configuration has failed, the system increments a failure counter, then reads the updated checksum, and repeats this process until the failure counter exceeds a preset failure value.
[0147] After hardware-level network configuration is complete, ensuring the accuracy of the configuration and the availability of the network interface card (NIC) is crucial. The system can monitor the configuration status by reading bit 0 of the smart NIC's hardware status register 0xD000, a critical monitoring point. If the configuration is successful, bit 0 should be set to 1 (or another predefined value indicating a successful status). However, due to network conditions, hardware response time, or other unforeseen factors, configuration may fail on the first attempt.
[0148] In an optional implementation, the value of 0xD000 bit 0 is read using the raw command of the ipmitool tool, i.e., ipmitool -H<BMC_IP> The command `raw 0x30 0xD0` reads bit 0 of the status register 0xD000. If bit 0 is 1, the configuration is considered successful; if it is 0, the configuration has failed. In the event of a configuration failure, the system logs the failure and automatically retryes after a 15-second timeout, up to a maximum of 3 retries. If bit 0 remains 0 after 3 retries, the target network interface card (NIC) configuration has failed.
[0149] It should be noted that the BMC and the smart network card can use RSA-2048 certificates for two-way authentication, ensuring security and reliability during data exchange. A dynamic key decryption mechanism is applied to the process of encrypting the MAC-IP mapping table during transmission, ensuring that even if the mapping table is eavesdropped on by an unauthorized third party, its contents cannot be easily decrypted or tampered with, thus improving the security level of network devices during automated batch configuration.
[0150] RSA is a widely used public-key encryption algorithm. A 2048-bit RSA certificate refers to a digital certificate generated using the RSA algorithm, containing a 2048-bit key pair (public and private keys). Digital certificates are a way to verify the identity of entities in network communication. They contain a public key, which can be used in conjunction with the entity's private key for encryption and decryption operations, ensuring the security of data transmission. In secure network communication, both parties need to verify each other's identity. Between a BMC and a smart network interface card (NIC), this means the BMC needs to verify the smart NIC's identity using the smart NIC's public key, and the smart NIC also needs to verify the BMC's identity using the BMC's public key. During data transmission, dynamic keys are used for encryption and decryption. Here, "dynamic key" means that a new key is used for encryption with each data exchange, rather than a fixed key. This ensures that even if a key is intercepted, it cannot be used to decrypt subsequent data packets.
[0151] In optional implementations, communication security between the BMC and the smart NIC is extremely important in large-scale automated testing systems in data centers, as it directly affects the accuracy of network configuration and the overall security of network devices. Both the BMC and the smart NIC hold corresponding digital certificates consisting of public and private keys. These certificates use the RSA algorithm and have a 2048-bit key length, providing strong encryption protection. At the start of each communication, the BMC uses the smart NIC's public key to authenticate the smart NIC's identity, while the smart NIC uses the BMC's public key to verify the BMC's legitimacy, ensuring that only authenticated parties can exchange data, effectively preventing unauthorized access attempts. During configuration, the MAC-IP mapping table is transmitted encrypted, and the private key held by the BMC is used to decrypt the mapping table. Furthermore, the key used for decryption is dynamic each time, meaning that even if a key is leaked at one time, it will not pose a security threat to subsequent communications, as the next data packet will be encrypted using a new key.
[0152] The embodiments described in this application ensure that even if initial configuration fails during hardware-level configuration, an automatic retry mechanism can attempt to recover the configuration, improving the reliability of the configuration process and reducing the need for manual intervention. This makes it highly suitable for large-scale automated network device deployment in data centers. Through two-way authentication and dynamic decryption mechanisms, communication security and data integrity are effectively guaranteed during network device configuration. Even in the complex and ever-changing network environment of a data center, the configuration process of network devices is protected from unauthorized interference, enhancing the overall security capabilities of the system.
[0153] In an optional implementation, obtaining the target hardware address corresponding to the target network card includes: determining at least one virtual network card corresponding to the target network card; obtaining the virtual hardware address corresponding to each of the at least one virtual network card, wherein the virtual hardware address is used to indicate the virtual network card; determining the target network address of the target network card based on the hardware address, and determining the first register value based on the target network address, including: searching for the virtual network address corresponding to each of the at least one virtual network card in the address mapping table based on the at least one virtual hardware address, and generating at least one virtual register value based on the at least one virtual network address; and writing the first register value into the register of the target network card, including: writing the at least one virtual register value into the register of the corresponding virtual network card.
[0154] It's important to note that a Virtual Function (VF) network interface appears as a virtual network interface in the host operating system. It is typically created from a physical network interface card (such as the BF3 smart network card) using SR-IOV technology or virtualization software. Each VF can be independently assigned an IP address, achieving network function isolation and parallel execution. The virtual hardware address refers to the MAC address of the virtual network card, which internally identifies different virtual network interfaces, ensuring correct routing of network traffic. The virtual network address refers to the IP address assigned to the virtual network card; it is a network layer identifier used for location and identification in network communication. The virtual register value translates the virtual network address into a format understandable by the smart network card's hardware control registers, used for direct writing to the hardware to complete the network parameter configuration of the virtual network card.
[0155] In an optional implementation, the detailed steps for virtualizing a smart network interface card (NIC) based on IPMI out-of-band batch management via BMC are as follows: First, the system needs to determine the list of virtual NICs created for the target NIC, and then obtain the MAC addresses of these virtual NICs. Subsequently, the system, based on a pre-established address mapping table, looks up or determines the virtual network address corresponding to each virtual hardware address and generates the corresponding virtual register value. Finally, these virtual register values are written to the corresponding virtual NIC hardware control register, completing the network parameter settings for the virtual NIC.
[0156] In an optional implementation, the system utilizes the SR-IOV virtualization capability of the smart network interface card (NIC) to create multiple virtual network interfaces (VFs) for each physical NIC. For example, the target NIC may have five VFs created, each with independent hardware resources and network addresses. The host operating system or BMC controls and reads the hardware address (MAC address) of each VF, which will be used for subsequent configuration operations. Based on the MAC address of each VF, the corresponding virtual network address is looked up in the address mapping table. For example, 00:11:22:33:44:55 corresponds to the virtual network address 192.168.1.10 / 24. The found virtual network address is converted into a value recognizable by the hardware control registers. For example, 192.168.1.10 / 24 is converted to 0xA000=0xC0A8010A and 0xA001=0x00000018 (24-bit subnet mask). Using the IPMI raw command, the BMC writes the virtual register values of each VF to the corresponding hardware control register, enabling offline, batch virtual network interface card (VNIC) initialization. To ensure that the written configuration parameters remain valid after a system reboot, the relevant configuration commands can be added to system startup scripts such as / etc / rc.local to achieve configuration persistence.
[0157] Figure 3This is a schematic diagram of an optional network interface card (NIC) configuration method according to an embodiment of this application; as shown... Figure 3 As shown, in the server's network interface card (e.g.) Figure 3 Network card 1 and network card 2 in the network interface can perform the functions of multiple virtual network cards (e.g., network card 1 and network card 2 in the network interface). Figure 3 The virtual network interface cards (VF1-VF8) shown can support the operation of virtual machines and provide functions similar to a physical network interface card (NIC). During the network configuration process for a server's NICs, if the server's NICs utilize SR-IOV virtualization capabilities to create multiple virtual NICs (VFs) for each physical NIC, then network configuration can be performed directly on these multiple virtual NICs.
[0158] Through the above-described embodiments of this application, through this series of automated batch configuration operations, not only can the physical network card be initialized and configured, but the multiple virtual network cards created can also independently have network configurations, thereby meeting the needs for efficient utilization and flexible allocation of network resources in the data center environment, and is particularly suitable for cloud computing scenarios that require high-concurrency network communication and resource isolation.
[0159] In an optional implementation, before determining at least one virtual network card corresponding to the target network card, the method includes: inputting a first indicator bit into the virtual register of the target network card, wherein the first indicator bit is used to instruct the target network card to create a virtual network card; generating at least one virtual hardware address based on the target network address; and writing the virtual hardware address into the register of the corresponding virtual network card.
[0160] It should be noted that the first indicator bit is used as a signal bit or parameter to trigger the smart network card to create a virtual network card. By writing to the virtual register, it will start the virtual network card creation process.
[0161] Before determining the at least one virtual network interface card (NIC) corresponding to the target NIC, the system needs to trigger the creation of the virtual NIC by writing a first indicator bit to the virtual register of the target NIC. Subsequently, the system generates a set of associated virtual hardware addresses based on the hardware address of the target NIC for subsequent virtual NIC configuration. Finally, these virtual hardware addresses are written into the control register of each newly created virtual NIC, completing the initialization configuration of the virtual NIC.
[0162] In an optional implementation, creating a virtual network interface (VF) is a key step in improving resource utilization and network flexibility. The BMC writes a specific first indicator bit to the virtual register of the target network interface, which initiates the VF creation process. For example, setting bits 0 to 1 of register 0x1000 instructs the BF3 network interface to begin creating and initializing virtual network interface resources. Based on the hardware address information of the target network interface (i.e., the physical network interface PF), a set of network addresses for the VF is generated. This may involve address planning and allocation to ensure that each VF has a unique and non-conflicting network identifier. Once the VF creation is complete, the BMC writes the generated virtual hardware address into the corresponding control register of each VF, completing the network parameter initialization of the VF. This ensures that each VF can communicate independently, unaffected by the status of the physical network interface or other VFs.
[0163] Figure 4 This is a schematic diagram of another optional network interface card (NIC) configuration method according to an embodiment of this application; as shown Figure 4 As shown, a physical network interface card (NIC) can be divided into multiple virtual NICs, which can be managed through the root NIC (PF). Before using a NIC, the BMC can create multiple virtual NICs (VF1-VF4) through the PF. This process can also be achieved by bypassing the server's operating system and drivers.
[0164] Through the above-described embodiments of this application, the BMC can ensure that each virtual network interface card (NIC) is initialized and configured according to its specific network address information, thereby providing independent network communication capabilities and improving the flexibility and utilization of data center network resources. Simultaneously, using IPMI commands for hardware-level operations avoids dependence on the operating system and network services, enhancing the stability and security of the configuration process.
[0165] It's important to note that as data centers continue to expand, the number of network devices is growing exponentially. Smart network interface cards (NICs), as the last mile of network connectivity, directly impact the performance and service quality of the entire data center. Traditional fault detection and repair rely on periodic manual inspections or reactive alarm responses, which are not only labor-intensive but also time-consuming, often causing service interruptions. Therefore, developing a system capable of proactively predicting and automatically repairing smart NIC faults is crucial.
[0166] In optional implementations, historical performance data and fault logs of smart network interface cards (NICs) within the data center are collected, including but not limited to metrics such as network throughput, packet loss rate, CPU utilization, and temperature. Machine learning algorithms (such as support vector machines, random forests, or deep neural networks) are used to analyze the historical data, constructing a fault prediction model. The model is trained to identify early signs of faults. A real-time monitoring module is deployed on the smart NICs to continuously collect key performance indicators and status information. The trained machine learning model is used to analyze the real-time monitoring data and predict the probability of faults in the future. When the prediction model determines that the probability of a fault exceeds a threshold, the system automatically issues a warning. A self-healing process is initiated, automatically adjusting network configuration, load balancing strategies, or triggering hardware self-repair mechanisms (such as automatic restarts or hardware redundancy switching) based on the fault type and predicted severity. IPMI commands and SR-IOV virtualization technology are introduced to ensure that fault self-healing operations can be performed through out-of-band channels even in the event of host operating system anomalies or network fluctuations. After fault self-healing, the system collects changes in performance data before and after the fault, using this as feedback input to the model. The model is continuously adjusted and optimized to more accurately predict future fault trends and improve the success rate of self-healing.
[0167] The above solutions, through proactive prediction and automatic repair, significantly reduce the incidence of network failures, improving data center service quality and user experience. They reduce the need for manual intervention, automate fault handling, save maintenance personnel time and effort, and lower operating costs. The self-healing system enables smart network interface cards (NICs) to maintain optimal working condition unattended, enhancing their availability and reliability in complex data center environments.
[0168] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0169] Embodiments of this application also provide a network interface card (NIC) configuration device. Figure 5 This is a structural block diagram of an optional network interface card (NIC) configuration device according to an embodiment of this application, such as... Figure 5 As shown, the device includes:
[0170] The hardware address acquisition module 502 is used to acquire the target hardware address corresponding to the target network card, wherein the target hardware address is used to indicate the target network card;
[0171] The network address determination module 504 is used to determine the target network address of the target network card based on the hardware address, and to determine the first register value according to the target network address, wherein the target network address is used to indicate the digital tag of the target network card, and the first register value is used to indicate the target network address;
[0172] The register writing module 506 is used to write the first register value into the register of the target network card, wherein the register of the target network card is used to set the network parameters of the target network card.
[0173] Optionally, the network address determination module 504 is further configured to: look up the target network address in the address mapping table based on the target network address, and generate a first register value according to the target network address, wherein the target network address is used to indicate the correspondence between the hardware address and the network address of at least one network card; receive first configuration information sent by the network configuration module, and determine the first register value from the first configuration information.
[0174] Optionally, the network address determination module 504 is further configured to: obtain a preset network address set and candidate hardware addresses corresponding to at least one candidate network card, wherein the preset network address set is used to indicate the network addresses corresponding to at least one candidate network card; and generate an address mapping table by mapping at least one candidate hardware address to the network addresses in the preset network address set.
[0175] Optionally, the hardware address acquisition module 502 described above is further configured to: write the second register value corresponding to the target hardware address into the register of the target network card, wherein the second register value is used to indicate the target hardware address; write the third register value into the register of the target network card, wherein the third register value is used to indicate the number of bits of the subnet mask of the target network card; and write the fourth register value into the register of the target network card, wherein the fourth register value is used to indicate the maximum value of the data transmission of the target network card.
[0176] Optionally, the hardware address acquisition module 502 is further configured to: receive second configuration information sent by the network configuration module, wherein the second configuration information is used to indicate the configuration information of at least one reference network card, and the at least one reference network card includes a target network card; determine the register value of the reference network address corresponding to each reference network card according to the second configuration information; and write the register value of at least one reference network address into the register of the corresponding reference network card.
[0177] Optionally, the network address determination module 504 described above is further configured to: obtain a reference register value for a target location in the register of the target network card, wherein the target location is used to indicate the location where the first register value is written to the register of the target network card; determine the target network address according to the address mapping table and the target hardware address, and generate a first register value according to the target network address; and determine that the target network card configuration is complete if the first register value and the reference register value are the same.
[0178] Optionally, the register writing module 506 is further configured to: when writing the first register value into the register of the target network card, read the check value at a preset position in the register of the target network card; when the check value indicates that the target network card configuration is complete, determine that the target network card configuration is complete; when the check value indicates that the target network card configuration has failed, increment the check failure value by one and read the check value; when the check failure value is greater than the preset failure value, determine that the target network card configuration has failed.
[0179] Optionally, the hardware address acquisition module 502 is further configured to: determine at least one virtual network card corresponding to the target network card; acquire the virtual hardware address corresponding to each of the at least one virtual network card, wherein the virtual hardware address is used to indicate the virtual network card; the network address determination module 504 is further configured to: search for the virtual network address corresponding to each of the at least one virtual network card in the address mapping table based on the at least one virtual hardware address, and generate at least one virtual register value according to the at least one virtual network address; and write the at least one virtual register value into the register of the corresponding virtual network card.
[0180] Optionally, the hardware address acquisition module 502 described above is further configured to: input a first indicator bit into the virtual register of the target network card, wherein the first indicator bit is used to instruct the target network card to create a virtual network card; generate at least one virtual hardware address based on the target network address; and write the virtual hardware address into the register of the corresponding virtual network card.
[0181] For a description of the features in the embodiment corresponding to the network interface card (NIC) network configuration device, please refer to the relevant description in the embodiment corresponding to the NIC network configuration method, which will not be repeated here.
[0182] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above-described network interface card (NIC) network configuration method embodiments.
[0183] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described network interface card (NIC) network configuration method embodiments when running.
[0184] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0185] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described network interface card (NIC) configuration method embodiments.
[0186] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described network interface card (NIC) network configuration method embodiments.
[0187] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0188] The foregoing has provided a detailed description of a network interface card (NIC) configuration method, apparatus, storage medium, and electronic device provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only intended to aid in understanding the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A method for configuring a network of network cards, comprising: obtaining a target hardware address corresponding to a target network card, wherein the target hardware address is used to indicate the target network card; determining a target network address of the target network card based on the target hardware address, and determining a first register value based on the target network address, wherein the target network address is used to indicate a digital label of the target network card, and the first register value is used to indicate the target network address; and writing the first register value into a register of the target network card, wherein the register of the target network card is used to set a network parameter of the target network card; wherein the determining of the target network address of the target network card based on the target hardware address, and the determining of the first register value based on the target network address, comprises one of the following: searching for the target network address in an address mapping table based on the target network address, and converting the target network address into the first register value corresponding to the target network card, wherein the address mapping table is used to indicate a corresponding relationship between hardware addresses and network addresses of at least one network card; and receiving first configuration information sent by a network configuration module, and determining the first register value from the first configuration information; wherein after the obtaining of the target hardware address corresponding to the target network card, at least one of the following is further included: writing a second register value corresponding to the target hardware address into the register of the target network card, wherein the second register value is used to indicate the target hardware address; writing a third register value into the register of the target network card, wherein the third register value is used to indicate a subnet mask bit number of the target network card; and writing a fourth register value into the register of the target network card, wherein the fourth register value is used to indicate a maximum value of transmission data of the target network card, and the first register value, the second register value, the third register value and the fourth register value are register values readable by the target network card and are used to directly configure the target network card; wherein after the writing of the first register value into the register of the target network card, the following is included: in the case of writing the first register value into the register of the target network card, reading a check value at a preset position of the register of the target network card; in the case that the check value indicates that the target network card is configured successfully, determining that the target network card is configured successfully; in the case that the check value indicates that the target network card is configured unsuccessfully, increasing a check failure value by one, and reading the check value; in the case that the check failure value is greater than a preset failure value, determining that the target network card is configured unsuccessfully; obtaining a reference register value at a target position in the register of the target network card, wherein the target position is used to indicate a position of the first register value written into the register of the target network card; determining the target network address based on the address mapping table and the target hardware address, and generating the first register value based on the target network address; and in the case that the first register value is the same as the reference register value, determining that the target network card is configured successfully. 2. The method of claim 1, wherein, before finding the target network address in the address mapping table based on the target network address, comprising: obtaining a preset network address set and a candidate hardware address corresponding to each of the at least one candidate network card, wherein the preset network address set is used to indicate the network address corresponding to each of the at least one candidate network card; generating the address mapping table by one-to-one correspondence between the at least one candidate hardware address and the network address in the preset network address set.
3. The method of claim 1, wherein, after obtaining the target hardware address corresponding to the target network card, comprising: receiving second configuration information sent by the network configuration module, wherein the second configuration information is used to indicate the configuration information of at least one reference network card, and the at least one reference network card includes the target network card; determining the register value of the reference network address corresponding to each of the reference network card according to the second configuration information; writing the register value of at least one reference network address into the register of the corresponding reference network card.
4. The method of claim 1 to 3, wherein, the obtaining the target hardware address corresponding to the target network card, comprising: determining at least one virtual network card corresponding to the target network card; obtaining a virtual hardware address corresponding to each of the at least one virtual network card, wherein the virtual hardware address is used to indicate the virtual network card; the determining the target network address of the target network card based on the hardware address and determining the first register value according to the target network address, comprising: finding the virtual network address corresponding to each of the at least one virtual network card in the address mapping table based on at least one virtual hardware address, and generating at least one virtual register value according to at least one virtual network address; the writing the first register value into the register of the target network card, comprising: writing at least one virtual register value into the register of the corresponding virtual network card.
5. The method of claim 4, wherein, before determining the at least one virtual network card corresponding to the target network card, comprising: inputting a first indication bit into the virtual register of the target network card, wherein the first indication bit is used to indicate the target network card to create the virtual network card; generating at least one virtual hardware address according to the target network address; writing the virtual hardware address into the register of the corresponding virtual network card.
6. An electronic device, comprising: a memory for storing a computer program; a processor for executing the computer program to implement the steps of the network card network configuration method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Network address management method of Feiteng server blade system
CN105812190A