Communication switching method, gateway device, terminal device, and readable storage medium

By establishing a multi-SIM card tunnel sharing the same IP address in industrial CPE devices and performing tunnel switching, the problems of high network switching latency and signaling storms are solved, achieving low-latency and high-reliability network switching and meeting the stringent requirements of industrial CPE devices.

CN122349138APending Publication Date: 2026-07-07FIBOCOM WIRELESS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610722906.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-22
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Existing network switching technologies cannot meet the ultra-high reliability requirements of industrial CPE devices, resulting in large network switching latency, frequent switching causing signaling storms and loss of industrial protocol status.

Method used

By establishing a first tunnel and a second tunnel sharing the same IP with the first SIM card and the second SIM card in the terminal device, and distinguishing between the primary tunnel and the backup tunnel, the forwarding of active data streams is switched to the backup tunnel after receiving a tunnel switching request, and the data stream is transmitted using the backup tunnel, thus avoiding IP replacement and session reconstruction.

Benefits of technology

It reduces network switching latency, minimizes service interruptions, ensures high reliability and continuity of industrial CPE equipment, and meets the latency requirements of Industry 4.0 scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122349138A_ABST
    Figure CN122349138A_ABST
Patent Text Reader

Abstract

This application discloses a communication handover method, a gateway device, a terminal device, and a readable storage medium. In this method, a first tunnel and a second tunnel sharing the same IP address are established with the first SIM card and the second SIM card of the terminal device, respectively. A primary tunnel and a backup tunnel are determined from the first and second tunnels. The forwarding direction of the active data stream is determined to be the primary tunnel, and the active data stream is transmitted using the primary tunnel in conjunction with IP. A tunnel handover request sent by the terminal device is received, and the forwarding direction of the active data stream is switched to the backup tunnel. The active data stream is transmitted using the backup tunnel in conjunction with IP. This application achieves network handover simply by changing the forwarding direction of the active data stream, without requiring IP address changes or session reconstruction, effectively shortening network handover latency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to communication switching methods, gateway devices, terminal devices, and readable storage media. Background Technology

[0002] Industrial CPE (Customer Premises Equipment) devices are the core hub connecting OT (Operational Technology) and IT (Information Technology). Industrial CPE devices require networks with: ultra-high reliability: zero-interruption switching for services such as robotic arm control and differential protection (<50ms, meeting IEC 62439 standard); and multi-link redundancy: mitigating single points of failure through multiple SIM cards (multiple carriers / multiple slices).

[0003] However, current network switching technologies cannot meet the stringent requirements of industry. For example, forced IP changes can cause 1-5 seconds of service interruption (i.e., large network switching latency), frequent switching can cause signaling storms, and loss of industrial protocol state.

[0004] In conclusion, effectively reducing network handover latency and other related issues are technical problems that urgently need to be solved by those skilled in the art. Summary of the Invention

[0005] The purpose of this application is to provide a communication switching method, gateway device, terminal device, and readable storage medium to reduce network switching latency and avoid service interruption.

[0006] To solve the above-mentioned technical problems, this application provides the following technical solution: A communication handover method, comprising: Establish a first tunnel and a second tunnel sharing the same IP address with the first SIM card and the second SIM card of the terminal device, respectively. The main tunnel and the backup tunnel are determined from the first tunnel and the second tunnel; The forwarding direction of the active data stream is determined to be the main tunnel, and the active data stream is transmitted using the main tunnel in conjunction with the IP. Receive the tunnel switching request sent by the terminal device, and switch the forwarding direction of the active data stream to the backup tunnel; The active data stream is transmitted using the backup tunnel and in conjunction with the IP transmission.

[0007] Preferably, establishing a first tunnel sharing the same IP address with the first SIM card of the terminal device includes: Receive the first data connection request sent by the first SIM card and obtain the first request information; If the first device identity information in the first request information is inconsistent with the existing session, a first session and a first tunnel corresponding to the first session are established. Assign an IP address to the first tunnel and record the correspondence between the first session and the identity information of the first device.

[0008] Preferably, establishing a second tunnel sharing the same IP address with the second SIM card of the terminal device includes: Receive the second data connection request sent by the second SIM card and obtain the second request information; If it is determined that the second device identity information in the second request information matches the first session, a second session is established, and a second tunnel is established corresponding to the second session; Associate the second session with the device session context of the second session, and share the IP of the first session with the second tunnel.

[0009] Preferably, utilizing the backup tunnel in conjunction with the IP transmission of the active data stream includes: If the IP address in the data packet of the active data stream matches the first session or the second session, the data packet is sent to the backup tunnel for encapsulation and forwarding.

[0010] Preferably, switching the forwarding direction of the active data stream to the backup tunnel includes: Update the session table or forwarding table to indicate the status information of the currently active tunnel so that the forwarding of the active data stream can be switched to the backup tunnel.

[0011] Preferably, receiving the tunnel switching request sent by the terminal device includes: The terminal device receives a tunnel switching request when it detects that the health of the main tunnel does not meet the transmission requirements.

[0012] A communication handover method, comprising: The first and second SIM cards in the terminal device are used to establish a first tunnel and a second tunnel that share the same IP address, respectively. The health status of the first tunnel and the second tunnel is monitored, and the tunnel switching detection is performed using the health status. If it is determined that a tunnel switchover is required, a tunnel switchover request is sent to the core network gateway so that the core network gateway redirects the active data stream from the currently used primary tunnel to the backup tunnel. If the active data stream is successfully switched to the backup tunnel, the main tunnel will be shut down after the protection period has passed.

[0013] A gateway device, comprising: Memory, used to store computer programs; A processor, used to implement the steps of the communication switching method described above when executing the computer program.

[0014] A terminal device, comprising: Memory, used to store computer programs; A processor, used to implement the steps of the communication switching method described above when executing the computer program.

[0015] A readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described communication switching method.

[0016] Using the method provided in the embodiments of this application, a first tunnel and a second tunnel sharing the same IP are established with the first SIM card and the second SIM card of the terminal device, respectively; a primary tunnel and a backup tunnel are determined from the first tunnel and the second tunnel; the forwarding direction of the active data stream is determined to be the primary tunnel, and the active data stream is transmitted using the primary tunnel in combination with IP; a tunnel switching request sent by the terminal device is received, and the forwarding direction of the active data stream is switched to the backup tunnel; the active data stream is transmitted using the backup tunnel in combination with IP.

[0017] In this application, to accelerate network handover, a first tunnel and a second tunnel are first established with different SIM cards in the terminal device. It is important to note that the first and second tunnels share the same IP address. Then, a primary tunnel and a backup tunnel are distinguished between the first and second tunnels. The primary tunnel, combined with the IP address, can transmit active data streams. Upon receiving a tunnel handover request from the terminal device, instead of creating a new session, the forwarding direction of the active data stream is switched to the backup tunnel, thereby utilizing the backup tunnel and combining it with the IP address to transmit the active data stream. In other words, network handover can be completed simply by changing the forwarding direction of the active data stream, without changing the IP address or re-establishing the session, effectively shortening network handover latency.

[0018] Accordingly, this application also provides a communication switching method applicable to terminal devices, corresponding to the above-described communication switching method, including a gateway device, a terminal device, and a readable storage medium, which have the above-described technical effects and will not be elaborated further here. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating the implementation of a communication switching method in an embodiment of this application. Figure 2 This is a flowchart illustrating another communication switching method implemented in this application. Figure 3 This is a flowchart illustrating a specific implementation of a communication switching method in this application. Figure 4 This is a flowchart illustrating the workflow of a dual-active IP anchor engine in an embodiment of this application. Figure 5 This is a flowchart illustrating a zero-copy hot migration module in an embodiment of this application. Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application; Figure 7 This is a schematic diagram of the specific structure of an electronic device in an embodiment of this application. Detailed Implementation

[0021] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some embodiments of the present application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0022] To facilitate understanding, the technical terms used in this article will be explained below.

[0023] CPE: Customer Premises Equipment.

[0024] PGW: Packet Data Network Gateway.

[0025] UPF: User Plane Function.

[0026] GTP-U GPRS: Tunneling Protocol-User plane GPRS.

[0027] RSRP: Reference Signal Received Power.

[0028] SD-WAN: Software-Defined Wide Area Network.

[0029] DPDK: Data Plane Development Kit.

[0030] MAC: Media Access Control.

[0031] TCP: Transmission Control Protocol.

[0032] UDP: User Datagram Protocol.

[0033] Please refer to Figure 1 , Figure 1 This is a flowchart of a communication switching method according to an embodiment of this application. The method is applied to a core network gateway and includes the following steps.

[0034] S101. Establish a first tunnel and a second tunnel sharing the same IP with the first SIM card and the second SIM card of the terminal device, respectively.

[0035] The terminal device can be a CPE (Customer Premises Equipment). To ensure network reliability, in this embodiment, the terminal device has two SIM cards.

[0036] To enable rapid network switching, in this embodiment, the core network gateway establishes a first tunnel and a second tunnel with the first SIM card and the second SIM card in the terminal device, respectively. It should be noted that the first tunnel and the second tunnel share the same IP address.

[0037] The terms "first" and "second" are used only to distinguish the existence of two objects and do not inherently imply primary or secondary importance or sequence. The first tunnel corresponds to the first SIM card, and the second tunnel corresponds to the second SIM card.

[0038] In one specific embodiment of this application, establishing a first tunnel sharing the same IP address with a first SIM card of a terminal device includes: Receive the first data connection request sent by the first SIM card and obtain the first request information; If the first device identity information in the first request information is inconsistent with the existing session, a first session and a first tunnel corresponding to the first session shall be established. Assign an IP address to the first tunnel and record the correspondence between the first session and the identity information of the first device.

[0039] Accordingly, establishing a second tunnel sharing the same IP with the second SIM card of the terminal device includes: Receive the second data connection request sent by the second SIM card and obtain the second request information; If the second device identity information in the second request information matches the first session, a second session is established, and a second tunnel is established corresponding to the second session. Associate the second session with the device session context of the second session, and share the IP of the first session with the second tunnel.

[0040] Specifically, in this embodiment, the PGW session management protocol can be extended to identify and associate at the terminal device level, thereby ultimately establishing two tunnels for two SIM cards of the same terminal device to communicate with the same IP.

[0041] It is important to note that the extended PGW session management protocol in this application refers to the addition of a terminal device identification and association capability to the original session establishment and management logic. Normally, when establishing a data session, the network only focuses on the SIM card itself. Each time a SIM initiates a connection request, the network considers it a completely new user, thus establishing an independent session and assigning an IP address. In this embodiment, when processing session establishment requests, the core network gateway on the network side, in addition to the information originally used to identify the SIM, also obtains identification information reflecting the terminal device's identity, such as IMEI, and incorporates this information into the session management process. This allows the network to no longer manage connections solely from the SIM's perspective, but rather to perceive whether these connections originate from the same physical device.

[0042] When the first SIM in a device initiates a data connection request, the core network gateway establishes a first session and assigns an IP address according to the normal procedure, while internally recording the device identity information corresponding to this first session. When the second SIM in the same device initiates a data connection request (i.e., a second data connection request), although the SIM identifier of the second data connection request is different from the previous one, the device identity information it carries is consistent with the existing first session. Based on this, the core network gateway on the network side can determine that the second data connection request does not come from another terminal device, but rather is a second session initiated by another SIM on the same terminal device that previously established a first session. After confirming this relationship, the core network gateway on the network side will not treat the second SIM as a completely independent new user, but will associate the second session corresponding to the second SIM with the session context of the existing first session of the terminal device, thereby achieving unified management among multiple SIM sessions.

[0043] Although multiple SIM sessions correspond to the same IP address, this does not cause service disruption. Specifically, each SIM maintains an independent session state within the network, and its data traffic, session parameters, and management information remain distinct. The core network gateway on the network side differentiates communication between different SIMs through session identifiers, connection information, and data flow characteristics. Even with the same IP address, it can accurately identify which SIM the data originates from and process and analyze it accordingly. Therefore, from the perspectives of service control, traffic management, and billing, multiple SIMs remain independent; only the IP address allocation level is merged.

[0044] Here, IP address refers to public IP address. Due to the scarcity and high cost of public IP resources, in multi-SIM terminal scenarios, managing them by assigning one public IP address to each SIM would result in the same terminal device occupying multiple public IP addresses, leading to low resource utilization efficiency. By allowing multiple SIM sessions within the same terminal device to share a single public IP address, the consumption of public IP addresses can be effectively reduced without affecting the terminal's communication experience and network management mechanisms, thereby improving the overall utilization efficiency of network resources.

[0045] S102. Determine the main tunnel and the backup tunnel from the first tunnel and the second tunnel.

[0046] After a tunnel is created, the core network gateway maintains available tunnel information for the session, including the currently used tunnel path and backup tunnel paths. These tunnels logically belong to the same session. The primary and backup tunnels can be randomly selected, or their primary and backup positions can be determined based on the order in which they were established.

[0047] S103. Determine the forwarding direction of the active data stream to the main tunnel, and use the main tunnel in conjunction with IP transmission of the active data stream.

[0048] Once the main tunnel is identified, the forwarding direction of the active data stream can be determined to be the main tunnel, that is, the active data stream is transmitted by the main tunnel in combination with IP.

[0049] S104. Receive the tunnel switching request sent by the terminal device and switch the forwarding of the active data stream to the backup tunnel.

[0050] When a terminal device needs to switch networks, it can send a tunnel switching request to the core network gateway. Based on this request, the core network gateway will quickly switch the forwarding of active data flows to the backup tunnel.

[0051] In one specific embodiment of this application, receiving a tunnel switching request sent by a terminal device includes: receiving a tunnel switching request sent by the terminal device when it detects that the health of the main tunnel does not meet the transmission requirements. That is, after the tunnel is established, the terminal device can monitor the first tunnel and the second tunnel and detect whether a tunnel switching is needed. If it is clear that a tunnel switching is needed, the terminal device can send a tunnel switching request to the core network gateway to perform the switching.

[0052] After the core network gateway receives a tunnel switching request from the terminal device, it can switch the forwarding of active data streams to the backup tunnel, thereby achieving fast network switching.

[0053] In one specific embodiment of this application, switching the forwarding direction of an active data stream to a backup tunnel includes: updating the status information in the session table or forwarding table that indicates the currently active tunnel, so as to switch the forwarding direction of the active data stream to the backup tunnel.

[0054] It's important to note that the instantaneous redirection of active data streams from the primary tunnel path to the backup tunnel is not achieved by re-establishing a connection or reallocating addresses. Instead, it's accomplished by the core network gateway switching the data forwarding pointers within the existing session context. At the beginning of a session, the network side pre-maintains available tunnel information for that session, including the currently used tunnel path and backup tunnel paths, all logically belonging to the same session. When a switch is needed, the core network gateway doesn't modify the session's identifier, nor does it change the IP address or session parameters. Instead, it updates the status information in its internal session table or forwarding table that indicates the currently active tunnel, switching the forwarding pointer from the primary tunnel (the currently used old tunnel) to the backup tunnel. From the network side's perspective, this change is essentially an update of the forwarding association; that is, after a data packet matches an existing session, it is sent to different tunnel exits for encapsulation and forwarding, rather than going through the entire session establishment process again. Since this process only involves switching the forwarding table or tunnel state within the core network, it does not require additional interaction with the terminal or resource reallocation, so it can be completed in a very short time, thus appearing as an instantaneous redirection of the data stream to the business.

[0055] S105. Utilize backup tunnels and combine them with IP transmission of active data streams.

[0056] The backup tunnel transmits active data streams in a similar manner to the main tunnel, with the only difference being the data packet forwarding path. This means that network switching can be achieved quickly without establishing a new session or changing the IP address.

[0057] In one specific embodiment of this application, utilizing a backup tunnel in conjunction with IP transmission of active data streams includes: if the IP in the data packets of the active data stream matches a first session or a second session, sending the data packets to the backup tunnel for encapsulation and forwarding.

[0058] In this embodiment, since the first tunnel and the second tunnel both correspond to the same IP, if the IP in the data packet of the active data stream matches the first session or the second session, the data packet can be sent to the backup tunnel for encapsulation and forwarding, thus realizing the use of the backup tunnel to transmit the active data stream.

[0059] In this embodiment, changing the tunnel essentially only changes the data forwarding path within the network; the logical identity of the connection remains unchanged. For terminal devices and upper-layer services, the source address, destination address, port number, and transport layer protocol type remain the same—the five-tuple does not change. Because the five-tuple and TCP / UDP state are completely copied and preserved, the service connection can continue to use the original session context after the channel switch, achieving a seamless migration that is imperceptible to the application.

[0060] Using the method provided in the embodiments of this application, a first tunnel and a second tunnel sharing the same IP are established with the first SIM card and the second SIM card of the terminal device, respectively; a primary tunnel and a backup tunnel are determined from the first tunnel and the second tunnel; the forwarding direction of the active data stream is determined to be the primary tunnel, and the active data stream is transmitted using the primary tunnel in combination with IP; a tunnel switching request sent by the terminal device is received, and the forwarding direction of the active data stream is switched to the backup tunnel; the active data stream is transmitted using the backup tunnel in combination with IP.

[0061] In this application, to accelerate network handover, a first tunnel and a second tunnel are first established with different SIM cards in the terminal device. It is important to note that the first and second tunnels share the same IP address. Then, a primary tunnel and a backup tunnel are distinguished between the first and second tunnels. The primary tunnel, combined with the IP address, can transmit active data streams. Upon receiving a tunnel handover request from the terminal device, instead of creating a new session, the forwarding direction of the active data stream is switched to the backup tunnel, thereby utilizing the backup tunnel and combining it with the IP address to transmit the active data stream. In other words, network handover can be completed simply by changing the forwarding direction of the active data stream, without changing the IP address or re-establishing the session, effectively shortening network handover latency.

[0062] Please refer to Figure 2 This application also provides a communication switching method applicable to terminal devices, which includes the following steps.

[0063] S201. The first SIM card and the second SIM card in the terminal device are used to establish a first tunnel and a second tunnel that share the same IP address.

[0064] In this application, the terminal device shares the same IP address through a first SIM card and a second SIM card, respectively, a first tunnel and a second tunnel.

[0065] While establishing the tunnel, the core network gateway on the network side will establish a session, bind the tunnels corresponding to the two SIM cards, set up the corresponding primary and backup tunnels, and transmit active data traffic based on the primary tunnel.

[0066] That is, powering on the terminal device and initializing the session: After the terminal device is powered on, multiple SIM cards (such as SIM1 and SIM2) will send attachment requests to the network respectively.

[0067] SIM1 establishes the main tunnel: First, SIM1 will successfully establish the first user plane data tunnel with the core network gateway (such as PGW / UPF) as in the traditional process. The core network will allocate an IP address to the session from its pre-allocated shared IP address pool.

[0068] SIM2 establishes a backup tunnel using a shared IP address (key innovation): SIM2 then initiates a session establishment request. At this point, the extended PGW session management protocol comes into play. Instead of assigning a new IP address to SIM2, the PGW recognizes this as another session from the same device and binds SIM2's session (IP multi-homing binding) to the IP address that SIM1 is currently using. In this way, SIM2 also establishes a user plane tunnel, but shares the same IP address as SIM1.

[0069] This creates a dual-active anchor point: at this point, there are two data tunnels between the terminal device and the network, both pointing to the same IP address. At this time, only one tunnel (such as the tunnel of SIM1) is active and handles data traffic, while the other (the tunnel of SIM2) is ready and in hot backup mode.

[0070] For detailed information on session creation and tunnel establishment, please refer to the relevant operations of the core network gateway mentioned above, which will not be repeated here.

[0071] S202. Monitor the health of the first and second tunnels, and use the health status to detect tunnel switching.

[0072] The terminal equipment can monitor the health of the first and second tunnels and determine whether tunnel switching is needed based on the health status.

[0073] Specifically, periodic link health checks can be performed: the system will simultaneously perform health checks on both tunnels at a very high frequency (e.g., every 100 milliseconds). Check metrics can include signal quality, latency, packet loss rate, etc. The monitoring module will continuously compare the health of the currently active tunnel (e.g., the SIM1 tunnel) with a preset threshold. If the health is good: the process returns to continue monitoring, and the data flow continues through the current tunnel. If the health falls below the threshold: the system immediately determines that a switchover is needed and confirms that a tunnel switchover is required.

[0074] S203. If it is determined that a tunnel switchover is required, a tunnel switchover request is sent to the core network gateway so that the core network gateway can redirect the active data flow from the currently used primary tunnel to the backup tunnel.

[0075] If a tunnel handover is clearly required, a tunnel handover request can be sent to the core network gateway.

[0076] After receiving a tunnel switching request, the core network gateway can redirect active data streams from the currently used primary tunnel to the backup tunnel by switching the forwarding path.

[0077] Specifically, the implementation details of the tunnel switching process include the following steps: Step 1: State replication and channel pre-establishment.

[0078] The process begins with the start / triggered hot migration. First, the connection state 5-tuple and TCP / UDP state are copied, essentially creating a complete state snapshot of the currently active network connection, ensuring that the connection's identity and session context are preserved. Next, the system establishes a zero-copy channel sharing the user plane buffer, crucial for ultra-low latency. Through kernel bypass technology, a direct data path is pre-built between the source and target nodes, sharing a memory buffer. This avoids the performance overhead of multiple data copies within the operating system kernel, physically preparing for seamless switching.

[0079] Step 2: Path switching and business verification.

[0080] After all preparations are complete, the process executes its core operation—switching the data path to the new node and anchor point. This step instantly redirects the user plane data stream to the newly established path. Subsequently, the system immediately enters the business verification RTT / packet loss decision-making phase, which is a continuous performance monitoring point used to determine in real time whether the quality of the new path meets the requirements.

[0081] Step 3: Complete quickly or roll back safely.

[0082] The verification result in the previous step directly determines the final outcome of the process, forming two closed loops: success and failure. If the verification passes, the process continues to execute and closes the old path, safely releasing the resources of the old path, marking a successful seamless hot migration. If the verification fails (i.e., the new path's quality is substandard), the process will immediately roll back quickly and maintain the original path. This means the system will undo the switchover operation, allowing data to continue transmitting on the original path, thus ensuring high availability and continuity of business operations and achieving a truly smooth migration.

[0083] S204. If the active data stream is successfully switched to the backup tunnel, the main tunnel shall be shut down after the protection period has passed.

[0084] After traffic successfully switches to the new tunnel, the old tunnel enters a brief protection state. This is to ensure that all packets in transit are processed correctly, or to prevent packet out-of-order delivery during the switchover. After the protection period, the old tunnel is safely closed, releasing resources.

[0085] Specifically, the protection period for old tunnels can be set to a default fixed time window, which is about 200 milliseconds.

[0086] The following is combined Figure 3 This section provides a detailed explanation of how to perform network switching.

[0087] The handover request (sent by CPE to the core network PGW) is triggered by the dynamic policy engine determining that a handover is necessary (e.g., SIM1 signal strength is below a threshold, or tariff costs are too high). The CPE sends a path handover request to the core network PGW, targeting the IP address of SIM2 that remains unchanged (e.g., 192.168.1.100).

[0088] User plane path update (PGW triggers UPF), core network actions: PGW checks the session context to confirm that the IP is bound to multiple SIM cards (such as SIM1 and SIM2); modifies the GTP-U tunnel mapping of the user plane (UPF) to switch the data flow from the tunnel of SIM1 to the tunnel of SIM2, and sends a tunnel update command to the UPF, requiring it to take effect immediately.

[0089] Zero-copy data forwarding (executed on the CPE side) works by modifying the link layer (MAC address) directly during the handover process, redirecting data packets from the physical port of SIM1 to the port of SIM2; bypassing the kernel protocol stack and avoiding delays caused by TCP / IP protocol processing.

[0090] Business flows are seamlessly inherited (without the application layer's awareness), and the protocol layer guarantees that the IP address remains unchanged and the routing table does not need to be updated. At the same time, the TCP layer sequence number and sliding window maintain a certain degree of continuity through snapshots.

[0091] Applying the method provided in the embodiments of this application, a first SIM card and a second SIM card in the terminal device are used to establish a first tunnel and a second tunnel sharing the same IP, respectively; the health of the first tunnel and the second tunnel is monitored, and tunnel switching detection is performed using the health status; if it is determined that tunnel switching is required, a tunnel switching request is sent to the core network gateway so that the core network gateway redirects the active data stream from the currently used primary tunnel to the backup tunnel; if the active data stream is successfully switched to the backup tunnel, the primary tunnel is closed after the protection period has passed.

[0092] In this application, to accelerate network handover, a first tunnel and a second tunnel are first established using different SIM cards in the terminal device. It is important to note that the first and second tunnels share the same IP address. Then, a primary tunnel and a backup tunnel are distinguished between the first and second tunnels. The primary tunnel, combined with the IP address, can transmit active data streams. By monitoring health, it can be determined whether to switch tunnels. If a tunnel switch is required, a tunnel switch request can be sent to the core network gateway. Instead of creating a new session, the core network gateway switches the forwarding direction of the active data stream to the backup tunnel, thereby utilizing the backup tunnel and its IP address to transmit the active data stream. To ensure data security and reliability, the primary tunnel can be closed after the protection period. In other words, network handover can be completed simply by changing the forwarding direction of the active data stream, without changing the IP address or rebuilding the session, effectively shortening network handover latency.

[0093] To help those skilled in the art better understand how the two communication switching methods provided in the embodiments of this application can be combined in practical applications, the detailed process of combining the two communication switching methods is described below.

[0094] In the Industry 4.0 process, industrial CPE devices have become the core hub connecting OT (Operational Technology) and IT (Information Technology). With the popularization of 5G private networks and edge computing, scenarios such as factories, power grids, and autonomous driving have created two major demands for 5G networks: Ultra-high reliability: such as zero interruption during switching of business requirements such as robotic arm control and differential protection (<50ms, meeting IEC62439 standard). Multi-link redundancy: Avoid single points of failure by using multiple SIM cards (multiple operators / multiple slices).

[0095] However, consumer-grade CPE technology cannot meet the stringent requirements of industry, mainly due to issues such as: forced IP replacement causing 1-5 seconds of service interruption, frequent switching causing signaling storms, and loss of industrial protocol status.

[0096] Industrial CPE multi-SIM card handover technology is mainly based on the 3GPP standard scheme, which uses serial polling to detect signal strength (every 2-5 seconds). During handover, the original connection must be released and a new PDN session must be rebuilt, resulting in IP changes and a complete rebuild of the protocol stack, causing service interruption of 1.5-4 seconds. This scheme has three major drawbacks: forced IP changes causing service interruption, high-frequency handover causing core network signaling storms, and loss of industrial protocol state, which completely fails to meet the latency requirements of Industry 4.0 scenarios.

[0097] In other words, the relevant technical vulnerabilities and their impacts are as follows: 1. Business operations are forcibly interrupted, directly impacting production and creating a negative customer experience.

[0098] 2. The continuous "blind switching" of equipment reduces reliability, manifested in the following ways: the more equipment is switched, the more sluggish it becomes: the video inspection screen becomes pixelated, causing normal business operations to be unable to proceed normally; the core network is dragged down: frequent signaling interactions trigger core network overload, and hundreds of devices go offline, affecting normal production processes.

[0099] 3. Increased operation and maintenance costs and frequent emergency repairs: Switching between faults requires the formation of a dynamic maintenance team to support this aspect. At the same time, frequent switching may also damage the main control unit of the equipment, resulting in increased costs.

[0100] As can be seen from the above, in response to the aforementioned technical vulnerabilities, this application proposes a multi-SIM card zero-reconstruction handover method for industrial CPEs based on dual-active IP anchors, which fundamentally solves the following technical problems: 1. In case of abnormal interruption at the protocol layer, a dual-active IP anchor point + user plane hot migration solution is used to fix the IP address and achieve a switching latency of ≤15ms. 2. Break through the bottleneck of vertical integration (the key to IT-OT convergence) and achieve millisecond-level energy efficiency control through zero-copy data forwarding ≤10ms.

[0101] The table below compares the advantages and disadvantages of the communication switching method provided in the embodiments of this application with those of related technologies.

[0102] Tables 1 and 2 are comparison tables of the defects and effects of the proposed solutions.

[0103] In other words, the core advantage of this application lies in: 1. Purely software-based, zero hardware dependency: This means no dedicated chips or base station modifications are required, it is compatible with existing 4G / 5G modules, and costs are reduced by 90%; 2. Truly seamless handover (≤15ms), the only solution to achieve zero protocol stack reconstruction and seamless IP layer migration, ensuring industrial business continuity.

[0104] Specifically, the technical solution of this application mainly solves the problems of service interruption, protocol reconstruction and signaling storm caused by multi-SIM card switching in industrial CPE, and achieves seamless switching within ≤15m, meeting the core requirements of Industry 4.0 for continuity, reliability and determinism.

[0105] Technical path: Protocol layer innovation: Dual-active IP anchor mechanism, breaking the 3GPP "one card, one IP" restriction; Data plane optimization: Zero-copy hot migration, bypassing protocol stack reconstruction; State management: Three-layer snapshot (transport layer / industrial control layer / application layer) to ensure service state inheritance.

[0106] In the specific implementation process, it can be divided into the modules and functions shown in the table below.

[0107] Table 2 is a schematic table of functional modules.

[0108] Please refer to Figure 4 , Figure 4 This is a flowchart of a dual-active IP anchor engine in an embodiment of this application, which describes in detail how the dual-active IP anchor engine is implemented.

[0109] Step 1: Initialization and dual tunnel establishment (pre-allocation and binding) are the foundation for ensuring that the IP remains unchanged. This occurs at the beginning of the session, not during the handover.

[0110] The specific implementation steps include: Step 1, Device Power-On and Session Initialization: After the device is powered on, multiple SIM cards (such as SIM1 and SIM2) will send attach requests to the network respectively.

[0111] Step 2, SIM1 establishes the main tunnel: First, SIM1 will successfully establish the first user plane data tunnel with the core network gateway (such as PGW / UPF) as in the traditional process. The core network will allocate an IP address to the session from its pre-allocated shared IP address pool.

[0112] Step 3: SIM2 establishes a backup tunnel using a shared IP address (Key Innovation): Next, SIM2 initiates a session establishment request. At this point, the extended PGW session management protocol comes into play. Instead of assigning a new IP address to SIM2, the PGW recognizes this as another session from the same device and binds SIM2's session (IP multi-homing binding) to the IP address currently being used by SIM1. Thus, SIM2 also establishes a user plane tunnel, but shares the same IP address as SIM1.

[0113] Step 4: Establishing a Dual-Active Anchor Point: At this point, two data tunnels exist simultaneously between the device and the network, both pointing to the same IP address. Only one tunnel (such as the tunnel for SIM1) is active, handling data traffic, while the other (the tunnel for SIM2) is ready and in hot backup mode. This concurrent architecture is called a dual-active or primary / backup anchor point.

[0114] Step 2: Continuous monitoring and intelligent triggering (decision-making) to ensure a rapid and seamless switchover. Specific steps include: Step 1: Periodic Link Health Check: The system will simultaneously perform health checks on these two tunnels at a very high frequency (e.g., every 100 milliseconds as shown in the flowchart). The detection metrics may include signal quality, latency, packet loss rate, etc.

[0115] Step 2, Judgment and Trigger: The monitoring module will continuously compare the health of the currently used active tunnel (such as the SIM1 tunnel) with a preset threshold.

[0116] If the health status is good: the process returns to continue monitoring, and the data flow continues through the current tunnel.

[0117] If the health level is below the threshold: the system immediately determines that a switch is needed, and the process continues.

[0118] Step 3: Network Coordinated Switching and Cleanup (Execution), the key to achieving a smooth switch, is centrally controlled by the core network. Specific steps include: Step 1: Send a handover request to the core network gateway: The device (or access network) sends a handover request to the core network gateway (PGW / UPF). This request, based on the extended session management protocol, specifies that active traffic needs to be switched from tunnel 1 to tunnel 2.

[0119] Step 2: Core Network Update and Implementation: Upon receiving the request, the core network gateway does not create a new session or assign a new IP address. Instead, it updates the indicator for the active tunnel in its internal session table, instantly redirecting data flow from the old tunnel path to the pre-established backup tunnel path. This switching action is completed on the network side and is extremely fast.

[0120] Step 3: Protective Closure of the Old Tunnel: After traffic successfully switches to the new tunnel, the old tunnel enters a brief protection state. This is to ensure that all incoming data packets are processed correctly, or to prevent out-of-order data packets during the switchover. After the protection period, the old tunnel is safely closed, releasing resources.

[0121] Please refer to Figure 5 , Figure 5 This is a flowchart illustrating a zero-copy hot migration module according to an embodiment of this application. Its specific implementation steps include: Step 1: State replication and channel pre-establishment.

[0122] The process begins with the start / triggered hot migration. First, the connection state 5-tuple and TCP / UDP state are copied, essentially creating a complete state snapshot of the currently active network connection, ensuring that the connection's identity and session context are preserved. Next, the system establishes a zero-copy channel sharing the user plane buffer, crucial for ultra-low latency. Through kernel bypass technology, a direct data path is pre-built between the source and target nodes, sharing a memory buffer. This avoids the performance overhead of multiple data copies within the operating system kernel, physically preparing for seamless switching.

[0123] Step 2: Path switching and business verification.

[0124] After all preparations are complete, the process executes its core operation—switching the data path to the new node and anchor point. This step instantly redirects the user plane data stream to the newly established path. Subsequently, the system immediately enters the business verification RTT / packet loss decision-making phase, which is a continuous performance monitoring point used to determine in real time whether the quality of the new path meets the requirements.

[0125] Step 3: Complete quickly or roll back safely.

[0126] The verification result in the previous step directly determines the final outcome of the process, forming two closed loops: success and failure. If the verification passes, the process continues to execute and closes the old path, safely releasing the resources of the old path, marking a successful seamless hot migration. If the verification fails (i.e., the new path's quality is substandard), the process will immediately roll back quickly and maintain the original path. This means the system will undo the switchover operation, allowing data to continue transmitting on the original path, thus ensuring high availability and continuity of business operations and achieving a truly smooth migration.

[0127] The overall process is as follows Figure 3 As shown, I will not go into detail here.

[0128] The following section uses a specific scenario of robotic arm control in a smart factory as an example to explain this communication switching method in detail.

[0129] Specific scenarios for controlling robotic arms in smart factories: Automotive welding production lines use 5G CPEs to connect to dual SIM cards (China Mobile + China Unicom), requiring zero interruption of robotic arm control commands.

[0130] The implementation steps include: a) Initial binding: The CPE requests IP 192.168.5.20 from the core network and binds it to SIM1 (China Mobile) and SIM2 (China Unicom).

[0131] b) Real-time monitoring: The probe detected a mobile signal RSRP of -115dBm (degraded) and a Unicom RSRP of -90dBm.

[0132] c) Policy trigger: The dynamic engine determines that the connection has been switched to China Unicom SIM2 and sends a path update request to PGW.

[0133] d) Seamless handover: PGW switches the GTP-U tunnel from China Mobile to China Unicom within 5ms, while IP address 192.168.5.20 remains unchanged.

[0134] Business assurance: The zero-copy engine forwards Profinet RT control commands, ensuring that the robotic arm's welding trajectory remains unoffset.

[0135] The technical effects achieved are: a switching latency of 12ms (compared to 1.2 seconds for related solutions); and an annual reduction of approximately 3.2 million in scrap losses.

[0136] Corresponding to the above method embodiments, this application also provides a gateway device and a terminal device. The gateway device and terminal device described below can be referred to in correspondence with the communication switching method described above.

[0137] A gateway device, comprising: Memory, used to store computer programs; A processor, used to execute computer programs, implements the above-mentioned... Figure 1 The steps of the communication switching method are shown.

[0138] A terminal device, comprising: Memory, used to store computer programs; A processor, used to execute computer programs, implements the above-mentioned... Figure 2 The steps of the communication switching method.

[0139] For details on the internal structure of the gateway device and terminal device, please refer to [reference needed]. Figure 6 and Figure 7 The structure of the electronic device is shown. (As shown) Figure 6 The electronic device includes: Memory 332 is used to store computer programs; The processor 322 is used to implement the steps of the communication switching method in the above method embodiment when executing a computer program.

[0140] Specifically, such as Figure 7The electronic device can vary considerably depending on its configuration or performance. It may include one or more central processing units (CPUs) (e.g., one or more processors) and memory 332, which stores one or more computer programs 342 or data 344. Memory 332 may be temporary or permanent storage. The program stored in memory 332 may include one or more modules (not shown in the figure), each module including a series of instruction operations on the data processing device. Furthermore, processor 322 may be configured to communicate with memory 332 and execute the series of instruction operations stored in memory 332 on electronic device 301.

[0141] Electronic device 301 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input / output interfaces 358, and / or one or more operating systems 341.

[0142] The steps in the communication switching method described above can be implemented by the structure of the electronic device.

[0143] Corresponding to the above method embodiments, this application also provides a readable storage medium. The readable storage medium described below and the communication switching method described above can be referred to each other.

[0144] A readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the communication switching method described in the above method embodiments.

[0145] The readable storage medium can specifically be a USB flash drive, external hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, or any other readable storage medium capable of storing program code.

[0146] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0147] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0148] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0149] Finally, it should be noted that in this document, relationships such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "include," "contain," or any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.

[0150] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A communication handover method, characterized in that, include: Establish a first tunnel and a second tunnel sharing the same IP address with the first SIM card and the second SIM card of the terminal device, respectively. The main tunnel and the backup tunnel are determined from the first tunnel and the second tunnel; The forwarding direction of the active data stream is determined to be the main tunnel, and the active data stream is transmitted using the main tunnel in conjunction with the IP. Receive the tunnel switching request sent by the terminal device, and switch the forwarding direction of the active data stream to the backup tunnel; The active data stream is transmitted using the backup tunnel and in conjunction with the IP transmission.

2. The method according to claim 1, characterized in that, Establishing a first tunnel sharing the same IP with the first SIM card of the terminal device includes: Receive the first data connection request sent by the first SIM card and obtain the first request information; If the first device identity information in the first request information is inconsistent with the existing session, a first session and a first tunnel corresponding to the first session are established. Assign an IP address to the first tunnel and record the correspondence between the first session and the identity information of the first device.

3. The method according to claim 2, characterized in that, Establishing a second tunnel sharing the same IP with the second SIM card of the terminal device includes: Receive the second data connection request sent by the second SIM card and obtain the second request information; If it is determined that the second device identity information in the second request information matches the first session, a second session is established, and a second tunnel is established corresponding to the second session; Associate the second session with the device session context of the second session, and share the IP of the first session with the second tunnel.

4. The method according to claim 3, characterized in that, Utilizing the backup tunnel and combining it with the IP transmission of the active data stream includes: If the IP address in the data packet of the active data stream matches the first session or the second session, the data packet is sent to the backup tunnel for encapsulation and forwarding.

5. The method according to claim 1, characterized in that, Switching the forwarding direction of the active data stream to the backup tunnel includes: Update the session table or forwarding table to indicate the status information of the currently active tunnel so that the forwarding of the active data stream can be switched to the backup tunnel.

6. The method according to any one of claims 1 to 5, characterized in that, Receiving the tunnel switching request sent by the terminal device includes: The terminal device receives a tunnel switching request when it detects that the health of the main tunnel does not meet the transmission requirements.

7. A communication handover method, characterized in that, include: The first and second SIM cards in the terminal device are used to establish a first tunnel and a second tunnel that share the same IP address, respectively. The health status of the first tunnel and the second tunnel is monitored, and the tunnel switching detection is performed using the health status. If it is determined that a tunnel switchover is required, a tunnel switchover request is sent to the core network gateway so that the core network gateway redirects the active data stream from the currently used primary tunnel to the backup tunnel. If the active data stream is successfully switched to the backup tunnel, the main tunnel will be shut down after the protection period has passed.

8. A gateway device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the communication switching method as described in any one of claims 1 to 6 when executing the computer program.

9. A terminal device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the communication switching method as described in claim 7 when executing the computer program.

10. A readable storage medium, characterized in that, The readable storage medium stores a computer program that, when executed by a processor, implements the steps of the communication switching method as described in any one of claims 1 to 7.