CN118018522A - Network card configuration method, device, equipment and medium - Google Patents

Network card configuration method, device, equipment and medium Download PDF

Info

Publication number
CN118018522A
CN118018522A CN202410240994.8A CN202410240994A CN118018522A CN 118018522 A CN118018522 A CN 118018522A CN 202410240994 A CN202410240994 A CN 202410240994A CN 118018522 A CN118018522 A CN 118018522A
Authority
CN
China
Prior art keywords
network card
network
target
computing resource
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410240994.8A
Other languages
Chinese (zh)
Inventor
季成科
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Softcom Power Information Technology Group Co ltd
Original Assignee
Softcom Power Information Technology Group Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Softcom Power Information Technology Group Co ltd filed Critical Softcom Power Information Technology Group Co ltd
Priority to CN202410240994.8A priority Critical patent/CN118018522A/en
Publication of CN118018522A publication Critical patent/CN118018522A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/085Retrieval of network configuration; Tracking network configuration history

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application discloses a configuration method, a device, equipment and a medium of a network card. Wherein the method comprises the following steps: in the starting process of the target computing resource, sending a DHCP request to a DHCP server through the target computing resource; the target computing resource is a virtual machine or a bare metal server, and is provided with at least two network cards; the network configuration information of the network card is fed back to the target computing resource through the DHCP server; if the network configuration information corresponding to the target network card received by the target computing resource comprises target gateway information, setting a default route in the target network card; otherwise, no default route is set in the target network card. According to the technical scheme, different network configuration information is fed back to each network card of the target computing resource through the DHCP server, so that default routes are only set in the network cards comprising the target gateway information, and other network cards are not provided with the default routes, so that the problem that a plurality of default routes collide is solved.

Description

Network card configuration method, device, equipment and medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for configuring a network card.
Background
In the native OpenStack, if multiple network cards are configured on the virtual machine or the bare metal server, when network access is performed, since each network card is provided with a default route, a problem of default route conflict occurs, that is, the virtual machine or the bare metal server may not be able to correctly determine which route should be used to send a data packet, which may cause a problem in network connection or communication failure.
How to avoid default route conflict under the multi-network card scene and realize smooth connection of the network is a technical problem to be solved.
Disclosure of Invention
The invention provides a configuration method, device, equipment and medium of a network card, which can solve the problem that a default route conflict occurs in a virtual machine or a bare metal server under a multi-network card scene, and realize smooth use of the network.
According to an aspect of the present invention, there is provided a method for configuring a network card, the method including:
In the starting process of the target computing resource, sending a DHCP request to a DHCP server through the target computing resource; the target computing resource is a virtual machine or a bare metal server, and is provided with at least two network cards;
the network configuration information of the network card is fed back to the target computing resource through the DHCP server;
If the network configuration information corresponding to the target network card received by the target computing resource comprises target gateway information, setting a default route in the target network card; otherwise the first set of parameters is selected,
No default route is set in the target network card.
According to another aspect of the present invention, there is provided a configuration apparatus for a network card, including:
The DHCP request sending module is used for sending a DHCP request to the DHCP server through the target computing resource in the starting process of the target computing resource; the target computing resource is a virtual machine or a bare metal server, and is provided with at least two network cards;
the network configuration information feedback module is used for feeding back the network configuration information of the network card to the target computing resource through the DHCP server;
The network card setting module is used for setting a default route in the target network card if the network configuration information corresponding to the target network card received by the target computing resource comprises target gateway information; otherwise the first set of parameters is selected,
No default route is set in the target network card.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the method for configuring a network card according to any one of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement a method for configuring a network card according to any one of the embodiments of the present invention when the computer instructions are executed.
The technical scheme of the embodiment of the application comprises the following steps: in the starting process of the target computing resource, sending a DHCP request to a DHCP server through the target computing resource; the target computing resource is a virtual machine or a bare metal server, and is provided with at least two network cards; the network configuration information of the network card is fed back to the target computing resource through the DHCP server; if the network configuration information corresponding to the target network card received by the target computing resource comprises target gateway information, setting a default route in the target network card; otherwise, no default route is set in the target network card. According to the technical scheme, different network configuration information is fed back to each network card of the target computing resource through the DHCP server, so that default routes are only set in the network cards comprising the target gateway information, and other network cards are not provided with the default routes, so that the problem that a plurality of default routes collide is solved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a method for configuring a network card according to a first embodiment of the present application;
fig. 2 is a flowchart of a method for configuring a network card according to a second embodiment of the present application;
FIG. 3 is a schematic diagram of an auto-configuration default route provided according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of a configuration device of a network card according to a fourth embodiment of the present application;
Fig. 5 is a schematic structural diagram of an electronic device implementing a method for configuring a network card according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," "target," and the like in the description and claims of the present invention and in the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a network card configuration method according to an embodiment of the present application, where the embodiment of the present application is applicable to a case of configuring a default route of a network card of a target computing resource, the method may be performed by a network card configuration device, the network card configuration device may be implemented in a hardware and/or software form, and the network card configuration device may be configured in an electronic device having data processing capability. As shown in fig. 1, the method includes:
S110, in the starting process of the target computing resource, sending a DHCP request to the DHCP server through the target computing resource.
The target computing resource is a virtual machine or a bare metal server, the target computing resource can realize the functions of data computing and processing, the target computing resource can be a computing resource created under any platform, and the target computing resource can be a virtual machine or a bare metal server created in an OpenStack (cloud computing management platform) by way of example. The target computing resource has at least two network cards.
DHCP (Dynamic Host Configuration Protocol ) is a protocol for configuring network information, and the DHCP protocol supports (client/server) structure, that is, the DHCP server can centrally manage IP network configuration information, and can process a DHCP request of a client, that is, assign network information such as an IP address to the DHCP client. DHCP client: information such as an IP address and DNS assigned from a DHCP server can be used for a terminal device in a network. In the embodiment of the application, the target computing resource is equivalent to a DHCP client.
Specifically, after the target computing resource is established and started, network information of at least two network cards needs to be configured, namely a DHCP request is sent to a DHCP server, so that the network is configured according to the network configuration information fed back by the DHCP.
S120, feeding back network configuration information of the network card to the target computing resource through the DHCP server.
The network configuration information may reflect network information for each network card, such as an IP address, a subnet mask, a gateway, etc., and an exemplary presentation form of the network configuration information may be a DHCP packet.
Specifically, after receiving a DHCP request sent by a target computing resource through a DHCP server, processing a preset configuration file of each network card aiming at the target computing resource to obtain network configuration information, and feeding back the network configuration information to the target computing resource through the DHCP server.
It should be noted that, in the network configuration information, the information about each network card may be different, for example, the network configuration information about a certain network card includes target gateway information, so that in a subsequent step, a default route is set in the network card, and the network configuration information about other network cards does not include target gateway information, so that no default route is set for other network cards. Obviously, the target gateway information may be set according to actual situations, and the embodiment of the present application is not limited to specific content and format thereof.
S130, if the network configuration information corresponding to the target network card received by the target computing resource comprises target gateway information, setting a default route in the target network card; otherwise, no default route is set in the target network card.
The target network card is any network card of the at least two network cards.
Specifically, after network configuration information is received through the target computing resource, judging whether the network configuration information corresponding to the target network card comprises target gateway information or not, and if so, setting a default route in the target network card; otherwise, no default route is set in the target network card.
Taking two network cards (named network card a and network card B respectively) as an example, if the network configuration information corresponding to the network card a includes the target gateway information, the default route is set in the network card a, and the default route is not set in the network card B. If the network configuration information corresponding to the network card B includes the target gateway information, setting a default route in the network card B, and not setting the default route in the network card A. Illustratively, the number of network cards setting the default route is 1.
The technical scheme of the embodiment of the application comprises the following steps: in the starting process of the target computing resource, sending a DHCP request to a DHCP server through the target computing resource; the target computing resource is a virtual machine or a bare metal server, and is provided with at least two network cards; the network configuration information of the network card is fed back to the target computing resource through the DHCP server; if the network configuration information corresponding to the target network card received by the target computing resource comprises target gateway information, setting a default route in the target network card; otherwise, no default route is set in the target network card. According to the technical scheme, different network configuration information is fed back to each network card of the target computing resource through the DHCP server, so that default routes are only set in the network cards comprising the target gateway information, and other network cards are not provided with the default routes, so that the problem that a plurality of default routes collide is solved.
Example two
Fig. 2 is a flowchart of a method for configuring a network card according to a second embodiment of the present application, where the method is optimized based on the foregoing embodiment of the present application.
As shown in fig. 2, the method in the embodiment of the present application specifically includes the following steps:
S210, if a creation request of a target computing resource is received, port information corresponding to a network card of the target computing resource is created according to the creation request; the port information includes role information of the network card.
In the embodiment of the application, a user can pre-designate which network card is the network card for setting the default route, and then initiate a creation request of the target computing resource, wherein the creation request comprises role information of each network card, and the role information can reflect whether each network card needs to set the default route.
Specifically, if a creation request of a target computing resource initiated by a user is received, port information of a network card of the target computing resource is created according to the creation request, and after the role of the network card is determined according to the creation request, role information of each network card is set in the port information.
In the embodiment of the present application, optionally, if a creation request of a target computing resource is received, port information corresponding to a network card for creating the target computing resource according to the creation request includes: if the calculation management module receives a creation request of a target calculation resource, sending a request for creating port information to the network management module through the calculation management module; creating port information corresponding to the network card of the target computing resource according to the creation request through the network management module; the method further comprises the steps of: and storing the port information into a database through the network management module.
Specifically, in OpenStack, a request for creating a target computing resource can be received through a computing management module, and after the request for creating is received, a request for creating port information is sent to a network management module through the computing management module; further, creating port information corresponding to the network card of the target computing resource according to the creation request through the network management module; and storing the port information into a database through the network management module.
In an embodiment of the present application, optionally, after the port information is stored in the database by the network management module, the method further includes: sending a request for configuring the DHCP to a network address allocation module through the network management module; and after the network address allocation module receives the request for configuring the DHCP, the port information is read from the database through the network address allocation module.
Specifically, after the port information is stored in the database through the network management module, a request for configuring the DHCP is sent to the network address allocation module through the network management module, and after the network address allocation module receives the request, the port information is read from the database, so that the role information of the network card is obtained.
S220, determining whether to set target gateway information in the configuration file of the network card according to the role information of the network card.
And the configuration file is a file used by the DHCP server for determining network configuration information of the network card. That is, the configuration file may reflect network configuration information of the network card, including related content that may reflect role information of the network card.
Specifically, it may be determined whether to set target gateway information in the configuration file of each network card according to the role information of each network card, for example, if the role information of the network card C is the first role, the target gateway information may be set in the configuration file of the network card C, and if the role information of the network card D is not the first role, the target gateway information is not set in the configuration file of the network card D.
Correspondingly, the determining whether to set the target gateway information in the configuration file of the network card according to the role information of the network card includes: if the role information of the target network card is determined to be the first role by the network address allocation module, setting target gateway information in a configuration file of the target network card; otherwise, the target gateway information is not set in the configuration file of the target network card; the network card corresponding to the first character is a network card needing to set a default route.
Specifically, according to the role information of the network card, updating the dnsmasq configuration corresponding to the network card network, that is, updating the configuration file, for example, if the role of the network card is the first role, the dhcp information of the IP contains a dhcp option 3; if the network card role is the second role, the dhcp information of the IP does not contain dhcpoption; the network card corresponding to the first role needs to set a default route, and the network card corresponding to the second role does not need to set the default route.
In the embodiment of the application, optionally, the number of network cards corresponding to the first role is one.
In the embodiment of the application, in order to avoid default route conflict, only one default route is set, namely, the number of network cards corresponding to the first role is one.
In the embodiment of the present application, optionally, after determining whether to set the target gateway information in the configuration file of the network card according to the role information of the network card, the method further includes: sending a request for creating a target computing resource to a computing implementation module through a computing management module; creating a target computing resource and starting the target computing resource through the computing implementation module.
Specifically, after the configuration file is set, the target computing resource can be started, that is, a request for creating the target computing resource is sent to the computing implementation module through the computing management module; creating a target computing resource and starting the target computing resource through the computing implementation module.
S230, in the starting process of the target computing resource, sending a DHCP request to the DHCP server through the target computing resource.
S240, the network configuration information of the network card is fed back to the target computing resource through the DHCP server.
Specifically, the DHCP server determines, according to the configuration file, network configuration information of the network card to be fed back to the target computing resource. Namely, aiming at a certain network card, if the configuration file is provided with target gateway information, the network configuration information comprises the target gateway information; if the configuration file is not provided with the target gateway information, the network configuration information does not comprise the target gateway information.
S250, if the network configuration information corresponding to the target network card received by the target computing resource comprises target gateway information, setting a default route in the target network card; otherwise, no default route is set in the target network card.
In the embodiment of the present application, optionally, the target gateway information is a gateway address option. The gateway address option is dhcp option 3.
According to the technical scheme of the embodiment of the application, the configuration file is changed according to the role information of the network card, when the target computing resource acquires the DHCP, the network configuration information is generated according to the configuration file, and then if the network configuration information corresponding to the network card contains gateway address options, a default route is set; otherwise, default route is not set, so that only one network card has default route under the scene of multiple network cards, and the problem of default route conflict is solved.
Example III
Fig. 3 is a schematic diagram of an automatic default route configuration, which includes a computing management module, a network management module, a computing implementation module, a network address allocation module, a DHCP server, a virtual machine, and the like under an OpenStack platform. Taking a target computing resource as a virtual machine as an example, referring to fig. 3, an implementation process of the present technical solution may be:
Step A1: and receiving a virtual machine creation request initiated by a user through a Nova-api calculation management module, wherein the request comprises the number of network cards and roles of each network card, and at most one master network card exists, so that the number of slave network cards (the master network card is a first role network card, and the slave network card is a second role network card) is not limited.
Step A2: the Nova-api calculation management module requests the Neutron-server network management module to create a port (port) corresponding to the network card.
Step A3: and the Neutron-server network management module stores the network card (port) information into a database.
Step A4: the Neutron-server network management module requests configuration of the dhcp information from the Neutron-dhcp-agent network address allocation module through the RPC.
Step A5: and updating the dnsmasq configuration corresponding to the network card according to the role information of the network card by a neutron-DHCP-agent network address allocation module (the dnsmasq is a program for providing DNS caching and DHCP service functions, and the functions of a DHCP server can be realized).
Specifically, in the configuration file, if the network card role is dominant, the dhcp information of the IP is set to include a dhcp option 3. If the network card role is slave, the dhcp information of the IP is set to not contain dhcpoption.
And A6, calling a nova-computer calculation implementation module by using the nova-api calculation management module RPC to call the nova-computer calculation implementation module to hatch and create a virtual machine.
Step A7, the nova-computer computing implementation module creates a starting virtual machine.
Step A8, in the starting process of the virtual machine, the network cards respectively initiate a dhcp request,
Further, the dhcp message acquired by the network card with the main role contains the dhcp option 3 gateway information; the dhcp message acquired from the network card with the role does not contain the dhcp option information
And A9, the virtual machine sets the network card to have a default route when the gateway information of the dhcp option3 is contained according to the dhcp return message, and does not set the network card to have the default route when the option3 does not exist.
The technical scheme of the embodiment of the application can solve the problem of default route conflict of the virtual machine or the bare metal server in a multi-network card scene, does not limit an implemented operating system, and can be executed in windows, linux and other systems. In addition, any network card can be designated as a first role (main network card), flexibility is high, and the network card granularity is finer than the original network granularity due to the fact that default route conflict is avoided.
Example IV
Fig. 4 is a schematic structural diagram of a configuration device for a network card according to a fourth embodiment of the present application, where the device may execute the configuration method for a network card according to any embodiment of the present application, and the configuration device has functional modules and beneficial effects corresponding to the execution method. As shown in fig. 4, the apparatus includes:
A DHCP request sending module 310, configured to send a DHCP request to a DHCP server through a target computing resource during a target computing resource startup process; the target computing resource is a virtual machine or a bare metal server, and is provided with at least two network cards;
the network configuration information feedback module 320 is configured to feed back network configuration information of the network card to the target computing resource through the DHCP server;
the network card setting module 330 is configured to set a default route in the target network card if the network configuration information corresponding to the target network card received by the target computing resource includes target gateway information; otherwise, no default route is set in the target network card.
The technical scheme of the embodiment of the application comprises the following steps: a DHCP request sending module 310, configured to send a DHCP request to a DHCP server through a target computing resource during a target computing resource startup process; the target computing resource is a virtual machine or a bare metal server, and is provided with at least two network cards; the network configuration information feedback module 320 is configured to feed back network configuration information of the network card to the target computing resource through the DHCP server; the network card setting module 330 is configured to set a default route in the target network card if the network configuration information corresponding to the target network card received by the target computing resource includes target gateway information; otherwise, no default route is set in the target network card. According to the technical scheme, different network configuration information is fed back to each network card of the target computing resource through the DHCP server, so that default routes are only set in the network cards comprising the target gateway information, and other network cards are not provided with the default routes, so that the problem that a plurality of default routes collide is solved.
In an embodiment of the present application, optionally, the apparatus further includes:
the port information creation module is used for creating port information corresponding to a network card of the target computing resource according to the creation request if the creation request of the target computing resource is received; the port information comprises role information of a network card;
The role information judging module is used for determining whether target gateway information is set in the configuration file of the network card according to the role information of the network card;
and the configuration file is a file used by the DHCP server for determining network configuration information of the network card.
In the embodiment of the present application, optionally, the target gateway information is a gateway address option.
In an embodiment of the present application, optionally, the port information creation module includes:
A request sending unit, configured to send a request for creating port information to the network management module through the computing management module if the computing management module receives a request for creating a target computing resource;
The port information creation unit is used for creating port information corresponding to the network card of the target computing resource according to the creation request through the network management module;
The apparatus further comprises:
and the port information storage unit is used for storing the port information into a database through the network management module.
In an embodiment of the present application, optionally, the apparatus further includes:
A DHCP request unit, configured to send a request for configuring DHCP to a network address allocation module through the network management module;
The port information reading unit is used for reading the port information from the database through the network address distribution module after the network address distribution module receives the request for configuring the DHCP;
correspondingly, the role information judging module comprises:
The role information judging unit is used for setting target gateway information in the configuration file of the target network card if the role information of the target network card is determined to be a first role through the network address distribution module; otherwise, the target gateway information is not set in the configuration file of the target network card; the network card corresponding to the first character is a network card needing to set a default route.
In an embodiment of the present application, optionally, the apparatus further includes:
A target computing resource creation request sending unit, configured to send, to the computing implementation module through the computing management module, a request for creating a target computing resource;
and the target computing resource starting unit is used for creating target computing resources through the computing implementation module and starting the target computing resources.
In the embodiment of the application, optionally, the number of network cards corresponding to the first role is one.
The configuration device of the network card provided by the embodiment of the application can execute the configuration method of the network card provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method.
Example five
Fig. 5 shows a schematic diagram of the structure of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 5, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the respective methods and processes described above, for example, the configuration method of the network card.
In some embodiments, the method of configuring a network card may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the above-described configuration method of the network card may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the configuration method of the network card in any other suitable way (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. The configuration method of the network card is characterized by comprising the following steps:
In the starting process of the target computing resource, sending a DHCP request to a DHCP server through the target computing resource; the target computing resource is a virtual machine or a bare metal server, and is provided with at least two network cards;
the network configuration information of the network card is fed back to the target computing resource through the DHCP server;
If the network configuration information corresponding to the target network card received by the target computing resource comprises target gateway information, setting a default route in the target network card; otherwise the first set of parameters is selected,
No default route is set in the target network card.
2. The method of claim 1, wherein prior to the target computing resource being started, the method further comprises:
If a creation request of a target computing resource is received, port information corresponding to a network card of the target computing resource is created according to the creation request; the port information comprises role information of a network card;
determining whether target gateway information is set in a configuration file of the network card according to the role information of the network card;
and the configuration file is a file used by the DHCP server for determining network configuration information of the network card.
3. The method of claim 1, wherein the target gateway information is a gateway address option.
4. The method according to claim 2, wherein if a creation request of a target computing resource is received, creating port information corresponding to a network card of the target computing resource according to the creation request includes:
If the calculation management module receives a creation request of a target calculation resource, sending a request for creating port information to the network management module through the calculation management module;
Creating port information corresponding to the network card of the target computing resource according to the creation request through the network management module;
the method further comprises the steps of:
and storing the port information into a database through the network management module.
5. The method of claim 4, wherein after storing the port information in a database by the network management module, the method further comprises:
Sending a request for configuring the DHCP to a network address allocation module through the network management module;
after receiving the request for configuring the DHCP, the network address allocation module reads the port information from the database through the network address allocation module;
correspondingly, the determining whether to set the target gateway information in the configuration file of the network card according to the role information of the network card includes:
if the role information of the target network card is determined to be the first role by the network address allocation module, setting target gateway information in a configuration file of the target network card; otherwise, the target gateway information is not set in the configuration file of the target network card; the network card corresponding to the first character is a network card needing to set a default route.
6. The method of claim 2, wherein after determining whether the target gateway information is set in the configuration file of the network card according to the role information of the network card, the method further comprises:
Sending a request for creating a target computing resource to a computing implementation module through a computing management module;
Creating a target computing resource and starting the target computing resource through the computing implementation module.
7. The method of claim 5, wherein the number of network cards corresponding to the first role is one.
8. A network card configuration apparatus, comprising:
The DHCP request sending module is used for sending a DHCP request to the DHCP server through the target computing resource in the starting process of the target computing resource; the target computing resource is a virtual machine or a bare metal server, and is provided with at least two network cards;
the network configuration information feedback module is used for feeding back the network configuration information of the network card to the target computing resource through the DHCP server;
The network card setting module is used for setting a default route in the target network card if the network configuration information corresponding to the target network card received by the target computing resource comprises target gateway information; otherwise the first set of parameters is selected,
No default route is set in the target network card.
9. An electronic device, the electronic device comprising:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of configuring a network card of any one of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to implement the method of configuring a network card of any one of claims 1-7 when executed.
CN202410240994.8A 2024-03-04 2024-03-04 Network card configuration method, device, equipment and medium Pending CN118018522A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410240994.8A CN118018522A (en) 2024-03-04 2024-03-04 Network card configuration method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410240994.8A CN118018522A (en) 2024-03-04 2024-03-04 Network card configuration method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN118018522A true CN118018522A (en) 2024-05-10

Family

ID=90942947

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410240994.8A Pending CN118018522A (en) 2024-03-04 2024-03-04 Network card configuration method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN118018522A (en)

Similar Documents

Publication Publication Date Title
CN114697391B (en) Data processing method, device, equipment and storage medium
CN117555570A (en) Service management method and device, electronic equipment and storage medium
CN117082073A (en) File storage method, file downloading method, device, equipment and storage medium
CN114924826B (en) Page fusion method, device and equipment based on different code platforms
CN113612643B (en) Network configuration method, device and equipment of cloud mobile phone and storage medium
CN118018522A (en) Network card configuration method, device, equipment and medium
CN114143328B (en) Data migration method, device, equipment and medium of cloud mobile phone
CN114095758B (en) Cloud image intercepting method and related device
CN114090118B (en) Method, device, equipment and storage medium for starting applet
CN113747423B (en) Cloud mobile phone state synchronization method, device, equipment, storage medium and program product
CN113726881B (en) Communication connection establishment method, related device and computer readable storage medium
CN115801687A (en) Flow balancing method and device, electronic equipment and storage medium
CN115767786A (en) Multi-cluster communication method and device, electronic equipment and storage medium
CN113901066A (en) Method for updating state after instance operation
CN113420275A (en) Data connection processing method, related device and computer program product
CN113014656B (en) Private cloud information synchronization method and device
CN114615273B (en) Data transmission method, device and equipment based on load balancing system
CN115277568B (en) Data transmission method, device, equipment and storage medium
CN116939228B (en) Distributed processing method, device and equipment for remote sensing image and storage medium
CN113660339B (en) Method and apparatus for decentralizing clusters
CN116886775A (en) External exposure method and device, cluster deployment system and storage medium
CN116471199A (en) QoS configuration method, device and equipment of virtual network card and storage medium
CN116723245A (en) Application request processing method, device, equipment and storage medium
CN117201481A (en) Method and device for downloading software update file, electronic equipment and readable medium
CN117298599A (en) Game version scheduling method, system, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination