CN112087375A - WAN port switching method of WAN port standby router, storage medium and router - Google Patents
WAN port switching method of WAN port standby router, storage medium and router Download PDFInfo
- Publication number
- CN112087375A CN112087375A CN202010885367.1A CN202010885367A CN112087375A CN 112087375 A CN112087375 A CN 112087375A CN 202010885367 A CN202010885367 A CN 202010885367A CN 112087375 A CN112087375 A CN 112087375A
- Authority
- CN
- China
- Prior art keywords
- wan port
- network
- wired
- module
- switching method
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/22—Alternate routing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0805—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
- H04L43/0811—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/28—Routing or path finding of packets in data switching networks using route fault recovery
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W24/00—Supervisory, monitoring or testing arrangements
- H04W24/04—Arrangements for maintaining operational condition
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W84/00—Network topologies
- H04W84/02—Hierarchically pre-organised networks, e.g. paging networks, cellular networks, WLAN [Wireless Local Area Network] or WLL [Wireless Local Loop]
- H04W84/10—Small scale networks; Flat hierarchical networks
- H04W84/12—WLAN [Wireless Local Area Networks]
Abstract
The invention discloses a WAN port switching method of a WAN port standby router, a storage medium and a router, wherein the method comprises the following steps: (S1) acquiring status parameters of the wired WAN port, the status parameters including a wired WAN port network connection status and an IP address status; (S2) acquiring status parameters of the wireless network module; (S3) when the status parameter of the wired WAN port is normal, taking the wired WAN port as a default route; and when the wired WAN port has no network connection, activating a wireless network module to access the network, and taking the wireless network module as a default route. The method can realize the function of intelligent backup and improve the reliability of network connection.
Description
Technical Field
The invention relates to the field of network communication, in particular to a WAN port switching method of a WAN port standby router, a storage medium and a router.
Background
A conventional router has only one wired WAN port and only one external network link, once the line fails. The network will be blocked and no network communication can be performed, so that engineers have studied a multilink solution many years ago, and finally successfully developed a dual WAN router to improve the reliability of network connection.
However, the dual WAN routers of the prior art are typically only capable of connecting two external network lines by wire. This approach only enables wired connections, and the user needs to access at least two wired networks, whereas in many buildings there is usually only one network provider, which makes it difficult for the user to access two wired external network lines.
Disclosure of Invention
The invention aims to provide a WAN port switching method of a WAN port standby router, a storage medium and the router according to the defects of the prior art, and solves the problems in the prior art by mutually backing up a wireless network and a wired network.
The purpose of the invention is realized by the following technical scheme:
a WAN port switching method of a WAN port standby router comprises the following steps:
(S1) acquiring status parameters of the wired WAN port, the status parameters including a wired WAN port network connection status and an IP address status;
(S2) acquiring status parameters of the wireless network module;
(S3) when the status parameter of the wired WAN port is normal, taking the wired WAN port as a default route; and when the wired WAN port has no network connection, activating a wireless network module to access the network, and taking the wireless network module as a default route.
The invention has the further improvement that the mode of acquiring the network cable connection state of the wired WAN port comprises the following steps: the kernel driver monitors whether a wired WAN port is plugged in a network cable or not, and writes state information into a state file of the file system when the wired WAN port is detected to be plugged in or pulled out; the application layer acquires the network cable connection state of the wired WAN port by detecting the state file.
A further development of the invention is that the application layer monitors the status file by calling inotify.
The invention has the further improvement that the network connection state is obtained through a netlink communication mechanism; the network connection state comprises obtaining an IP address and losing the IP address.
The invention is further improved in that the normal state parameter of the wired WAN port means that the wired WAN port is in a state of network cable connection, namely, network cable insertion is detected, and the network connection is in a state of obtaining an IP address.
In a further improvement of the invention, the wired WAN non-network connection means that the wired WAN port network cable connection state is that a network cable pull-out is detected.
The invention is further improved in that:
when the default route is switched from the wireless network module to the wired WAN port, sending an IP change message to the application using the network;
and when the default route is switched from the WAN port to the wireless network module, stopping using the network application except the white list according to the wireless flow white list.
The invention is further improved in that the wireless network module is one or a combination of more of LTE, 5G module, 4G module and 3G module.
The present invention also includes a storage medium storing a plurality of instructions for execution by one or more processors to implement the steps of the WAN port switching method of the WAN port backup router described above.
The present invention also includes a router, comprising:
a processor to implement instructions;
a storage medium to store a plurality of instructions;
wherein: the processor is used for executing the instructions stored in the storage medium to realize the steps of the WAN port switching method of the WAN port standby router.
The invention has the advantages that: the dual-WAN intelligent backup function can be realized by mainly using the Ethernet port, when the network connected with the Ethernet port is in normal communication, the link of the mobile module is in a disconnected state, once the link of the Ethernet port is interrupted, an abnormality is detected, the mobile LTE module or the 5G module immediately starts to be connected with the mobile network to replace the Ethernet to reestablish network connection, so that the network connection of a user is kept smooth, and once the Ethernet is cleared of faults and is recovered to be normal, the connection of the mobile LTE module or the 5G module is immediately cut off, so that the cost is saved. The intelligent backup function is realized, and the reliability of network connection is improved.
Drawings
Fig. 1 is a flowchart of a WAN port switching method of a WAN port standby router.
Detailed Description
The features of the present invention and other related features are described in further detail below by way of example in conjunction with the following drawings to facilitate understanding by those skilled in the art:
example (b): as shown in fig. 1, the embodiment of the present invention includes a WAN port switching method of a WAN port standby router, which is applied to the WAN port standby router. The WAN port standby router integrates a mobile LTE communication module or a 5G module, and by the method, the double WAN intelligent standby function can be realized, the Ethernet port is taken as a main part, when the network connected with the Ethernet port is in normal communication, a mobile module link is in a disconnected state, once the Ethernet port link is interrupted, an abnormality is detected, the mobile LTE module or the 5G module immediately starts to be connected with the mobile network to replace the Ethernet to reestablish network connection, so that the network connection of a user is kept smooth, and once the Ethernet fails, the connection of the mobile LTE module or the 5G module is immediately cut off after the Ethernet is recovered to be normal, and the cost is saved. The intelligent backup function is realized.
Specifically, the method of this embodiment includes the following steps:
(S1) acquiring status parameters of the wired WAN port, the status parameters including a wired WAN port network connection status and an IP address status;
(S2) acquiring status parameters of the wireless network module;
(S3) when the status parameter of the wired WAN port is normal, taking the wired WAN port as a default route; and when the wired WAN port has no network connection, activating the wireless network module to access the network, and taking the wireless network module as a default route.
In this embodiment, the WAN port backup router has at least one wired WAN port. The wired WAN port is connected with the PHY chip, and the PHY chip is connected with the CPU through the switch chip.
The step of obtaining the connection state of the network cable of the wired WAN port is realized by matching a zm _ router program module running in a CPU with corresponding hardware, and the process needs to establish communication between a kernel and an application layer. In this embodiment, the communication between the kernel and the application layer is established in a virtual file system manner.
The specific way of acquiring the connection state of the network cable of the wired WAN port is as follows: the kernel driver monitors whether a wired WAN port is plugged in a network cable or not, and writes state information into a state file of the file system when the wired WAN port is detected to be plugged in or pulled out; the application layer acquires the network cable connection state of the wired WAN port by detecting the state file.
In one embodiment, when a network cable is detected, the kernel driver writes a 1 in the/tmp/ethernet _ status file, and when the network cable is pulled, the kernel driver writes a 0 in the/tmp/ethernet _ status file. The zm _ router program module of the application layer monitors/tmp/ethernet _ status this file by calling inotify to achieve fast response. In this way, whether the network cable is inserted or not can obtain a specific wired WAN port state, so that the shielding of the transmission process of the wired WAN port state from the kernel to the application layer is avoided.
In the embodiment, the application layer acquires the network connection state through a netlink communication mechanism; the network connection state includes a get IP address (RTM _ NEWADDR), a lose IP address (RTM _ DELADDR). This step is also performed by the zm _ router program module.
Switching the default route between the wired WAN port and the wireless network module is performed by an oamd program module running in the CPU. The zm _ router program module and the oamd program module may be implemented by processes, threads, and combinations thereof with hardware.
In a specific embodiment, the zm _ router program module and the oamd program module are implemented in a process manner, and communicate with each other in a message queue (message queue). Specifically, the state of the wired WAN port network cable connection reported by the zm _ router program module to the oamd program module includes:
network line pull-out (MSG _ CMD _ ETHERNET _ LINK _ DOWN),
Network line insertion (MSG _ CMD _ ETHERNET _ LINK _ UP).
The network connection state reported by the zm _ router program module to the oamd program module includes:
obtain an IP address (MSG _ CMD _ ETHERNET _ IP _ ADD),
The IP address (MSG _ CMD _ ETHERNET _ IP _ DEL) is lost.
In this embodiment, the reason for separately detecting the network connection state and the network connection state of the wired WAN port is that, in the dhcp mode, the wired WAN port needs to determine whether the ethernet network can be successfully accessed by detecting whether the IP is acquired, so whether the network access of the wired WAN port is an individual message, whether the IP address of the wired WAN port is acquired is an individual message, and different actions are performed according to different messages.
In this embodiment, the normal state parameter of the wired WAN port indicates that the wired connection state of the wired WAN port is the state where the insertion of the wired is detected and the network connection state is the state where the IP address is obtained.
In this embodiment, the wired WAN non-network connection means that the wired WAN port network cable connection state is the detection of the network cable being pulled out.
The oamd program module responds to the information sent by the zm _ router program module, and the switching mode of the default route is as follows: when the default route is switched from the wireless network module to the wired WAN port, sending an IP change message to the application using the network; and when the default route is switched from the WAN port to the wireless network module, stopping using the network application except the white list according to the wireless flow white list. The wireless flow white list comprises a user-specified application list which can use the wireless flow, and the list suggests software which needs uninterrupted networking, such as communication software, industrial software, financial transaction software and the like. FTP, NTP and other software which can quickly exhaust the traffic is not suggested to be added in a wireless traffic white list. By means of wireless flow white name, application of the current network can be reasonably controlled, and the smoothness of the important application network is guaranteed while flow charge is saved. In this embodiment, the router may determine the type of the application through each field in the data packet. The adopted fields comprise a source port number, a target port number and a service type; or determine the application type from the data in the data packet.
In this embodiment, the wireless network module is one or a combination of multiple LTE, 5G module, 4G module, and 3G module.
Embodiments of the present invention also include a storage medium storing a plurality of instructions for execution by one or more processors to implement the steps of the WAN port switching method of the WAN port backup router described above.
An embodiment of the present invention is also a router, including:
a processor to implement instructions;
a storage medium to store a plurality of instructions;
wherein: the processor is used for executing the instructions stored in the storage medium to realize the steps of the WAN port switching method of the WAN port standby router.
The above embodiments of the present invention do not limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. A WAN port switching method of a WAN port standby router is characterized by comprising the following steps:
(S1) acquiring status parameters of the wired WAN port, the status parameters including a wired WAN port network connection status and an IP address status;
(S2) acquiring status parameters of the wireless network module;
(S3) when the status parameter of the wired WAN port is normal, taking the wired WAN port as a default route; and when the wired WAN port has no network connection, activating a wireless network module to access the network, and taking the wireless network module as a default route.
2. The WAN port switching method of a WAN port standby router according to claim 1, wherein the manner of obtaining the connection status of the network cable of the wired WAN port is as follows: the kernel driver monitors whether a wired WAN port is plugged in a network cable or not, and writes state information into a state file of the file system when the wired WAN port is detected to be plugged in or pulled out; the application layer acquires the network cable connection state of the wired WAN port by detecting the state file.
3. The WAN port switching method of a WAN port standby router according to claim 2, wherein said application layer monitors said state file by calling inotify.
4. The WAN port switching method of a WAN port standby router according to claim 2, wherein the network connection state is obtained through a netlink communication mechanism; the network connection state comprises obtaining an IP address and losing the IP address.
5. The method of claim 4, wherein the WAN port switching method of the WAN port standby router comprises: the normal state parameters of the wired WAN port mean that the wired WAN port network cable connection state is that network cable insertion is detected, and the network connection state is that an IP address is obtained.
6. The method of claim 4, wherein the WAN port switching method of the WAN port standby router comprises: the wired WAN non-network connection means that the connection state of the wired WAN port network cable is that the network cable is detected to be pulled out.
7. The method of claim 4, wherein the WAN port switching method of the WAN port standby router comprises:
when the default route is switched from the wireless network module to the wired WAN port, sending an IP change message to the application using the network;
and when the default route is switched from the WAN port to the wireless network module, stopping using the network application except the white list according to the wireless flow white list.
8. The method of claim 1, wherein the method further comprises: the wireless network module is one or a combination of more than one of an LTE module, a 5G module, a 4G module and a 3G module.
9. A storage medium storing a plurality of instructions for execution by one or more processors to perform the steps of the WAN port switching method of a WAN port standby router of any one of claims 1 to 8.
10. A router, comprising:
a processor to implement instructions;
a storage medium to store a plurality of instructions;
wherein: the processor is configured to execute the instructions stored in the storage medium to implement the steps of the WAN port switching method of the WAN port standby router according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010885367.1A CN112087375A (en) | 2020-08-28 | 2020-08-28 | WAN port switching method of WAN port standby router, storage medium and router |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010885367.1A CN112087375A (en) | 2020-08-28 | 2020-08-28 | WAN port switching method of WAN port standby router, storage medium and router |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112087375A true CN112087375A (en) | 2020-12-15 |
Family
ID=73728848
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010885367.1A Pending CN112087375A (en) | 2020-08-28 | 2020-08-28 | WAN port switching method of WAN port standby router, storage medium and router |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112087375A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112804721A (en) * | 2021-01-05 | 2021-05-14 | 湖南恒茂高科股份有限公司 | Automatic link switching method for dual-frequency router and dual-frequency router |
CN113206752A (en) * | 2021-03-25 | 2021-08-03 | 厦门才茂通信科技有限公司 | Router network communication double-path backup method |
CN113747533A (en) * | 2021-08-16 | 2021-12-03 | 湖南恒茂高科股份有限公司 | Automatic router link switching method and dual-frequency router |
CN115883383A (en) * | 2022-12-09 | 2023-03-31 | 山东有人物联网股份有限公司 | Network expansion communication method, device, equipment and storage medium |
CN115883383B (en) * | 2022-12-09 | 2024-05-10 | 山东有人物联网股份有限公司 | Network extension communication method, device, equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106941678A (en) * | 2016-01-04 | 2017-07-11 | 希姆通信息技术(上海)有限公司 | The intelligent switch method and system of MiFi online patterns |
CN107979532A (en) * | 2017-12-27 | 2018-05-01 | 苏州德铂思电子科技有限公司 | A kind of 4G interfaces of router and the automatic selecting method of wireline interface |
CN109120557A (en) * | 2018-07-13 | 2019-01-01 | 上海斐讯数据通信技术有限公司 | A kind of intelligent router WAN mouthfuls of dynamic switching method and system |
CN110460462A (en) * | 2019-07-24 | 2019-11-15 | 中国移动通信集团黑龙江有限公司 | Dual network router control system and dual network router |
CN110536353A (en) * | 2014-05-26 | 2019-12-03 | 华为技术有限公司 | A kind of flow control methods, device |
-
2020
- 2020-08-28 CN CN202010885367.1A patent/CN112087375A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110536353A (en) * | 2014-05-26 | 2019-12-03 | 华为技术有限公司 | A kind of flow control methods, device |
CN106941678A (en) * | 2016-01-04 | 2017-07-11 | 希姆通信息技术(上海)有限公司 | The intelligent switch method and system of MiFi online patterns |
CN107979532A (en) * | 2017-12-27 | 2018-05-01 | 苏州德铂思电子科技有限公司 | A kind of 4G interfaces of router and the automatic selecting method of wireline interface |
CN109120557A (en) * | 2018-07-13 | 2019-01-01 | 上海斐讯数据通信技术有限公司 | A kind of intelligent router WAN mouthfuls of dynamic switching method and system |
CN110460462A (en) * | 2019-07-24 | 2019-11-15 | 中国移动通信集团黑龙江有限公司 | Dual network router control system and dual network router |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112804721A (en) * | 2021-01-05 | 2021-05-14 | 湖南恒茂高科股份有限公司 | Automatic link switching method for dual-frequency router and dual-frequency router |
CN113206752A (en) * | 2021-03-25 | 2021-08-03 | 厦门才茂通信科技有限公司 | Router network communication double-path backup method |
CN113747533A (en) * | 2021-08-16 | 2021-12-03 | 湖南恒茂高科股份有限公司 | Automatic router link switching method and dual-frequency router |
CN113747533B (en) * | 2021-08-16 | 2024-04-16 | 湖南恒茂高科股份有限公司 | Automatic switching method of router link and dual-frequency router |
CN115883383A (en) * | 2022-12-09 | 2023-03-31 | 山东有人物联网股份有限公司 | Network expansion communication method, device, equipment and storage medium |
CN115883383B (en) * | 2022-12-09 | 2024-05-10 | 山东有人物联网股份有限公司 | Network extension communication method, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11223514B2 (en) | Method and system of a dynamic high-availability mode based on current wide area network connectivity | |
CN110912780B (en) | High-availability cluster detection method, system and controlled terminal | |
US10715411B1 (en) | Altering networking switch priority responsive to compute node fitness | |
CN112087375A (en) | WAN port switching method of WAN port standby router, storage medium and router | |
EP2993838B1 (en) | Methods for setting a member identity of gateway device and corresponding management gateway devices | |
US9385944B2 (en) | Communication system, path switching method and communication device | |
CN105656645A (en) | Decision making method and device for fault processing of stacking system | |
CN111682927A (en) | Message synchronization method, device, equipment and medium based on MLAG environment | |
CN109960634A (en) | A kind of method for monitoring application program, apparatus and system | |
US20140050092A1 (en) | Load sharing method and apparatus | |
US20230132861A1 (en) | Switching method and apparatus, device, and storage medium | |
CN108600100B (en) | Member port selection method and device | |
US20210014166A1 (en) | Data traffic processing method, device, and system | |
CN103001865B (en) | The method and apparatus released news in a kind of LSP fragment message | |
CN108574583A (en) | A kind of device updating method and access device | |
JP4964666B2 (en) | Computer, program and method for switching redundant communication paths | |
US8681604B2 (en) | Address refresh method and system | |
US8902738B2 (en) | Dynamically adjusting active members in multichassis link bundle | |
CN109150709B (en) | Method, equipment and system for realizing Mux machine | |
CN113938405B (en) | Data processing method and device | |
CN110138656B (en) | Service processing method and device | |
CN115152192B (en) | PCE controlled network reliability | |
EP3627766B1 (en) | Method and system for switching between active bng and standby bng | |
CN112217718A (en) | Service processing method, device, equipment and storage medium | |
CN111984376B (en) | Protocol processing method, device, equipment and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20201215 |
|
RJ01 | Rejection of invention patent application after publication |