Network card automatic binding method and device, equipment, medium and program product
By automatically obtaining and processing network card binding configuration information, the automatic binding of network card and switch ports is achieved, and the problems of low efficiency and poor accuracy of network card binding configuration in the existing technology are solved, and the efficiency and accuracy of the binding process are improved.
Patent Information
- Application Number
- CN202411585826.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-11-07
AI Technical Summary
In the prior art, network card binding configuration is inefficient and the accuracy cannot be guaranteed, and manual configuration is required, resulting in complex configuration and error-prone.
By obtaining the network card binding configuration, including working mode information and physical network card port information, the target physical network card and switch port are automatically determined, and a configuration request is generated to send to the switch. After the switch port is automatically bound, the network card binding is configured on the host side. Certainly.
It realizes automated binding of network card and switch-side ports, improves configuration efficiency and accuracy, and reduces the risk of human error.
Smart Images

Figure CN119402446A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer network communication, and in particular to a network card automatic binding method, device, equipment, medium and program product. Background Art
[0002] NIC bonding (also known as NIC bundling, Bond technology), that is, to solve the problems of network reliability and bandwidth improvement by binding multiple physical NICs into a virtual NIC, NIC bonding makes multiple NICs appear as a single Ethernet interface device with the same IP (Internet Protocol) address.
[0003] In the related art, engineers usually select the physical network ports that need to be bound and configured from multiple physical network cards on the host according to the network topology, and manually virtualize multiple physical network cards into one virtual network card. Then, they need to configure the ports on the switch. Manual binding configuration requires configuration on the host side before configuration on the switch side, which has low configuration efficiency and cannot guarantee configuration accuracy. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a network card automatic binding method, device, equipment, medium and program product, which can realize automatic binding of network card side and switch side ports. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a network card automatic binding method, which is applied to a host, comprising:
[0006] Obtaining a network card binding configuration; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards;
[0007] Determine the corresponding target physical network card according to the physical network card port information;
[0008] Generate a configuration request according to the working mode information and the interface address of the target physical network card, send the configuration request to the switch, the switch determines the target port corresponding to the interface address of the target physical network card on the switch, and sets the target port to a corresponding port aggregation state according to the working mode information;
[0009] The target physical network cards are configured according to the working mode information to bind all the target physical network cards.
[0010] Optionally, obtaining the network card binding configuration includes:
[0011] Obtain a network card binding instruction, and display a network configuration interface on a human-computer interaction interface according to the network card binding instruction;
[0012] The network card binding configuration is obtained through the network configuration interface.
[0013] Optionally, configuring the target physical network card according to the working mode information includes:
[0014] Generate a corresponding configuration file according to the working mode information;
[0015] Apply the configuration file to the target physical network card.
[0016] Optionally, before the switch determines the interface address of the target physical network card corresponding to the target port on the switch, the method further includes:
[0017] The switch determines whether the target physical network cards are all connected to the local switch according to the interface address of the target physical network card;
[0018] If all the target physical network cards are connected to the local switch, the switch determines the target port corresponding to the interface address of the target physical network card on the switch.
[0019] Optionally, after determining whether all the target physical network cards are connected to the local switch, the method further includes:
[0020] If the target physical network card is not connected to the local switch, a binding failure prompt including abnormal connection between the network card and the switch is generated.
[0021] Optionally, before configuring the target physical network card according to the working mode information, the method further includes:
[0022] Acquire the port configuration result sent by the switch; the port configuration result is obtained by reading the current port aggregation state of the target port after the switch sets the port aggregation state for the target port according to the working mode information;
[0023] If the port configuration result is successful, performing the operation of configuring the target physical network card according to the working mode information;
[0024] Optionally, after obtaining the port configuration result sent by the switch, the method further includes:
[0025] If the port configuration result is unsuccessful configuration, a prompt indicating that the port configuration is unsuccessful is generated, and the operation of configuring the target physical network card according to the working mode information is not performed.
[0026] Optionally, the working mode information includes information of any one of the following working modes: polling balancing mode, master-slave mode, hash-based balancing mode, broadcast mode, dynamic link aggregation mode, sending load balancing mode, and receiving and sending load balancing mode; the port aggregation status is a static physical port group, a dynamic physical port group, or no physical port group is configured.
[0027] Optionally, before generating a configuration request according to the working mode information and the interface address of the target physical network card, the method further includes:
[0028] Checking the connection status of the target physical network card; the connection status includes a normal network connection status and a disconnected network connection status;
[0029] If the connection state of the target physical network card is the normal network connection state, the operation of generating a configuration request according to the working mode information and the interface address of the target physical network card is performed;
[0030] If the connection state of the target physical network card is the network disconnection state, a status abnormality prompt is generated, and a command selection interface is displayed on the human-computer interaction interface;
[0031] Receiving, through the instruction selection interface, a response instruction sent by the user according to the abnormal status prompt; the response instruction includes a first instruction and a second instruction, the first instruction is used to instruct to terminate the binding operation, and the second instruction is used to instruct to continue the binding operation;
[0032] If the response instruction is the first instruction, exit the network card binding operation;
[0033] If the response instruction is the second instruction, the operation of configuring the target physical network card according to the working mode information is directly executed.
[0034] On the other hand, the present application discloses a method for automatically binding a network card, which is applied to a switch, comprising:
[0035] Obtaining a configuration request sent by a host; the host is used to obtain a network card binding configuration; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards; determining a corresponding target physical network card according to the physical network card port information; generating the configuration request according to the working mode information and the interface address of the target physical network card; configuring the target physical network card according to the working mode information to bind all the target physical network cards;
[0036] The target port corresponding to the interface address of the target physical network card on the switch is determined, and the target port is set to a corresponding port aggregation state according to the working mode information.
[0037] On the other hand, the present application discloses a network card automatic binding device, applied to a host, comprising:
[0038] A network card binding configuration acquisition module, used to acquire a network card binding configuration; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards;
[0039] A target physical network card determination module, used to determine the corresponding target physical network card according to the physical network card port information;
[0040] a configuration request sending module, configured to generate a configuration request according to the working mode information and the interface address of the target physical network card, and send the configuration request to the switch, wherein the switch determines the target port corresponding to the interface address of the target physical network card on the switch, and sets the target port to a corresponding port aggregation state according to the working mode information;
[0041] The network card binding module is used to configure the target physical network card according to the working mode information to bind all the target physical network cards.
[0042] On the other hand, the present application discloses a network card automatic binding device, applied to a switch, comprising:
[0043] A configuration request acquisition module, used to acquire a configuration request sent by a host; the host is used to acquire a network card binding configuration; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards; a corresponding target physical network card is determined according to the physical network card port information; the configuration request is generated according to the working mode information and the interface address of the target physical network card; the target physical network card is configured according to the working mode information to bind all the target physical network cards;
[0044] The port configuration module is used to determine the target port corresponding to the interface address of the target physical network card on the switch, and set the target port to the corresponding port aggregation state according to the working mode information.
[0045] In another aspect, the present application discloses an electronic device, comprising:
[0046] Memory, used to store computer programs;
[0047] The processor is used to execute the computer program to implement the aforementioned network card automatic binding method.
[0048] On the other hand, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program implements the aforementioned network card automatic binding method when executed by a processor.
[0049] On the other hand, the present application discloses a computer program product, including a computer program / instruction, which implements the aforementioned network card automatic binding method when executed by a processor.
[0050] In the present application, a network card binding configuration is obtained; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards; a corresponding target physical network card is determined according to the physical network card port information; a configuration request is generated according to the working mode information and the interface address of the target physical network card, and the configuration request is sent to a switch, the switch determines the target port corresponding to the interface address of the target physical network card on the switch, and sets the target port to a corresponding port aggregation state according to the working mode information; the target physical network card is configured according to the working mode information to bind all the target physical network cards. It can be seen that by configuring the working mode information and the port information of the physical network card to be bound to the network card, a configuration request is automatically generated and sent to the switch. The switch determines the target port to be bound according to the received configuration request, and sets the port aggregation state of the target port according to the working mode information to realize the port binding on the switch side. The host side then configures the target physical network card according to the working mode information to realize the physical network card binding, thereby realizing the automatic binding of the network card side and the switch side ports without manual operation, thereby improving the efficiency and accuracy of the network card binding. In addition, by executing the switch port binding first and then executing the network card binding, the problem of meaningless network card binding and waste of resources when the switch port cannot be successfully bound is avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0052] FIG1 is a flow chart of a method for automatically binding a network card provided by the present application;
[0053] FIG2 is a flowchart of a specific method for automatic network card binding provided by the present application;
[0054] Figure 3 Another specific flow chart of the automatic network card binding method provided by this application;
[0055] FIG4 is a schematic diagram of the structure of a host-side network card automatic binding device provided by the present application;
[0056] FIG5 is a structural diagram of an electronic device provided in this application. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0058] In the related art, engineers usually select the physical network ports that need to be bound and configured from multiple physical network cards on the host according to the network topology, and manually virtualize multiple physical network cards into one virtual network card. Then, they need to configure the ports on the switch. Manual binding configuration is performed manually, and the switch side configuration needs to be performed after the host side configuration is completed. The configuration efficiency is low and the configuration accuracy cannot be guaranteed. In order to overcome the above technical problems, this application proposes a network card automatic binding method to realize the automatic binding of the network card side and the switch side ports.
[0059] The embodiment of the present application discloses a method for automatically binding a network card, which is applied to a host. Referring to FIG1 , the method may include the following steps:
[0060] Step S11: Acquire a network card binding configuration; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards.
[0061] First, obtain the network card binding configuration sent by the user, which includes at least the working mode information and the physical network card port information of at least two physical network cards. That is, the user configures the working mode for the network card according to the usage requirements, and sends the physical network card port information of the network card to be bound. The working principle of network card binding is to combine multiple physical network cards into a logical interface. In this logical interface, data can be distributed to multiple physical network cards, thereby improving transmission speed and bandwidth. Network card binding has multiple working modes, such as load sharing (round-robin), active-backup mode (active-backup), balance strategy (balance-xor), etc. These modes provide flexible configuration options to adapt to different network requirements.
[0062] In some embodiments, obtaining the network card binding configuration may include: obtaining a network card binding instruction, displaying a network configuration interface on a human-computer interaction interface according to the network card binding instruction; obtaining the network card binding configuration through the network configuration interface. That is, the network card side provides a one-key binding command, enters the network configuration interface of the host side, executes the one-key binding command, and after executing the command, the user will be prompted to select the binding type and the corresponding port. Network card bonding supports multiple modes, the common ones include the following 7 types: polling balancing mode (balance-rr), active-backup mode (active-backup), balancing mode based on hash (balance-xor), broadcast mode (broadcast), dynamic link aggregation mode (802.3ad), sending load balancing mode (balance-tlb), transceiver load balancing mode (balance-alb), that is, the user selects one of the working modes to configure the network card binding.
[0063] Step S12: Determine the corresponding target physical network card according to the physical network card port information.
[0064] According to the physical network card port information configured by the user, the physical network card corresponding to the physical network card port information is searched and obtained as the target physical network card to be bound.
[0065] Step S13: Generate a configuration request based on the working mode information and the interface address of the target physical network card, and send the configuration request to the switch. The switch determines the target port corresponding to the interface address of the target physical network card on the switch, and sets the target port to the corresponding port aggregation state according to the working mode information.
[0066] The host sends a configuration request to the switch connected to the optical cable, so that the switch automatically binds the port on the switch side after receiving the request. Specifically, the configuration request includes the above working mode information and the interface address of the target physical network card, which can be the MAC address (Media Access Control Address) of the target physical network card interface.
[0067] That is to say, after selecting the binding type on the NIC side, the system will send a configuration request to the switch. This request message contains detailed binding configuration information: the working mode information is used to specify the working mode selected by the user; the port MAC address, that is, the MAC address of the NIC interface participating in the binding operation, so that the switch can correctly identify and configure these interfaces; it can also include other configuration parameters, such as the relevant settings of the Link Aggregation Control Protocol (LACP). After receiving the request message sent by the NIC, the switch will parse this information to obtain the working mode information and the interface address of the target physical NIC, etc. Then, the switch will perform automatic binding operations based on the parsed information.
[0068] In some embodiments, in order to further improve the success rate of network card binding, before generating a configuration request according to the working mode information and the interface address of the target physical network card, it is also necessary to detect the connection status of the network card, which specifically includes the following steps:
[0069] S130: Check the connection status of the target physical network card; the connection status includes a normal network connection status and a disconnected network connection status.
[0070] It is understandable that once the working mode is selected, the program will start to perform the binding operation; before execution, the system will detect the connection status of the network card to ensure that all interfaces are connected correctly.
[0071] S131: If the connection state of the target physical network card is the normal network connection state, executing the operation of generating a configuration request according to the working mode information and the interface address of the target physical network card;
[0072] S132: If the connection status of the target physical network card is the network disconnection status, a status abnormality prompt is generated, and a command selection interface is displayed on the human-computer interaction interface.
[0073] That is, the system will detect the connection status of the network card. If the network card port status is normal (link up), the binding operation will continue. If the network card port status is found to be disconnected (link down), the system will prompt the user that the connection status is abnormal.
[0074] S133: receiving, through the instruction selection interface, a response instruction sent by the user according to the status abnormality prompt; the response instruction includes a first instruction and a second instruction, the first instruction is used to instruct to terminate the binding operation, and the second instruction is used to instruct to continue the binding operation;
[0075] S134: If the response instruction is the first instruction, exit the network card binding operation;
[0076] S135: If the response instruction is the second instruction, directly executing the operation of configuring the target physical network card according to the working mode information.
[0077] It is understandable that in order to improve the flexibility of network card binding, when the connection status of the marked physical network card is disconnected, the system automatically asks the user whether to continue the binding operation; if the user chooses to give up, the program will exit and record the reason for the interruption of the operation; if the user chooses to continue, the program will ignore the abnormal status and directly bind the corresponding port on the host side. After the host side configuration is completed, the program exits, prompts and records the port status.
[0078] The port aggregation status is specifically static physical port group (static portchannel), dynamic physical port group (dynamic portchannel), or no physical port group (no portchannel). Physical port group (portChannel) is a switch network technology that aggregates multiple physical ports into a logical port so that data streams can be distributed to these physical ports, thereby increasing the total bandwidth of the link. That is, the switch side configures static portchannel, dynamic portchannel, or no portchannel for the corresponding port according to the different bond types configured on the network card side. Specifically, the polling balance mode (balance-rr) corresponds to static portchannel, the active-backup mode (active-backup) corresponds to no portchannel, the balance mode based on hashing (balance-xor) corresponds to static portchannel, the broadcast mode (broadcast) corresponds to static portchannel, the dynamic link aggregation mode (802.3ad) corresponds to dynamic portchannel, the sending load balancing mode (balance-tlb) corresponds to no portchannel, and the transceiver load balancing mode (balance-alb) corresponds to no portchannel.
[0079] In some embodiments, before the switch determines the interface address of the target physical network card corresponding to the target port on the switch, it may also include: the switch determines whether the target physical network cards are all connected to the local switch based on the interface address of the target physical network card; if all the target physical network cards are connected to the local switch, the switch determines the target port on the switch corresponding to the interface address of the target physical network card; if there is a target physical network card that is not connected to the local switch, a binding failure prompt is generated including an abnormal connection between the network card and the switch.
[0080] That is, the switch performs automatic binding according to the parsed information and returns a response message. First, the switch checks whether all ports requested to be bound by the peer network card are connected to the switch. If it finds that there are ports that are not on the switch, the switch will return a failure message to the network card with the specific reason for the failure. If the check information is correct, the switch will configure the corresponding port as a static portchannel, a dynamic portchannel, or no portchannel according to the configured working mode. After the configuration is completed, the switch will return a success message to the network card.
[0081] Step S14: configuring the target physical network cards according to the working mode information to bind all the target physical network cards.
[0082] After the host is bound to the switch, the target physical network card is configured according to the working mode information to achieve network card binding. Specifically, configuring the target physical network card according to the working mode information includes: generating a corresponding configuration file according to the working mode information; applying the configuration file to the target physical network card. That is, by automatically generating a configuration file corresponding to the working mode information and applying the configuration file to the target physical network card, the configuration file is effective on the target physical network card to achieve network card binding.
[0083] Compared with the traditional networking, the network card and switch are manually configured to achieve network card binding, which has low configuration efficiency and cannot guarantee configuration accuracy. This application unifies and simplifies the configuration process of network cards and switches, reduces the complexity of manual configuration, and reduces the risk of human error; at the same time, through the rapid screening of corresponding line abnormalities or port abnormalities, the efficiency of fault location is improved.
[0084] In some embodiments, before configuring the target physical network card according to the working mode information, the method may further include: obtaining the port configuration result sent by the switch; the port configuration result is obtained by reading the current port aggregation state of the target port after the switch sets the port aggregation state for the target port according to the working mode information; if the port configuration result is successful, the operation of configuring the target physical network card according to the working mode information is performed; if the port configuration result is unsuccessful configuration, a prompt indicating that the port configuration is unsuccessful is generated. That is, the network card end will perform the next action according to the message returned by the switch. If the switch returns failure, the network card end will record the failure reason and exit the operation, which helps the user to quickly locate the problem and take further solutions. If the switch returns success, the network card end will perform a binding operation on the target port, that is, bind the ports of multiple target network cards into one binding port, and check the status of the binding port; if the port network connection is normal, a prompt indicating that the binding operation is completed is displayed, and the port information and port status are displayed.
[0085] In some embodiments, the above-mentioned network card automatic binding method also includes: automatically generating an operation log and event record for the network card binding process, so that the administrator can trace the problem by viewing the operation log and the event record; the event record is used to record configuration changes, status updates and fault handling. The operation log is used to record content including but not limited to the time when the network card binding configuration is obtained, the time when the configuration request is sent to the switch, the time when the switch response is received, the switch-side binding result returned by the switch, and the operation of binding the target physical network card. Therefore, the log helps network administrators track configuration history and audit network operations; log records can not only provide transparency of operations, but also support post-analysis and help optimize network configuration.
[0086] As can be seen from the above, in this embodiment, a network card binding configuration is obtained; the network card binding configuration includes working mode information, and physical network card port information of at least two physical network cards; the corresponding target physical network card is determined according to the physical network card port information; a configuration request is generated according to the working mode information and the interface address of the target physical network card, and the configuration request is sent to the switch, the switch determines the target port corresponding to the interface address of the target physical network card on the switch, and sets the target port to the corresponding port aggregation state according to the working mode information; the target physical network card is configured according to the working mode information to bind all the target physical network cards. It can be seen that by configuring the working mode information and the port information of the physical network card to be bound to the network card, a configuration request is automatically generated and sent to the switch. The switch determines the target port to be bound according to the received configuration request, and sets the port aggregation state of the target port according to the working mode information to realize the port binding on the switch side. The host side then configures the target physical network card according to the working mode information to realize the physical network card binding, thereby realizing the automatic binding of the network card side and the switch side ports without manual operation, thereby improving the efficiency and accuracy of the network card binding. In addition, by executing the switch port binding first and then executing the network card binding, the problem of meaningless network card binding and waste of resources when the switch port cannot be successfully bound is avoided.
[0087] The embodiment of the present application discloses a specific network card automatic binding method, which is applied to a host, that is, a network card end. Referring to FIG. 2 , the method may include the following steps:
[0088] S201: The network card provides a one-key binding option and performs a one-key binding operation;
[0089] S202: After one-key binding is executed, a network configuration interface is provided so that the user can select the type to be bound and the target binding port;
[0090] S203: Start detecting the host-side network card status to check whether the network card status is normal;
[0091] S204: Enter different processes according to the network connection status of the network card;
[0092] S205: When the network connection on the network card is disconnected, determine whether to continue to perform the bond operation;
[0093] S206: When the network connection of the network card is normal, the network card sends a bond request message to the switch, which carries the bond type, port MAC address and other configuration parameters;
[0094] S207: The switch receives the request message, parses the request message, and retrieves the corresponding information;
[0095] S208: Check the corresponding connection port according to the obtained port MAC;
[0096] S209: The switch configures the corresponding connection port according to the bond type;
[0097] S210: The switch returns a response message of the local operation to the network card, which may be a success message or a failure message. The failure message carries the failure reason.
[0098] S211: The network card parses the response message to determine whether the execution is successful;
[0099] S212: The network card performs a binding operation on the target port and checks the binding port status;
[0100] S213: The binding operation is completed, the execution result is prompted, and a log is recorded.
[0101] It can be seen that the automatic binding tool is used to unify and simplify the configuration process of network cards and switches. This automated method reduces the complexity of manual configuration and reduces the risk of human error. Administrators can use automated tools to batch configure network card binding and switch port channels to ensure configuration consistency and accuracy. In addition, the automatic binding method checks the status of network cards and switches during the binding process and quickly detects abnormalities in network connections or ports. Rapid screening of corresponding line abnormalities or port abnormalities improves the efficiency of fault location.
[0102] The present application embodiment discloses a specific network card automatic binding method, which is applied to a switch, see Figure 3 As shown, the method may include the following steps:
[0103] Step S31: Obtain a configuration request sent by a host; the host is used to obtain a network card binding configuration; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards; determine the corresponding target physical network card according to the physical network card port information; generate the configuration request according to the working mode information and the interface address of the target physical network card; configure the target physical network card according to the working mode information to bind all the target physical network cards.
[0104] The host is also used to obtain a network card binding instruction, and display a network configuration interface on a human-computer interaction interface according to the network card binding instruction; and obtain the network card binding configuration through the network configuration interface.
[0105] The above-mentioned configuring the target physical network card according to the working mode information includes: generating a corresponding configuration file according to the working mode information; and applying the configuration file to the target physical network card.
[0106] The switch is also used to determine whether the target physical network cards are all connected to the local switch according to the interface addresses of the target physical network cards; if all the target physical network cards are connected to the local switch, the switch determines the target port corresponding to the interface address of the target physical network card on the switch. If there is a target physical network card that is not connected to the local switch, a binding failure prompt including an abnormal connection between the network card and the switch is generated.
[0107] Step S32: Determine the target port on the switch corresponding to the interface address of the target physical network card, and set the target port to a corresponding port aggregation state according to the working mode information.
[0108] After the switch sets the port aggregation state for the target port according to the working mode information, the switch obtains the port configuration result by reading the current port aggregation state of the target port; the port configuration result is sent to the host for the host to analyze; if the port configuration result is successful, the operation of configuring the target physical network card according to the working mode information is performed; if the port configuration result is unsuccessful, a prompt of unsuccessful port configuration is generated.
[0109] The host is also used to check the connection status of the target physical network card before generating a configuration request according to the working mode information and the interface address of the target physical network card; the connection status includes a normal network connection status and a disconnected network connection status; if the connection status of the target physical network card is the normal network connection status, the operation of generating a configuration request according to the working mode information and the interface address of the target physical network card is executed; if the connection status of the target physical network card is the disconnected network connection status, an abnormal status prompt is generated, and an instruction selection interface is displayed on a human-computer interaction interface; through the instruction selection interface, a response instruction sent by the user according to the abnormal status prompt is received; the response instruction includes a first instruction and a second instruction, the first instruction is used to instruct the termination of the binding operation, and the second instruction is used to instruct the continuation of the binding operation; if the response instruction is the first instruction, the network card binding operation is exited; if the response instruction is the second instruction, the operation of configuring the target physical network card according to the working mode information is directly executed.
[0110] As can be seen from the above, in this embodiment, a network card binding configuration is obtained; the network card binding configuration includes working mode information, and physical network card port information of at least two physical network cards; the corresponding target physical network card is determined according to the physical network card port information; a configuration request is generated according to the working mode information and the interface address of the target physical network card, and the configuration request is sent to the switch, the switch determines the target port corresponding to the interface address of the target physical network card on the switch, and sets the target port to the corresponding port aggregation state according to the working mode information; the target physical network card is configured according to the working mode information to bind all the target physical network cards. It can be seen that by configuring the working mode information and the port information of the physical network card to be bound to the network card, a configuration request is automatically generated and sent to the switch. The switch determines the target port to be bound according to the received configuration request, and sets the port aggregation state of the target port according to the working mode information to realize the port binding on the switch side. The host side then configures the target physical network card according to the working mode information to realize the physical network card binding, thereby realizing the automatic binding of the network card side and the switch side ports without manual operation, thereby improving the efficiency and accuracy of the network card binding. In addition, by executing the switch port binding first and then executing the network card binding, the problem of meaningless network card binding and waste of resources when the switch port cannot be successfully bound is avoided.
[0111] Correspondingly, the embodiment of the present application further discloses a network card automatic binding device, which is applied to a host. Referring to FIG. 4 , the device includes:
[0112] The network card binding configuration acquisition module 11 is used to acquire the network card binding configuration; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards;
[0113] A target physical network card determination module 12 is used to determine a corresponding target physical network card according to the physical network card port information;
[0114] A configuration request sending module 13, configured to generate a configuration request according to the working mode information and the interface address of the target physical network card, and send the configuration request to the switch, the switch determines the target port corresponding to the interface address of the target physical network card on the switch, and sets the target port to a corresponding port aggregation state according to the working mode information;
[0115] The network card binding module 14 is used to configure the target physical network cards according to the working mode information to bind all the target physical network cards.
[0116] As can be seen from the above, in this embodiment, a network card binding configuration is obtained; the network card binding configuration includes working mode information, and physical network card port information of at least two physical network cards; the corresponding target physical network card is determined according to the physical network card port information; a configuration request is generated according to the working mode information and the interface address of the target physical network card, and the configuration request is sent to the switch, the switch determines the target port corresponding to the interface address of the target physical network card on the switch, and sets the target port to the corresponding port aggregation state according to the working mode information; the target physical network card is configured according to the working mode information to bind all the target physical network cards. It can be seen that by configuring the working mode information and the port information of the physical network card to be bound to the network card, a configuration request is automatically generated and sent to the switch. The switch determines the target port to be bound according to the received configuration request, and sets the port aggregation state of the target port according to the working mode information to realize the port binding on the switch side. The host side then configures the target physical network card according to the working mode information to realize the physical network card binding, thereby realizing the automatic binding of the network card side and the switch side ports without manual operation, thereby improving the efficiency and accuracy of the network card binding. In addition, by executing the switch port binding first and then executing the network card binding, the problem of meaningless network card binding and waste of resources when the switch port cannot be successfully bound is avoided.
[0117] In some specific embodiments, the network card binding configuration acquisition module 11 may specifically include:
[0118] A network card binding instruction acquisition unit, used to acquire a network card binding instruction, and display a network configuration interface on a human-computer interaction interface according to the network card binding instruction;
[0119] A network card binding configuration acquiring unit is used to acquire the network card binding configuration through the network configuration interface.
[0120] In some specific embodiments, the network card binding module 14 may specifically include:
[0121] A configuration file generating unit, used to generate a corresponding configuration file according to the working mode information;
[0122] The configuration file validation unit is used to apply the configuration file to the target physical network card.
[0123] In some specific embodiments, the switch can be specifically used to determine whether the target physical network cards are all connected to the local switch based on the interface addresses of the target physical network cards before the switch determines the target port on the switch corresponding to the interface address of the target physical network card; if all the target physical network cards are connected to the local switch, the switch determines the target port on the switch corresponding to the interface address of the target physical network card; if there is a target physical network card that is not connected to the local switch, a binding failure prompt is generated including an abnormal connection between the network card and the switch.
[0124] In some specific embodiments, the network card automatic binding device may specifically include:
[0125] A port configuration result acquisition unit, used to acquire the port configuration result sent by the switch before configuring the target physical network card according to the working mode information; the port configuration result is obtained by reading the current port aggregation state of the target port after the switch sets the port aggregation state for the target port according to the working mode information;
[0126] An execution unit, configured to execute the operation of configuring the target physical network card according to the working mode information if the port configuration result is a successful configuration;
[0127] The prompt unit is used to generate a prompt indicating that the port configuration is not successful if the port configuration result is not successful.
[0128] In some specific embodiments, the network card automatic binding device may specifically include:
[0129] A connection status detection unit, used for checking the connection status of the target physical network card before generating a configuration request according to the working mode information and the interface address of the target physical network card; the connection status includes a normal network connection status and a disconnected network connection status;
[0130] an execution unit, configured to execute the operation of generating a configuration request according to the working mode information and the interface address of the target physical network card if the connection state of the target physical network card is the normal network connection state;
[0131] an abnormal prompt unit, configured to generate an abnormal status prompt if the connection status of the target physical network card is the network disconnected status, and display an instruction selection interface on a human-computer interaction interface;
[0132] A response instruction acquisition unit, used to receive a response instruction sent by a user according to the abnormal status prompt through the instruction selection interface; the response instruction includes a first instruction and a second instruction, the first instruction is used to instruct to terminate the binding operation, and the second instruction is used to instruct to continue the binding operation;
[0133] A binding exit unit, configured to exit the network card binding operation if the response instruction is the first instruction;
[0134] A binding execution unit is used to directly execute the operation of configuring the target physical network card according to the working mode information if the response instruction is the second instruction.
[0135] Correspondingly, the embodiment of the present application also discloses a network card automatic binding device, which is applied to a switch, and the device includes: a configuration request acquisition module, which is used to acquire a configuration request sent by a host; the host is used to acquire a network card binding configuration; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards; the corresponding target physical network card is determined according to the physical network card port information; the configuration request is generated according to the working mode information and the interface address of the target physical network card; the target physical network card is configured according to the working mode information to bind all the target physical network cards;
[0136] The port configuration module is used to determine the target port corresponding to the interface address of the target physical network card on the switch, and set the target port to the corresponding port aggregation state according to the working mode information.
[0137] Furthermore, an embodiment of the present application also discloses an electronic device, as shown in FIG5 . The content in the figure cannot be regarded as any limitation on the scope of use of the present application.
[0138] FIG5 is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the network card automatic binding method disclosed in any of the aforementioned embodiments.
[0139] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0140] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222, and data 223 including working mode information, etc. The storage method can be temporary storage or permanent storage.
[0141] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the network card automatic binding method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0142] Furthermore, an embodiment of the present application also discloses a computer storage medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, the steps of the network card automatic binding method disclosed in any of the aforementioned embodiments are implemented.
[0143] Furthermore, an embodiment of the present application also discloses a computer program product, in which a computer program is stored. When the computer program is loaded and executed by a processor, the steps of the automatic network card binding method disclosed in any of the aforementioned embodiments are implemented.
[0144] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0145] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0146] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0147] The above is a detailed introduction to the network card automatic binding method, device, equipment, medium and program product provided by the present invention. Specific examples are used in this article to illustrate the principle and implementation method of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A network card automatic binding method, characterized in that: Applied to the host, including: Obtaining a network card binding configuration; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards; Determine the corresponding target physical network card according to the physical network card port information; Generate a configuration request according to the working mode information and the interface address of the target physical network card, send the configuration request to the switch, the switch determines the target port corresponding to the interface address of the target physical network card on the switch, and sets the target port to a corresponding port aggregation state according to the working mode information; The target physical network cards are configured according to the working mode information to bind all the target physical network cards.
2. The network card automatic binding method according to claim 1, characterized in that: The obtaining of the network card binding configuration includes: Obtain a network card binding instruction, and display a network configuration interface on a human-computer interaction interface according to the network card binding instruction; The network card binding configuration is obtained through the network configuration interface.
3. The network card automatic binding method according to claim 1, characterized in that: The configuring the target physical network card according to the working mode information includes: Generate a corresponding configuration file according to the working mode information; Apply the configuration file to the target physical network card.
4. The network card automatic binding method according to claim 1, characterized in that: Before the switch determines the interface address of the target physical network card corresponding to the target port on the switch, the method further includes: The switch determines whether all the target physical network cards are connected to the local switch according to the interface address of the target physical network card; If all the target physical network cards are connected to the local switch, the switch determines the target port corresponding to the interface address of the target physical network card on the switch.
5. The method for automatic network card binding according to claim 4, characterized in that: After determining whether the target physical network cards are all connected to the local switch, the method further includes: If the target physical network card is not connected to the local switch, a binding failure prompt including abnormal connection between the network card and the switch is generated.
6. The network card automatic binding method according to claim 1, characterized in that: Before configuring the target physical network card according to the working mode information, the method further includes: Acquire the port configuration result sent by the switch; the port configuration result is obtained by reading the current port aggregation state of the target port after the switch sets the port aggregation state for the target port according to the working mode information; If the port configuration result is successful, the operation of configuring the target physical network card according to the working mode information is performed.
7. The method for automatic network card binding according to claim 6, characterized in that: After obtaining the port configuration result sent by the switch, the method further includes: If the port configuration result is unsuccessful configuration, a prompt indicating that the port configuration is unsuccessful is generated, and the operation of configuring the target physical network card according to the working mode information is not performed.
8. The network card automatic binding method according to claim 1, characterized in that: The working mode information includes information of any one of the following working modes: polling balancing mode, active-standby mode, balancing mode based on hash, broadcast mode, dynamic link aggregation mode, sending load balancing mode, and sending-receiving load balancing mode; The port aggregation status is static physical port group, dynamic physical port group, or no physical port group is configured.
9. The network card automatic binding method according to any one of claims 1 to 8, characterized in that: Before generating a configuration request according to the working mode information and the interface address of the target physical network card, the method further includes: Checking the connection status of the target physical network card; the connection status includes a normal network connection status and a disconnected network connection status; If the connection state of the target physical network card is the normal network connection state, the operation of generating a configuration request according to the working mode information and the interface address of the target physical network card is performed; If the connection state of the target physical network card is the network disconnection state, a status abnormality prompt is generated, and a command selection interface is displayed on the human-computer interaction interface; Receiving, through the instruction selection interface, a response instruction sent by the user according to the abnormal status prompt; the response instruction includes a first instruction and a second instruction, the first instruction is used to instruct to terminate the binding operation, and the second instruction is used to instruct to continue the binding operation; If the response instruction is the first instruction, exit the network card binding operation; If the response instruction is the second instruction, the operation of configuring the target physical network card according to the working mode information is directly executed.
10. A network card automatic binding method, characterized in that: Applicable to switches, including: Obtaining a configuration request sent by a host; the host is used to obtain a network card binding configuration; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards; determining a corresponding target physical network card according to the physical network card port information; generating the configuration request according to the working mode information and the interface address of the target physical network card; configuring the target physical network card according to the working mode information to bind all the target physical network cards; The target port corresponding to the interface address of the target physical network card on the switch is determined, and the target port is set to a corresponding port aggregation state according to the working mode information.
11. A network card automatic binding device, characterized in that: Applied to the host, including: A network card binding configuration acquisition module, used to acquire a network card binding configuration; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards; A target physical network card determination module, used to determine the corresponding target physical network card according to the physical network card port information; a configuration request sending module, configured to generate a configuration request according to the working mode information and the interface address of the target physical network card, and send the configuration request to the switch, wherein the switch determines the target port corresponding to the interface address of the target physical network card on the switch, and sets the target port to a corresponding port aggregation state according to the working mode information; The network card binding module is used to configure the target physical network card according to the working mode information to bind all the target physical network cards.
12. A network card automatic binding device, characterized in that: Applicable to switches, including: A configuration request acquisition module, used to acquire a configuration request sent by a host; the host is used to acquire a network card binding configuration; the network card binding configuration includes working mode information and physical network card port information of at least two physical network cards; a corresponding target physical network card is determined according to the physical network card port information; the configuration request is generated according to the working mode information and the interface address of the target physical network card; the target physical network card is configured according to the working mode information to bind all the target physical network cards; The port configuration module is used to determine the target port corresponding to the interface address of the target physical network card on the switch, and set the target port to the corresponding port aggregation state according to the working mode information.
13. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the network card automatic binding method according to any one of claims 1 to 9, or the network card automatic binding method according to claim 10.
14. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein when the computer program is executed by a processor, the network card automatic binding method according to any one of claims 1 to 9 or the network card automatic binding method according to claim 10 is implemented.
15. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a processor, implements the network card automatic binding method according to any one of claims 1 to 9, or the network card automatic binding method according to claim 10.
Citation Information
Patent Citations
Method, network card and communication system for binding physical internet ports
CN102137169A
Network interface card binding method and device
CN106209449A
Cloud physical host network card binding configuration method and system based on OpenStack platform
CN112436966A
Network card configuration method and device and computer storage medium
CN112448839A
Method, device and equipment for determining configuration information
CN114189443A
Cited By
Secret-related switch port communication processing method and device, secret-related switch and system
CN119996077A