WO2017032058A1 - Network switching method and apparatus, and computer readable storage medium - Google Patents

Network switching method and apparatus, and computer readable storage medium Download PDF

Info

Publication number
WO2017032058A1
WO2017032058A1 PCT/CN2016/081319 CN2016081319W WO2017032058A1 WO 2017032058 A1 WO2017032058 A1 WO 2017032058A1 CN 2016081319 W CN2016081319 W CN 2016081319W WO 2017032058 A1 WO2017032058 A1 WO 2017032058A1
Authority
WO
WIPO (PCT)
Prior art keywords
network
router
address
fixed
fixed network
Prior art date
Application number
PCT/CN2016/081319
Other languages
French (fr)
Chinese (zh)
Inventor
高飞
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2017032058A1 publication Critical patent/WO2017032058A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/70Admission control; Resource allocation
    • H04L47/76Admission control; Resource allocation using dynamic resource allocation, e.g. in-call renegotiation requested by the user or requested by the network in response to changing network conditions
    • H04L47/765Admission control; Resource allocation using dynamic resource allocation, e.g. in-call renegotiation requested by the user or requested by the network in response to changing network conditions triggered by the end-points

Definitions

  • the present application is not limited to the field of communications, and in particular, to a network switching method, apparatus, and computer readable storage medium.
  • the uplink of the Customer Premises Equipment (CPE) product can only be fixed as a data network (for example, 4G) or a fixed network, wherein the fixed network includes a wired broadband pppoe dialing and a wired broadband dhcp method for applying for an Internet protocol.
  • IP Internet Protocol
  • the current uplink channel can only be fixed to 4G or fixed to the fixed network. If the switchover is to be performed, the operation needs to be manually performed on the webUI, the handover process cannot be automatically completed, and the restart is required, and the user experience is not good. No effective solution has been proposed.
  • the embodiment of the invention provides a network switching method, device and computer readable storage medium to solve the problem that the related art can only switch between the data network and the fixed network manually.
  • a network switching method including
  • the router monitors whether the router is connected to the fixed network device when connected to the first network.
  • the router When it is detected that the router is connected to the fixed network device, the router acquires an internet protocol IP address of the second network corresponding to the fixed network device.
  • the router switches from the first network to the second network according to the IP address.
  • the method further includes: before the router acquires an Internet Protocol IP address of the second network corresponding to the fixed network device, the router sends an application message to the fixed network device, The application message is used to apply for the IP address to the fixed network device.
  • the method further includes: after monitoring that the router is connected to the fixed network device, if the router cannot obtain the IP address, the router maintains a connection with the first network .
  • the method further includes: after the router switches from the first network to the second network according to the IP address, a chain between the router and a gateway of the second network In the case of a smooth road, the router maintains a connection with the second network; or, in a case where the link between the router and the gateway of the second network is not smooth, the router is The second network switches to the first network.
  • the first network comprises a data network.
  • a network switching device applied to a router, includes:
  • a monitoring module is configured to monitor whether the router is connected to the fixed network device if connected to the first network.
  • an obtaining module configured to acquire an Internet Protocol IP address of the second network corresponding to the fixed network device when the monitoring module detects that the router is connected to the fixed network device.
  • a switching module configured to switch from the first network to the second network according to the IP address.
  • the device further includes: a sending module, configured to send an application message to the fixed network device before the acquiring module acquires an Internet Protocol IP address of the second network corresponding to the fixed network device, where The application message is used to apply for the IP address to the fixed network device.
  • a sending module configured to send an application message to the fixed network device before the acquiring module acquires an Internet Protocol IP address of the second network corresponding to the fixed network device, where The application message is used to apply for the IP address to the fixed network device.
  • the device further includes: a holding module, configured to: after the monitoring module detects that the router is connected to the fixed network device, if the acquiring module cannot obtain the IP address, keep The connection of the first network.
  • a holding module configured to: after the monitoring module detects that the router is connected to the fixed network device, if the acquiring module cannot obtain the IP address, keep The connection of the first network.
  • the device further includes: an checking module, configured to check that the router is connected to the second after the switching module is switched from the first network to the second network according to the IP address Whether the link of the network is unobstructed, and if the result of the check is that the link of the router to the second network is unobstructed, the connection with the second network is maintained, and the result of the check is that the router is connected to the If the link of the second network is not smooth, the second network switches to the first network.
  • an checking module configured to check that the router is connected to the second after the switching module is switched from the first network to the second network according to the IP address Whether the link of the network is unobstructed, and if the result of the check is that the link of the router to the second network is unobstructed, the connection with the second network is maintained, and the result of the check is that the router is connected to the If the link of the second network is not smooth, the second network switches to the first network.
  • the first network comprises a data network.
  • a computer readable storage medium storing computer executable instructions that, when executed by a processor, implement the network switching method.
  • the router when the router is connected to the first network, the router monitors whether the router is connected to the fixed network device; when the router is connected to the fixed network device, the router acquires the corresponding device corresponding to the fixed network device.
  • the Internet Protocol IP address of the second network the router switches from the first network to the second network according to the IP address.
  • FIG. 1 is a flowchart of a network switching method according to an embodiment of the present invention.
  • FIG. 2 is a structural block diagram of a network switching apparatus according to an embodiment of the present invention.
  • FIG. 3 is a structural block diagram (1) of a network switching apparatus according to an embodiment of the present invention.
  • FIG. 4 is a structural block diagram (2) of a network switching apparatus according to an embodiment of the present invention.
  • FIG. 5 is a structural block diagram (3) of a network switching apparatus according to an embodiment of the present invention.
  • FIG. 6 is a block diagram of a module for implementing a 4G Internet access and a fixed network interconnection device according to an embodiment of the present invention
  • FIG. 7 is a flowchart of a method for implementing mutual switching between a 4G Internet access and a fixed online network according to an embodiment of the present invention.
  • FIG. 1 is a flowchart of a network switching method according to an embodiment of the present invention. As shown in FIG. 1, the process includes the following steps S101-S103:
  • the router monitors whether the router is connected to the fixed network device.
  • the router acquires an Internet Protocol IP address of the second network corresponding to the fixed network device.
  • the router switches from the first network to the second network according to the IP address.
  • the router monitors that the router is connected to the fixed network device, indicating that the router acquires the opportunity to connect to the fixed network, that is, the second network, and acquires the IP of the second network at the router. After the address, the first network can be switched to the second network.
  • the problem that the related technology can only switch between the data network and the fixed network can be solved manually, thereby realizing the automatic switching between the data network and the fixed network, thereby improving the user experience.
  • the router obtains the Internet Protocol IP address of the second network corresponding to the fixed network device. Before the router obtains the IP address, one or more necessary steps are required, which will be exemplified below.
  • the router before the router acquires an Internet Protocol IP address of the second network corresponding to the fixed network device, the router sends an application message to the fixed network device, where the application message is used to apply to the fixed network device. IP address. So that the fixed network device allocates the above IP address to the router according to the application information sent by the router.
  • the router After the router sends the application message to the fixed network device, the router may not obtain the IP address connected to the second network. Therefore, after the router is connected to the fixed network device, the terminal cannot obtain the terminal. In the case of the IP address, the router maintains a connection with the first network.
  • the router switches from the first network to the second network according to the IP address, check whether the link connected to the second network by the router is unobstructed, and the result of the check is that the router is connected to the second network. In the case that the link is unobstructed, the router maintains a connection with the second network. If the result of the check is that the link of the router to the second network is not smooth, the router is switched from the second network to the first network.
  • the detection method may include a plurality of types, for example, after checking that the multiplexed Ethernet port of the router is connected to the external device and the ip address is obtained from the external device, the route is The ping packet is sent to the Ethernet card connected to the external server to detect whether the fixed network link is normal.
  • the destination address of the ping packet is the gateway address of the server.
  • the ping packet command is: ping 10.10.10.10–I eth0. If the returned ping packet is received within the timeout period, the fixed network link is unobstructed. At this time, the fixed network link is maintained. If the returned ping packet cannot be received within the unit time, the fixed network link is different. To the 4G network, where the timeout can be set to 5 seconds.
  • the fixed network device includes one or more of the following: a Pppoe server and a dhcp server.
  • the first network includes a data network
  • the second network includes: a fixed network
  • the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation.
  • the technical solution of the present invention in essence or the contribution to the related art can be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, CD-ROM).
  • the instructions include a number of instructions for causing a terminal device (which may be a cell phone, computer, server, or network device, etc.) to perform the methods described in various embodiments of the present invention.
  • a network switching device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and has not been described again.
  • the term “module” may implement a combination of software and/or hardware of a predetermined function.
  • the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
  • FIG. 2 is a structural block diagram of a network switching device according to an embodiment of the present invention. As shown in FIG. 2, the device includes:
  • the monitoring module 11 is arranged to monitor whether the connection to the router is to a fixed network device if connected to the first network.
  • the obtaining module 12 is configured to obtain an Internet Protocol IP address of the second network corresponding to the fixed network device when the router is connected to the fixed network device.
  • the switching module 13 is configured to switch from the first network to the second network according to the IP address.
  • the apparatus includes: a transmitting module 14 configured to be in addition to all the modules shown in FIG. Before obtaining the IP address, the acquiring module sends an application message to the fixed network device, where the application message is used to apply for the IP address to the fixed network device.
  • the apparatus further includes: a holding module 15 configured to monitor, at the monitoring module 22, that the router is connected to a fixed network device. Thereafter, when the acquisition module 12 cannot obtain the IP address, the connection with the first network is maintained.
  • FIG. 5 is a structural block diagram (3) of a network switching apparatus according to an embodiment of the present invention.
  • the apparatus further includes: an checking module 16 configured to be configured by the switching module 13 according to the IP address. After the first network is switched to the second network, it is checked whether the link connected to the second network by the router is unobstructed, and if the result of the check is that the link of the router to the second network is unobstructed, The connection of the second network is switched by the second network to the first network if the result of the check is that the link of the router to the second network is not smooth.
  • the fixed network device includes one or more of the following: a Pppoe server and a dhcp server.
  • the first network includes a data network
  • the second network includes: a fixed network
  • each of the foregoing modules may be implemented by software or hardware.
  • the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the modules are located in multiple In the processor.
  • Embodiments of the present invention also provide a computer readable storage medium.
  • the foregoing storage medium may be configured to store program code for performing the following steps:
  • the terminal monitors whether the router corresponding to the terminal is connected to the fixed network device.
  • the terminal acquires an Internet Protocol IP address of the second network corresponding to the fixed network device.
  • the terminal switches from the first network to the second network according to the IP address.
  • the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • a mobile hard disk e.g., a hard disk
  • magnetic memory e.g., a hard disk
  • the processor executes according to the stored program code in the storage medium.
  • router equipment is widely used as a relatively portable communication terminal. It can choose different uplinks as the uplink channel to access the router.
  • the client provides access to the Internet service.
  • the optional uplink channels include: 4G gateway mode and wired broadband mode (where the wired broadband mode includes wired broadband dhcp and wired broadband pppoe).
  • the present embodiment provides a method for automatically switching between a 4G dial-up network and a fixed network.
  • the user can formulate a differentiated switching policy according to the 4G priority or the fixed network priority.
  • the method is: the device is powered on. After that, the default is 4G dial-up Internet access and 4G priority.
  • the device automatically initiates pppoe dialing application ip, and the device applies for ip through dhcp.
  • the current online mode will be automatically switched to wired broadband pppoe or wired broadband dhcp, and the user will normally access the Internet; if the pppoe server is detected but the authentication fails, it is judged whether it is 4G priority or fixed network priority, if it is 4G first The current mode is set to 4G dialing. If the fixed network priority is set, the current mode is set to the wired broadband pppoe. When the subsequent user accesses the webpage through the browser, the page is redirected to the page where the user name and password are set by pppoe.
  • the internal periodicity of the device monitors whether the fixed network path is unobstructed, and if it is smooth, it remains. Fixed network or switch from 4G to fixed network, if not, keep the current mode unchanged.
  • This embodiment proposes a device for implementing mutual switching between a router 4G Internet access and a fixed online network.
  • FIG. 6 is a block diagram of a module for implementing a 4G Internet access and a fixed network interconnection device according to an embodiment of the present invention.
  • the device involves four modules, namely, a fixed network module and a solid-state module.
  • the network applies for an ip module, a monitoring fixed network link smoothing module (corresponding to the above checking module 52), and a mode automatic switching module (corresponding to the above switching module 26).
  • the fixed network module is used to monitor whether the router is currently connected to the external fixed network device through the network cable.
  • the external device If it is found that the external device is connected, it is necessary to identify whether the current connection is a pppoe server or a dhcp server; applying to the fixed network for the ip module is responsible for sending the pppoe.
  • the request and the dhcp request apply for an ip address to the fixed network; if the ip address assigned to the fixed network is obtained, the monitoring of the fixed network link patency module inside the router periodically detects whether the link from the router to the fixed network gateway is unobstructed;
  • the module is responsible for determining whether to perform mode switching based on the detection result.
  • FIG. 7 is a flowchart of a method for implementing mutual switching between a 4G Internet access and a fixed online network according to an embodiment of the present invention. The following describes the entire function by using the functional flowchart shown in FIG. 7:
  • the device defaults to 4G gateway mode after booting. Therefore, it is first determined whether the current device is in 4G gateway mode. If not, it is modified to 4G gateway mode, and the routing related parameters are modified to 4G gateway corresponding parameters, and the routing parameters thereof. Including but not limited to dns address, firewall rules, etc.
  • the "discovery fixed network module” is responsible for periodically monitoring whether the router is connected to an external fixed network device, wherein the fixed network device includes but is not limited to a pppoe server or a dhcp server.
  • the discovery method is to monitor whether it is connected to an external device at the driver level.
  • the third step if the router is not connected to the external device, the 4G gateway mode is maintained; if the router is connected to the external device, the router sends an application ip request to the external device, and the sent request includes but is not limited to the pppoe request and the dhcp request. If the ip address is not applied from the fixed network device to perform the fourth step, otherwise the fifth step is performed.
  • the fourth step is to determine whether the external device connected to the router is detected as a pppoe server: if it is not a pppoe server, set the mode to 4G gateway mode and perform the second step; if it is a pppoe server, determine whether the default is fixed network priority or 4G gateway priority. If it is a fixed network priority, set the mode to wired broadband pppoe and continue to monitor whether the connected fixed network device changes. If it is not the fixed network priority, the 4G gateway takes precedence. At this time, the current mode is set to 4G gateway mode. And perform the second step.
  • the mode is set to the wired broadband dhcp mode, otherwise the mode is set to the wired broadband pppoe mode.
  • the wan side network card changes (for example, the usb0 of the wan side network card from the 4G gateway changes to the eth0 of the wired broadband), Therefore, it is necessary to update the parameters related to this.
  • the parameters to be updated include, but are not limited to, the routing table, the firewall rule, the router dns address, and the 4G connection needs to be disconnected because the uplink path is switched from the 4G gateway mode to the wired broadband mode.
  • the sixth step if unobstructed, indicates that the fixed network path is working normally and continues to maintain the current working mode; if it is not smooth, it may be due to the arrears of the fixed network or the network cable has been pulled out, etc. step.
  • the flowchart includes the following steps S701-S708:
  • S703 is set as a 4G gateway module.
  • step S705. Determine whether the router is connected to the fixed network. If the determination result is no, step S702 is performed. If the determination result is yes, step S706 is performed.
  • step S707. Determine whether the application for the fixed network IP is successful. If the application is successful, step S708 is performed. If the application is unsuccessful, step S713 is performed.
  • step S708 whether the pppoe server is found, if the determination result is yes, step S709 is performed, and if the determination result is no, step S710 is performed.
  • the setting mode is a wired broadband pppoe.
  • the setting mode is a wired broadband dhep.
  • step S713. Determine whether the fixed network is unobstructed. If the determination result is yes, step S714 is performed. If the determination result is no, step S715.
  • step S715. It is determined whether the pppoe server is found. If the determination result is YES, step S717 is performed. If the determination result is negative, step S716 is performed.
  • the setting mode is wired broadband pppoe.
  • the pppoe server is inserted into the WAN port of the router through the network cable, and the router recognizes that the pppoe server is currently connected, and sets the mode to the wired broadband pppoe mode. After the dialing succeeds, the router obtains from the pppoe server. Public network ip, you can go online. Insert a pppoe server into the WAN port of the router through the network cable. The router recognizes that the current connection is a pppoe server, and sets the mode to wired broadband pppoe mode. After entering the wrong username and password, the router cannot obtain the public network ip address.
  • the current mode is the wired broadband pppoe mode, and the current mode is set to 4G gateway mode under the priority of the 4G gateway.
  • the router recognizes that the current connection is a dhcp server, and sets the mode to wired broadband dhcp mode.
  • the router obtains the public network ip from the dhcp server and can access the Internet.
  • the router's WAN port does not connect to any external device, and the router sets the mode to 4G gateway mode.
  • the routing table, firewall rules, and router dns address are all updated to wired broadband mode.
  • the 4G connection is successfully disconnected.
  • the dynamic automatic switching between the 4G Internet access and the fixed online network on the router is realized, which satisfies the needs of users in different scenarios and improves the user experience.
  • all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve.
  • the devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
  • the device/function module/functional unit in the above embodiment When the device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium.
  • the above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
  • the router when the router is connected to the first network, the router monitors whether the router is connected to the fixed network device; when the router is connected to the fixed network device, the router acquires the corresponding device corresponding to the fixed network device.
  • the Internet Protocol IP address of the second network the router switches from the first network to the second network according to the IP address.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Disclosed are a network switching method and apparatus, and a computer readable storage medium. The method comprises: a router detects, when it is connected to a first network, whether it is connected to a fixed-network device; when detecting that the router is connected to a fixed-network device, the router obtains an Internet Protocol (IP) address of a second network corresponding to the fixed-network device; the router switches from the first network to the second network according to the IP address. The solution of the embodiments of the present invention solves the problem in the related art that switching between a data network and a fixed network can only be manually implemented, and implements the automatic switching between a data network and a fixed network, thereby improving user experience.

Description

一种网络切换方法、装置和计算机可读存储介质Network switching method, device and computer readable storage medium 技术领域Technical field
本申请但不限于通信领域,尤其涉及一种网络切换方法、装置和计算机可读存储介质。The present application is not limited to the field of communications, and in particular, to a network switching method, apparatus, and computer readable storage medium.
背景技术Background technique
相关技术中,用户端设备(Customer Premises Equipment,简称为CPE)产品的上行只能固定为数据网络(例如:4G)或固网,其中固网包括有线宽带pppoe拨号和有线宽带dhcp方式申请互联网协议(Internet Protocol,简称为IP)。若要将上行从4G切换到固网或从固网切换到4G,只能在webUI上手动进行切换,且切换后设备需要重启。In the related art, the uplink of the Customer Premises Equipment (CPE) product can only be fixed as a data network (for example, 4G) or a fixed network, wherein the fixed network includes a wired broadband pppoe dialing and a wired broadband dhcp method for applying for an Internet protocol. (Internet Protocol, referred to as IP). To switch the uplink from 4G to fixed network or from fixed network to 4G, you can only manually switch on the webUI, and the device needs to be restarted after switching.
针对相关技术中,只能将当前上行通路固定为4G或固定为固网,若要切换则需要手动在webUI上进行操作,切换过程无法自动完成,且需要重启,用户体验不好的问题,还未提出有效的解决方案。For the related technology, the current uplink channel can only be fixed to 4G or fixed to the fixed network. If the switchover is to be performed, the operation needs to be manually performed on the webUI, the handover process cannot be automatically completed, and the restart is required, and the user experience is not good. No effective solution has been proposed.
发明内容Summary of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this document. This Summary is not intended to limit the scope of the claims.
本发明实施例提出了一种网络切换方法、装置和计算机可读存储介质,以解决相关技术中只能通过手动实现数据网络与固网之间切换的问题。The embodiment of the invention provides a network switching method, device and computer readable storage medium to solve the problem that the related art can only switch between the data network and the fixed network manually.
一种网络切换方法,包括A network switching method, including
路由器在连接至第一网络的情况下,监测所述路由器是否连接至固网设备。The router monitors whether the router is connected to the fixed network device when connected to the first network.
当监测到所述路由器连接至固网设备时,所述路由器获取与所述固网设备对应的第二网络的互联网协议IP地址。When it is detected that the router is connected to the fixed network device, the router acquires an internet protocol IP address of the second network corresponding to the fixed network device.
所述路由器根据所述IP地址由所述第一网络切换至所述第二网络。The router switches from the first network to the second network according to the IP address.
可选地,所述方法还包括:在所述路由器获取与所述固网设备对应的第二网络的互联网协议IP地址之前,所述路由器向所述固网设备发送申请消息, 其中,所述申请消息用于向所述固网设备申请所述IP地址。Optionally, the method further includes: before the router acquires an Internet Protocol IP address of the second network corresponding to the fixed network device, the router sends an application message to the fixed network device, The application message is used to apply for the IP address to the fixed network device.
可选地,所述方法还包括:在监测到所述路由器连接至固网设备之后,在所述路由器无法获取到所述IP地址的情况下,所述路由器保持与所述第一网络的连接。Optionally, the method further includes: after monitoring that the router is connected to the fixed network device, if the router cannot obtain the IP address, the router maintains a connection with the first network .
可选地,所述方法还包括:在所述路由器根据所述IP地址由所述第一网络切换至所述第二网络之后,在所述路由器与所述第二网络的网关之间的链路通畅的情况下,所述路由器保持与所述第二网络的连接;或者,在所述路由器与所述第二网络的网关之间的链路不通畅的情况下,所述路由器由所述第二网络切换至所述第一网络。Optionally, the method further includes: after the router switches from the first network to the second network according to the IP address, a chain between the router and a gateway of the second network In the case of a smooth road, the router maintains a connection with the second network; or, in a case where the link between the router and the gateway of the second network is not smooth, the router is The second network switches to the first network.
可选地,所述第一网络包括数据网络。Optionally, the first network comprises a data network.
一种网络切换装置,应用于路由器,包括:A network switching device, applied to a router, includes:
监测模块,设置为在连接至第一网络的情况下,监测所述路由器是否连接至固网设备。A monitoring module is configured to monitor whether the router is connected to the fixed network device if connected to the first network.
获取模块,设置为当监测模块监测到所述路由器连接至固网设备时,获取与所述固网设备对应的第二网络的互联网协议IP地址。And an obtaining module, configured to acquire an Internet Protocol IP address of the second network corresponding to the fixed network device when the monitoring module detects that the router is connected to the fixed network device.
切换模块,设置为根据所述IP地址由所述第一网络切换至所述第二网络。And a switching module configured to switch from the first network to the second network according to the IP address.
可选地,所述装置还包括:发送模块,设置为在所述获取模块获取与所述固网设备对应的第二网络的互联网协议IP地址之前,向所述固网设备发送申请消息,其中,所述申请消息用于向所述固网设备申请所述IP地址。Optionally, the device further includes: a sending module, configured to send an application message to the fixed network device before the acquiring module acquires an Internet Protocol IP address of the second network corresponding to the fixed network device, where The application message is used to apply for the IP address to the fixed network device.
可选地,所述装置还包括:保持模块,设置为在监测模块监测到所述路由器连接至固网设备之后,在所述获取模块无法获取到所述IP地址的情况下,保持与所述第一网络的连接。Optionally, the device further includes: a holding module, configured to: after the monitoring module detects that the router is connected to the fixed network device, if the acquiring module cannot obtain the IP address, keep The connection of the first network.
可选地,所述装置还包括:检查模块,设置为在所述切换模块根据所述IP地址由所述第一网络切换至所述第二网络之后,检查所述路由器连接至所述第二网络的链路是否通畅,在检查结果为所述路由器连接至所述第二网络的链路通畅的情况下,保持与所述第二网络的连接,在检查结果为所述路由器连接至所述第二网络的链路不通畅的情况下,由所述第二网络切换至所述第一网络。 Optionally, the device further includes: an checking module, configured to check that the router is connected to the second after the switching module is switched from the first network to the second network according to the IP address Whether the link of the network is unobstructed, and if the result of the check is that the link of the router to the second network is unobstructed, the connection with the second network is maintained, and the result of the check is that the router is connected to the If the link of the second network is not smooth, the second network switches to the first network.
可选地,所述第一网络包括数据网络。Optionally, the first network comprises a data network.
一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被处理器执行时实现所述的网络切换方法。A computer readable storage medium storing computer executable instructions that, when executed by a processor, implement the network switching method.
本发明实施例方案,采用路由器在连接至第一网络的情况下,路由器监测该路由器是否连接至固网设备;当监测到该路由器连接至固网设备时,路由器获取与该固网设备对应的第二网络的互联网协议IP地址;路由器根据该IP地址由第一网络切换至第二网络。解决了相关技术中只能通过手动实现数据网络与固网之间切换的问题,进而实现了数据网络与固网之间的自动切换,提升了用户体验。In the embodiment of the present invention, when the router is connected to the first network, the router monitors whether the router is connected to the fixed network device; when the router is connected to the fixed network device, the router acquires the corresponding device corresponding to the fixed network device. The Internet Protocol IP address of the second network; the router switches from the first network to the second network according to the IP address. The problem that the related technology can only switch between the data network and the fixed network can be solved manually, thereby realizing the automatic switching between the data network and the fixed network, thereby improving the user experience.
附图概述BRIEF abstract
图1是根据本发明实施例的网络切换方法的流程图;1 is a flowchart of a network switching method according to an embodiment of the present invention;
图2是根据本发明实施例的网络切换装置的结构框图;2 is a structural block diagram of a network switching apparatus according to an embodiment of the present invention;
图3是根据本发明实施例的网络切换装置的结构框图(一);3 is a structural block diagram (1) of a network switching apparatus according to an embodiment of the present invention;
图4是根据本发明实施例的网络切换装置的结构框图(二);4 is a structural block diagram (2) of a network switching apparatus according to an embodiment of the present invention;
图5是根据本发明实施例的网络切换装置的结构框图(三);FIG. 5 is a structural block diagram (3) of a network switching apparatus according to an embodiment of the present invention; FIG.
图6是根据本发明实施例的实现4G上网与固网上网互切换装置的模块结构图;6 is a block diagram of a module for implementing a 4G Internet access and a fixed network interconnection device according to an embodiment of the present invention;
图7是根据本发明实施例的实现4G上网与固网上网互切换方法的流程图。FIG. 7 is a flowchart of a method for implementing mutual switching between a 4G Internet access and a fixed online network according to an embodiment of the present invention.
本发明的实施方式Embodiments of the invention
下文中将参考附图并结合实施例来详细说明本发明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。The invention will be described in detail below with reference to the drawings in conjunction with the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。 It is to be understood that the terms "first", "second" and the like in the specification and claims of the present invention are used to distinguish similar objects, and are not necessarily used to describe a particular order or order.
在本实施例中提供了一种网络切换方法,图1是根据本发明实施例的网络切换方法的流程图,如图1所示,该流程包括如下步骤S101-S103:A network switching method is provided in this embodiment. FIG. 1 is a flowchart of a network switching method according to an embodiment of the present invention. As shown in FIG. 1, the process includes the following steps S101-S103:
S101、路由器在连接至第一网络的情况下,路由器监测该路由器是否连接至固网设备。S101. When the router is connected to the first network, the router monitors whether the router is connected to the fixed network device.
S102、当监测到所述路由器连接至固网设备时,路由器获取与该固网设备对应的第二网络的互联网协议IP地址。S102. When it is detected that the router is connected to the fixed network device, the router acquires an Internet Protocol IP address of the second network corresponding to the fixed network device.
S103、路由器根据该IP地址由第一网络切换至第二网络。S103. The router switches from the first network to the second network according to the IP address.
通过上述步骤,路由器在连接至第一网络的情况下,路由器监测到该路由器连接至固网设备,说明路由器获取了连接至固网即上述第二网络的机会,在路由器获取第二网络的IP地址之后,可以由第一网络切换至第二网络。解决了相关技术中只能通过手动实现数据网络与固网之间切换的问题,进而实现了数据网络与固网之间的自动切换,提升了用户体验。Through the above steps, when the router is connected to the first network, the router monitors that the router is connected to the fixed network device, indicating that the router acquires the opportunity to connect to the fixed network, that is, the second network, and acquires the IP of the second network at the router. After the address, the first network can be switched to the second network. The problem that the related technology can only switch between the data network and the fixed network can be solved manually, thereby realizing the automatic switching between the data network and the fixed network, thereby improving the user experience.
上述步骤S102中涉及到路由器获取与该固网设备对应的第二网络的互联网协议IP地址,在路由器获取到上述IP地址之前,需要一个或者多个必要的步骤,下面对此进行举例说明。In the above step S102, the router obtains the Internet Protocol IP address of the second network corresponding to the fixed network device. Before the router obtains the IP address, one or more necessary steps are required, which will be exemplified below.
可选地,在所述路由器获取与所述固网设备对应的第二网络的互联网协议IP地址之前,路由器向该固网设备发送申请消息,其中,该申请消息用于向固网设备申请该IP地址。以便于固网设备根据路由器发送的申请信息为路由器分配上述IP地址。Optionally, before the router acquires an Internet Protocol IP address of the second network corresponding to the fixed network device, the router sends an application message to the fixed network device, where the application message is used to apply to the fixed network device. IP address. So that the fixed network device allocates the above IP address to the router according to the application information sent by the router.
路由器向该固网设备发送申请消息之后,有可能路由器不能获取到连接至第二网络的IP地址,因此,可选地,在监测到所述路由器连接至固网设备之后,在终端无法获取到该IP地址的情况下,路由器保持与该第一网络的连接。After the router sends the application message to the fixed network device, the router may not obtain the IP address connected to the second network. Therefore, after the router is connected to the fixed network device, the terminal cannot obtain the terminal. In the case of the IP address, the router maintains a connection with the first network.
可选地,在路由器根据该IP地址由第一网络切换至第二网络之后,检查路由器连接至该第二网络的链路是否通畅,在检查结果为所述路由器连接至所述第二网络的链路通畅的情况下,路由器保持与第二网络的连接,在检查结果为所述路由器连接至所述第二网络的链路不通畅的情况下,路由器由第二网络切换至第一网络。其中检测方式可以包括很多种,例如:在检查到路由器的复用以太网口连接了外部设备并且从外部设备获取到ip地址后,路由 器向连接外部服务器的以太网卡发送ping包进行检测固网链路是否通常,ping包的目的地址是服务器的网关地址,举例来说ping包命令为:ping 10.10.10.10–I eth0。若在超时时间内收到返回的ping包则说明固网链路通畅,此时保持固网链路,若在单位时间内无法收到返回的ping包说明固网链路不同,此时需要切换到4G网络,其中,超时时间可以设置为5秒。Optionally, after the router switches from the first network to the second network according to the IP address, check whether the link connected to the second network by the router is unobstructed, and the result of the check is that the router is connected to the second network. In the case that the link is unobstructed, the router maintains a connection with the second network. If the result of the check is that the link of the router to the second network is not smooth, the router is switched from the second network to the first network. The detection method may include a plurality of types, for example, after checking that the multiplexed Ethernet port of the router is connected to the external device and the ip address is obtained from the external device, the route is The ping packet is sent to the Ethernet card connected to the external server to detect whether the fixed network link is normal. The destination address of the ping packet is the gateway address of the server. For example, the ping packet command is: ping 10.10.10.10–I eth0. If the returned ping packet is received within the timeout period, the fixed network link is unobstructed. At this time, the fixed network link is maintained. If the returned ping packet cannot be received within the unit time, the fixed network link is different. To the 4G network, where the timeout can be set to 5 seconds.
可选地,该固网设备包括以下一种或多种:Pppoe服务器和dhcp服务器。Optionally, the fixed network device includes one or more of the following: a Pppoe server and a dhcp server.
可选地,该第一网络包括数据网络;该第二网络包括:固网。Optionally, the first network includes a data network; the second network includes: a fixed network.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation. Based on such understanding, the technical solution of the present invention in essence or the contribution to the related art can be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, CD-ROM). The instructions include a number of instructions for causing a terminal device (which may be a cell phone, computer, server, or network device, etc.) to perform the methods described in various embodiments of the present invention.
在本实施例中还提供了一种网络切换装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。In the embodiment, a network switching device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and has not been described again. As used below, the term "module" may implement a combination of software and/or hardware of a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
在本实施例中还提供了一种网络切换装置,应用于路由器,图2是根据本发明实施例的网络切换装置的结构框图,如图2所示,该装置包括:In this embodiment, a network switching device is also provided, which is applied to a router. FIG. 2 is a structural block diagram of a network switching device according to an embodiment of the present invention. As shown in FIG. 2, the device includes:
监测模块11,设置为在连接至第一网络的情况下,监测与该路由器连接是否至固网设备。The monitoring module 11 is arranged to monitor whether the connection to the router is to a fixed network device if connected to the first network.
获取模块12,设置为当监测到路由器连接至固网设备时,获取与该固网设备对应的第二网络的互联网协议IP地址。The obtaining module 12 is configured to obtain an Internet Protocol IP address of the second network corresponding to the fixed network device when the router is connected to the fixed network device.
切换模块13,设置为根据该IP地址由该第一网络切换至该第二网络。The switching module 13 is configured to switch from the first network to the second network according to the IP address.
图3是根据本发明实施例的网络切换装置的结构框图(一),如图3所示,该装置除包括图2所示的所有模块外,还包括:发送模块14,设置为在 该获取模块获取该IP地址之前,向该固网设备发送申请消息,其中,该申请消息用于向该固网设备申请该IP地址。3 is a structural block diagram (1) of a network switching apparatus according to an embodiment of the present invention. As shown in FIG. 3, the apparatus includes: a transmitting module 14 configured to be in addition to all the modules shown in FIG. Before obtaining the IP address, the acquiring module sends an application message to the fixed network device, where the application message is used to apply for the IP address to the fixed network device.
图4是根据本发明实施例的网络切换装置的结构框图(二),如图4所示,该装置还包括:保持模块15,设置为在监测模块22监测到所述路由器连接至固网设备之后,在该获取模块12无法获取到该IP地址的情况下,保持与该第一网络的连接。4 is a structural block diagram (2) of a network switching apparatus according to an embodiment of the present invention. As shown in FIG. 4, the apparatus further includes: a holding module 15 configured to monitor, at the monitoring module 22, that the router is connected to a fixed network device. Thereafter, when the acquisition module 12 cannot obtain the IP address, the connection with the first network is maintained.
图5是根据本发明实施例的网络切换装置的结构框图(三),如图5所示,该装置还包括:检查模块16,设置为在所述切换模块13根据所述IP地址由所述第一网络切换至所述第二网络之后,检查路由器连接至该第二网络的链路是否通畅,在检查结果为所述路由器连接至所述第二网络的链路通畅的情况下,保持与该第二网络的连接,在检查结果为所述路由器连接至所述第二网络的链路不通畅的情况下,该路由器由该第二网络切换至该第一网络。FIG. 5 is a structural block diagram (3) of a network switching apparatus according to an embodiment of the present invention. As shown in FIG. 5, the apparatus further includes: an checking module 16 configured to be configured by the switching module 13 according to the IP address. After the first network is switched to the second network, it is checked whether the link connected to the second network by the router is unobstructed, and if the result of the check is that the link of the router to the second network is unobstructed, The connection of the second network is switched by the second network to the first network if the result of the check is that the link of the router to the second network is not smooth.
可选地,该固网设备包括以下一种或多种:Pppoe服务器和dhcp服务器。Optionally, the fixed network device includes one or more of the following: a Pppoe server and a dhcp server.
可选地,该第一网络包括数据网络;该第二网络包括:固网。Optionally, the first network includes a data network; the second network includes: a fixed network.
需要说明的是,上述每个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述模块分别位于多个处理器中。It should be noted that each of the foregoing modules may be implemented by software or hardware. For the latter, the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the modules are located in multiple In the processor.
本发明的实施例还提供了一种计算机可读存储介质。可选地,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的程序代码:Embodiments of the present invention also provide a computer readable storage medium. Optionally, in the embodiment, the foregoing storage medium may be configured to store program code for performing the following steps:
S1,终端在连接至第一网络的情况下,终端监测与该终端对应的路由器是否连接至固网设备;S1. When the terminal is connected to the first network, the terminal monitors whether the router corresponding to the terminal is connected to the fixed network device.
S2,当监测到所述路由器连接至固网设备时,终端获取与该固网设备对应的第二网络的互联网协议IP地址。S2. When it is detected that the router is connected to the fixed network device, the terminal acquires an Internet Protocol IP address of the second network corresponding to the fixed network device.
S3,终端根据该IP地址由第一网络切换至第二网络。S3. The terminal switches from the first network to the second network according to the IP address.
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。Optionally, in this embodiment, the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory. A variety of media that can store program code, such as a disc or a disc.
可选地,在本实施例中,处理器根据存储介质中已存储的程序代码执行 上述S1、S2和S3。Optionally, in this embodiment, the processor executes according to the stored program code in the storage medium. The above S1, S2 and S3.
可选地,本实施例中的示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。For example, the examples in this embodiment may refer to the examples described in the foregoing embodiments and the optional embodiments, and details are not described herein again.
随着互联网的快速发展,尤其是4G、固网等业务的快速发展与普及,路由器设备作为一种较为便携式的通讯终端得到广泛应用,其自身可以选择不同上行出口作为上行通路为接入到路由器的客户端提供接入上网服务,目前可选的上行通路包括:4G网关模式、有线宽带模式(其中,有线宽带模式包括有线宽带dhcp和有线宽带pppoe)。这两种模式各有特点:固网(路由器处于有线宽带模式)特别是光纤网络具有上网稳定、网速快的特点,但固网铺设成本较高;4G上网不受环境的影响,只要插入SIM卡完成4G拨号后即可上网,但缺点是资费较高。因此,一个较好的方法是在有固网的环境下使用有线宽带上网,在没有固网的环境下使用4G拨号上网。但目前路由器设备只能手动选择4G拨号上网或使用固网上网,若要完成二者之间的切换需要用户手动在页面上完成,用户体验不良好。With the rapid development of the Internet, especially the rapid development and popularization of 4G and fixed network services, router equipment is widely used as a relatively portable communication terminal. It can choose different uplinks as the uplink channel to access the router. The client provides access to the Internet service. Currently, the optional uplink channels include: 4G gateway mode and wired broadband mode (where the wired broadband mode includes wired broadband dhcp and wired broadband pppoe). These two modes have their own characteristics: fixed network (router is in wired broadband mode), especially fiber-optic network has the characteristics of stable Internet access and fast network speed, but the cost of fixed network laying is high; 4G Internet access is not affected by the environment, just insert SIM After the card is 4G dialed, the Internet can be accessed, but the disadvantage is that the tariff is higher. Therefore, a better method is to use wired broadband Internet access in a fixed network environment, and use 4G dial-up Internet access in an environment without a fixed network. However, at present, the router device can only manually select 4G dial-up or use the fixed network. To complete the switchover between the two, the user needs to manually complete the page, and the user experience is not good.
针对以上问题,本可选实施例提出一种用于实现4G拨号上网与固网上网自动切换的方法,用户可以根据4G优先或固网优先制定差异化的切换策略,实现方法是:设备上电后默认为4G拨号上网且4G优先,当监测到路由器上连接固网的网口有网线插入后设备内部自动发起pppoe拨号申请ip,同时设备通过dhcp方式申请ip。若固网方式申请到ip则将当前上网模式自动切换到有线宽带pppoe或有线宽带dhcp,用户正常上网;若探测到pppoe服务器但鉴权失败则判断当前是4G优先还是固网优先,若是4G优先则将当前模式设定为4G拨号,若为固网优先则将当前模式设定为有线宽带pppoe,后续用户通过浏览器访问网页时将页面重定向到pppoe设置用户名、密码的页面。无论路由器当前处于4G拨号模式还是处于有线宽带模式,只要设备通过固网获得了ip地址,则设备内部会周期性(比如:周期设定为30秒)监测固网通路是否通畅,若通畅则保持固网或从4G切换到固网,若不通保持当前模式不变。For the above problem, the present embodiment provides a method for automatically switching between a 4G dial-up network and a fixed network. The user can formulate a differentiated switching policy according to the 4G priority or the fixed network priority. The method is: the device is powered on. After that, the default is 4G dial-up Internet access and 4G priority. When the network port connected to the fixed network on the router is detected, the device automatically initiates pppoe dialing application ip, and the device applies for ip through dhcp. If the fixed network method applies to ip, the current online mode will be automatically switched to wired broadband pppoe or wired broadband dhcp, and the user will normally access the Internet; if the pppoe server is detected but the authentication fails, it is judged whether it is 4G priority or fixed network priority, if it is 4G first The current mode is set to 4G dialing. If the fixed network priority is set, the current mode is set to the wired broadband pppoe. When the subsequent user accesses the webpage through the browser, the page is redirected to the page where the user name and password are set by pppoe. Regardless of whether the router is currently in the 4G dialing mode or in the wired broadband mode, as long as the device obtains the ip address through the fixed network, the internal periodicity of the device (for example, the period is set to 30 seconds) monitors whether the fixed network path is unobstructed, and if it is smooth, it remains. Fixed network or switch from 4G to fixed network, if not, keep the current mode unchanged.
本实施例提出了一种实现路由器4G上网与固网上网互切换的装置。This embodiment proposes a device for implementing mutual switching between a router 4G Internet access and a fixed online network.
图6是根据本发明实施例的实现4G上网与固网上网互切换装置的模块结构图,如图6所示,该装置共涉及四个模块,分别为发现固网模块、向固 网申请ip模块、监测固网链路通畅模块(相当于上述检查模块52)、模式自动切换模块(相当于上述切换模块26)。其中,发现固网模块用于监测路由器当前是否通过网线连接了外部固网设备,若发现连接了外部设备要能够识别出当前连接的是pppoe服务器还是dhcp服务器;向固网申请ip模块负责发送pppoe请求和dhcp请求向固网申请ip地址;若获取到固网分配的ip地址则路由器内部的监测固网链路通畅性模块周期性检测从路由器到达固网网关的链路是否通畅;模式自动切换模块负责根据检测结果决定是否进行模式切换。6 is a block diagram of a module for implementing a 4G Internet access and a fixed network interconnection device according to an embodiment of the present invention. As shown in FIG. 6, the device involves four modules, namely, a fixed network module and a solid-state module. The network applies for an ip module, a monitoring fixed network link smoothing module (corresponding to the above checking module 52), and a mode automatic switching module (corresponding to the above switching module 26). The fixed network module is used to monitor whether the router is currently connected to the external fixed network device through the network cable. If it is found that the external device is connected, it is necessary to identify whether the current connection is a pppoe server or a dhcp server; applying to the fixed network for the ip module is responsible for sending the pppoe. The request and the dhcp request apply for an ip address to the fixed network; if the ip address assigned to the fixed network is obtained, the monitoring of the fixed network link patency module inside the router periodically detects whether the link from the router to the fixed network gateway is unobstructed; The module is responsible for determining whether to perform mode switching based on the detection result.
图7是根据本发明实施例的实现4G上网与固网上网互切换方法的流程图,下面通过图7所示的功能流程图对整个功能进行说明:FIG. 7 is a flowchart of a method for implementing mutual switching between a 4G Internet access and a fixed online network according to an embodiment of the present invention. The following describes the entire function by using the functional flowchart shown in FIG. 7:
第一步,开机后设备默认为4G网关模式,因此首先判断当前设备是否处于4G网关模式,若不是则将其修改为4G网关模式,并修改路由相关参数为4G网关对应参数,其中的路由参数包括但不限于dns地址、防火墙规则等。In the first step, the device defaults to 4G gateway mode after booting. Therefore, it is first determined whether the current device is in 4G gateway mode. If not, it is modified to 4G gateway mode, and the routing related parameters are modified to 4G gateway corresponding parameters, and the routing parameters thereof. Including but not limited to dns address, firewall rules, etc.
第二步,“发现固网模块”负责周期性监测路由器是否连接了外部固网设备,其中的固网设备包括但不限于pppoe服务器、dhcp服务器。发现方法为在驱动层面监测是否与外部设备连接。In the second step, the "discovery fixed network module" is responsible for periodically monitoring whether the router is connected to an external fixed network device, wherein the fixed network device includes but is not limited to a pppoe server or a dhcp server. The discovery method is to monitor whether it is connected to an external device at the driver level.
第三步,若未发现路由器连接了外部设备则保持4G网关模式;若发现路由器连接了外部设备则路由器向外部设备发送申请ip请求,所发送请求包括但不限于pppoe请求、dhcp请求。若未从固网设备处申请到ip地址执行第四步,否则执行第五步。In the third step, if the router is not connected to the external device, the 4G gateway mode is maintained; if the router is connected to the external device, the router sends an application ip request to the external device, and the sent request includes but is not limited to the pppoe request and the dhcp request. If the ip address is not applied from the fixed network device to perform the fourth step, otherwise the fifth step is performed.
第四步,判断是否监测到路由器连接的外部设备为pppoe服务器:若不是pppoe服务器则将模式设定为4G网关模式并执行第二步;若是pppoe服务器则判断默认为固网优先还是4G网关优先,若为固网优先则将模式设定为有线宽带pppoe并继续监测连接的固网设备是否有变化,若不是固网优先则为4G网关优先,此时将当前模式设定为4G网关模式,并执行第二步。The fourth step is to determine whether the external device connected to the router is detected as a pppoe server: if it is not a pppoe server, set the mode to 4G gateway mode and perform the second step; if it is a pppoe server, determine whether the default is fixed network priority or 4G gateway priority. If it is a fixed network priority, set the mode to wired broadband pppoe and continue to monitor whether the connected fixed network device changes. If it is not the fixed network priority, the 4G gateway takes precedence. At this time, the current mode is set to 4G gateway mode. And perform the second step.
第五步,判断是否监测到路由器连接的外部设备为pppoe服务器:若不是pppoe服务器则将模式设定为有线宽带dhcp模式,否则将模式设置为有线宽带pppoe模式。此时由于路由器上行通路发生变化,具体而言wan侧网卡发生变化(如:wan侧网卡从4G网关时的usb0变为了有线宽带时的eth0), 因此需要更新与此相关的参数,要更新的参数包括但不限于:路由表、防火墙规则、路由器dns地址,同时由于上行通路从4G网关模式切换到了有线宽带模式,因此需要断开4G连接。In the fifth step, it is determined whether the external device connected to the router is detected as a pppoe server: if it is not a pppoe server, the mode is set to the wired broadband dhcp mode, otherwise the mode is set to the wired broadband pppoe mode. At this time, due to the change of the router uplink path, specifically, the wan side network card changes (for example, the usb0 of the wan side network card from the 4G gateway changes to the eth0 of the wired broadband), Therefore, it is necessary to update the parameters related to this. The parameters to be updated include, but are not limited to, the routing table, the firewall rule, the router dns address, and the 4G connection needs to be disconnected because the uplink path is switched from the 4G gateway mode to the wired broadband mode.
但无论设置为何种模式都说明已经从固网申请到了ip,需要周期性检查到达固网的链路是否通畅,执行第六步。However, no matter which mode is set, it indicates that the ip has been applied from the fixed network, and it is necessary to periodically check whether the link to the fixed network is smooth, and the sixth step is performed.
第六步,若通畅则说明此时固网通路工作正常,继续保持当前工作模式;若不通畅,则可能是因为固网欠费或网线已经拔出等原因导致固网工作异常,执行第四步。The sixth step, if unobstructed, indicates that the fixed network path is working normally and continues to maintain the current working mode; if it is not smooth, it may be due to the arrears of the fixed network or the network cable has been pulled out, etc. step.
如图7所示,流程图包括如下步骤S701-S708:As shown in FIG. 7, the flowchart includes the following steps S701-S708:
S701、判断当前是否为4G网关模式,在判断结果为是的情况下,执行步骤S702,在判断结果为否的情况下,执行步骤S703。S701. Determine whether the current mode is the 4G gateway mode. If the determination result is YES, execute step S702. If the determination result is negative, execute step S703.
S702、保持4G网关模块。S702. Maintain a 4G gateway module.
S703、设定为4G网关模块。S703 is set as a 4G gateway module.
S704、监测路由器是否连接固网。S704. Monitor whether the router is connected to the fixed network.
S705、判断路由器是否连接至固网,在判断结果为否的情况下,执行步骤S702,在判断结果为是的情况下,执行步骤S706.S705. Determine whether the router is connected to the fixed network. If the determination result is no, step S702 is performed. If the determination result is yes, step S706 is performed.
S706、申请固网IP。S706. Apply for a fixed network IP.
S707、判断申请固网IP是否成功,在成功的情况下,执行步骤S708,在申请不成功的情况下,执行步骤S713.S707. Determine whether the application for the fixed network IP is successful. If the application is successful, step S708 is performed. If the application is unsuccessful, step S713 is performed.
S708、是否发现pppoe服务器,在判断结果为是的情况下,执行步骤S709,在判断结果为否的情况下,执行步骤S710.S708, whether the pppoe server is found, if the determination result is yes, step S709 is performed, and if the determination result is no, step S710 is performed.
S709、设定模式为有线宽带pppoe。S709. The setting mode is a wired broadband pppoe.
S710、设定模式为有线宽带dhep。S710. The setting mode is a wired broadband dhep.
S711、更新路由器参数。S711, update the router parameters.
S712、周期性检测固网链路通畅性。S712. Periodically detecting the patency of the fixed network link.
S713、判断固网是否通畅,在判断结果为是的情况下,执行步骤S714, 在判断结果为否的情况下,执行步骤S715.;S713. Determine whether the fixed network is unobstructed. If the determination result is yes, step S714 is performed. If the determination result is no, step S715.
S714、保持当前固网模式。S714. Maintain the current fixed network mode.
S715、判断是否发现pppoe服务器,在判断结果为是的情况下,执行步骤S717,在判断结果为否的情况下,执行步骤S716。S715. It is determined whether the pppoe server is found. If the determination result is YES, step S717 is performed. If the determination result is negative, step S716 is performed.
S716、设定为4G网关模式。S716, set to 4G gateway mode.
S716、固网优先。S716, fixed network priority.
S717、设定模式为有线宽带pppoe。S717, the setting mode is wired broadband pppoe.
综上所述,通过本发明将一台pppoe服务器通过网线插入到路由器的WAN口,路由器识别出当前连接的是pppoe服务器,将模式设定为有线宽带pppoe模式,拨号成功后路由器从pppoe服务器获得公网ip,可以上网。将一台pppoe服务器通过网线插入到路由器的WAN口,路由器识别出当前连接的是pppoe服务器,将模式设定为有线宽带pppoe模式,输入错误用户名、密码后路由器无法获得公网ip地址,在有线宽带优先情况下保持当前模式为有线宽带pppoe模式,在4G网关优先情况下设置当前模式为4G网关模式。将一台dhcp服务器通过网线插入到路由器的WAN口,路由器识别出当前连接的是dhcp服务器,将模式设定为有线宽带dhcp模式,拨号成功后路由器从dhcp服务器获得公网ip,可以上网。路由器的WAN口不去连接任何外部设备,此时路由器将模式设定为4G网关模式。路由器从4G网关模式切换到有线宽带模式后,路由表、防火墙规则、路由器dns地址都已更新至有线宽带模式,同时当模式切换到有线宽带后,4G连接断开成功。实现了路由器上4G上网和固网上网的动态自动互切换,满足了不同场景下用户的使用需要,提升了用户体验。In summary, the pppoe server is inserted into the WAN port of the router through the network cable, and the router recognizes that the pppoe server is currently connected, and sets the mode to the wired broadband pppoe mode. After the dialing succeeds, the router obtains from the pppoe server. Public network ip, you can go online. Insert a pppoe server into the WAN port of the router through the network cable. The router recognizes that the current connection is a pppoe server, and sets the mode to wired broadband pppoe mode. After entering the wrong username and password, the router cannot obtain the public network ip address. In the case of wired broadband priority, the current mode is the wired broadband pppoe mode, and the current mode is set to 4G gateway mode under the priority of the 4G gateway. Insert a dhcp server into the WAN port of the router through the network cable. The router recognizes that the current connection is a dhcp server, and sets the mode to wired broadband dhcp mode. After the dialup is successful, the router obtains the public network ip from the dhcp server and can access the Internet. The router's WAN port does not connect to any external device, and the router sets the mode to 4G gateway mode. After the router switches from 4G gateway mode to wired broadband mode, the routing table, firewall rules, and router dns address are all updated to wired broadband mode. When the mode is switched to wired broadband, the 4G connection is successfully disconnected. The dynamic automatic switching between the 4G Internet access and the fixed online network on the router is realized, which satisfies the needs of users in different scenarios and improves the user experience.
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一个计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。One of ordinary skill in the art will appreciate that all or a portion of the steps of the above-described embodiments can be implemented using a computer program flow, which can be stored in a computer readable storage medium, such as on a corresponding hardware platform (eg, The system, device, device, device, etc. are executed, and when executed, include one or a combination of the steps of the method embodiments.
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。 Alternatively, all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve.
上述实施例中的装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。The devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
上述实施例中的装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。When the device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. The above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
工业实用性Industrial applicability
本发明实施例方案,采用路由器在连接至第一网络的情况下,路由器监测到该路由器是否连接至固网设备;当监测到该路由器连接至固网设备时,路由器获取与该固网设备对应的第二网络的互联网协议IP地址;路由器根据该IP地址由第一网络切换至第二网络。解决了相关技术中只能通过手动实现数据网络与固网之间切换的问题,进而实现了数据网络与固网之间的自动切换,提升了用户体验。 In the embodiment of the present invention, when the router is connected to the first network, the router monitors whether the router is connected to the fixed network device; when the router is connected to the fixed network device, the router acquires the corresponding device corresponding to the fixed network device. The Internet Protocol IP address of the second network; the router switches from the first network to the second network according to the IP address. The problem that the related technology can only switch between the data network and the fixed network can be solved manually, thereby realizing the automatic switching between the data network and the fixed network, thereby improving the user experience.

Claims (11)

  1. 一种网络切换方法,包括:A network switching method includes:
    路由器在连接至第一网络的情况下,监测所述路由器是否连接至固网设备;The router monitors whether the router is connected to the fixed network device when connected to the first network;
    当监测到所述路由器连接至固网设备时,所述路由器获取与所述固网设备对应的第二网络的互联网协议IP地址;When it is detected that the router is connected to the fixed network device, the router acquires an internet protocol IP address of the second network corresponding to the fixed network device;
    所述路由器根据所述IP地址由所述第一网络切换至所述第二网络。The router switches from the first network to the second network according to the IP address.
  2. 根据权利要求1所述的方法,所述方法还包括:在所述路由器获取与所述固网设备对应的第二网络的互联网协议IP地址之前,所述路由器向所述固网设备发送申请消息,其中,所述申请消息用于向所述固网设备申请所述IP地址。The method of claim 1, further comprising: before the router acquires an internet protocol IP address of a second network corresponding to the fixed network device, the router sends an application message to the fixed network device The application message is used to apply for the IP address to the fixed network device.
  3. 根据权利要求1所述的方法,所述方法还包括:在监测到所述路由器连接至固网设备之后,在所述路由器无法获取到所述IP地址的情况下,所述路由器保持与所述第一网络的连接。The method of claim 1, further comprising: after monitoring that the router is connected to the fixed network device, in case the router is unable to obtain the IP address, the router remains The connection of the first network.
  4. 根据权利要求1所述的方法,所述方法还包括:在所述路由器根据所述IP地址由所述第一网络切换至所述第二网络之后,检查所述路由器连接至所述第二网络的链路是否通畅,在检查结果为所述路由器连接至所述第二网络的链路通畅的情况下,所述路由器保持与所述第二网络的连接,在检查结果为所述路由器连接至所述第二网络的链路不通畅的情况下,所述路由器由所述第二网络切换至所述第一网络。The method of claim 1, further comprising: after the router switches from the first network to the second network according to the IP address, checking that the router is connected to the second network Whether the link is unobstructed, and in the case that the link of the router connected to the second network is unobstructed, the router maintains a connection with the second network, and the result of the check is that the router is connected to If the link of the second network is not smooth, the router is switched by the second network to the first network.
  5. 根据权利要求1至4中任一项所述的方法,其中,所述第一网络包括数据网络。The method of any of claims 1 to 4, wherein the first network comprises a data network.
  6. 一种网络切换装置,应用于路由器,所述装置包括:A network switching device is applied to a router, and the device includes:
    监测模块,设置为在连接至第一网络的情况下,监测所述路由器是否连接至固网设备;a monitoring module configured to monitor whether the router is connected to the fixed network device when connected to the first network;
    获取模块,设置为当所述监测模块监测到所述路由器连接至固网设备时,获取与所述固网设备对应的第二网络的互联网协议IP地址; An acquiring module, configured to: when the monitoring module detects that the router is connected to the fixed network device, acquire an internet protocol IP address of the second network corresponding to the fixed network device;
    切换模块,设置为根据所述IP地址由所述第一网络切换至所述第二网络。And a switching module configured to switch from the first network to the second network according to the IP address.
  7. 根据权利要求6所述的装置,所述装置还包括:The apparatus of claim 6 further comprising:
    发送模块,设置为在所述获取模块获取与所述固网设备对应的第二网络的互联网协议IP地址之前,向所述固网设备发送申请消息,其中,所述申请消息用于向所述固网设备申请所述IP地址。a sending module, configured to send an application message to the fixed network device before the acquiring module acquires an Internet Protocol IP address of the second network corresponding to the fixed network device, where the application message is used to The fixed network device applies for the IP address.
  8. 根据权利要求6所述的装置,所述装置还包括:The apparatus of claim 6 further comprising:
    保持模块,设置为在监测模块监测到所述路由器连接至固网设备之后,在所述获取模块无法获取到所述IP地址的情况下,保持与所述第一网络的连接。And a holding module, configured to: after the monitoring module detects that the router is connected to the fixed network device, if the acquiring module cannot obtain the IP address, maintain the connection with the first network.
  9. 根据权利要求6所述的装置,所述装置还包括:The apparatus of claim 6 further comprising:
    检查模块,设置为在所述切换模块根据所述IP地址由所述第一网络切换至所述第二网络之后,检查所述路由器连接至所述第二网络的链路是否通畅,在检查结果为所述路由器连接至所述第二网络的链路通畅的情况下,保持与所述第二网络的连接,在检查结果为所述路由器连接至所述第二网络的链路不通畅的情况下,由所述第二网络切换至所述第一网络。The checking module is configured to check whether the link connected to the second network by the router is unobstructed after the switching module is switched from the first network to the second network according to the IP address, and the check result is When the link connecting the router to the second network is unobstructed, the connection with the second network is maintained, and the result of the check is that the link connecting the router to the second network is not smooth. And switching from the second network to the first network.
  10. 根据权利要求6至9中任一项所述的装置,其中,所述第一网络包括数据网络。The apparatus of any of claims 6 to 9, wherein the first network comprises a data network.
  11. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被处理器执行时实现权利要求1-5任意一项所述的网络切换方法。 A computer readable storage medium storing computer executable instructions that, when executed by a processor, implement the network switching method of any of claims 1-5.
PCT/CN2016/081319 2015-08-21 2016-05-06 Network switching method and apparatus, and computer readable storage medium WO2017032058A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510519680.2 2015-08-21
CN201510519680.2A CN106470170B (en) 2015-08-21 2015-08-21 Network switching method and device

Publications (1)

Publication Number Publication Date
WO2017032058A1 true WO2017032058A1 (en) 2017-03-02

Family

ID=58099501

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/081319 WO2017032058A1 (en) 2015-08-21 2016-05-06 Network switching method and apparatus, and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN106470170B (en)
WO (1) WO2017032058A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112929942A (en) * 2021-02-09 2021-06-08 惠州Tcl移动通信有限公司 Intelligent routing method, system, storage medium and terminal equipment
CN113765802A (en) * 2021-07-26 2021-12-07 深圳市智微智能科技股份有限公司 android device network card dynamic switching method, system, terminal and storage medium
CN114286403A (en) * 2021-12-07 2022-04-05 深圳市联洲国际技术有限公司 Switching method and switching device for internet access mode of gateway equipment
WO2023216836A1 (en) * 2022-05-13 2023-11-16 中兴通讯股份有限公司 Mesh networking uplink control method and system, and device and readable storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110460462A (en) * 2019-07-24 2019-11-15 中国移动通信集团黑龙江有限公司 Dual network router control system and dual network router
CN114024903A (en) * 2021-11-08 2022-02-08 深圳市共进电子股份有限公司 Network switching method and device and gateway equipment
CN116208981B (en) * 2023-01-06 2024-02-23 广州通则康威科技股份有限公司 CPE network optimization method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006020977A1 (en) * 2004-08-13 2006-02-23 Heinrich Sinnreich Fixed-mobile communications with mid-session mode switching
CN101577769A (en) * 2008-05-07 2009-11-11 深圳华为通信技术有限公司 Method, system and customer premises equipment for handover of speech service between different networks
CN201789639U (en) * 2010-06-13 2011-04-06 广东天波信息技术股份有限公司 Multi-network wireless router
CN103200087A (en) * 2010-05-27 2013-07-10 华为终端有限公司 Wireless router, wireless routing method and wireless routing system
CN103428066A (en) * 2013-08-09 2013-12-04 深圳市吉祥腾达科技有限公司 Broadband router, as well as method and system for networking by utilizing same

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103546932B (en) * 2012-07-17 2016-12-21 中国移动通信集团公司 Method, device, network element and the system of a kind of network switching

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006020977A1 (en) * 2004-08-13 2006-02-23 Heinrich Sinnreich Fixed-mobile communications with mid-session mode switching
CN101577769A (en) * 2008-05-07 2009-11-11 深圳华为通信技术有限公司 Method, system and customer premises equipment for handover of speech service between different networks
CN103200087A (en) * 2010-05-27 2013-07-10 华为终端有限公司 Wireless router, wireless routing method and wireless routing system
CN201789639U (en) * 2010-06-13 2011-04-06 广东天波信息技术股份有限公司 Multi-network wireless router
CN103428066A (en) * 2013-08-09 2013-12-04 深圳市吉祥腾达科技有限公司 Broadband router, as well as method and system for networking by utilizing same

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112929942A (en) * 2021-02-09 2021-06-08 惠州Tcl移动通信有限公司 Intelligent routing method, system, storage medium and terminal equipment
CN113765802A (en) * 2021-07-26 2021-12-07 深圳市智微智能科技股份有限公司 android device network card dynamic switching method, system, terminal and storage medium
CN113765802B (en) * 2021-07-26 2023-08-08 深圳市智微智能科技股份有限公司 android device network card dynamic switching method, system, terminal and storage medium
CN114286403A (en) * 2021-12-07 2022-04-05 深圳市联洲国际技术有限公司 Switching method and switching device for internet access mode of gateway equipment
WO2023216836A1 (en) * 2022-05-13 2023-11-16 中兴通讯股份有限公司 Mesh networking uplink control method and system, and device and readable storage medium

Also Published As

Publication number Publication date
CN106470170A (en) 2017-03-01
CN106470170B (en) 2020-07-14

Similar Documents

Publication Publication Date Title
WO2017032058A1 (en) Network switching method and apparatus, and computer readable storage medium
CN109315004B (en) PDU type setting method and related entity
RU2556468C2 (en) Terminal access authentication method and customer premise equipment
US9391800B2 (en) Dynamic and interoperable generation of stateful VPN connection profiles for computing devices
US11611931B2 (en) WI-FI hotspot recommendation method, terminal, and graphical user interface
US8433807B2 (en) Method, system, and apparatus for processing access prompt information
US9918353B2 (en) 802.1X access session keepalive method, device, and system
EP3032859B1 (en) Access control method and system, and access point
WO2017114362A1 (en) Packet forwarding method, device and system
CN102761482B (en) A kind of method for building up of bgp neighbor and equipment
WO2016095118A1 (en) Method and device for home wifi station device to select link for data transmitting
KR101909400B1 (en) Method and system for managing network traffic
EP3614649A1 (en) Ip address allocation method and device
WO2017215492A1 (en) Device detection method and apparatus
EP2838250B1 (en) Method, device and system for allocating phone number
WO2016155826A1 (en) System, apparatus and method for load balancing
WO2018053894A1 (en) Internet-of-things access point handover method and device based on transmission rate
CN107528788B (en) Method and device for realizing automatic stacking between network devices
US11902380B1 (en) Liveness detection for an authenticated client session
WO2014180302A1 (en) Application internet access processing method, apparatus, and terminal
EP3148159B1 (en) Using a multicast address as a tunnel remote gateway address in a layer 2 tunneling protocol access concentrator
US11562062B1 (en) Supporting multiple authentication methods on a port of a network device at the same time
WO2017161866A1 (en) Network connection method and device
CN103327482B (en) Terminal and network method for handover control
US20140215034A1 (en) Processing Method and Processing Device for Automatically Setting Internet Access Mode

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: 16838320

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16838320

Country of ref document: EP

Kind code of ref document: A1