A redundant network intelligent switching method

By adding active redundant code blocks to the network card driver, intelligent switching of redundant networks is achieved, and the problem of single switching conditions, insufficient flexibility and control in the existing technology is solved, and more flexible and efficient network switching is achieved.

CN118869580BActive Publication Date: 2025-02-25CHANGSHA XIANGJI HAIDUN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411348571.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2025-02-25
Estimated Expiration
2044-09-26

AI Technical Summary

Technical Problem

The existing redundant network technology has single switching conditions, insufficient flexibility and control, and cannot meet the switching needs under special conditions.

Method used

By adding active redundant code blocks to the interrupt function driven by the network card, combined with the application, intelligent switching of the redundant network is achieved. The specific steps include selecting the Ethernet interface driven by the same network card, binding to form a redundant network channel, monitoring the number of data packets, and automatically switching to another communication link when the preset conditions are met.

Benefits of technology

It realizes intelligent switching of redundant networks, supports customized switching conditions, expands application scenarios, improves network flexibility and control, has a simple structure and low cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118869580B_ABST
    Figure CN118869580B_ABST
Patent Text Reader

Abstract

The present invention discloses a redundant network intelligent switching method, comprising: selecting any two Ethernet interfaces of the same network card driver, and binding the corresponding communication links to form a redundant network channel; a data packet reaches the physical layer through any Ethernet interface and the corresponding communication link, and an interrupt signal is generated when the physical layer receives a complete data packet; an interrupt function in the network card driver responds to the interrupt signal, and encapsulates and stores the data packet and related information; at the same time, the driver can automatically identify the redundant network configured in the upper layer, and can classify and count all data frames passing through the redundant network; when it is monitored that the number of data packets of the current communication link meets the set active redundant switching condition, the driver in the kernel state sends a redundant network channel switching signal to the system application layer; the system application layer verifies and judges the switching condition, and then switches to another communication link. The flexibility and controllability of the redundant network are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of redundant network control, and in particular to a redundant network intelligent switching method. Background Art

[0002] Redundant network means manually setting up a virtual IP address between the main router and the slave router. When the main router fails and cannot communicate, this virtual IP address will be mapped to the backup router for automatic switching, so as to quickly restore communication and avoid data loss and service interruption in some application scenarios caused by network failure. Therefore, redundant network is an effective way to improve network reliability.

[0003] With the continuous development of network technology applications, modern equipment has higher and higher requirements for network reliability. At present, the traditional technology in the industry mainly realizes network redundancy by configuring redundant networks and introducing multiple paths to increase multiple network connections. However, the switching condition of this method is that the main router will only switch passively due to failures such as network cable damage. It is limited to the conditions of fault damage, cannot meet the switching requirements of customized conditions, and has poor flexibility and controllability. Summary of the invention

[0004] In order to solve the current technical problems of single network switching conditions and insufficient flexibility and controllability of redundant networks, the present invention provides a redundant network intelligent switching method, which can effectively expand its application scenarios.

[0005] The present invention provides a redundant network intelligent switching method, comprising:

[0006] S1: Select any two Ethernet interfaces of the same network card driver, and bind their corresponding communication links through manual configuration to form a redundant network channel; wherein one of the two communication links is a first communication link, and the other is a second communication link;

[0007] S2: The network data frame reaches the physical layer through any Ethernet interface and the corresponding communication link. When the physical layer receives a complete data packet, an interrupt signal is generated;

[0008] S3: The interrupt function in the network card driver responds to the interrupt signal and encapsulates the data packet and related information into a unified data format and stores it in the kernel buffer. At the same time, the network card driver classifies and counts all data packets of the redundant network according to the Ethernet frame header information.

[0009] S4: When it is detected that the number of data packets of the current communication link in the redundant network channel meets the active redundant switching condition set in the interrupt function, the driver in the kernel state sends a redundant network channel switching signal to the specified process of the system application layer;

[0010] S5: After receiving the signal, the system application layer checks and judges the switching conditions, and switches to another communication link when the preset check and judgment conditions are met.

[0011] Furthermore, the network card is a domestically produced wx1860 network card chip.

[0012] Furthermore, the unified data format in S3 is the sk_buff structure; wherein the sk_buff structure is allocated to the message queue of the corresponding channel according to the Ethernet interface for storage management; and then the sk_buff structure is taken out from the message receiving queue in sequence, and the data packet is parsed layer by layer through the protocol stack and passed to the application layer.

[0013] Furthermore, the active redundant switching condition is that the current communication link receives greater than or equal to 20 data packets.

[0014] Furthermore, the specific process of the interrupt function in the network card driver in S3 responding to the interrupt signal is:

[0015] S31: Determine whether the two target Ethernet interfaces are configured with redundant binding: if so, proceed to S32; if not, end directly;

[0016] S32: The classification processing function performs classification processing and statistics according to the destination physical address in the Ethernet frame header of the transmission data packet, and outputs a corresponding return value;

[0017] S33: Select a structure code segment to execute a corresponding program according to the return value.

[0018] Furthermore, the specific judgment criteria for binding the redundant networks in S31 include:

[0019] The two Ethernet interfaces are the target Ethernet interfaces to be bound; and the physical addresses of the two Ethernet interfaces are the same.

[0020] Furthermore, the specific process of S32 is:

[0021] If the receiving end physical address of the data packet indicates that the data packet is a broadcast packet, it returns 0 directly;

[0022] If the physical address of the receiving end of the data packet is exactly the same as the physical address of the first communication link or the second communication link channel, then the value of the corresponding channel variable of the data packet passing through the two Ethernet interfaces is increased by 1; if it is the Ethernet interface corresponding to the first communication link, the return value is 3; if it is the Ethernet interface corresponding to the second communication link, the return value is 4;

[0023] If the receiving end physical address of the data packet indicates that the data packet is unicast or multicast, the value of the channel variable corresponding to the Ethernet interface through which the data packet is transmitted is incremented by 1; if it is the Ethernet interface corresponding to the first communication link, the return value is 3; if it is the Ethernet interface corresponding to the second communication link, the return value is 4;

[0024] If the receiving end physical address of the data packet indicates that the data packet is another packet, the return value is 0.

[0025] Furthermore, the specific process of S33 is:

[0026] If the return value is 0, break directly out of the switch statement;

[0027] If the return value is 3, determine whether the first communication link is in a connected state: if not, end directly; if so, enter S4;

[0028] If the return value is 4, determine whether the second communication link is in a connected state: if not, end directly; if so, enter S4;

[0029] If it is any other case, break out of the switch statement directly.

[0030] Furthermore, the inspection and judgment conditions preset in S5 are specifically:

[0031] S51: Determine whether the two Ethernet interfaces have been bound to redundant network channels: if so, proceed to S52; if not, directly end;

[0032] S52: Determine whether the bound redundant network channel has an IP address: if not, then end directly; if yes, then determine whether the IP address is valid: if valid, then enter S53; if not, then end directly;

[0033] S53: Determine whether the current communication link is consistent with the communication link of the required switching signal. At this time, the application needs to send a structure from the user layer to the driver through IOCTL, and the driver will write the channel to be switched into the structure: if they are consistent, it will end directly; if they are inconsistent, the communication link will be switched.

[0034] The present invention proposes a redundant network intelligent switching method. The method realizes the intelligent switching of redundant networks according to user needs by adding an active redundant code block in a driver interrupt function and carrying an application program coordinated therewith. The method effectively solves the embarrassing situation that the redundant network cannot be switched under special conditions, supports customized switching conditions, further expands the application scenarios, and improves the flexibility and controllability of the redundant network. The method has a simple structure and meets the user's needs for redundant networks in different scenarios at a relatively low cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] 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 some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0036] Figure 1 is a flow chart of intelligent switching of redundant networks provided by an embodiment of the present invention;

[0037] Figure 2 The present invention provides a flowchart of active redundant code blocks in an interrupt function of a driver program. DETAILED DESCRIPTION

[0038] To make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other implementation methods obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.

[0039] Example 1

[0040] like Figure 1 As shown, this embodiment provides a redundant network intelligent switching method, including:

[0041] S1: Select any two Ethernet interfaces of the same network card driver, and bind their corresponding communication links through manual configuration to form a redundant network channel; wherein, one of the two communication links is the first communication link, and the other is the second communication link. In specific implementation, the network card chip can be adjusted according to actual conditions and is not limited. This embodiment adds an active redundant switching code block based on the domestic wx1860 network card chip driver to realize the function of intelligent switching of redundant networks.

[0042] eth1, eth2, eth3, ..., ethN correspond to the Ethernet interfaces on the N routers, and each Ethernet interface corresponds to its own communication link. In this embodiment, the communication link 3 and the communication link 4 of the N communication links are randomly selected and bound together to form a redundant network channel through manual configuration. This embodiment takes the redundant network channel bound by the communication link 3 and the communication link 4 as an example for detailed explanation.

[0043] eth3 and eth4 are manually bound under the system and a virtual IP address is configured. Data packets can be transmitted through the virtual IP address. The router through which the data packet passes is set as the main router, and the router through which the data packet passes is set as the slave router. The virtual IP address is a network address that is not a static IP address assigned to the physical network interface, but a dynamic address that can be shared and drifted between different routers. The virtual IP address is shared between routers, one of which is designated as the main router and the other as the backup router. If the main router is unavailable, the virtual IP will be mapped to the backup router for communication.

[0044] S2: The network data frame reaches the physical layer through any Ethernet interface and the corresponding communication link. When the physical layer receives a complete data packet, an interrupt signal is generated.

[0045] PHY_1, PHY_2, PHY_3, ..., PHY_N correspond to the port physical layers of N Ethernet interfaces. The network data frame reaches the physical layer through eth3 and communication link 3. When PHY_3 receives a complete data packet (the data packet consists of a network data frame), an interrupt signal is generated.

[0046] S3: The interrupt function in the network card driver responds to the interrupt signal and encapsulates the data packet and related information into a unified data format and stores it in the kernel state buffer; at the same time, the network card driver adds the function of automatically identifying redundant networks, that is, it can classify and count all data packets passing through the redundant network according to the Ethernet frame header information.

[0047] Specifically, the interrupt function in the network card driver immediately responds to the interrupt signal; at the same time, the interrupt function encapsulates the received data packets and related information into a unified data format (sk_buff structure in this embodiment) and stores them in the kernel buffer, and distributes them to the message queue of the corresponding channel, and then transmits them to the user layer along the protocol stack; in addition, the network card driver classifies and counts all data packets of the redundant network according to the Ethernet frame header information. Among them, the sk_buff structure is allocated to the corresponding message queue according to the Ethernet interface for storage management; the sk_buff structure is taken out from the message queue in turn, and the data packet is parsed layer by layer through the protocol stack and passed to the Linux socket.

[0048] More specifically, the sk_buff structure is a key structure for data transmission at each layer in the network system. The storage space of the sk_buff structure is divided into three parts: header space, data packet, and tail space. The header space includes the TCP header, IP header, and Ethernet frame header. The Ethernet frame header includes the destination MAC address (i.e., the physical address of the receiving end), the source MAC address (i.e., the physical address of the sending end), and the type (i.e., the protocol type). The required information can be obtained by parsing the Ethernet frame header.

[0049] In specific implementation, when the physical layer PHY-3 receives a data packet, the received data is converted into the data type of the sk_buff structure in the interrupt function and passed to the lower layer, and then each layer strips different protocol headers from the sk_buff structure until it is handed over to the user. Linux socket is a socket communication under the Linux system, providing an application interface. Users can use the application interface to create, bind, connect, monitor, and send / receive data in user mode.

[0050] Specifically, Figure 2 As shown in the figure, the specific process of the interrupt function in the network card driver responding to the interrupt signal is:

[0051] S31: Determine whether the two Ethernet interfaces are configured with redundant binding: if so, proceed to S32; if not, end directly;

[0052] The specific criteria for determining whether to bind redundant networks include:

[0053] The two Ethernet interfaces are the target Ethernet interfaces for binding; and the physical addresses of the two target Ethernet interfaces are consistent. For example, if the two target Ethernet interfaces to be bound into a redundant network channel are eth3 and eth4, first determine whether the two Ethernet interfaces are eth3 and eth4, and then determine whether the physical addresses of the two Ethernet interfaces (eth3 and eth4) are consistent. If both of these judgment conditions are met, it means that the redundant network binding is successful.

[0054] S32: The classification processing function performs classification processing and statistics according to the destination physical address in the Ethernet frame header of the transmission data packet, and outputs a corresponding return value;

[0055] If the receiving end physical address of the data packet indicates that the data packet is a broadcast packet, it returns 0 directly;

[0056] If the physical address of the receiving end of the data packet is exactly the same as the physical address of the first communication link or the second communication link channel, then the value of the corresponding channel variable of the data packet passing through the two Ethernet interfaces is increased by 1; if it is the Ethernet interface corresponding to the first communication link, the return value is 3; if it is the Ethernet interface corresponding to the second communication link, the return value is 4;

[0057] If the receiving end physical address of the data packet indicates that the data packet is unicast or multicast, the value of the channel variable corresponding to the Ethernet interface through which the data packet is transmitted is incremented by 1; if it is the Ethernet interface corresponding to the first communication link, the return value is 3; if it is the Ethernet interface corresponding to the second communication link, the return value is 4;

[0058] If the receiving end physical address of the data packet indicates that the data packet is another packet, the return value is 0.

[0059] Among them, broadcast packets are one-to-many communication methods, and their data packets are sent to all devices on the network (PHY-1, PHY-2, ..., PHY-N); unicast refers to a one-to-one communication mode between hosts; multicast refers to a one-to-many communication mode between hosts, and unlike broadcast packets, data packets are only sent to devices in a specific group. Specifically, broadcast packets, unicast, and multicast are determined based on the mac address: a mac address of hexadecimal FF-FF-FF-FF-FF-FF is a broadcast packet; a mac address with the lowest binary digit of the first byte being 0 is a unicast address; a mac address with the lowest binary digit of the first byte being 1 is a multicast address.

[0060] More specifically, the operation of adding 1 to the value of the corresponding communication link variable is to count the data packets transmitted in order to prepare for the subsequent active redundant switching condition.

[0061] More specifically, the classification processing function prints the data packet type, MAC address, transmission channel name and numerical information of the corresponding channel variable according to different situations, which is convenient for software debugging and information confirmation.

[0062] S33: Select the structure code segment and execute the corresponding program according to the return value. The specific process is as follows:

[0063] If the return value is 0, break out of the switch statement directly;

[0064] If the return value is 3, determine whether the first communication link is in a connected state: if not, end directly; if so, enter S4;

[0065] If the return value is 4, determine whether the second communication link is in a connected state. If not, end directly; if yes, enter S4;

[0066] If it is any other case, break out of the switch statement directly.

[0067] S4: When it is detected that the number of data packets of the current communication link in the redundant network channel meets the active redundant switching condition set in the interrupt function, the driver in the kernel state sends a redundant network channel switching signal to the specified process of the system application layer. The active redundancy conditions can be customized and modified according to the needs of the user's actual application scenario, and are not limited to them. For example, according to the number of communication link data packets received, special packets can also be screened out according to the information of the Ethernet frame header for active redundant switching. In this embodiment, the active redundant switching condition is that the current communication link receives more than or equal to 20 data packets. The redundant network intelligent switching function supports two modes: active redundant switching and passive redundant switching. The active redundant switching depends on customized switching conditions. The passive redundant switching performs active-standby switching based on channel failure or damage. The redundant active switching function increases the switching flexibility without destroying the original redundant passive switching.

[0068] In specific implementation, when the number of data packets detected in the redundant network channel of the current communication link meets the active redundant switching condition set in the interrupt function, the kernel state sends a switching signal to the user state through the send_sig function. The user state captures the switching signal through the sigaction function. Then the system interface is called to use the "ifenslave –c bond0eth3 / eth4" command to perform active redundant switching.

[0069] S5: After receiving the signal, the system application layer checks and judges the switching conditions, and switches to another communication link when the preset check and judgment conditions are met.

[0070] Specifically, the preset inspection and judgment conditions are:

[0071] S51: Determine whether the two Ethernet interfaces have been bound to redundant network channels: if so, proceed to S52; if not, directly end;

[0072] S52: Determine whether the bound redundant network channel has an IP address: if not, then end directly; if yes, then determine whether the IP address is valid: if valid, then enter S53; if not, then end directly;

[0073] S53: Determine whether the current communication link is consistent with the communication link of the required switching signal. At this time, the application needs to send a structure from the user layer to the driver through IOCTL, and the driver will write the channel to be switched into the structure: if they are consistent, it ends directly; if they are inconsistent, the communication link is switched.

[0074] During specific implementation, after the system application layer receives the signal, it checks that the two Ethernet interfaces eth3 and eth4 have bound redundant network channels, and the bound redundant network channels have IP addresses, and the IP addresses are valid. The current active link is communication link 3, then it switches from communication link 3 to communication link 4.

[0075] It should be understood that in the embodiments of the present invention, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the type of device.

[0076] The readable storage medium is a computer-readable storage medium, which may be an internal storage unit of the controller described in any of the foregoing embodiments, such as a hard disk or memory of the controller. The readable storage medium may also be an external storage device of the controller, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the controller. Furthermore, the readable storage medium may also include both an internal storage unit of the controller and an external storage device. The readable storage medium is used to store the computer program and other programs and data required by the controller. The readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0077] Based on this understanding, the technical solution of the present invention, in essence or in other words, the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned readable storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., various media that can store program codes.

[0078] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.

[0079] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

Claims

1. A redundant network intelligent switching method, characterized in that: include: S1: Select the Ethernet interfaces on any two routers driven by the same network card, and bind their corresponding communication links through manual configuration to form a redundant network channel; wherein one of the two communication links is a first communication link, and the other is a second communication link; S2: The network data frame reaches the physical layer through any Ethernet interface and the corresponding communication link. When the physical layer receives a complete data packet, an interrupt signal is generated; S3: The interrupt function in the network card driver responds to the interrupt signal and encapsulates the data packet and related information into a unified data format and stores it in the kernel buffer. At the same time, the network card driver classifies and counts all data packets of the redundant network according to the Ethernet frame header information. S4: When it is detected that the number of data packets of the current communication link in the redundant network channel meets the active redundant switching condition set in the interrupt function, the driver in the kernel state sends a redundant network channel switching signal to the specified process of the system application layer; S5: After receiving the signal, the system application layer checks and judges the switching conditions, and switches to another communication link when the preset checking and judging conditions are met; Among them, the specific process of the interrupt function in the network card driver in S3 responding to the interrupt signal is: S31: Determine whether the two Ethernet interfaces are configured with redundant binding: if so, proceed to S32; if not, end directly; S32: The classification processing function performs classification processing and statistics according to the destination physical address in the Ethernet frame header of the transmission data packet, and outputs the corresponding return value. The specific process is as follows: If the receiving end physical address of the data packet indicates that the data packet is a broadcast packet, it returns 0 directly; If the physical address of the receiving end of the data packet is exactly the same as the physical address of the first communication link or the second communication link channel, then the value of the corresponding channel variable of the Ethernet interface through which the data packet is transmitted is increased by 1; if it is the Ethernet interface corresponding to the first communication link, the return value is 3; if it is the Ethernet interface corresponding to the second communication link, the return value is 4; If the receiving end physical address of the data packet indicates that the data packet is unicast or multicast, then the value of the corresponding channel variable of the Ethernet interface through which the data packet is transmitted is increased by 1; if it is the Ethernet interface corresponding to the first communication link, the return value is 3; if it is the Ethernet interface corresponding to the second communication link, the return value is 4; If the receiving end physical address of the data packet indicates that the data packet is other packet, the return value is 0; S33: Select the structure code segment and execute the corresponding program according to the return value. The specific process is as follows: If the return value is 0, break out of the switch statement directly; If the return value is 3, determine whether the first communication link is in a connected state: if not, end directly; if so, enter S4; If the return value is 4, determine whether the second communication link is in a connected state: if not, end directly; if so, enter S4; If it is any other case, break out of the switch statement directly.

2. The redundant network intelligent switching method according to claim 1, characterized in that: The network card is a domestically produced wx1860 network card chip.

3. The redundant network intelligent switching method according to claim 1, characterized in that: The unified data format in S3 is the sk_buff structure; the sk_buff structure is allocated to the message queue of the corresponding channel according to the Ethernet interface for storage management; then the sk_buff structure is taken out from the message queue in sequence, and the data packet is parsed layer by layer through the protocol stack and passed to the application layer.

4. The redundant network intelligent switching method according to claim 1, characterized in that: The active redundant switching condition is that the current communication link receives more than or equal to 20 data packets.

5. The redundant network intelligent switching method according to claim 1, characterized in that: The specific criteria for binding redundant networks in S31 include: The two Ethernet interfaces are the target Ethernet interfaces for bonding; and the physical addresses of the two Ethernet interfaces are the same.

6. The redundant network intelligent switching method according to claim 1, characterized in that: The inspection and judgment conditions preset in S5 are specifically: S51: Determine whether the two Ethernet interfaces have been bound to redundant network channels: if so, proceed to S52; if not, directly end; S52: Determine whether the bound redundant network channel has an IP address: if not, then end directly; if yes, then determine whether the IP address is valid: if valid, then enter S53; if not, then end directly; S53: Determine whether the current communication link is consistent with the communication link of the required switching signal. At this time, the application needs to send a structure from the user layer to the network card driver through IOCTL. The network card driver will write the channel to be switched into the structure. If they are consistent, the process ends directly. If they are inconsistent, the communication link is switched.

Citation Information

Patent Citations

  • Data flow transmission method and related equipment and system

    CN102215530A

  • Multi-channel network switching method and system

    CN106612233A