WO2023280240A1 - 网关切换方法、装置、终端设备及计算机可读存储介质 - Google Patents
网关切换方法、装置、终端设备及计算机可读存储介质 Download PDFInfo
- Publication number
- WO2023280240A1 WO2023280240A1 PCT/CN2022/104231 CN2022104231W WO2023280240A1 WO 2023280240 A1 WO2023280240 A1 WO 2023280240A1 CN 2022104231 W CN2022104231 W CN 2022104231W WO 2023280240 A1 WO2023280240 A1 WO 2023280240A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- gateway
- new
- tested
- switching
- network
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 112
- 238000004891 communication Methods 0.000 claims abstract description 60
- 238000012544 monitoring process Methods 0.000 claims abstract description 17
- 230000006870 function Effects 0.000 claims description 43
- 238000004590 computer program Methods 0.000 claims description 25
- 238000012360 testing method Methods 0.000 claims description 24
- 230000008569 process Effects 0.000 claims description 17
- 238000012545 processing Methods 0.000 claims description 15
- 230000006855 networking Effects 0.000 claims description 14
- 230000008859 change Effects 0.000 claims description 5
- 230000004044 response Effects 0.000 abstract description 12
- 238000010586 diagram Methods 0.000 description 14
- 238000001514 detection method Methods 0.000 description 9
- 230000006872 improvement Effects 0.000 description 8
- 230000007246 mechanism Effects 0.000 description 6
- 238000011084 recovery Methods 0.000 description 6
- 230000001360 synchronised effect Effects 0.000 description 6
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 238000013500 data storage Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/06—Management of faults, events, alarms or notifications
- H04L41/0654—Management of faults, events, alarms or notifications using network fault recovery
- H04L41/0663—Performing the actions predefined by failover planning, e.g. switching to standby network elements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/66—Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/2514—Translation of Internet protocol [IP] addresses between local and global IP addresses
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/2557—Translation policies or rules
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5007—Internet protocol [IP] addresses
- H04L61/5014—Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/10—Mapping addresses of different types
- H04L61/103—Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]
Definitions
- the present disclosure relates to the technical field of communications, and in particular, to a gateway switching method, device, terminal equipment, and computer-readable storage medium.
- the quality of network access services provided by ISPs varies, and users of traditional access methods are completely constrained by the broadband provided by ISPs.
- the gateway needs to be backed up.
- the existing commonly used gateway backup solutions are mostly used in industrial fields with high requirements for stability and reliability.
- additional hardware modules usually need to be added, which makes them unsuitable for home environments.
- the backup process only exists on the main router device in the network system. This kind of scheme is less flexible, and users can only choose devices with multiple access methods as the main router.
- the purpose of the embodiments of the present disclosure is to provide a gateway switching method, device, terminal equipment, and computer-readable storage medium, which can use the repeater in the network system as a new gateway, and select the new gateway when the ISP connected to the gateway to be tested has a communication failure.
- the appropriate gateway switching mode is used to switch the gateway, which improves the adaptability of the gateway backup.
- the first aspect of the embodiments of the present disclosure provides a gateway switching method, including:
- the gateway switching mode includes at least one of the first gateway switching mode, the second gateway switching mode, the third gateway switching mode and the fourth gateway switching mode;
- the first gateway switching mode is: control the waiting The test gateway restarts and enters the relay mode, and controls the new gateway to restart and enters the routing mode;
- the second gateway switching method is: while keeping the original data flow logic of the internal network unchanged, increase the control of the gateway to be tested Forwarding the flow of accessing the external network to the new gateway for processing, and controlling the process of the new gateway forwarding the flow returned by the external network to the gateway to be tested;
- the switching method of the third gateway is: controlling the The test gateway broadcasts the information of the new gateway that has completed the information configuration, so that the client sends the traffic for accessing the external network to the new gateway;
- the fourth gateway switching method is: replace the test gateway and the The IP of new gateway, and open the DHCP server of described new gateway while closing the DHCP server of described gateway to be tested.
- the first gateway switching method is specifically:
- the gateway to be tested, the new gateway and the other repeaters are connected to the client.
- the second gateway switching method is specifically:
- the third gateway switching method is specifically:
- the fourth gateway switching method is specifically:
- a repeater with a backup gateway function is selected as the new gateway according to the network connectivity of the repeater.
- the method further includes: restoring the network to an initial state when it is detected that the ISP communication connected to the gateway to be tested returns to normal.
- the second aspect of the embodiment of the present disclosure provides a gateway switching device, including:
- a monitoring module configured to monitor the communication status of the ISP connected to the gateway to be tested
- the gateway selection module is configured to select a repeater with a backup gateway function as a new gateway when a communication failure occurs in the ISP connected to the gateway to be tested;
- the gateway switching module is configured to select a preset gateway switching mode to perform gateway switching when responding to the gateway switching operation;
- the gateway switching mode includes at least one of the first gateway switching mode, the second gateway switching mode, the third gateway switching mode and the fourth gateway switching mode;
- the first gateway switching mode is: control the waiting The test gateway restarts and enters the relay mode, and controls the new gateway to restart and enters the routing mode;
- the second gateway switching method is: while keeping the original data flow logic of the internal network unchanged, increase the control of the gateway to be tested Forwarding the flow of accessing the external network to the new gateway for processing, and controlling the process of the new gateway forwarding the flow returned by the external network to the gateway to be tested;
- the switching method of the third gateway is: controlling the The test gateway broadcasts the information of the new gateway that has completed the information configuration, so that the client sends the traffic for accessing the external network to the new gateway;
- the fourth gateway switching method is: replace the test gateway and the The IP of new gateway, and open the DHCP server of described new gateway while closing the DHCP server of described gateway to be tested.
- a third aspect of the embodiments of the present disclosure provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor
- the gateway switching method described in any one of the first aspect above is realized when the computer program is executed.
- the fourth aspect of the embodiments of the present disclosure provides a computer-readable storage medium, the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the computer can control the The device where the storage medium is read executes the gateway switching method described in any one of the above first aspects.
- a gateway switching method, device, device, and computer-readable storage medium disclosed in the embodiments of the present disclosure monitor the communication status of the ISP connected to the gateway to be tested, so that when the gateway to be tested is connected to When a communication failure occurs in the ISP, a repeater with a backup gateway function is selected as a new gateway, and then in response to a gateway switching operation, a preset gateway switching mode is selected for gateway switching; wherein the gateway switching mode includes the first At least one of the gateway switching mode, the second gateway switching mode, the third gateway switching mode and the fourth gateway switching mode, the first gateway switching mode is to control the gateway to be tested to restart and enter the relay mode, and control the The new gateway restarts and enters the routing mode, and the switching method of the second gateway is to increase and control the gateway under test to forward the flow of accessing the external network to the new gateway while keeping the original data flow logic of the internal network unchanged.
- the third gateway switching method is to control the information of the new gateway that the gateway to be tested will complete the information configuration Broadcast, so that the client sends the traffic to access the external network to the new gateway
- the fourth gateway switching method is to replace the IP of the gateway to be tested and the new gateway, and close the gateway of the gateway to be tested
- the DHCP server of the new gateway is started at the same time as the DHCP server.
- the embodiment of the present disclosure can use the repeater in the network system as a new gateway, and select an appropriate gateway switching mode to perform gateway switching when the ISP connected to the gateway to be tested has a communication failure, which improves the adaptability of the gateway backup .
- FIG. 1 is a flow chart of a preferred embodiment of a gateway switching method provided by the first aspect of the embodiments of the present disclosure
- FIG. 2 is a data flow diagram of communication between other clients except the client of the new gateway itself and the external network provided by the first aspect of the embodiment of the present disclosure after the gateway is switched;
- Fig. 3 is a structural block diagram of a gateway switching device provided by the second aspect of the embodiment of the present disclosure.
- Fig. 4 is a structural block diagram of another gateway switching device provided by the second aspect of the embodiment of the present disclosure.
- Fig. 5 is a structural block diagram of another gateway switching device provided by the second aspect of the embodiment of the present disclosure.
- Fig. 6 is a structural block diagram of another gateway switching device provided by the second aspect of the embodiment of the present disclosure.
- Fig. 7 is a structural block diagram of another gateway switching device provided by the second aspect of the embodiment of the present disclosure.
- Fig. 8 is a structural block diagram of another gateway switching device provided by the second aspect of the embodiment of the present disclosure.
- Fig. 9 is a structural block diagram of another gateway switching device provided by the second aspect of the embodiment of the present disclosure.
- Fig. 10 is a structural block diagram of a terminal device provided by a third aspect of an embodiment of the present disclosure.
- the first aspect of the embodiment of the present disclosure provides a gateway switching method.
- FIG. 1 it is a flow chart of a preferred embodiment of a gateway switching method provided in one aspect of the present disclosure.
- the method includes steps S11 to S13:
- the gateway switching mode includes at least one of the first gateway switching mode, the second gateway switching mode, the third gateway switching mode and the fourth gateway switching mode;
- the first gateway switching mode is: control the waiting The test gateway restarts and enters the relay mode, and controls the new gateway to restart and enters the routing mode;
- the second gateway switching method is: while keeping the original data flow logic of the internal network unchanged, increase the control of the gateway to be tested Forwarding the flow of accessing the external network to the new gateway for processing, and controlling the process of the new gateway forwarding the flow returned by the external network to the gateway to be tested;
- the switching method of the third gateway is: controlling the The test gateway broadcasts the information of the new gateway that has completed the information configuration, so that the client sends the traffic for accessing the external network to the new gateway;
- the fourth gateway switching method is: replace the test gateway and the The IP of new gateway, and open the DHCP server of described new gateway while closing the DHCP server of described gateway to be tested.
- the embodiments of the present disclosure are applicable to a system having a gateway to be tested and several repeaters with new gateway functions, and the method can be executed by the gateway to be tested.
- the gateway to be tested detects its own operating status by regularly or irregularly monitoring the DNS domain name resolution request sent by the user and the response returned by the ISP according to the received DNS domain name resolution request, or by monitoring the download of the user's web page;
- the gateway to be tested determines that the connected ISP has a communication failure, and selects one of several repeaters with backup gateway functions as the new gateway;
- the gateway to be tested selects a preset gateway switching mode to perform gateway switching between the gateway to be tested and the selected new gateway.
- the method may also be executed by an additional external controller, which is not limited here.
- the gateway switching operation may be that the user or the manufacturer pre-sets selection rules for several stored gateway switching modes, and when a communication failure occurs in the ISP connected to the gateway to be tested, the gateway switching mode is performed according to the selection rules.
- a pop-up window may be used, but not limited to the pop-up window, for the user to select the switching mode, and then switch the gateway according to the received user selection.
- the selection rule can be: when monitoring the communication failure of the ISP connected to the gateway to be tested, if the time from the last gateway switching exceeds the preset time, indicating that the failure rate of the gateway to be tested is lower than the preset failure rate threshold, then choose the second gateway switching method that takes a short time, the client has no sense of gateway switching, and the conversion is not complete; If the switching time does not exceed the preset time, it means that the failure rate of the gateway to be tested is not lower than the preset failure rate threshold, so the second gateway switching method that is completely converted but takes a long time is selected.
- selection rules are not limited to the above specific rules, and can be set according to actual conditions.
- a gateway switching method disclosed in an embodiment of the present disclosure monitors the communication status of the ISP connected to the gateway to be tested, so that when a communication failure occurs in the ISP connected to the gateway to be tested, a gateway with a backup is selected.
- the repeater of the gateway function acts as a new gateway, and then in response to the gateway switching operation, selects a preset gateway switching mode to perform gateway switching; wherein, the gateway switching mode includes a first gateway switching mode, a second gateway switching mode, At least one of the third gateway switching mode and the fourth gateway switching mode, the first gateway switching mode is to control the gateway to be tested to restart and enter the relay mode, and control the new gateway to restart and enter the routing mode.
- the second gateway switching method is to increase the control of the gateway to be tested to forward the flow of accessing the external network to the new gateway for processing while keeping the original data flow logic of the internal network unchanged, and to control the new gateway to transfer the external
- the flow returned by the network is forwarded to the gateway to be tested for processing
- the third gateway switch mode is to control the gateway to be tested to complete the information broadcast of the new gateway that configures the information, so that the client will access the external network
- the traffic of the gateway to be tested is sent to the new gateway
- the fourth gateway switching method is to replace the IP of the gateway to be tested and the new gateway, and turn on the IP of the new gateway while closing the DHCP server of the gateway to be tested.
- DHCP server DHCP server.
- the embodiment of the present disclosure can use the repeater in the network system as a new gateway, and select an appropriate gateway switching mode to perform gateway switching when the ISP connected to the gateway to be tested has a communication failure, which improves the adaptability of the gateway backup .
- the first gateway switching method specifically includes steps S131a-S133a:
- S131a Disconnect the gateway to be tested, the new gateway, and other repeaters in the networking from the client;
- the gateway to be tested and all repeaters are disconnected from all clients, then the gateway to be tested enters the relay mode, other repeaters except the new gateway enter the detection mode, and the new gateway enters the routing mode;
- the repeater in the detection mode detects how the routing devices in the networking system form a network. Through detection, the repeater in the detection mode finds a new gateway in the routing state, or finds the routing device connected to the new gateway in the routing mode.
- detecting refers to sensing the existence of the master node (new gateway in routing mode) and establishing internal network communication (Backhaul) with it; after completing the networking, wait for Test gateways, new gateways, and other repeaters re-establish connections with clients.
- the initial state of the gateway to be tested is routing mode
- the initial state of all repeaters is relay mode.
- a device in relay mode is always looking for a device in route mode, or a device in relay mode that is already connected to a device in route mode, so there is no need to specifically Disconnect the connection of each device in the routing system and keep the original routing connection relationship.
- the gateway to be tested restarts to enter the relay mode, and the new gateway restarts to enter the routing mode, the status of the gateway to be tested becomes the relay mode.
- the original routing connection relationship cannot satisfy all the devices in the relay mode to be directly or indirectly connected with the devices in the routing mode. The direct or indirect connection of the gateway, and the routing connection relationship will change accordingly.
- the DHCP server switches from the gateway to be tested to the new gateway.
- the second gateway switching method specifically includes steps S131b-S132b:
- S132b Control the new gateway to perform information configuration according to the network configuration information, so that the new gateway forwards the traffic accessing the external network to the external network according to the NAT rule, and forwards the traffic returned from the external network according to the NAT rule to the internal network.
- the gateway to be tested sends the network configuration information stored by itself to the new gateway.
- the network configuration information includes but is not limited to the source IP, destination IP, source port, destination port, and various communication protocols recorded by the gateway to be tested; the new gateway Perform information configuration according to the network configuration information sent by the gateway to be tested, so that the new gateway forwards the traffic accessing the external network to the external network according to the NAT rules, and forwards the traffic returned from the external network to the internal network according to the NAT rules .
- FIG. 2 it is a data flow diagram of communication between other clients except the client of the new gateway itself and the external network after the gateway is switched. Except for the client of RE (new gateway) itself with a backup function, other access
- the Internet (external network) traffic is forwarded to the original FAP according to the data flow direction before the gateway switch, and forwarded by the original FAP to the RE with backup function, and then forwarded to the external network by the RE with backup function according to NAT rules;
- the functional RE receives the traffic returned from the Internet, it forwards it to the gateway to be tested according to the NAT rules, and then the gateway to be tested sends it to the corresponding client according to the data flow direction before the gateway switch; among them, the client of the new gateway itself refers to It is the client to which the data that needs to be forwarded by the new gateway belongs when the client transmits data with the external network before the gateway is switched.
- FAP refers to the device as a gateway in the internal network.
- the corresponding control system runs on the FAP, which can control the RE in the internal network, such as the rate of Backhaul, the switch of wireless WiFi, the switch of LED and the password of the network. etc.; in addition to the normal relay function, the RE can also respond to various operating commands issued by the FAP; in this embodiment, the FAP and the RE can be the same in hardware, and the functions of the two are controlled by software. It is actually required to switch modes between the FAP and the RE with the backup function.
- the data flow direction of the communication between the new gateway’s own client and the external network is as follows: the new gateway’s own client sends the traffic accessing the external network to the new gateway, and the new gateway forwards it to the external network; the traffic returned from the external network to the new gateway’s own client is sent by the new gateway.
- the gateway receives and forwards to the corresponding new gateway's own client.
- the DHCP server is still on the gateway to be tested after the gateway is switched by using the second gateway switching method.
- the third gateway switching method specifically includes steps S131c-S133c:
- S133c Control the other repeaters and the client to update their own network configuration information according to the DHCP message, so that the client sends the traffic for accessing the external network to the new gateway.
- the gateway to be tested sends the network data packet (network configuration information) to the selected temporary gateway (new gateway), so as to enable the temporary gateway and make the temporary gateway carry out information configuration (such as router, firewall, etc.) according to the network data packet;
- the temporary gateway completes the information configuration, it sends the information that has completed the information configuration to the gateway to be tested.
- the gateway to be tested receives the information that has completed the information configuration sent from the temporary gateway, it broadcasts a DHCP message, wherein the DHCP message Carry the information of the new temporary gateway; after other devices (other repeaters and clients) receive the DHCP message, other devices update their own network configuration information according to the DHCP message. After that, the data exchange between the internal network and the external network is forwarded by the new gateway.
- switching gateways using the third gateway switching method requires clients (such as mobile phones, PCs, etc.) to adapt to new protocols.
- the new protocol is to expand the existing DHCP protocol and add a DHCP message type named DHCPREOFFER (0x09).
- the format of this message is the same as DHCPOFFER.
- the parameters sent by the client have changed compared with the parameters obtained by the DHCP client before (such as changes in the default gateway, changes in the DNS server, changes in static routes, or changes in other dhcp option fields, etc.), the message is actively sent by the DHCP server, It is required that the DHCP client in the BOUND state can respond to this type of DHCP message. In addition, this type of message does not set transactionID. After receiving this type of message, the client should ignore this field, and then the client can independently choose to enter the DISCOVER state, or directly accept the parameters in the DHCPREOFFER message to enter the REQUESTING state.
- the DHCP server is still on the gateway to be tested after the gateway is switched using the third gateway switching method.
- the fourth gateway switching method specifically includes steps S131d-S133d:
- the client information list stored by the gateway to be tested is sent to the new gateway; wherein, the client information list is the lease information of the client, and is information related to DHCP Lease, including the client IP that has been allocated, the corresponding MAC, All necessary information such as the lease, the relevant information of the DHCP server itself, such as the scope of the address pool, etc., are always synchronized on each device (including the gateway to be tested, the new gateway, and other repeaters) in the internal network, which is the key of this embodiment.
- the inherent functions of the network system have been realized.
- the configuration in the synchronization mechanism will be sent to other devices through the inherent mechanism when it is updated. Each device has a complete set of configurations.
- the IP of the gateway to be tested is set to the IP of the current new gateway, then the DHCP server of the gateway to be tested is closed, the IP of the new gateway itself is set to the original IP of the gateway to be tested, and then the IP of the new gateway
- the DHCP server is turned on; the new gateway broadcasts its own new IP address and MAC address, announcing the binding relationship between its current IP and MAC, so that the client (mobile phone, PC, etc.) can still use the default gateway information previously obtained by itself , and directly send the traffic accessing the Internet to the new gateway.
- This gateway switching method is almost insensitive to the client. According to the synchronized client information list, the new gateway starts to perform the tasks that a normal DHCP server should undertake. work.
- a repeater with a backup gateway function is selected as a new gateway, specifically including steps S121-S123:
- the gateway to be tested when it is detected that the gateway to be tested is in a network failure, the gateway to be tested sends a message to the repeater in the network according to the network information list recorded on itself, and reports its own network failure, so that the repeater will Send the connectivity status of itself as a new gateway to the gateway to be tested within a certain period of time (the repeater can keep detecting the Internet connectivity operation, and can also detect after receiving the fault information reported by the gateway to be tested); Select a repeater as the new gateway based on the connectivity information reported by the received repeater.
- the method further includes: restoring the network to an initial state when it is detected that the ISP communication connected to the gateway to be tested returns to normal.
- the network when it is detected that the communication of the ISP connected to the gateway to be tested returns to normal, the network can be restored to the initial state according to the preset recovery mode, or it can be provided to the user through a pop-up window but not limited to a pop-up window.
- the selection of the recovery mode, and then the recovery of the network is performed according to the received user's selection.
- the gateway switching method provided by the embodiment of the present disclosure can use the repeater in the network system as a new gateway, and select an appropriate gateway switching method when the ISP connected to the gateway to be tested fails to communicate.
- Gateway switching improves the adaptability of gateway backup, without adding additional hardware modules, gateway switching can be realized only on home routers, the cost is low, and it is suitable for home scenarios.
- the physical connection of the internal network remains unchanged, but the logical relationship changes.
- the customer The network topology information (including the client's default routing information, etc.) stored on the terminal has not changed, and can be applied to scenarios with fixed IPs.
- the second aspect of the embodiment of the present disclosure provides a gateway switching device.
- FIG. 3 it is a structural block diagram of a preferred embodiment of the gateway switching device provided in the second aspect of the present disclosure.
- the devices include:
- the monitoring module 11 is configured to monitor the communication status of the ISP connected to the gateway to be tested;
- Gateway selection module 12 is configured to select a repeater with a backup gateway function as a new gateway when a communication failure occurs in the ISP connected to the gateway to be tested;
- the gateway switching module 13 is configured to select a preset gateway switching mode to perform gateway switching when responding to the gateway switching operation;
- the gateway switching mode includes at least one of the first gateway switching mode, the second gateway switching mode, the third gateway switching mode and the fourth gateway switching mode;
- the first gateway switching mode is: control the waiting The test gateway restarts and enters the relay mode, and controls the new gateway to restart and enters the routing mode;
- the second gateway switching method is: while keeping the original data flow logic of the internal network unchanged, increase the control of the gateway to be tested Forwarding the flow of accessing the external network to the new gateway for processing, and controlling the process of the new gateway forwarding the flow returned by the external network to the gateway to be tested;
- the switching method of the third gateway is: controlling the The test gateway broadcasts the information of the new gateway that has completed the information configuration, so that the client sends the traffic for accessing the external network to the new gateway;
- the fourth gateway switching method is: replace the test gateway and the The IP of new gateway, and open the DHCP server of described new gateway while closing the DHCP server of described gateway to be tested.
- the embodiments of the present disclosure are applicable to a system having a gateway to be tested and several repeaters with backup gateway functions.
- the device may be a gateway to be tested, or an additional external controller, which is not limited herein.
- the monitoring module 11 detects its own operating conditions by monitoring the DNS domain name resolution request sent by the user regularly or irregularly and the response returned by the ISP according to the received DNS domain name resolution request, or monitoring the user's webpage download situation;
- the gateway selection module 12 is when the gateway to be tested cannot detect the response returned by the IPS according to the received DNS domain name resolution request or the returned response has an error within the preset time, or detects that the web page has not been completed correctly within the preset time. During the complete download, it is determined that the ISP connected to the gateway to be tested has a communication failure, and one of several repeaters with backup gateway functions is selected as the new gateway;
- the gateway switching module selects a preset gateway switching mode to perform gateway switching between the gateway to be tested and the selected new gateway.
- the gateway switching operation may be that the user or the manufacturer pre-sets selection rules for several stored gateway switching modes, and when a communication failure occurs in the ISP connected to the gateway to be tested, the gateway switching mode is performed according to the selection rules.
- a pop-up window may be used, but not limited to the pop-up window, for the user to select the switching mode, and then switch the gateway according to the received user selection.
- the selection rule can be: when monitoring the communication failure of the ISP connected to the gateway to be tested, if the time from the last gateway switching exceeds the preset time, indicating that the failure rate of the gateway to be tested is lower than the preset failure rate threshold, then choose the second gateway switching method that takes a short time, the client has no sense of gateway switching, and the conversion is not complete; If the switching time does not exceed the preset time, it means that the failure rate of the gateway to be tested is not lower than the preset failure rate threshold, so the second gateway switching method that is completely converted but takes a long time is selected.
- selection rules are not limited to the above specific rules, and can be set according to actual conditions.
- the embodiment of the present disclosure discloses a gateway switching device, which monitors the communication status of the ISP connected to the gateway to be tested, so that when a communication failure occurs in the ISP connected to the gateway to be tested, select an ISP with a backup
- the repeater of the gateway function acts as a new gateway, and then in response to the gateway switching operation, selects a preset gateway switching mode to perform gateway switching; wherein, the gateway switching mode includes a first gateway switching mode, a second gateway switching mode, At least one of the third gateway switching mode and the fourth gateway switching mode, the first gateway switching mode is to control the gateway to be tested to restart and enter the relay mode, and control the new gateway to restart and enter the routing mode.
- the second gateway switching method is to increase the control of the gateway to be tested to forward the flow of accessing the external network to the new gateway for processing while keeping the original data flow logic of the internal network unchanged, and to control the new gateway to transfer the external
- the flow returned by the network is forwarded to the gateway to be tested for processing
- the third gateway switch mode is to control the gateway to be tested to complete the information broadcast of the new gateway that configures the information, so that the client will access the external network
- the traffic of the gateway to be tested is sent to the new gateway
- the fourth gateway switching method is to replace the IP of the gateway to be tested and the new gateway, and turn on the IP of the new gateway while closing the DHCP server of the gateway to be tested.
- DHCP server DHCP server.
- the repeater in the network system can be used as a new gateway, and when a communication failure occurs in the ISP connected to the gateway to be tested, an appropriate gateway switching method is selected to perform gateway switching, which improves the adaptability of gateway backup .
- the device further includes:
- the disconnection module 131a is configured to disconnect the gateway to be tested, the new gateway and other repeaters in the network from the client;
- the mode reselection module 132a is configured to control the gateway to be tested to restart and enter the relay mode, and control the new gateway to restart and enter the routing mode;
- the connection establishing module 133a is configured to establish a connection between the gateway to be tested, the new gateway and the other repeaters and the client.
- the gateway to be tested and all repeaters are disconnected from all clients, then the gateway to be tested enters the relay mode, other repeaters except the new gateway enter the detection mode, and the new gateway enters the routing mode;
- the repeater in the detection mode detects how the routing devices in the networking system form a network. Through detection, the repeater in the detection mode finds a new gateway in the routing state, or finds the routing device connected to the new gateway in the routing mode.
- detecting refers to sensing the existence of the master node (new gateway in routing mode) and establishing internal network communication (Backhaul) with it; after completing the networking, wait for Test gateways, new gateways, and other repeaters re-establish connections with clients.
- the initial state of the gateway to be tested is routing mode
- the initial state of all repeaters is relay mode.
- a device in relay mode is always looking for a device in route mode, or a device in relay mode that is already connected to a device in route mode, so there is no need to specifically Disconnect the connection of each device in the routing system and keep the original routing connection relationship.
- the gateway to be tested restarts to enter the relay mode, and the new gateway restarts to enter the routing mode, the status of the gateway to be tested becomes the relay mode.
- the original routing connection relationship cannot satisfy all the devices in the relay mode to be directly or indirectly connected with the devices in the routing mode. The direct or indirect connection of the gateway, and the routing connection relationship will change accordingly.
- the DHCP server switches from the gateway to be tested to the new gateway.
- the device further includes:
- the information sending module 131b is configured to control the gateway under test to send network configuration information to the new gateway;
- the information configuration module 132b is configured to control the new gateway to perform information configuration according to the network configuration information, so that the new gateway forwards the traffic accessing the external network to the external network according to the NAT rule, and forwards the traffic to the external network according to the NAT rule Traffic returned from the external network is forwarded to the internal network.
- the gateway to be tested sends the network configuration information stored by itself to the new gateway.
- the network configuration information includes but is not limited to the source IP, destination IP, source port, destination port, and various communication protocols recorded by the gateway to be tested; the new gateway Perform information configuration according to the network configuration information sent by the gateway to be tested, so that the new gateway forwards the traffic accessing the external network to the external network according to the NAT rules, and forwards the traffic returned from the external network to the internal network according to the NAT rules .
- FIG. 2 it is a data flow diagram of communication between other clients except the client of the new gateway itself and the external network after the gateway is switched. Except for the client of RE (new gateway) itself with a backup function, other access
- the Internet (external network) traffic is forwarded to the original FAP according to the data flow direction before the gateway switch, and forwarded by the original FAP to the RE with backup function, and then forwarded to the external network by the RE with backup function according to NAT rules;
- the functional RE receives the traffic returned from the Internet, it forwards it to the gateway to be tested according to the NAT rules, and then the gateway to be tested sends it to the corresponding client according to the data flow direction before the gateway switch; among them, the client of the new gateway itself refers to It is the client to which the data that needs to be forwarded by the new gateway belongs when the client transmits data with the external network before the gateway is switched.
- FAP refers to the device as a gateway in the internal network.
- the corresponding control system runs on the FAP, which can control the RE in the internal network, such as the rate of Backhaul, the switch of wireless WiFi, the switch of LED and the password of the network. etc.; in addition to the normal relay function, the RE can also respond to various operating commands issued by the FAP; in this embodiment, the FAP and the RE can be the same in hardware, and the functions of the two are controlled by software. It is actually required to switch modes between the FAP and the RE with the backup function.
- the data flow direction of the communication between the new gateway’s own client and the external network is as follows: the new gateway’s own client sends the traffic accessing the external network to the new gateway, and the new gateway forwards it to the external network; the traffic returned from the external network to the new gateway’s own client is sent by the new gateway.
- the gateway receives and forwards to the corresponding new gateway's own client.
- the DHCP server is still on the gateway to be tested after the gateway is switched by using the second gateway switching method.
- the device further includes:
- the information reconfiguration module 131c is configured to control the gateway under test to send the network configuration information to the new gateway, so that the new gateway performs information configuration according to the network configuration information;
- the message broadcasting module 132c is configured to control the gateway to be tested to broadcast a DHCP message after the new gateway completes information configuration; wherein, the DHCP message includes information about the new gateway;
- the information update module 133c is configured to control the other repeaters and clients to update their own network configuration information according to the DHCP message, so that the clients send traffic for accessing external networks to the new gateway.
- the gateway to be tested sends the network data packet (network configuration information) to the selected temporary gateway (new gateway), so as to enable the temporary gateway and make the temporary gateway carry out information configuration (such as router, firewall, etc.) according to the network data packet;
- the temporary gateway completes the information configuration, it sends the information that has completed the information configuration to the gateway to be tested.
- the gateway to be tested receives the information that has completed the information configuration sent from the temporary gateway, it broadcasts a DHCP message, wherein the DHCP message Carry the information of the new temporary gateway; after other devices (other repeaters and clients) receive the DHCP message, other devices update their own network configuration information according to the DHCP message. After that, the data exchange between the internal network and the external network is forwarded by the new gateway.
- switching gateways using the third gateway switching method requires clients (such as mobile phones, PCs, etc.) to adapt to new protocols.
- the new protocol is to expand the existing DHCP protocol and add a DHCP message type named DHCPREOFFER (0x09).
- the format of this message is the same as DHCPOFFER.
- the parameters sent by the client have changed compared with the parameters obtained by the DHCP client before (such as changes in the default gateway, changes in the DNS server, changes in static routes, or changes in other dhcp option fields, etc.), the message is actively sent by the DHCP server, It is required that the DHCP client in the BOUND state can respond to this type of DHCP message. In addition, this type of message does not set transactionID. After receiving this type of message, the client should ignore this field, and then the client can independently choose to enter the DISCOVER state, or directly accept the parameters in the DHCPREOFFER message to enter the REQUESTING state.
- the DHCP server is still on the gateway to be tested after the gateway is switched using the third gateway switching method.
- the device further includes:
- the list sending module 131d is configured to control the gateway under test to send the client information list to the new gateway; wherein, the client information list is lease information of the client;
- the server replacement module 132d is configured to replace the IP addresses of the gateway to be tested and the new gateway, and close the DHCP server of the gateway to be tested, and open the DHCP server of the new gateway;
- the information broadcasting module 133d is configured to control the new gateway to broadcast its own new IP address and MAC address.
- the client information list stored by the gateway to be tested is sent to the new gateway; wherein, the client information list is the lease information of the client, and is information related to DHCP Lease, including the client IP that has been allocated, the corresponding MAC, All necessary information such as the lease, the relevant information of the DHCP server itself, such as the scope of the address pool, etc., are always synchronized on each device (including the gateway to be tested, the new gateway, and other repeaters) in the internal network, which is the key of this embodiment.
- the inherent functions of the network system have been realized.
- the configuration in the synchronization mechanism will be sent to other devices through the inherent mechanism when it is updated. Each device has a complete set of configurations.
- the IP of the gateway to be tested is set to the IP of the current new gateway, then the DHCP server of the gateway to be tested is closed, the IP of the new gateway itself is set to the original IP of the gateway to be tested, and then the IP of the new gateway
- the DHCP server is turned on; the new gateway broadcasts its own new IP address and MAC address, announcing the binding relationship between its current IP and MAC, so that the client (mobile phone, PC, etc.) can still use the default gateway information previously obtained by itself , and directly send the traffic accessing the Internet to the new gateway.
- This gateway switching method is almost insensitive to the client. According to the synchronized client information list, the new gateway starts to perform the tasks that a normal DHCP server should undertake. work.
- the gateway selection module 12 specifically includes:
- the fault information sending module 121 is configured to control the gateway to be tested to send fault information to a repeater in the networking when a communication failure occurs in the ISP connected to the gateway to be tested;
- connection detection module 122 is configured to control the repeater in the network to detect its own network connection
- the gateway selection module 123 is configured to select a repeater with a backup gateway function as a new gateway according to the network connectivity of the repeater.
- the gateway to be tested when it is detected that the gateway to be tested is in a network failure, the gateway to be tested sends a message to the repeater in the network according to the network information list recorded on itself, and reports its own network failure, so that the repeater will Send the connectivity status of itself as a new gateway to the gateway to be tested within a certain period of time (the repeater can keep detecting the Internet connectivity operation, and can also detect after receiving the fault information reported by the gateway to be tested); Select a repeater as the new gateway based on the connectivity information reported by the received repeater.
- the device further includes: a gateway restoration module 14 configured to restore the network to the initial state when it is detected that the ISP communication connected to the gateway to be tested returns to normal.
- the network when it is detected that the communication of the ISP connected to the gateway to be tested returns to normal, the network can be restored to the initial state according to the preset recovery mode, or it can be provided to the user through a pop-up window but not limited to a pop-up window.
- the selection of the recovery mode, and then the recovery of the network is performed according to the received user's selection.
- the gateway switching device can use a repeater in the network system as a new gateway, and select an appropriate gateway switching method when a communication failure occurs in the ISP connected to the gateway to be tested.
- Gateway switching improves the adaptability of gateway backup, without adding additional hardware modules, gateway switching can be realized only on home routers, the cost is low, and it is suitable for home scenarios.
- FIG. 10 it is a structural block diagram of a preferred embodiment of a terminal device provided by the fourth aspect of the present disclosure.
- the terminal device includes a processor 21, a memory 22, and is stored in the memory 22 and is configured to be
- the device 21 executes the computer program, the functions of each module in the above-mentioned device embodiments, such as the monitoring module 11, are realized.
- the computer program may be divided into one or more modules, and the one or more modules are stored in the memory 22 and executed by the processor 21 to complete the present disclosure.
- the one or more modules may be a series of computer program instruction segments capable of accomplishing specific functions, and the instruction segments are configured to describe the execution process of the computer program in the terminal device.
- the computer program can be divided into a monitoring module 11, a gateway selection module 12 and a gateway switching module 13, and the specific functions of each module are as follows:
- the monitoring module 11 is configured to monitor the communication status of the ISP connected to the gateway to be tested;
- Gateway selection module 12 is configured to select a repeater with a backup gateway function as a new gateway when a communication failure occurs in the ISP connected to the gateway to be tested;
- the gateway switching module 13 is configured to select a preset gateway switching mode to perform gateway switching when responding to the gateway switching operation.
- the terminal device may be computing devices such as desktop computers, notebooks, palmtop computers, and cloud servers.
- the terminal device may include, but not limited to, a processor 21 and a memory 22 .
- a processor 21 and a memory 22 .
- the schematic diagram is only an example of a terminal device, and does not constitute a limitation to the terminal device, and may include more or less components than those shown in the figure, or combine certain components, or different components,
- the terminal device may also include an input and output device, a network access device, a bus, and the like.
- the processor 21 can be a central processing unit (Central Processing Unit, CPU), and can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
- the general-purpose processor may be a microprocessor or any conventional processor, etc.
- the processor 21 is the control center of the terminal device, and connects various parts of the entire terminal device with various interfaces and lines.
- the memory 22 may be configured to store the computer programs and/or modules, and the processor 21 runs or executes the computer programs and/or modules stored in the memory 22, and calls the computer programs and/or modules stored in the memory 22. data to realize various functions of the terminal device.
- the memory 22 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application program required by at least one function (such as the function of monitoring the communication status of the ISP connected to the gateway to be tested, selecting a new function of the gateway, etc.); the storage data area can store data created according to the operation of the network (such as network configuration information, firewall, etc.) and the like.
- memory 22 can include high-speed random access memory, and can also include non-volatile memory, such as hard disk, internal memory, plug-in hard disk, smart memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card), at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
- non-volatile memory such as hard disk, internal memory, plug-in hard disk, smart memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card), at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
- the integrated modules of the terminal equipment are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium.
- the present disclosure realizes all or part of the processes in the methods of the above embodiments, and can also be completed by instructing related hardware through computer programs.
- the computer programs can be stored in a computer-readable storage medium, and the computer When the program is executed by the processor, the steps in the above-mentioned various method embodiments can be realized.
- the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form.
- the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM, Read-Only Memory) , Random Access Memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.
- the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) or a random access memory (Random Access Memory, RAM), etc.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
本公开公开一种网关切换方法,包括:监测待测网关连接的ISP的通信状态;当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关;在响应于网关切换操作时,选择预设的网关切换方式进行网关切换。本公开还公开了一种网关切换装置、终端设备和存储介质,其能够利用网络系统中的中继器作为新网关,在待测网关连接的ISP出现通信故障时选择合适的网关切换方式进行网关切换,提高了网关备份的适配性。
Description
本公开以2021年07月06日递交的、申请号为202110764712.0且名称为“网关切换方法、装置、终端设备及计算机可读存储介质”的专利文件为优先权文件,该文件的全部内容通过引用结合在本公开中。
本公开涉及通信技术领域,尤其涉及一种网关切换方法、装置、终端设备及计算机可读存储介质。
ISP提供的网络接入服务质量良莠不齐,传统接入方式用户完全受制于ISP提供的宽带。为提高用户网络体验,保障用户在宽带质量较差甚至崩溃状况下继续享用网络服务,需对网关进行备份。现有常用的网关备份方案大多应用于稳定性和可靠性要求高的工业领域,在备份过程中通常需要增加额外的硬件模块,导致不适合家庭环境。另外,个别基于普通家用路由器的实现方案中,备份过程只存在于网络系统中主路由设备上,这种方案灵活性较差,用户只能选取具有多重接入方式的设备作为主路由使用。
发明内容
本公开实施例的目的是提供一种网关切换方法、装置、终端设备及计算机可读存储介质,能够利用网络系统中的中继器作为新网关,在待测网关连接的ISP出现通信故障时选择合适的网关切换方式进行网关切换,提高了网关备份的适配性。
为了解决上述技术问题,本公开实施例第一方面提供了一种网关切换方法,包括:
监测待测网关的连接的ISP的通信状态;
当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关;
在响应于网关切换操作时,选择预设的网关切换方式进行网关切换;
其中,所述网关切换方式包括第一网关切换方式、第二网关切换方式、第三网关切换方式和第四网关切换方式中的至少一种;所述第一网关切换方式为:控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式;所述第二网关切换方式为:在保持内部网络原本的数据流动逻辑不变的情况下,增加控制所述待测网关将访问外部网络的流量转发给所述新网关处理,以及控制所述新网关将外部网络返回的流量转发给所述待测网关处理的过程;所述第三网关切换方式为:控制所述待测网关将完成信息配置的所述新网关的信息广播,以使客户端将访问外部网络的流量发送至所述新网关;所述第四网关切换方式为:更换所述待测网关和所述新网关的IP,并在关闭所述待测网关的DHCP服务器的同时开启所述新网关的DHCP服务器。
作为上述方案的改进,所述第一网关切换方式具体为:
将所述待测网关、所述新网关和组网中的其它中继器断开与所述客户端的连接;
控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式;
将所述待测网关、所述新网关和所述其它中继器建立与所述客户端的连接。
作为上述方案的改进,所述第二网关切换方式具体为:
控制所述待测网关将网络配置信息发送至所述新网关;
控制所述新网关根据所述网络配置信息进行信息配置,以使所述新网关按照NAT规则将访问外部网络的流量转发至外部网络,并且按照所述NAT规则将外部网络返回 的流量转发至内部网络。
作为上述方案的改进,所述第三网关切换方式具体为:
控制所述待测网关将所述网络配置信息发送至所述新网关,以使所述新网关根据所述网络配置信息进行信息配置;
在所述新网关完成信息配置后,控制所述待测网关广播DHCP报文;其中,所述DHCP报文包含所述新网关的信息;
控制所述其它中继器和客户端根据所述DHCP报文更新自身的网络配置信息,以使所述客户端将访问外部网络的流量发送至所述新网关。
作为上述方案的改进,所述第四网关切换方式具体为:
控制所述待测网关将客户端信息列表发送给所述新网关;其中,所述客户端信息列表为所述客户端的租约信息;
更换所述待测网关和所述新网关的IP地址,并关闭所述待测网关的DHCP服务器,开启所述新网关的DHCP服务器;
控制所述新网关将自身的新的IP地址和MAC地址广播。
作为上述方案的改进,所述当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关,具体为:
当所述待测网关连接的ISP发生通信故障时,控制所述待测网关向组网中的中继器发送故障信息;
控制所述组网中的中继器探测自身的网络连通情况;
根据所述中继器的网络连通情况选择一个具有备份网关功能的中继器作为新网关。
作为上述方案的改进,所述方法还包括:当监测到所述待测网关连接的ISP通信恢复正常时,恢复网络到初始状态。
为了解决上述技术问题,本公开实施例第二方面提供了一种网关切换装置,包括:
监测模块,被配置为监测待测网关连接的ISP的通信状态;
网关选择模块,被配置为当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关;
网关切换模块,被配置为在响应于网关切换操作时,选择预设的网关切换方式进行网关切换;
其中,所述网关切换方式包括第一网关切换方式、第二网关切换方式、第三网关切换方式和第四网关切换方式中的至少一种;所述第一网关切换方式为:控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式;所述第二网关切换方式为:在保持内部网络原本的数据流动逻辑不变的情况下,增加控制所述待测网关将访问外部网络的流量转发给所述新网关处理,以及控制所述新网关将外部网络返回的流量转发给所述待测网关处理的过程;所述第三网关切换方式为:控制所述待测网关将完成信息配置的所述新网关的信息广播,以使客户端将访问外部网络的流量发送至所述新网关;所述第四网关切换方式为:更换所述待测网关和所述新网关的IP,并在关闭所述待测网关的DHCP服务器的同时开启所述新网关的DHCP服务器。
为了解决上述技术问题,本公开实施例第三方面提供了一种终端设备,包括处理器、存储器以及存储在所述存储器中且被配置为由所述处理器执行的计算机程序,所述处理器执行所述计算机程序时实现上述第一方面任一项所述的网关切换方法。
为了解决上述技术问题,本公开实施例第四方面提供了一种计算机可读存储介质, 所述计算机可读存储介质包括存储的计算机程序,其中,在所述计算机程序运行时控制所述计算机可读存储介质所在设备执行上述第一方面任一项所述的网关切换方法。
与现有技术相比,本公开实施例公开的一种网关切换方法、装置、设备及计算机可读存储介质,通过监测待测网关连接的ISP的通信状态,以当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关,进而在响应于网关切换操作时,选择预设的网关切换方式进行网关切换;其中,所述网关切换方式包括第一网关切换方式、第二网关切换方式、第三网关切换方式和第四网关切换方式中的至少一种,所述第一网关切换方式为控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式,所述第二网关切换方式为在保持内部网络原本的数据流动逻辑不变的情况下,增加控制所述待测网关将访问外部网络的流量转发给所述新网关处理,以及控制所述新网关将外部网络返回的流量转发给所述待测网关处理的过程,所述第三网关切换方式为控制所述待测网关将完成信息配置的所述新网关的信息广播,以使客户端将访问外部网络的流量发送至所述新网关,所述第四网关切换方式为更换所述待测网关和所述新网关的IP,并在关闭所述待测网关的DHCP服务器的同时开启所述新网关的DHCP服务器。由此可见,本公开实施例能够利用网络系统中的中继器作为新网关,在待测网关连接的ISP出现通信故障时选择合适的网关切换方式进行网关切换,提高了网关备份的适配性。
图1是本公开实施例第一方面提供的一种网关切换方法的一个优选实施例的流程图;
图2是本公开实施例第一方面提供的网关切换后的除新网关自身客户端外的其他客户端与外部网络通信的数据流向图;
图3是本公开实施例第二方面提供的一种网关切换装置的结构框图;
图4是本公开实施例第二方面提供的另一种网关切换装置的结构框图;
图5是本公开实施例第二方面提供的另一种网关切换装置的结构框图;
图6是本公开实施例第二方面提供的另一种网关切换装置的结构框图;
图7是本公开实施例第二方面提供的另一种网关切换装置的结构框图;
图8是本公开实施例第二方面提供的另一种网关切换装置的结构框图;
图9是本公开实施例第二方面提供的另一种网关切换装置的结构框图;
图10是本公开实施例第三方面提供的一种终端设备的结构框图。
下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本技术领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。
本公开实施例第一方面提供了一种网关切换方法,参见图1,是本公开一方面提供的一种网关切换方法的一个优选实施例的流程图,所述方法包括步骤S11~S13:
S11、监测待测网关连接的ISP的通信状态;
S12、当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关;
S13、在响应于网关切换操作时,选择预设的网关切换方式进行网关切换;
其中,所述网关切换方式包括第一网关切换方式、第二网关切换方式、第三网关 切换方式和第四网关切换方式中的至少一种;所述第一网关切换方式为:控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式;所述第二网关切换方式为:在保持内部网络原本的数据流动逻辑不变的情况下,增加控制所述待测网关将访问外部网络的流量转发给所述新网关处理,以及控制所述新网关将外部网络返回的流量转发给所述待测网关处理的过程;所述第三网关切换方式为:控制所述待测网关将完成信息配置的所述新网关的信息广播,以使客户端将访问外部网络的流量发送至所述新网关;所述第四网关切换方式为:更换所述待测网关和所述新网关的IP,并在关闭所述待测网关的DHCP服务器的同时开启所述新网关的DHCP服务器。
具体地,本公开实施例适用于具有待测网关和若干个具有新网关功能的中继器的系统,所述方法可以由待测网关执行。
待测网关通过定期或不定期监听用户发送的DNS域名解析请求以及ISP根据接收到的DNS域名解析请求返回的响应,或者监听用户网页下载情况等方式,来对自身的运行状况进行检测;
当待测网关在预设的时间内无法检测到IPS根据接收到的DNS域名解析请求返回的响应或者返回的响应出现错误,或者在预设的时间内检测到网页没有完成准确完整的下载,则待测网关判定连接的ISP发生通信故障,并在若干个具有备份网关功能的中继器中选出其中一个作为新网关;
待测网关响应于网关切换操作,选择预设的网关切换方式对待测网关和选出的新网关进行网关切换。
可选的,所述方法也可以由增设的外部控制器执行,在此不作限定。
可选的,所述网关切换操作可以是用户或者厂家预先对存储的若干种网关切换方式设定选用规则,当监测到待测网关连接的ISP发生通信故障时,按照选用规则进行网关切换方式的选择,也可以在监测到待测网关连接的ISP发生通信故障时,通过弹窗但不限于弹窗的方式以供用户进行切换方式的选择,进而根据接收到的用户的选择进行网关的切换。
示例性的,当系统中包括第一网关切换方式和第二网关切换方式,选用规则可以是:当监测到待测网关连接的ISP发生通信故障时,若距上一次网关切换的时间超过预设的时间,说明待测网关的故障率低于预设故障率阈值,则选用耗时短、客户端对网关切换无感且转换不彻底的第二网关切换方式进行网关切换;若距上一次网关切换的时间没有超过预设的时间,说明待测网关的故障率不低于预设故障率阈值,则选用转换彻底但耗时长的第二网关切换方式。
值得说明的是,选用规则并不局限于上述具体的规则,可根据实际情况进行设定。
与现有技术相比,本公开实施例公开的一种网关切换方法,通过监测待测网关连接的ISP的通信状态,以当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关,进而在响应于网关切换操作时,选择预设的网关切换方式进行网关切换;其中,所述网关切换方式包括第一网关切换方式、第二网关切换方式、第三网关切换方式和第四网关切换方式中的至少一种,所述第一网关切换方式为控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式,所述第二网关切换方式为在保持内部网络原本的数据流动逻辑不变的情况下,增加控制所述待测网关将访问外部网络的流量转发给所述新网关处理,以及控制所述新网关将外部网络返回的流量转发给所述待测网关处理的过程,所述第三网关切换方式为控制所述待测网关将完成信息配置的所述新网关的信息广播,以使客户端将访问外部网 络的流量发送至所述新网关,所述第四网关切换方式为更换所述待测网关和所述新网关的IP,并在关闭所述待测网关的DHCP服务器的同时开启所述新网关的DHCP服务器。由此可见,本公开实施例能够利用网络系统中的中继器作为新网关,在待测网关连接的ISP出现通信故障时选择合适的网关切换方式进行网关切换,提高了网关备份的适配性。
在另一种优选实施例中,所述第一网关切换方式具体包括步骤S131a~S133a:
S131a、将所述待测网关、所述新网关和组网中的其它中继器断开与所述客户端的连接;
S132a、控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式;
S133a、将所述待测网关、所述新网关和所述其它中继器建立与所述客户端的连接。
具体地,待测网关和所有中继器都断开与所有客户端的连接,接着待测网关进入中继模式,除新网关外的其它中继器进入探测模式,新网关进入路由模式;处于探测模式的中继器探测组网系统中的路由设备如何组成一个网络,通过探测使得处于探测模式的中继器找到处于路由状态的新网关,或者,找到与处于路由模式的新网关相连的路由设备,重新完成组网,组成子母路由网络;其中,探测指的是感知到主节点(处于路由模式的新网关)的存在并与之建立网络内部通讯(Backhaul);在完成组网后,待测网关、新网关和其它中继器重新建立与客户端的连接。
需要说明的是,系统中的所有中继器和待测网关组成路由系统,待测网关的初始状态为路由模式,所有中继器的初始状态为中继模式,在本实施例中,处于中继模式的设备总是在寻找处于路由模式的设备,或者寻找已经与处于路由模式的设备相连的处于中继模式的设备,因此,在路由系统断开与所有客户端的连接的情况下,无需专门断开路由系统中各个设备的连接,保持原有的路由连接关系即可,在待测网关重启进入中继模式,新网关重启进入路由模式之后,由于待测网关的状态变成了中继模式,原有的路由连接关系不能满足所有的处于中继模式的设备与处于路由模式的设备进行直接或间接的连接,因此,处于中继模式的设备将重新寻找并建立与当前处于路由模式的新网关的直接或间接的连接,路由连接关系进而发生改变。
需要说明的是,使用第一网关切换方式进行网关切换后的DHCP服务器从待测网关转换到新网关上。
在又一种优选实施例中,所述第二网关切换方式具体包括步骤S131b~S132b:
S131b、控制所述待测网关将网络配置信息发送至所述新网关;
S132b、控制所述新网关根据所述网络配置信息进行信息配置,以使所述新网关按照NAT规则将访问外部网络的流量转发至外部网络,并且按照所述NAT规则将外部网络返回的流量转发至内部网络。
具体地,待测网关将自身存储的网络配置信息发送至新网关,网络配置信息包括但不限于待测网关记载的源IP、目的IP、源端口、目的端口和各种通信协议等;新网关根据待测网关发送过来的网络配置信息进行信息配置,以使所述新网关按照NAT规则将访问外部网络的流量转发至外部网络,并且按照所述NAT规则将外部网络返回的流量转发至内部网络。
具体地,参见图2,为网关切换后的除新网关自身客户端外的其他客户端与外部网络通信的数据流向图,除了具有备份功能的RE(新网关)自身的客户端外,其他访问Internet(外部网络)的流量按照网关切换前的数据流向,被转发到原FAP,由原 FAP转发至具有备份功能的RE,再由具有备份功能的RE按照NAT规则转发至外部网络;当具有备份功能的RE接收到Internet返回的流量时,根据NAT规则将其转发至待测网关,再由待测网关按照网关切换前的数据流向发送至相应的客户端;其中,新网关自身客户端指的是网关切换前,客户端与外部网络进行数据传输时,需要经新网关转发的数据所属的客户端。其中,FAP指的是内部网络中作为网关的设备,在FAP上运行着相应的控制系统,可以控制内部网络中的RE,比如Backhaul的速率、无线WiFi的开关、LED的开关以及组网的密码等;RE除了正常的中继功能外,还可响应FAP下发的各种操作命令;在本实施例中,FAP和RE在硬件上可以是相同的,两者的功能由软件控制,可按照实际需求对FAP和具有备份功能的RE进行模式的切换。
新网关自身客户端与外部网络通信的数据流向为:新网关自身客户端将访问外部网络的流量发送至新网关,由新网关转发至外部网络;外部网络返回给新网关自身客户端的流量由新网关接收并转发至相应的新网关自身客户端。
需要说明的是,使用第二网关切换方式进行网关切换后的DHCP服务器依旧在待测网关上。
在又一种优选实施例中,所述第三网关切换方式具体包括步骤S131c~S133c:
S131c、控制所述待测网关将所述网络配置信息发送至所述新网关,以使所述新网关根据所述网络配置信息进行信息配置;
S132c、在所述新网关完成信息配置后,控制所述待测网关广播DHCP报文;其中,所述DHCP报文包含所述新网关的信息;
S133c、控制所述其它中继器和客户端根据所述DHCP报文更新自身的网络配置信息,以使所述客户端将访问外部网络的流量发送至所述新网关。
具体地,待测网关将网络数据包(网络配置信息)发送至选定的临时网关(新网关),以启用临时网关并使临时网关根据网络数据包进行信息配置(如路由器、防火墙等);临时网关在完成信息配置后发送已完成信息配置的信息至待测网关,待测网关在接收到从临时网关处发送过来的已完成信息配置的信息时,广播DHCP报文,其中,DHCP报文携带新的临时网关的信息;在其他设备(其它中继器和客户端)接收到DHCP报文后,其他设备根据DHCP报文更新自身的网络配置信息。此后,内部网络与外部网络的数据往来由新网关进行转发。
需要说明的是,使用第三网关切换方式进行网关切换需要客户端(如手机、PC等)适配新协议。新协议是对现有的DHCP协议进行扩展,增加一种名为DHCPREOFFER(0x09)的DHCP报文种类,该报文格式与DHCPOFFER相同,该报文由DHCP服务器主动发出,宣示了DHCP服务器希望给客户端下发的参数相比之前DHCP客户端拿到的参数发生了变化(比如默认网关变化、DNS服务器变化、静态路由变化或者其他dhcp option字段变化等),该报文由DHCP服务器主动发出,要求处于BOUND状态下的DHCP客户端能对此类型的DHCP报文作出响应,另外,此类型报文不设置transactionID,客户端收到此类型报文后应忽视这一字段,然后客户端可自主选择进入DISCOVER状态,或直接接受DHCPREOFFER报文中的参数进入REQUESTING状态。
需要说明的是,使用第三网关切换方式进行网关切换后的DHCP服务器依旧在待测网关上。
在又一种优选实施例中,所述第四网关切换方式具体包括步骤S131d~S133d:
S131d、控制所述待测网关将客户端信息列表发送给所述新网关;其中,所述客户端信息列表为所述客户端的租约信息;
S132d、更换所述待测网关和所述新网关的IP地址,并关闭所述待测网关的DHCP服务器,开启所述新网关的DHCP服务器;
S133d、控制所述新网关将自身的新的IP地址和MAC地址广播。
具体地,将待测网关存储的客户端信息列表发送给新网关;其中,客户端信息列表为客户端的租约信息,为DHCP Lease相关的信息,包括已经分配出去的客户端IP,对应的MAC,租约等所有必要信息,DHCP服务器本身的相关信息,比如地址池范围等在内部网络中各个设备上(包括待测网关、新网关和其它中继器)一直都是同步的,是本实施例的网络系统已经实现的固有功能,在同步机制中的配置在更新时会通过固有机制发送给其他设备,每个设备上都有一套完整的配置,如果需要同步某个配置,将这个配置项加入原有同步机制即可;待测网关自身的IP被设置为当前新网关的IP,接着待测网关的DHCP服务器关闭,新网关自身的IP被设置成待测网关的原先的IP,接着新网关的DHCP服务器开启;新网关将自身的新的IP地址和MAC地址广播,宣告自身的当前IP和MAC的绑定关系,以使客户端(手机、PC等)依然可以根据自身先前获取的默认网关信息,直接将访问Internet的流量发送给新网关,这种网关切换方式在客户端看来几乎无感,新网关根据同步过来的客户端信息列表,接力待测网关开始执行一个正常DHCP服务器所应承担的工作。
在又一种优选实施例中,所述当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关,具体包括步骤S121~S123:
S121、当所述待测网关连接的ISP发生通信故障时,控制所述待测网关向组网中的中继器发送故障信息;
S122、控制所述组网中的中继器探测自身的网络连通情况;
S123、根据所述中继器的网络连通情况选择一个具有备份网关功能的中继器作为新网关。
具体地,当检测到待测网关处于网络故障时,待测网关根据记录在自身上的网络信息列表向网络中的中继器发送报文,报告自身网络故障,以使中继器在规定的时间内向待测网关发送自身的作为新网关的连通状况(中继器可以一直保持探测Internet连通性的操作,也可以收到待测网关报告的故障信息后再进行探测);根据待测网关接收到的中继器报告的连通状况的信息选择一个中继器作为新网关。
在又一种优选实施例中,所述方法还包括:当监测到所述待测网关连接的ISP通信恢复正常时,恢复网络到初始状态。
可选的,当监测到所述待测网关连接的ISP的通信恢复正常时,可按照预设的恢复方式将网络恢复到初始状态,也可通过弹窗但不限于弹窗的方式以供用户恢复方式的选择,进而根据接收到的用户的选择进行网络的恢复。
与现有技术相比,本公开实施例提供的一种网关切换方法,能够利用网络系统中的中继器作为新网关,在待测网关连接的ISP发生通信故障时选择合适的网关切换方式进行网关切换,提高了网关备份的适配性,无需额外增加硬件模块,仅在家用路由器上即可实现网关切换,成本较低,适用于家庭场景。除了第一网关切换方式外,使用其他的网关切换方式进行网关切换,内部网络的物理连接都保持不变,只是逻辑关系发生变化,特别地,第二网关切换方式和第四网关切换方式中客户端存储的网络拓扑信息(包括客户端的默认路由信息等)也没有发生改变,可应用于固定IP的场景。
本公开实施例第二方面提供了一种网关切换装置,参见图3,是本公开第二方面提供的一种网关切换装置的一个优选实施例的结构框图。所述装置包括:
监测模块11,被配置为监测待测网关连接的ISP的通信状态;
网关选择模块12,被配置为当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关;
网关切换模块13,被配置为在响应于网关切换操作时,选择预设的网关切换方式进行网关切换;
其中,所述网关切换方式包括第一网关切换方式、第二网关切换方式、第三网关切换方式和第四网关切换方式中的至少一种;所述第一网关切换方式为:控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式;所述第二网关切换方式为:在保持内部网络原本的数据流动逻辑不变的情况下,增加控制所述待测网关将访问外部网络的流量转发给所述新网关处理,以及控制所述新网关将外部网络返回的流量转发给所述待测网关处理的过程;所述第三网关切换方式为:控制所述待测网关将完成信息配置的所述新网关的信息广播,以使客户端将访问外部网络的流量发送至所述新网关;所述第四网关切换方式为:更换所述待测网关和所述新网关的IP,并在关闭所述待测网关的DHCP服务器的同时开启所述新网关的DHCP服务器。
具体地,本公开实施例适用于具有待测网关和若干个具有备份网关功能的中继器的系统,所述装置可以是待测网关,也可以是增设的外部控制器,在此不作限定。
监测模块11通过定期或不定期监听用户发送的DNS域名解析请求以及ISP根据接收到的DNS域名解析请求返回的响应,或者监听用户网页下载情况等方式,来对自身的运行状况进行检测;
网关选择模块12在当待测网关在预设的时间内无法检测到IPS根据接收到的DNS域名解析请求返回的响应或者返回的响应出现错误,或者在预设的时间内检测到网页没有完成准确完整的下载时,判定待测网关连接的ISP发生通信故障,并在若干个具有备份网关功能的中继器中选出其中一个作为新网关;
网关切换模块响应于网关切换操作,选择预设的网关切换方式对待测网关和选出的新网关进行网关切换。
可选的,所述网关切换操作可以是用户或者厂家预先对存储的若干种网关切换方式设定选用规则,当监测到待测网关连接的ISP发生通信故障时,按照选用规则进行网关切换方式的选择,也可以在监测到待测网关连接的ISP发生通信故障时,通过弹窗但不限于弹窗的方式以供用户进行切换方式的选择,进而根据接收到的用户的选择进行网关的切换。
示例性的,当系统中包括第一网关切换方式和第二网关切换方式,选用规则可以是:当监测到待测网关连接的ISP发生通信故障时,若距上一次网关切换的时间超过预设的时间,说明待测网关的故障率低于预设故障率阈值,则选用耗时短、客户端对网关切换无感且转换不彻底的第二网关切换方式进行网关切换;若距上一次网关切换的时间没有超过预设的时间,说明待测网关的故障率不低于预设故障率阈值,则选用转换彻底但耗时长的第二网关切换方式。
值得说明的是,选用规则并不局限于上述具体的规则,可根据实际情况进行设定。
与现有技术相比,本公开实施例公开的一种网关切换装置,通过监测待测网关连接的ISP的通信状态,以当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关,进而在响应于网关切换操作时,选择预设的网关切换方式进行网关切换;其中,所述网关切换方式包括第一网关切换方式、第二网关切换方式、第三网关切换方式和第四网关切换方式中的至少一种,所述第一网关切换 方式为控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式,所述第二网关切换方式为在保持内部网络原本的数据流动逻辑不变的情况下,增加控制所述待测网关将访问外部网络的流量转发给所述新网关处理,以及控制所述新网关将外部网络返回的流量转发给所述待测网关处理的过程,所述第三网关切换方式为控制所述待测网关将完成信息配置的所述新网关的信息广播,以使客户端将访问外部网络的流量发送至所述新网关,所述第四网关切换方式为更换所述待测网关和所述新网关的IP,并在关闭所述待测网关的DHCP服务器的同时开启所述新网关的DHCP服务器。由此可见,本公开实施例能够利用网络系统中的中继器作为新网关,在待测网关连接的ISP出现通信故障时选择合适的网关切换方式进行网关切换,提高了网关备份的适配性。
在另一种优选实施例中,参见图4所述装置还包括:
连接断开模块131a,被配置为将所述待测网关、所述新网关和组网中的其它中继器断开与所述客户端的连接;
模式重选模块132a,被配置为控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式;
连接建立模块133a,被配置为将所述待测网关、所述新网关和所述其它中继器建立与所述客户端的连接。
具体地,待测网关和所有中继器都断开与所有客户端的连接,接着待测网关进入中继模式,除新网关外的其它中继器进入探测模式,新网关进入路由模式;处于探测模式的中继器探测组网系统中的路由设备如何组成一个网络,通过探测使得处于探测模式的中继器找到处于路由状态的新网关,或者,找到与处于路由模式的新网关相连的路由设备,重新完成组网,组成子母路由网络;其中,探测指的是感知到主节点(处于路由模式的新网关)的存在并与之建立网络内部通讯(Backhaul);在完成组网后,待测网关、新网关和其它中继器重新建立与客户端的连接。
需要说明的是,系统中的所有中继器和待测网关组成路由系统,待测网关的初始状态为路由模式,所有中继器的初始状态为中继模式,在本实施例中,处于中继模式的设备总是在寻找处于路由模式的设备,或者寻找已经与处于路由模式的设备相连的处于中继模式的设备,因此,在路由系统断开与所有客户端的连接的情况下,无需专门断开路由系统中各个设备的连接,保持原有的路由连接关系即可,在待测网关重启进入中继模式,新网关重启进入路由模式之后,由于待测网关的状态变成了中继模式,原有的路由连接关系不能满足所有的处于中继模式的设备与处于路由模式的设备进行直接或间接的连接,因此,处于中继模式的设备将重新寻找并建立与当前处于路由模式的新网关的直接或间接的连接,路由连接关系进而发生改变。
需要说明的是,使用第一网关切换方式进行网关切换后的DHCP服务器从待测网关转换到新网关上。
在又一种优选实施例中,参见图5,所述装置还包括:
信息发送模块131b,被配置为控制所述待测网关将网络配置信息发送至所述新网关;
信息配置模块132b,被配置为控制所述新网关根据所述网络配置信息进行信息配置,以使所述新网关按照NAT规则将访问外部网络的流量转发至外部网络,并且按照所述NAT规则将外部网络返回的流量转发至内部网络。
具体地,待测网关将自身存储的网络配置信息发送至新网关,网络配置信息包括 但不限于待测网关记载的源IP、目的IP、源端口、目的端口和各种通信协议等;新网关根据待测网关发送过来的网络配置信息进行信息配置,以使所述新网关按照NAT规则将访问外部网络的流量转发至外部网络,并且按照所述NAT规则将外部网络返回的流量转发至内部网络。
具体地,参见图2,为网关切换后的除新网关自身客户端外的其他客户端与外部网络通信的数据流向图,除了具有备份功能的RE(新网关)自身的客户端外,其他访问Internet(外部网络)的流量按照网关切换前的数据流向,被转发到原FAP,由原FAP转发至具有备份功能的RE,再由具有备份功能的RE按照NAT规则转发至外部网络;当具有备份功能的RE接收到Internet返回的流量时,根据NAT规则将其转发至待测网关,再由待测网关按照网关切换前的数据流向发送至相应的客户端;其中,新网关自身客户端指的是网关切换前,客户端与外部网络进行数据传输时,需要经新网关转发的数据所属的客户端。其中,FAP指的是内部网络中作为网关的设备,在FAP上运行着相应的控制系统,可以控制内部网络中的RE,比如Backhaul的速率、无线WiFi的开关、LED的开关以及组网的密码等;RE除了正常的中继功能外,还可响应FAP下发的各种操作命令;在本实施例中,FAP和RE在硬件上可以是相同的,两者的功能由软件控制,可按照实际需求对FAP和具有备份功能的RE进行模式的切换。
新网关自身客户端与外部网络通信的数据流向为:新网关自身客户端将访问外部网络的流量发送至新网关,由新网关转发至外部网络;外部网络返回给新网关自身客户端的流量由新网关接收并转发至相应的新网关自身客户端。
需要说明的是,使用第二网关切换方式进行网关切换后的DHCP服务器依旧在待测网关上。
在又一种优选实施例中,参见图6,所述装置还包括:
信息重配置模块131c,被配置为控制所述待测网关将所述网络配置信息发送至所述新网关,以使所述新网关根据所述网络配置信息进行信息配置;
报文广播模块132c,被配置为在所述新网关完成信息配置后,控制所述待测网关广播DHCP报文;其中,所述DHCP报文包含所述新网关的信息;
信息更新模块133c,被配置为控制所述其它中继器和客户端根据所述DHCP报文更新自身的网络配置信息,以使所述客户端将访问外部网络的流量发送至所述新网关。
具体地,待测网关将网络数据包(网络配置信息)发送至选定的临时网关(新网关),以启用临时网关并使临时网关根据网络数据包进行信息配置(如路由器、防火墙等);临时网关在完成信息配置后发送已完成信息配置的信息至待测网关,待测网关在接收到从临时网关处发送过来的已完成信息配置的信息时,广播DHCP报文,其中,DHCP报文携带新的临时网关的信息;在其他设备(其它中继器和客户端)接收到DHCP报文后,其他设备根据DHCP报文更新自身的网络配置信息。此后,内部网络与外部网络的数据往来由新网关进行转发。
需要说明的是,使用第三网关切换方式进行网关切换需要客户端(如手机、PC等)适配新协议。新协议是对现有的DHCP协议进行扩展,增加一种名为DHCPREOFFER(0x09)的DHCP报文种类,该报文格式与DHCPOFFER相同,该报文由DHCP服务器主动发出,宣示了DHCP服务器希望给客户端下发的参数相比之前DHCP客户端拿到的参数发生了变化(比如默认网关变化、DNS服务器变化、静态路由变化或者其他dhcp option字段变化等),该报文由DHCP服务器主动发出,要求处于BOUND状态下的DHCP客户端能对此类型的DHCP报文作出响应,另外,此类型报文不设置 transactionID,客户端收到此类型报文后应忽视这一字段,然后客户端可自主选择进入DISCOVER状态,或直接接受DHCPREOFFER报文中的参数进入REQUESTING状态。
需要说明的是,使用第三网关切换方式进行网关切换后的DHCP服务器依旧在待测网关上。
在又一种优选实施例中,参见图7,所述装置还包括:
列表发送模块131d,被配置为控制所述待测网关将客户端信息列表发送给所述新网关;其中,所述客户端信息列表为所述客户端的租约信息;
服务器更换模块132d,被配置为更换所述待测网关和所述新网关的IP地址,并关闭所述待测网关的DHCP服务器,开启所述新网关的DHCP服务器;
信息广播模块133d,被配置为控制所述新网关将自身的新的IP地址和MAC地址广播。
具体地,将待测网关存储的客户端信息列表发送给新网关;其中,客户端信息列表为客户端的租约信息,为DHCP Lease相关的信息,包括已经分配出去的客户端IP,对应的MAC,租约等所有必要信息,DHCP服务器本身的相关信息,比如地址池范围等在内部网络中各个设备上(包括待测网关、新网关和其它中继器)一直都是同步的,是本实施例的网络系统已经实现的固有功能,在同步机制中的配置在更新时会通过固有机制发送给其他设备,每个设备上都有一套完整的配置,如果需要同步某个配置,将这个配置项加入原有同步机制即可;待测网关自身的IP被设置为当前新网关的IP,接着待测网关的DHCP服务器关闭,新网关自身的IP被设置成待测网关的原先的IP,接着新网关的DHCP服务器开启;新网关将自身的新的IP地址和MAC地址广播,宣告自身的当前IP和MAC的绑定关系,以使客户端(手机、PC等)依然可以根据自身先前获取的默认网关信息,直接将访问Internet的流量发送给新网关,这种网关切换方式在客户端看来几乎无感,新网关根据同步过来的客户端信息列表,接力待测网关开始执行一个正常DHCP服务器所应承担的工作。
在又一种优选实施例中,参见图8,所述网关选择模块12,具体包括:
故障信息发送模块121,被配置为当所述待测网关连接的ISP发生通信故障时,控制所述待测网关向组网中的中继器发送故障信息;
连通探测模块122,被配置为控制所述组网中的中继器探测自身的网络连通情况;
网关选择模块123,被配置为根据所述中继器的网络连通情况选择一个具有备份网关功能的中继器作为新网关。
具体地,当检测到待测网关处于网络故障时,待测网关根据记录在自身上的网络信息列表向网络中的中继器发送报文,报告自身网络故障,以使中继器在规定的时间内向待测网关发送自身的作为新网关的连通状况(中继器可以一直保持探测Internet连通性的操作,也可以收到待测网关报告的故障信息后再进行探测);根据待测网关接收到的中继器报告的连通状况的信息选择一个中继器作为新网关。
在又一种优选实施例中,参见图9,所述装置还包括:网关恢复模块14,被配置为当监测到所述待测网关连接的ISP通信恢复正常时,恢复网络到初始状态。
可选的,当监测到所述待测网关连接的ISP的通信恢复正常时,可按照预设的恢复方式将网络恢复到初始状态,也可通过弹窗但不限于弹窗的方式以供用户恢复方式的选择,进而根据接收到的用户的选择进行网络的恢复。
与现有技术相比,本公开实施例提供的一种网关切换装置,能够利用网络系统中的中继器作为新网关,在待测网关连接的ISP发生通信故障时选择合适的网关切换方 式进行网关切换,提高了网关备份的适配性,无需额外增加硬件模块,仅在家用路由器上即可实现网关切换,成本较低,适用于家庭场景。
值得说明的是,具体的所述网关切换装置的工作过程可参考上述实施例中所述网关切换方法的工作过程,在此不再赘述。
参见图10,是本公开第四方面提供的一种终端设备的一个优选实施例的结构框图,所述终端设备,包括处理器21、存储器22以及存储在所述存储器22中且被配置为由所述处理器21执行的计算机程序,所述处理器21执行所述计算机程序时实现如上述网关切换方法实施例中的步骤,例如图1中所述的步骤S11~S13;或者,所述处理器21执行所述计算机程序时实现上述各装置实施例中各模块的功能,例如监测模块11。
示例性的,所述计算机程序可以被分割成一个或多个模块,所述一个或者多个模块被存储在所述存储器22中,并由所述处理器21执行,以完成本公开。所述一个或多个模块可以是能够完成特定功能的一系列计算机程序指令段,该指令段被配置为描述所述计算机程序在所述终端设备中的执行过程。例如,所述计算机程序可以被分割成监测模块11、网关选择模块12和网关切换模块13,各模块具体功能如下:
监测模块11,被配置为监测待测网关连接的ISP的通信状态;
网关选择模块12,被配置为当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关;
网关切换模块13,被配置为在响应于网关切换操作时,选择预设的网关切换方式进行网关切换。
各个模块具体的工作过程可参考上述实施例所述的网关切换装置的工作过程,在此不再赘述。
所述终端设备可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述终端设备可包括,但不仅限于,处理器21、存储器22。本领域技术人员可以理解,所述示意图仅仅是终端设备的示例,并不构成对终端设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端设备还可以包括输入输出设备、网络接入设备、总线等。
所述处理器21可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,所述处理器21是所述终端设备的控制中心,利用各种接口和线路连接整个终端设备的各个部分。
所述存储器22可被配置为存储所述计算机程序和/或模块,所述处理器21通过运行或执行存储在所述存储器22内的计算机程序和/或模块,以及调用存储在存储器22内的数据,实现所述终端设备的各种功能。所述存储器22可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如监测待测网关连接的ISP的通信状态的功能、选择新网关的功能等)等;存储数据区可存储根据网络的运行所创建的数据(比如网络配置信息、防火墙等)等。此外,存储器22可以包括高速随机存取存储器,还可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD) 卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
其中,所述终端设备集成的模块如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本公开实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
以上所述是本公开的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本公开原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本公开的保护范围。
Claims (10)
- 一种网关切换方法,其中,包括:监测待测网关连接的ISP的通信状态;当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关;在响应于网关切换操作时,选择预设的网关切换方式进行网关切换;其中,所述网关切换方式包括第一网关切换方式、第二网关切换方式、第三网关切换方式和第四网关切换方式中的至少一种;所述第一网关切换方式为:控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式;所述第二网关切换方式为:在保持内部网络原本的数据流动逻辑不变的情况下,增加控制所述待测网关将访问外部网络的流量转发给所述新网关处理,以及控制所述新网关将外部网络返回的流量转发给所述待测网关处理的过程;所述第三网关切换方式为:控制所述待测网关将完成信息配置的所述新网关的信息广播,以使客户端将访问外部网络的流量发送至所述新网关;所述第四网关切换方式为:更换所述待测网关和所述新网关的IP,并在关闭所述待测网关的DHCP服务器的同时开启所述新网关的DHCP服务器。
- 如权利要求1所述的网关切换方法,其中,所述第一网关切换方式具体为:将所述待测网关、所述新网关和组网中的其它中继器断开与所述客户端的连接;控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式;将所述待测网关、所述新网关和所述其它中继器建立与所述客户端的连接。
- 如权利要求1所述的网关切换方法,其中,所述第二网关切换方式具体为:控制所述待测网关将网络配置信息发送至所述新网关;控制所述新网关根据所述网络配置信息进行信息配置,以使所述新网关按照NAT规则将访问外部网络的流量转发至外部网络,并且按照所述NAT规则将外部网络返回的流量转发至内部网络。
- 如权利要求1所述的网关切换方法,其中,所述第三网关切换方式具体为:控制所述待测网关将网络配置信息发送至所述新网关,以使所述新网关根据所述网络配置信息进行信息配置;在所述新网关完成信息配置后,控制所述待测网关广播DHCP报文;其中,所述DHCP报文包含所述新网关的信息;控制其它中继器和客户端根据所述DHCP报文更新自身的网络配置信息,以使所述客户端将访问外部网络的流量发送至所述新网关。
- 如权利要求1所述的网关切换方法,其中,所述第四网关切换方式具体为:控制所述待测网关将客户端信息列表发送给所述新网关;其中,所述客户端信息列表为所述客户端的租约信息;更换所述待测网关和所述新网关的IP地址,并关闭所述待测网关的DHCP服务器,开启所述新网关的DHCP服务器;控制所述新网关将自身的新的IP地址和MAC地址广播。
- 如权利要求1所述的网关切换方法,其中,所述当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关,具体为:当所述待测网关连接的ISP发生通信故障时,控制所述待测网关向组网中的中继器发送故障信息;控制所述组网中的中继器探测自身的网络连通情况;根据所述中继器的网络连通情况选择一个具有备份网关功能的中继器作为新网 关。
- 如权利要求1所述的网关切换方法,其中,所述方法还包括:当监测到所述待测网关连接的ISP通信恢复正常时,恢复网络到初始状态。
- 一种网关切换装置,其中,包括:监测模块,被配置为监测待测网关连接的ISP的通信状态;网关选择模块,被配置为当所述待测网关连接的ISP发生通信故障时,选择一个具有备份网关功能的中继器作为新网关;网关切换模块,被配置为在响应于网关切换操作时,选择预设的网关切换方式进行网关切换;其中,所述网关切换方式包括第一网关切换方式、第二网关切换方式、第三网关切换方式和第四网关切换方式中的至少一种;所述第一网关切换方式为:控制所述待测网关重启进入中继模式,并控制所述新网关重启进入路由模式;所述第二网关切换方式为:在保持内部网络原本的数据流动逻辑不变的情况下,增加控制所述待测网关将访问外部网络的流量转发给所述新网关处理,以及控制所述新网关将外部网络返回的流量转发给所述待测网关处理的过程;所述第三网关切换方式为:控制所述待测网关将完成信息配置的所述新网关的信息广播,以使客户端将访问外部网络的流量发送至所述新网关;所述第四网关切换方式为:更换所述待测网关和所述新网关的IP,并在关闭所述待测网关的DHCP服务器的同时开启所述新网关的DHCP服务器。
- 一种终端设备,其中,包括处理器、存储器以及存储在所述存储器中且被配置为由所述处理器执行的计算机程序,所述处理器执行所述计算机程序时实现如权利要求1至7中任意一项所述的网关切换方法。
- 一种计算机可读存储介质,其中,所述计算机可读存储介质包括存储的计算机程序,其中,在所述计算机程序运行时控制所述计算机可读存储介质所在设备执行如权利要求1至7中任意一项所述的网关切换方法。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US18/406,242 US20240146687A1 (en) | 2021-07-06 | 2024-01-08 | Gateway Handover method and Apparatus, Terminal Device and Computer Readable Storage Medium |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110764712.0 | 2021-07-06 | ||
CN202110764712.0A CN113660109B (zh) | 2021-07-06 | 2021-07-06 | 网关切换方法、装置、终端设备及计算机可读存储介质 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US18/406,242 Continuation US20240146687A1 (en) | 2021-07-06 | 2024-01-08 | Gateway Handover method and Apparatus, Terminal Device and Computer Readable Storage Medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023280240A1 true WO2023280240A1 (zh) | 2023-01-12 |
Family
ID=78489126
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/104231 WO2023280240A1 (zh) | 2021-07-06 | 2022-07-06 | 网关切换方法、装置、终端设备及计算机可读存储介质 |
Country Status (3)
Country | Link |
---|---|
US (1) | US20240146687A1 (zh) |
CN (1) | CN113660109B (zh) |
WO (1) | WO2023280240A1 (zh) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113660109B (zh) * | 2021-07-06 | 2024-07-26 | 深圳市联洲国际技术有限公司 | 网关切换方法、装置、终端设备及计算机可读存储介质 |
CN114448783B (zh) * | 2022-01-11 | 2024-05-17 | 杭州涂鸦信息技术有限公司 | 设备替换方法以及相关装置 |
WO2023193154A1 (zh) * | 2022-04-06 | 2023-10-12 | 北京小米移动软件有限公司 | 多网关组网方法、装置、系统、网关设备及存储介质 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001127801A (ja) * | 1999-10-27 | 2001-05-11 | Fujitsu Ltd | ルータ |
US20050246431A1 (en) * | 2004-04-07 | 2005-11-03 | American Power Conversion Corporation | Method and apparatus for selecting forwarding modes |
JP2014175771A (ja) * | 2013-03-07 | 2014-09-22 | Nippon Telegraph & Telephone West Corp | 無線lanルータ |
CN105992262A (zh) * | 2016-06-30 | 2016-10-05 | 西安电子科技大学 | 一种无线Mesh网络的自适应模式切换方法 |
CN110839288A (zh) * | 2018-08-17 | 2020-02-25 | 上海诺基亚贝尔股份有限公司 | 家庭无线网络中的通信方法、设备和计算机可读存储介质 |
CN113660109A (zh) * | 2021-07-06 | 2021-11-16 | 深圳市联洲国际技术有限公司 | 网关切换方法、装置、终端设备及计算机可读存储介质 |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101895447B (zh) * | 2010-08-31 | 2012-06-13 | 迈普通信技术股份有限公司 | Sip中继网关故障监控方法以及sip中继网关 |
CN107360034B (zh) * | 2017-07-25 | 2021-03-19 | 美智光电科技股份有限公司 | 网关恢复方法、装置及其设备 |
CN107466079B (zh) * | 2017-08-17 | 2020-11-13 | 深圳市盛路物联通讯技术有限公司 | 自动中继切换方法及装置 |
CN110572275B (zh) * | 2019-08-01 | 2022-09-09 | 新华三技术有限公司成都分公司 | 一种网卡切换方法、装置、服务器及计算机可读存储介质 |
JP2021061478A (ja) * | 2019-10-03 | 2021-04-15 | セイコーソリューションズ株式会社 | 中継装置、中継システム、及び中継プログラム |
CN112543457B (zh) * | 2020-11-23 | 2021-09-03 | 广州技象科技有限公司 | 一种物联网终端的网关切换绑定方法及装置 |
-
2021
- 2021-07-06 CN CN202110764712.0A patent/CN113660109B/zh active Active
-
2022
- 2022-07-06 WO PCT/CN2022/104231 patent/WO2023280240A1/zh unknown
-
2024
- 2024-01-08 US US18/406,242 patent/US20240146687A1/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001127801A (ja) * | 1999-10-27 | 2001-05-11 | Fujitsu Ltd | ルータ |
US20050246431A1 (en) * | 2004-04-07 | 2005-11-03 | American Power Conversion Corporation | Method and apparatus for selecting forwarding modes |
JP2014175771A (ja) * | 2013-03-07 | 2014-09-22 | Nippon Telegraph & Telephone West Corp | 無線lanルータ |
CN105992262A (zh) * | 2016-06-30 | 2016-10-05 | 西安电子科技大学 | 一种无线Mesh网络的自适应模式切换方法 |
CN110839288A (zh) * | 2018-08-17 | 2020-02-25 | 上海诺基亚贝尔股份有限公司 | 家庭无线网络中的通信方法、设备和计算机可读存储介质 |
CN113660109A (zh) * | 2021-07-06 | 2021-11-16 | 深圳市联洲国际技术有限公司 | 网关切换方法、装置、终端设备及计算机可读存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN113660109B (zh) | 2024-07-26 |
US20240146687A1 (en) | 2024-05-02 |
CN113660109A (zh) | 2021-11-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10917262B2 (en) | VXLAN packet forwarding method, device, and system | |
WO2023280240A1 (zh) | 网关切换方法、装置、终端设备及计算机可读存储介质 | |
US11012355B2 (en) | Route processing method, device, and system | |
US11855809B2 (en) | Resilient zero touch provisioning | |
US8891358B2 (en) | Method for application broadcast forwarding for routers running redundancy protocols | |
US20050086385A1 (en) | Passive connection backup | |
US11451509B2 (en) | Data transmission method and computer system | |
US20210160182A1 (en) | Communication method, communications device, and communications system | |
EP3641241A1 (en) | Node protection for bum traffic for multi-homed node failure | |
WO2015041832A1 (en) | Redundancy network protocol system | |
WO2019080592A1 (zh) | 一种发送报文的方法和设备 | |
EP3675431A1 (en) | Core isolation for logical tunnels stitching multi-homed evpn and l2 circuit | |
CN106713039B (zh) | 以太网口的识别方法、装置及路由器 | |
CN103200117B (zh) | 一种负载均衡方法和装置 | |
US20210351956A1 (en) | Customer premises lan expansion | |
WO2022001669A1 (zh) | 建立vxlan隧道的方法及相关设备 | |
WO2022143818A1 (zh) | 故障处理方法、控制面网元、切换决策网元及相关设备 | |
US20220294728A1 (en) | Packet Transmission Path Switching Method, Device, and System | |
US11929851B2 (en) | Gateway selection method, device, and system | |
WO2013104279A1 (zh) | Trill网络中设置cvlan的方法和装置 | |
US20150334019A1 (en) | Routing control method and non-transitory computer-readable recording medium storing routing control program | |
US20080310319A1 (en) | Server, network system, and network connection method used for the same | |
JP3798754B2 (ja) | ルータを介して接続されたサブネットワーク間のブロードキャスト | |
CN116137582A (zh) | 基于cups bng的分组转发系统、方法和非暂态计算机可读存储介质 | |
CN110545240B (zh) | 基于分布式聚合系统的标签转发表的建立及报文转发方法 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22836985 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |