Communication method and electronic device

By enabling the DHCP service when the router is disconnected and deciding whether to assign an IP address based on the interface type, the problem of electronic devices being unable to obtain the IP address assigned by the main router is solved and the stability of network access is ensured.

CN117714266BActive Publication Date: 2024-08-23HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311109063.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-30
Publication Date
2024-08-23
Estimated Expiration
2043-08-30

AI Technical Summary

Technical Problem

After the connection is restored between the master router and the slave router, the electronic device cannot obtain the IP address assigned by the master router, resulting in the inability to access the network.

Method used

When the slave router is disconnected from the main router, the Dynamic Host Configuration Protocol DHCP service is enabled, responds to the connection request of the electronic device, and determines the interface type. If it is a wireless interface, no IP address is assigned to avoid leaving the IP address assigned by the slave router. Access the network again after the IP address assigned by the main router is restored.

Benefits of technology

It ensures that electronic devices can obtain the IP address assigned by the master router after the connection is restored between the master router and the slave router, avoiding the problem of being unable to access the network and improving the reliability of network access.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117714266B
    Figure CN117714266B
Patent Text Reader

Abstract

The embodiments of the present application are applicable to the field of communication technology, and provide a communication method and an electronic device, including: when a slave router is disconnected from a main router, starting a dynamic host configuration protocol DHCP service, determining the type of a first interface in response to a connection request sent by a first electronic device, and if the type of the first interface is a wireless interface, not assigning a first IP address to the first electronic device, and refusing the first electronic device to access the slave router, that is, after the slave router is disconnected from the main router, if the first electronic device accesses the slave router through the wireless interface, the slave router will not assign the first IP address to the first electronic device, and thus the first electronic device will not use the IP address assigned by the slave router to connect to the main router, thereby avoiding the situation where the first electronic device cannot access the Internet after the connection between the main router and the slave router is restored.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and more specifically, to a communication method and electronic device. Background Art

[0002] At present, electronic devices often connect to the Internet through routers to access the Internet. In some scenarios, due to the large area, one router cannot cover the entire area, so two or more routers are usually required to be connected in bridge mode to cover a larger area.

[0003] It should be understood that the above-mentioned router connected by bridge mode generally includes a main router and a slave router, and the main router assigns an IP address to the electronic device through the slave router, and the electronic device connects to the network through the main router based on the IP address assigned by the main router. In this case, the slave router can be equivalent to a transmission device. However, when the connection between the slave router and the main router fails, it is usually necessary to access the slave router in order to troubleshoot the fault. In this case, the electronic device needs to access the slave router through the IP address assigned by the slave router. After the connection between the main router and the slave router is restored, the network is accessed through the IP address assigned by the main router. However, some electronic devices have a roaming function, resulting in the electronic device still retaining the IP address assigned by the slave router after the connection between the main router and the slave router is restored, and the IP address assigned by the main router cannot be obtained, which in turn causes the electronic device to be unable to access the network based on the IP address assigned by the main router.

[0004] Based on this, how to avoid the problem that electronic devices cannot access the network when the main router and the slave router are connected again has become an urgent problem to be solved. Summary of the invention

[0005] The present application provides a communication method, which can prevent an electronic device from being unable to access a network when a main router and a slave router are connected again.

[0006] In a first aspect, a communication method is provided, which is applied to a slave router, wherein the slave router is applied to a slave router in a router network connected by a master router and a slave router in a bridge mode, comprising:

[0007] When the slave router is disconnected from the master router, enable the Dynamic Host Configuration Protocol (DHCP) service;

[0008] In response to a connection request sent by the first electronic device, determining a type of a first interface, the first interface being a connection interface between the first electronic device and a slave router, the connection request being used to request access to the slave router;

[0009] If the type of the first interface is a wireless interface, the first IP address is not allocated to the first electronic device, and the first electronic device is denied access to the slave router.

[0010] The communication method provided by the embodiment of the present application is applied to a slave router in a router network in which a master router and a slave router are connected through a bridge mode. The method includes: when the slave router is disconnected from the master router, starting a dynamic host configuration protocol DHCP service, and determining the type of a first interface in response to a connection request sent by a first electronic device, wherein the first interface refers to a connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router. If the type of the first interface is a wireless interface, the first IP address is not allocated to the first electronic device, and the first electronic device is denied access to the slave router. That is, after the slave router is disconnected from the master router, if the first electronic device accesses the slave router through the wireless interface, the slave router will not allocate the first IP address to the first electronic device, so that after the connection between the master router and the slave router is restored, there is no remaining first IP address allocated by the slave router in the first electronic device, and thus the first electronic device will not use the IP address allocated by the slave router to connect to the master router, thereby avoiding the situation where the first electronic device uses the first IP address in a different network segment from the IP address of the master router to access the master router, thereby avoiding the situation where the first electronic device cannot access the Internet after the connection between the master router and the slave router is restored.

[0011] In combination with the first aspect, in some embodiments of the first aspect, the method further includes: if the type of the first interface is a wired interface, allocating a first IP address to the first electronic device, and the first electronic device accesses the slave router based on the first IP address.

[0012] In the communication method provided by the embodiment of the present application, after the master router and the slave router are disconnected, and when the first interface connecting the first electronic device and the slave router is a wired interface, the slave router can assign a first IP address to the first electronic device, so that the first electronic device can access the slave router based on the first IP address, so that the fault of the slave router can be checked through the first electronic device.

[0013] In combination with the first aspect, in certain embodiments of the first aspect, the connection request carries indication information, and the indication information is used to indicate the type of the first interface. In response to the connection request sent by the first electronic device, the type of the first interface is determined, including: determining the first interface type based on the indication information carried in the connection request.

[0014] In combination with the first aspect, in certain embodiments of the first aspect, the method further includes: when the slave router is connected to the master router again, closing the DHCP service, the first electronic device obtains a second IP address assigned by the master router, and accesses the network based on the second IP address.

[0015] The communication method provided by the embodiment of the present application is applied to a slave router in a router network connected by a master router and a slave router through a bridge mode. The method includes: when the slave router is disconnected from the master router, a dynamic host configuration protocol DHCP service is started, and in response to a connection request sent by a first electronic device, the type of the first interface is determined, wherein the first interface refers to the connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router. If the type of the first interface is a wireless interface, the first IP address is not assigned to the first electronic device, and the first electronic device is denied access to the slave router. When the slave router is connected to the master router again, the DHCP service is turned off, and the first electronic device obtains the second IP address assigned by the master router and accesses the network based on the second IP address. That is to say, after the slave router is disconnected from the master router, if the first electronic device accesses the slave router through the wireless interface, the slave router will not assign the first IP address to the first electronic device, so that after the connection between the master router and the slave router is restored, there is no first IP address assigned by the slave router left in the first electronic device, so the first electronic device can obtain the second IP address assigned by the master router, so that the first electronic device can access the Internet based on the second IP address belonging to the same network segment as the IP address of the master router.

[0016] In combination with the first aspect, in certain embodiments of the first aspect, determining the type of the first interface in response to a connection request sent by the first electronic device includes: determining whether the connection mode between the slave router and the master router is a bridge mode in response to the connection request sent by the first electronic device; if the connection mode between the slave router and the master router is a bridge mode, determining the type of the first interface.

[0017] The communication method provided in the embodiment of the present application starts the dynamic host configuration protocol DHCP service after the master router and the slave router are disconnected. The slave router first determines whether the connection mode between the master router and the slave router is the bridge mode in response to the connection request sent by the first electronic device. If the connection mode between the master router and the slave router is not the bridge mode, there is no need to further determine whether the first interface is a wireless interface, and there is no need to not allocate the first IP address to the first electronic device when the first interface is a wireless interface. This is because the connection mode between the master router and the slave router is not the bridge mode, and the master router and the slave router do not share a network identifier and an access password. In this way, the first electronic device will not access the master router based on the same network identifier and access password after accessing the slave router, and thus the first electronic device will not be unable to access the Internet through the master router. Therefore, after determining that the connection mode between the master router and the slave router is not the bridge mode, the subsequent steps of not allocating an IP address to the first electronic device are not performed, which can reduce the system overhead occupied by the slave router to perform unnecessary tasks.

[0018] In combination with the first aspect, in certain embodiments of the first aspect, the first electronic device includes a terminal device with a roaming function, and the roaming function refers to a function of not deleting network configuration information in the first electronic device when the connection between the first electronic device and the network device is disconnected.

[0019] In a second aspect, a communication method is provided, which is applied to a router network connected by a master router and a slave router in a bridge mode, comprising:

[0020] When the master router and slave router are disconnected, the slave router starts the Dynamic Host Configuration Protocol DHCP service;

[0021] The first electronic device sends a connection request to the slave router, where the connection request is used to request access to the slave router;

[0022] The slave router determines, in response to the connection request, a type of the first interface, where the first interface refers to a connection interface between the first electronic device and the slave router;

[0023] If the first interface is a wireless interface, the slave router does not allocate the first IP address to the first electronic device, and denies the first electronic device access to the slave router.

[0024] The communication method provided by the embodiment of the present application is applied to a router network connected by a master router and a slave router through a bridge mode. The method includes: when the slave router is disconnected from the master router, the slave router starts a dynamic host configuration protocol DHCP service, and determines the type of the first interface in response to a connection request sent by the first electronic device, wherein the first interface refers to the connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router. If the type of the first interface is a wireless interface, the slave router does not assign a first IP address to the first electronic device, and refuses the first electronic device to access the slave router. That is, after the slave router is disconnected from the master router, if the first electronic device accesses the slave router through the wireless interface, the slave router will not assign the first IP address to the first electronic device, so that after the connection between the master router and the slave router is restored, there is no first IP address assigned by the slave router left in the first electronic device, so that the first electronic device will not use the IP address assigned by the slave router to connect to the master router, thereby avoiding the situation where the first electronic device uses the first IP address in a different network segment from the IP address of the master router to access the master router, thereby avoiding the situation where the first electronic device cannot access the Internet after the connection between the master router and the slave router is restored.

[0025] In combination with the second aspect, in some embodiments of the second aspect, the method further includes: if the first interface is a wired interface, allocating a first IP address to the first electronic device from the router; and the first electronic device accessing the slave router based on the first IP address.

[0026] In combination with the second aspect, in some embodiments of the second aspect, the method further includes: when the slave router is connected to the main router again, the slave router turns off the DHCP service; the first electronic device obtains a second IP address assigned by the main router, and accesses the network based on the second IP address.

[0027] The communication method provided by the embodiment of the present application is applied to a router network connected by a master router and a slave router through a bridge mode. The method includes: when the slave router is disconnected from the master router, the dynamic host configuration protocol DHCP service is turned on, and in response to a connection request sent by a first electronic device, the type of the first interface is determined, wherein the first interface refers to the connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router. If the type of the first interface is a wireless interface, the first IP address is not assigned to the first electronic device, and the first electronic device is denied access to the slave router. When the slave router is connected to the master router again, the DHCP service is turned off, and the first electronic device obtains the second IP address assigned by the master router and accesses the network based on the second IP address. That is to say, after the slave router is disconnected from the master router, if the first electronic device accesses the slave router through the wireless interface, the slave router will not assign the first IP address to the first electronic device, so that after the connection between the master router and the slave router is restored, there is no first IP address assigned by the slave router in the first electronic device, so the first electronic device can obtain the second IP address assigned by the master router, so that the first electronic device can access the Internet based on the second IP address belonging to the same network segment as the IP address of the master router.

[0028] In a third aspect, a communication method is provided, which is applied to a slave router, and the slave router is applied to a router network connected by a master router and a slave router in a bridge mode, comprising:

[0029] Before establishing a communication connection between the slave router and the master router for the first time, storing first configuration information of the slave router;

[0030] When the connection between the slave router and the master router is disconnected, the slave router is configured according to the first configuration information, and a dynamic host configuration protocol DHCP service is enabled;

[0031] In response to a first connection request sent by the first electronic device, a first IP address is allocated to the first electronic device based on first configuration information, and the first electronic device accesses the slave router based on the first IP address and the first configuration information.

[0032] The communication method provided in the embodiment of the present application is applied to a slave router in a router network in which a master router and a slave router are connected through a bridge mode. Before a communication connection is first established between the slave router and the master router, first configuration information of the slave router is stored; when the slave router and the master router are disconnected, the slave router is configured according to the first configuration information, and a dynamic host configuration protocol DHCP service is started; in response to a first connection request sent by a first electronic device, a first IP address is allocated to the first electronic device based on the first configuration information, and the first electronic device accesses the slave router based on the first IP address, that is, after the slave router and the master router are disconnected, the network identifier and access password used by the first electronic device when accessing the slave router are the initial network identifier and initial access password of the slave router before the slave router and the master router are first connected, so that the first electronic device does not store the same network identifier and access password as the master router, so that when the IP address of the first electronic device is the first IP address allocated by the slave router, the master router cannot be accessed through the network identifier and access password stored in the first electronic device, thereby avoiding the situation where the Internet cannot be accessed due to accessing the master router using the first IP address that is not in the same network segment as the IP address of the master router.

[0033] In combination with the third aspect, in some embodiments of the third aspect, the method also includes: when the connection between the slave router and the master router is restored, obtaining second configuration information sent by the master router; performing configuration based on the second configuration information, and shutting down the DHCP service; in response to a second connection request sent by the first electronic device, forwarding the second IP address assigned by the master router to the first electronic device, and the first electronic device accessing the network based on the second IP address and the configuration information of the master router.

[0034] The communication method provided in the embodiment of the present application is applied to a slave router in a router network in which a master router and a slave router are connected through a bridge mode. Before a communication connection is first established between the slave router and the master router, first configuration information of the slave router is stored; when the connection between the slave router and the master router is disconnected, the slave router is configured according to the first configuration information, and a dynamic host configuration protocol DHCP service is turned on; in response to a first connection request sent by a first electronic device, a first IP address is allocated to the first electronic device based on the first configuration information, and the first electronic device accesses the slave router based on the first IP address; when the connection between the slave router and the master router is restored, second configuration information sent by the master router is obtained; the slave router is configured based on the second configuration information, and the DHCP service is turned off; in response to a second connection request sent by the first electronic device, the second IP address allocated by the master router is forwarded to the first electronic device, and the first electronic device accesses the network based on the second IP address, that is, in After the slave router is disconnected from the main router, the network identifier and access password used by the first electronic device to access the slave router are the initial network identifier and initial access password of the slave router before the slave router is first connected to the main router. When the connection between the slave router and the main router is restored, the network identifier and access password stored in the first electronic device are the initial network identifier and initial access password of the slave router. The first electronic device cannot directly access the main router based on the stored network identifier and access password. Therefore, the first electronic device must send a second connection request to the main router, so that the main router allocates a second IP address to the first electronic device based on the second connection, and then accesses the main router based on the network identifier and access password matching the main router, and accesses the Internet through the main router. In this way, the first electronic device will not use the first IP address that is not in the same network segment as the IP address of the main router to access the main router, thereby avoiding the situation where the first electronic device cannot access the Internet.

[0035] In a fourth aspect, a communication method is provided, the method being applied to a router network connected by a master router and a slave router in a bridge mode, the method comprising:

[0036] Before establishing a communication connection between the slave router and the master router for the first time, the slave router stores first configuration information of the slave router;

[0037] When the connection between the slave router and the master router is disconnected, the slave router configures the slave router according to the first configuration information and starts the Dynamic Host Configuration Protocol DHCP service;

[0038] The first electronic device sends a first connection request to the slave router, where the first connection request is used to request access to the slave router;

[0039] In response to the first connection request sent by the first electronic device, the slave router allocates a first IP address to the first electronic device based on the first configuration information;

[0040] The first electronic device accesses the slave router based on the first IP address and the first configuration information.

[0041] The communication method provided in the embodiment of the present application is applied to a router network in which a master router and a slave router are connected through a bridge mode. Before a communication connection is first established between the slave router and the master router, first configuration information of the slave router is stored; when the slave router and the master router are disconnected, the slave router is configured according to the first configuration information, and a dynamic host configuration protocol DHCP service is started; in response to a first connection request sent by a first electronic device, a first IP address is allocated to the first electronic device based on the first configuration information, and the first electronic device accesses the slave router based on the first IP address, that is, after the slave router and the master router are disconnected, the network identifier and access password used by the first electronic device when accessing the slave router are the initial network identifier and initial access password of the slave router before the slave router and the master router are first connected, so that the first electronic device does not store the same network identifier and access password as the master router, so that when the IP address of the first electronic device is the first IP address allocated by the slave router, the main router cannot be accessed through the network identifier and access password stored in the first electronic device, thereby avoiding the situation where the Internet cannot be accessed due to accessing the main router using the first IP address that is not in the same network segment as the IP address of the main router.

[0042] In combination with the fourth aspect, in some embodiments of the fourth aspect, the method also includes: when the connection between the slave router and the master router is restored, the slave router obtains second configuration information sent by the master router; the slave router is configured based on the second configuration information and closes the DHCP service; the first electronic device sends a second connection request to the slave router, and the second connection request is used to request access to the network; the slave router forwards the second IP address assigned by the master router to the first electronic device in response to the second connection request sent by the first electronic device; the first electronic device accesses the network based on the second IP address and the configuration information of the master router.

[0043] The communication method provided in the embodiment of the present application is applied to a router network in which a master router and a slave router are connected through a bridge mode. Before the first communication connection is established between the slave router and the master router, the first configuration information of the slave router is stored; when the connection between the slave router and the master router is disconnected, the slave router is configured according to the first configuration information, and the dynamic host configuration protocol DHCP service is turned on; in response to a first connection request sent by a first electronic device, a first IP address is allocated to the first electronic device based on the first configuration information, and the first electronic device accesses the slave router based on the first IP address. When the connection between the slave router and the master router is restored, the second configuration information sent by the master router is obtained; the slave router is configured based on the second configuration information, and the DHCP service is turned off; in response to a second connection request sent by the first electronic device, the second IP address allocated by the master router is forwarded to the first electronic device, and the first electronic device accesses the network based on the second IP address. That is, in the slave router, After the slave router is disconnected from the main router, the network identifier and access password used by the first electronic device to access the slave router are the initial network identifier and initial access password of the slave router before the slave router is first connected to the main router. When the connection between the slave router and the main router is restored, the network identifier and access password stored in the first electronic device are the initial network identifier and initial access password of the slave router. The first electronic device cannot directly access the main router based on the stored network identifier and access password. Therefore, the first electronic device must send a second connection request to the main router, so that the main router allocates a second IP address to the first electronic device based on the second connection, and then accesses the main router based on the network identifier and access password matching the main router, and accesses the Internet through the main router. In this way, the first electronic device will not use the first IP address that is not in the same network segment as the IP address of the main router to access the main router, thereby avoiding the situation where the first electronic device cannot access the Internet.

[0044] In a fifth aspect, a communication device is provided, comprising a unit for executing any one of the methods in the first aspect or the third aspect. The device may be a server, a terminal device, or a chip in a terminal device. The device may include an input unit and a processing unit.

[0045] When the device is a terminal device, the processing unit may be a processor, and the input unit may be a communication interface; the terminal device may also include a memory, which is used to store computer program code. When the processor executes the computer program code stored in the memory, the terminal device executes any one of the methods in the first aspect or the third aspect.

[0046] When the device is a chip in a terminal device, the processing unit may be a processing unit inside the chip, and the input unit may be an output interface, a pin or a circuit, etc.; the chip may also include a memory, which may be a memory inside the chip (for example, a register, a cache, etc.) or a memory located outside the chip (for example, a read-only memory, a random access memory, etc.); the memory is used to store computer program code, and when the processor executes the computer program code stored in the memory, the chip executes any one of the methods in the first aspect or the third aspect.

[0047] In a possible implementation, a memory is used to store computer program codes; a processor executes the computer program codes stored in the memory, and when the computer program codes stored in the memory are executed, the processor is used to perform: when the slave router is disconnected from the master router, starting the Dynamic Host Configuration Protocol DHCP service; in response to a connection request sent by a first electronic device, determining the type of a first interface, the first interface refers to a connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router; if the type of the first interface is a wireless interface, not assigning a first IP address to the first electronic device, and refusing the first electronic device to access the slave router.

[0048] In a possible implementation, a memory is used to store computer program codes; a processor executes the computer program codes stored in the memory, and when the computer program codes stored in the memory are executed, the processor is used to perform: before a communication connection is first established between the slave router and the master router, storing first configuration information of the slave router; when the slave router and the master router are disconnected, configuring the slave router according to the first configuration information and starting a dynamic host configuration protocol DHCP service; in response to a first connection request sent by a first electronic device, allocating a first IP address to the first electronic device based on the first configuration information, and the first electronic device accessing the slave router based on the first IP address and the first configuration information.

[0049] In a sixth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program code. When the computer program code is executed by a communication device, the communication device executes any one of the methods in the first aspect or the third aspect.

[0050] In a seventh aspect, a computer program product is provided, the computer program product comprising: a computer program code, when the computer program code is executed by a communication device, the communication device executes any one of the methods in the first aspect or the third aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1is a schematic diagram of a bridge mode connection between a master router and a slave router;

[0052] Figure 2 is a schematic diagram of a hardware system of an electronic device applicable to the present application;

[0053] Figure 3 It is a schematic diagram of an application scenario of a communication method provided in an embodiment of the present application;

[0054] Figure 4 It is a flow chart of a communication method provided in an embodiment of the present application;

[0055] Figure 5 It is a flowchart of another communication method provided in an embodiment of the present application;

[0056] Figure 6 is a schematic diagram of a process for determining a first interface provided in an embodiment of the present application;

[0057] Figure 7 It is a schematic diagram of a connection relationship of a router network provided in an embodiment of the present application;

[0058] Figure 8 It is a flowchart of another communication method provided in an embodiment of the present application;

[0059] Fig. 9 It is a flowchart of another communication method provided in an embodiment of the present application;

[0060] Fig.10 is a schematic diagram of another connection relationship of a router network provided in an embodiment of the present application;

[0061] Fig.11 It is a flowchart of another communication method provided in an embodiment of the present application;

[0062] Fig.12 is a schematic diagram of a communication device provided by the present application;

[0063] Fig.13 is a schematic diagram of a communication device provided by the present application;

[0064] Fig.14 It is a schematic diagram of an electronic device provided by the present application. DETAILED DESCRIPTION

[0065] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0066] In the following, the terms "first", "second", and "third" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first", "second", and "third" may explicitly or implicitly include one or more of the features.

[0067] In order to facilitate understanding, some of the exemplary examples given are provided for reference to the description of concepts related to the embodiments of the present application.

[0068] 1. The router's bridge mode connection.

[0069] Usually, in a target area with a large area, due to the limited signal coverage of a router, it is impossible to cover the entire target area. In order to avoid frequent switching of routers by electronic devices connected to the router, a router network connected in bridge mode can be used to access the network. Among them, the router network connected in bridge mode usually includes a main router and at least one slave router. When establishing a bridge mode connection, the main router sends configuration information to at least one slave router, and the slave router configures the network identification and access password of the slave router based on the configuration information sent by the main router, so that the network identification and access password of the main router and the slave router are the same. In this case, the electronic device can be connected to the main router through the slave router and access the network through the main router. It should be understood that the slave router connected in bridge mode turns off the Dynamic Host Configuration Protocol (DHCP) service, so the slave router in bridge mode connection cannot assign an IP address to the electronic device, and the electronic device accesses the network through the IP address assigned by the main router. In other words, although the electronic device is connected to the main router through the slave router and then accesses the network through the main router, the IP address of the electronic device is the IP address assigned by the main router, which is in the same network segment as the main router and in a different network segment from the IP address of the slave router.

[0070] 2. Roaming function of electronic devices.

[0071] The roaming function of the electronic device shown in the embodiment of the present application means that when the electronic device is disconnected from the network device, the IP address assigned by the network device is still retained in the electronic device, and the last time the electronic device is connected to the network device, the last assigned IP address can be used to connect to the network device.

[0072] At present, electronic devices often connect to the Internet through routers to access the Internet. In some scenarios, due to the large area, one router cannot cover the entire area, so two or more routers are usually required to connect in bridge mode to cover a larger area.

[0073] It should be understood that the above-mentioned router connected by bridge mode generally includes a main router and a slave router, and the main router assigns an IP address to the electronic device through the slave router, and the electronic device connects to the network through the main router based on the IP address assigned by the main router. In this case, the slave router can be equivalent to a transmission device. However, when the connection between the slave router and the main router fails, it is usually necessary to access the slave router in order to troubleshoot the fault. At this time, the electronic device needs to access the slave router through the IP address assigned by the slave router. After the connection between the main router and the slave router is restored, the network is accessed through the IP address assigned by the main router. However, some electronic devices have a roaming function, resulting in the electronic device still retaining the IP address assigned by the slave router after the connection between the main router and the slave router is restored, and the IP address assigned by the main router cannot be obtained, which in turn causes the electronic device to be unable to access the network based on the IP address assigned by the main router.

[0074] For example, Figure 1 As shown in (a), since the area of ​​the preset area is large, one router cannot fully cover the preset area, so a router system in which the master router 300 and the slave router 200 are connected in bridge mode is used to provide signal coverage for the preset area. In this case, the master router 300 usually sends configuration parameters to the slave router 200 so that the slave router 200 is configured based on the configuration parameters, and the network identification and access password of the configured slave router 200 are the same as those of the master router 300. At the same time, the slave router 200 turns off the Dynamic Host Configuration Protocol (DHCP) service. It should be understood that if the slave router 200 turns off the DHCP service, the slave router 200 cannot assign an IP address to the electronic device 100.

[0075] For example, Figure 1As shown in (a), the network identification SSID of the main router 300 is luyouqi, and the password is 12345678; the network identification SSID of the slave router 200 is luyouqi1, and the password is 12345678. At this time, the IP address of the main router 300 is 192.168.10.1, and the IP address of the slave router 200 is 192.168.11.1. If the electronic device 100 requests to access the network through the slave router 200, since the DHCP service of the slave router 200 is turned off, the slave router 200 will not assign an IP address to the electronic device 100. The slave router 200 can forward the IP address 192.168.10.10 assigned by the main router 300 to the electronic device 100. In this case, the slave router 200 is equivalent to a transmission device.

[0076] After the master router 300 and the slave router 200 are disconnected, the slave router 200 starts the DHCP service and can assign an IP address to the electronic device 100. If the user needs to find out which router is faulty, it is necessary to access the master router 300 and the slave router 200. When the electronic device 100 accesses the slave router 200, the electronic device 100 sends a connection request to the slave router 200, and the slave router 200 assigns the IP address 192.168.11.10 to the electronic device. The electronic device 100 accesses the slave router 200 through the IP address 192.168.11.10. Figure 1 It should be noted that, since the network segments of the main router 300 and the slave router 200 are different, the electronic device 100 cannot access the main router 300 through the IP address assigned by the slave router 200, nor can it access the network through the main router 300.

[0077] After the connection between the master router 300 and the slave router 200 is restored, the slave router 200 turns off the DHCP service. The electronic device 100 needs to access the network through the master router 300. Then, in a possible case, the electronic device 100 has a roaming function, which means that when the connection with the network device (such as the slave router 200) is disconnected, the configuration information of the slave router 200 is still retained, including the network identification and access password of the slave router 200, such as Figure 1As shown in (c) in the figure. Since the network identification and access password of the main router 300 and the slave router 200 are the same, at this time, when the electronic device 100 accesses the network, it can directly connect to the main router 300 according to the configuration information left over from the last time. Since the electronic device 100 can directly connect to the main router 300, the electronic device 100 will not initiate a DHCP request, resulting in the main router 300 not allocating an IP address to the electronic device 100 based on the request sent by the electronic device 100. In this way, the electronic device 100 accesses the main router 300 based on the IP address 192.168.11.10 allocated by the slave router 200, and the IP address 192.168.11.10 allocated by the slave router 200 and the IP address 192.168.10.1 of the main router 300 are not IP addresses of the same network segment, so the electronic device 100 cannot access the network through the main router 300.

[0078] In view of this, a communication method provided in an embodiment of the present application is applied to a slave router in a router network connected by a master router and a slave router through a bridge mode. The method includes: when the slave router is disconnected from the master router, starting a dynamic host configuration protocol DHCP service, and determining the type of the first interface in response to a connection request sent by a first electronic device, wherein the first interface refers to a connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router. If the type of the first interface is a wireless interface, the first IP address is not assigned to the first electronic device, and the first electronic device is denied access to the slave router. That is, after the slave router is disconnected from the master router, if the first electronic device accesses the slave router through the wireless interface, the slave router will not assign the first IP address to the first electronic device, so that after the connection between the master router and the slave router is restored, there is no first IP address assigned by the slave router left in the first electronic device, so that the first electronic device will not use the IP address assigned by the slave router to connect to the master router, thereby avoiding the first electronic device using the first IP address in a different network segment from the IP address of the master router to access the master router, thereby avoiding the first electronic device being unable to access the Internet after the connection between the master router and the slave router is restored.

[0079] The communication method provided in the embodiment of the present application can be applied to a router. The electronic device can access the network by accessing the router. Optionally, the electronic device includes a terminal device, which can also be called a terminal, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), etc. The terminal device can be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, etc. The embodiment of the present application does not limit the specific technology and specific device form adopted by the terminal device.

[0080] For example, Figure 2 1 shows a schematic diagram of the structure of the electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0081] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0082] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0083] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0084] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0085] It should be noted that any electronic device mentioned in the embodiments of the present application may include more or fewer modules in the electronic device 100.

[0086] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.

[0087] The application scenarios provided by the embodiments of the present application are described below with reference to the accompanying drawings.

[0088] Figure 3 A schematic diagram of an application scenario of the communication method provided in the embodiment of the present application, such as Figure 3As shown, the electronic device 100 is connected to the Internet through the bridge mode connecting the main router 300 and the slave router 200. Among them, the electronic device 100 can be an electronic device with a roaming function, that is, after the router is disconnected, the electronic device 100 retains the last assigned IP address, the network identifier and access password of the connected router. The network identifier and access password of the main router 300 and the slave router 200 connected in the bridge mode are the same. The main router 300 assigns an IP address to the electronic device, and the electronic device 100 accesses the Internet based on the IP address assigned by the main router 300. After the main router 300 and the slave router 200 are disconnected, the slave router 200 starts the DHCP service, and the electronic device 100 can send a DHCP request to the slave router 200, requesting to access the slave router 200 to check whether the slave router 200 has a fault. Then when the main router 300 and the slave router 200 are restored to connection, the electronic device accesses the Internet based on the IP address assigned by the main router 300, the network identifier and access password of the main router.

[0089] It should be understood that the above is an example of an application scenario and does not limit the application scenario of the present application.

[0090] Combine the following Figures 4 to 10 The communication method provided in the embodiment of the present application is described in detail.

[0091] Figure 4 A flow chart of a communication method provided in an embodiment of the present application is shown as follows: Figure 4 As shown, the method is applied to a slave router, which is a slave router in a router network connected by a master router and a slave router through a bridge mode, and the method includes:

[0092] S101. When the slave router is disconnected from the master router, enable the Dynamic Host Configuration Protocol (DHCP) service.

[0093] It should be understood that since the master router and the slave router are connected via the bridge mode, the DHCP service of the slave router is turned off when the master router and the slave router are processing the connection state. In this case, the slave server cannot respond to the DHCP message sent by the electronic device requesting a connection, and thus cannot allocate an IP address to the electronic device in response to the DHCP message.

[0094] When the slave router is disconnected from the main router, the slave router can start the DHCP service. At this time, the slave router can receive DHCP messages. Therefore, when the electronic device sends a DHCP message requesting a connection to the slave router, the slave router can allocate an IP address to the electronic device in response to the DHCP message, so that the electronic device accesses the slave router based on the IP address.

[0095] The electronic device may be an electronic device with a roaming function, for example, a mobile phone, a tablet computer, etc. with a roaming function. When the mobile phone is disconnected from a network device (such as a router), the electronic device does not release the allocated IP address, and the next time it connects to the router, it can use the last allocated IP address to connect to the router.

[0096] S102: In response to a connection request sent by the first electronic device, determine a type of a first interface, where the first interface refers to a connection interface between the first electronic device and a slave router, and the connection request is used to request access to the slave router.

[0097] It should be understood that a router usually has two interfaces: a wireless interface and a wired interface. When an electronic device accesses a router through a wireless interface, it usually needs to send a DHCP service request to the router, and the router assigns an IP address to the electronic device based on the DHCP service request sent by the electronic device. Usually, the IP address assigned by the router to the electronic device is an IP address in the same network segment as the router's own IP address. The electronic device accesses the router based on the IP address in the same network segment as the router's own IP address. When an electronic device accesses the router through a wired interface, usually, the electronic device can access the router based on the IP address assigned to the first interface. This is equivalent to the router not having to assign an IP address to the electronic device based on a connection request.

[0098] For example, when the slave router is disconnected from the master router, the slave router starts the DHCP service, so that the slave router can receive the DHCP message sent by the first electronic device, that is, the connection request. At this time, the slave router first determines the type of the first interface based on the information carried in the connection request, that is, the type of the connection interface between the first electronic device and the slave router.

[0099] In a possible case, the connection request may carry indication information indicating the type of the interface, and the slave router may determine the type of the first interface according to the type indicated by the indication information.

[0100] S103: If the type of the first interface is a wireless interface, do not allocate the first IP address to the first electronic device, and deny the first electronic device access to the slave router.

[0101] It should be understood that when the first interface between the first electronic device and the slave router is a wireless interface, the first electronic device needs to allocate a first IP address to the first electronic device from the slave router based on the connection request, so that the first electronic device accesses the slave router based on the first IP address. In the communication method provided in the embodiment of the present application, in order to avoid the first electronic device using the IP address allocated by the slave router to connect to the main router, when the first electronic device accesses the slave router through the wireless interface to troubleshoot the fault of the slave router, the slave router does not allocate the first IP address to the first electronic device. Therefore, before the first electronic device connects to the main router again, the first IP address allocated by the slave router will not be stored in the first electronic device, and the first electronic device will not use the IP address allocated by the slave router to connect to the main router.

[0102] The communication method provided by the embodiment of the present application is applied to a slave router in a router network in which a master router and a slave router are connected through a bridge mode. The method includes: when the slave router is disconnected from the master router, starting a dynamic host configuration protocol DHCP service, and determining the type of a first interface in response to a connection request sent by a first electronic device, wherein the first interface refers to a connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router. If the type of the first interface is a wireless interface, the first IP address is not allocated to the first electronic device, and the first electronic device is denied access to the slave router. That is, after the slave router is disconnected from the master router, if the first electronic device accesses the slave router through the wireless interface, the slave router will not allocate the first IP address to the first electronic device, so that after the connection between the master router and the slave router is restored, there is no remaining first IP address allocated by the slave router in the first electronic device, and thus the first electronic device will not use the IP address allocated by the slave router to connect to the master router, thereby avoiding the situation where the first electronic device uses the first IP address in a different network segment from the IP address of the master router to access the master router, thereby avoiding the situation where the first electronic device cannot access the Internet after the connection between the master router and the slave router is restored.

[0103] Figure 5 A flow chart of another communication method provided in an embodiment of the present application is shown as follows: Figure 5 As shown, the method is applied to a slave router, which is a slave router in a router network connected by a master router and a slave router through a bridge mode, and the method includes:

[0104] S201. When the slave router is disconnected from the master router, enable the Dynamic Host Configuration Protocol (DHCP) service.

[0105] It should be understood that since the master router and the slave router are connected via the bridge mode, the DHCP service of the slave router is turned off when the master router and the slave router are processing the connection state. In this case, the slave server cannot respond to the DHCP message sent by the electronic device requesting a connection, and thus cannot allocate an IP address to the electronic device in response to the DHCP message.

[0106] When the slave router is disconnected from the main router, the slave router can start the DHCP service. At this time, the slave router can receive DHCP messages. Therefore, when the electronic device sends a DHCP message requesting a connection to the slave router, the slave router can allocate an IP address to the electronic device in response to the DHCP message, so that the electronic device accesses the slave router based on the IP address.

[0107] The electronic device may be an electronic device with a roaming function, for example, a mobile phone, a tablet computer, etc. with a roaming function. When the mobile phone is disconnected from a network device (such as a router), the electronic device does not release the allocated IP address, and the next time it connects to the router, it can use the last allocated IP address to connect to the router.

[0108] S202: In response to the connection request sent by the first electronic device, determine whether the connection mode between the slave router and the master router is a bridge mode.

[0109] Since the configuration information is not shared between the master router and the slave router in other connection modes, that is, the network identification and access password of the master router in other connection modes may be different from the network identification and access password of the slave router, the first electronic device will not access the master router based on the same network identification and access password after accessing the slave router.

[0110] When a connection request sent by the first electronic device is received, it is first determined whether the connection mode between the slave router and the main router is the bridge mode. If the connection mode between the slave router and the main router is not the bridge mode, the first electronic device will not access the main router based on the same network identifier and access password after accessing the slave router, and thus the first electronic device will not be unable to access the Internet through the main router.

[0111] The communication method provided in the embodiment of the present application starts the dynamic host configuration protocol DHCP service after the master router and the slave router are disconnected. The slave router first determines whether the connection mode between the master router and the slave router is the bridge mode in response to the connection request sent by the first electronic device. If the connection mode between the master router and the slave router is not the bridge mode, there is no need to further determine whether the first interface is a wireless interface, and there is no need to not allocate the first IP address to the first electronic device when the first interface is a wireless interface. This is because the connection mode between the master router and the slave router is not the bridge mode, and the master router and the slave router do not share a network identifier and an access password. In this way, the first electronic device will not access the master router based on the same network identifier and access password after accessing the slave router, and thus the first electronic device will not be unable to access the Internet through the master router. Therefore, after determining that the connection mode between the master router and the slave router is not the bridge mode, the subsequent steps of not allocating an IP address to the first electronic device are not performed, which can reduce the system overhead occupied by the slave router to perform unnecessary tasks.

[0112] S203: If the connection mode between the slave router and the master router is a bridge mode, determine the type of the first interface.

[0113] The first interface refers to a connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router.

[0114] It should be understood that a router usually has two interfaces: a wireless interface and a wired interface. When an electronic device accesses a router through a wireless interface, it usually needs to send a DHCP service request to the router, and the router assigns an IP address to the electronic device based on the DHCP service request sent by the electronic device. Usually, the IP address assigned by the router to the electronic device is an IP address in the same network segment as the router's own IP address. The electronic device accesses the router based on the IP address in the same network segment as the router's own IP address. When an electronic device accesses the router through a wired interface, usually, the electronic device can access the router based on the IP address assigned to the first interface. This is equivalent to the router not having to assign an IP address to the electronic device based on a connection request.

[0115] For example, when the slave router is disconnected from the master router, the slave router starts the DHCP service, so that the slave router can receive the DHCP message sent by the first electronic device, that is, the connection request. At this time, the slave router first determines the type of the first interface based on the information carried in the connection request, that is, the type of the connection interface between the first electronic device and the slave router.

[0116] In a possible case, the connection request may carry indication information indicating the type of the interface, and the slave router may determine the type of the first interface according to the type indicated by the indication information.

[0117] Optionally, the indication information may be information generated based on the User Datagram Protocol (UDP). For example, after the master router and the slave router are disconnected, the slave router starts the DHCP service and creates a DHCP process. The DHCP process may modify the format of the message between the connection interface and the DHCP process so that the message between the connection interface and the DHCP process carries information indicating the interface type. It should be understood that the DHCP process cannot directly interact with the connection interface and needs to be forwarded through the kernel. The kernel may refer to the Linux kernel.

[0118] For example, Figure 6 As shown, the DHCP process obtaining the indication information in the connection request may include the following steps:

[0119] 1. The DHCP process creates a service based on UDP to monitor the connection interface.

[0120] For example, the DHCP process creates a monitoring port 67 based on UDP. Port 67 is used to monitor whether the connection interface sends information.

[0121] 2. The DHCP process adds the IP_ORIGINDEV option in the UDP message.

[0122] 3. The DHCP process sends setsockopt to the Linux kernel, which instructs to add the IP_ORIGINDEV option to the message.

[0123] 4. The Linux kernel calls setsockopt through the do_ip_setsockopt function and adds the IP_CMSG_ORIGINDEV option to the message.

[0124] Among them, the IP_CMSG_ORIGINDEV option is a specific option in IP_ORIGINDEV.

[0125] 5. The first interface sends a DHCP request message to the Linux kernel.

[0126] 6. The Linux kernel finds the socket corresponding to the five-tuple information according to the five-tuple information in the DHCP request message, and obtains the interface type corresponding to the five-tuple information from the Linux kernel database.

[0127] The five-tuple information may include a protocol type, a source IP address, a source port, a destination address, and a destination port. It should be understood that the five-tuple information of the wireless interface and the wired interface is different.

[0128] 7. The Linux kernel encapsulates the interface type in a socket.

[0129] 8. The Linux kernel sends a socket to the DHCP process.

[0130] 9. The DHCP process calls recvmsg to read information indicating the interface type from the socket and determine the interface type of the first interface.

[0131] Based on the above steps, the interface type of the first interface can be determined from the DHCP process in the router.

[0132] S204: If the type of the first interface is a wireless interface, do not allocate the first IP address to the first electronic device, and deny the first electronic device access to the slave router.

[0133] It should be understood that when the first interface between the first electronic device and the slave router is a wireless interface, the first electronic device needs to allocate a first IP address to the first electronic device from the slave router based on the connection request, so that the first electronic device accesses the slave router based on the first IP address. In the communication method provided in the embodiment of the present application, in order to avoid the first electronic device using the IP address allocated by the slave router to connect to the main router, when the first electronic device accesses the slave router through the wireless interface to troubleshoot the fault of the slave router, the slave router does not allocate the first IP address to the first electronic device. Therefore, before the first electronic device connects to the main router again, the first IP address allocated by the slave router will not be stored in the first electronic device, and the first electronic device will not use the IP address allocated by the slave router to connect to the main router.

[0134] S205: If the type of the first interface is a wired interface, a first IP address is allocated to the first electronic device, and the first electronic device accesses the slave router based on the first IP address.

[0135] It should be understood that in the case where the first interface is a wired interface, the first electronic device usually does not have a roaming function. That is to say, after the connection between the main router and the slave router is restored, the slave router disconnects the first electronic device, and the network identification and access password of the router are not stored in the first electronic device. In this case, the first electronic device can only resend a connection request to the main router to connect to the network. The main router assigns an IP address to the first electronic device based on the connection request sent by the first electronic device, and the first electronic device then accesses the Internet based on the IP address assigned by the main router.

[0136] In the communication method provided by the embodiment of the present application, after the master router and the slave router are disconnected, and when the first interface connecting the first electronic device and the slave router is a wired interface, the slave router can assign a first IP address to the first electronic device, so that the first electronic device can access the slave router based on the first IP address, so that the fault of the slave router can be checked through the first electronic device.

[0137] S206: When the slave router is connected to the master router again, the DHCP service is turned off, the first electronic device obtains the second IP address assigned by the master router, and accesses the network based on the second IP address.

[0138] After the connection failure between the slave router and the main router is eliminated, the slave router and the main router are connected again. Since the slave router and the main router are connected in bridge mode, when the slave router and the main router are connected again, the connection mode between the slave router and the main router remains unchanged in bridge mode, and the slave router turns off the DHCP service. When the slave router and the first electronic device are connected through a wireless interface, since the slave router does not assign a first IP address to the first electronic device, the first electronic device cannot access the main router based on the IP address of the wireless interface, the same network identifier and the same access password. The first electronic device needs to send a DHCP request message to the main router, and the main router assigns a second IP address to the first electronic device based on the DHCP request message sent by the first electronic device, and the first electronic device accesses the Internet based on the second IP address. It should be understood that the second IP address assigned by the main router to the first electronic device can be sent directly by the main router to the first electronic device, or it can be forwarded by the main router to the first electronic device through the slave router, and the embodiment of the present application is not limited to this.

[0139] Exemplarily, the first electronic device is close to the main router and is within the signal coverage of the main router, and the second IP address is directly sent by the main router to the first electronic device.

[0140] Exemplarily, the first electronic device is far away from the main router and is not within the signal coverage range of the main router, but the first electronic device is close to the slave router and is within the signal coverage range of the slave router. In this case, the second IP address is sent from the main router to the slave router and forwarded to the first electronic device by the slave router.

[0141] For example, Figure 7As shown in (a), when the connection between the main router 300 and the slave router 200 is disconnected, if it is detected that the slave router 200 and the first electronic device 100 are connected via a wireless interface. When the first electronic device 100 sends a DHCP request to the slave router 200 to request access to the slave router 200, the slave router 200 does not assign an IP address to the first electronic device 100. When the connection between the main router 300 and the slave router 200 is restored, the distance between the first electronic device 100 and the main router 300 is far and is not within the signal coverage of the main router 300. Figure 7 As shown in (b), the first electronic device 100 sends a DHCP request to the slave router 200, and the slave router 200 forwards the DHCP request sent by the first electronic device 100 to the master router 300. In response to the request, the master router 300 sends an IP address 192.168.10.10 to the slave router 200, which is an IP address belonging to the same network segment as the IP address 192.168.10.1 of the master router 300 itself, and the slave router 200 forwards the IP address 192.168.10.10 to the first electronic device 100. Since the IP address 192.168.10.10 and the IP address 192.168.10.1 of the master router 300 itself belong to the same network segment, the master router 300 can provide the first electronic device 100 with the IP address 192.168.10.10 with access to the Internet.

[0142] The communication method provided by the embodiment of the present application is applied to a slave router in a router network connected by a master router and a slave router through a bridge mode. The method includes: when the slave router is disconnected from the master router, a dynamic host configuration protocol DHCP service is started, and in response to a connection request sent by a first electronic device, the type of the first interface is determined, wherein the first interface refers to the connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router. If the type of the first interface is a wireless interface, the first IP address is not assigned to the first electronic device, and the first electronic device is denied access to the slave router. When the slave router is connected to the master router again, the DHCP service is turned off, and the first electronic device obtains the second IP address assigned by the master router and accesses the network based on the second IP address. That is to say, after the slave router is disconnected from the master router, if the first electronic device accesses the slave router through the wireless interface, the slave router will not assign the first IP address to the first electronic device, so that after the connection between the master router and the slave router is restored, there is no first IP address assigned by the slave router left in the first electronic device, so the first electronic device can obtain the second IP address assigned by the master router, so that the first electronic device can access the Internet based on the second IP address belonging to the same network segment as the IP address of the master router.

[0143] Figure 8 A flow chart of another communication method provided in an embodiment of the present application is shown as follows: Figure 8 As shown, the method is applied to a router network connected by a master router and a slave router in a bridge mode, comprising:

[0144] S301. When the master router and the slave router are disconnected, the slave router starts the Dynamic Host Configuration Protocol DHCP service.

[0145] S302: The first electronic device sends a connection request to the slave router, where the connection request is used to request access to the slave router.

[0146] S303: The slave router determines the type of the first interface in response to the connection request, where the first interface refers to a connection interface between the first electronic device and the slave router.

[0147] S304: If the first interface is a wireless interface, the slave router does not allocate the first IP address to the first electronic device, and denies the first electronic device access to the slave router.

[0148] S305: If the first interface is a wired interface, a first IP address is allocated from the router to the first electronic device.

[0149] S306: The first electronic device accesses the slave router based on the first IP address.

[0150] S307: When the slave router is connected to the master router again, the slave router turns off the DHCP service.

[0151] S308: The first electronic device sends a connection request to the primary router.

[0152] S309: The primary router allocates a second IP address to the first electronic device.

[0153] S310: The first electronic device accesses a network based on the second IP address.

[0154] Figure 8 The implementation principle of the illustrated embodiment is similar to that of the above-mentioned embodiment and will not be described in detail here.

[0155] The communication method provided by the embodiment of the present application is applied to a router network connected by a master router and a slave router through a bridge mode. The method includes: when the slave router is disconnected from the master router, the dynamic host configuration protocol DHCP service is turned on, and in response to a connection request sent by a first electronic device, the type of the first interface is determined, wherein the first interface refers to the connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router. If the type of the first interface is a wireless interface, the first IP address is not assigned to the first electronic device, and the first electronic device is denied access to the slave router. When the slave router is connected to the master router again, the DHCP service is turned off, and the first electronic device obtains the second IP address assigned by the master router and accesses the network based on the second IP address. That is to say, after the slave router is disconnected from the master router, if the first electronic device accesses the slave router through the wireless interface, the slave router will not assign the first IP address to the first electronic device, so that after the connection between the master router and the slave router is restored, there is no first IP address assigned by the slave router in the first electronic device, so the first electronic device can obtain the second IP address assigned by the master router, so that the first electronic device can access the Internet based on the second IP address belonging to the same network segment as the IP address of the master router.

[0156] Figures 4 to 8 The illustrated embodiment focuses on describing that after the connection between the master router and the slave router is disconnected, the slave router determines whether to assign an IP address to the electronic device based on the type of connection interface between the slave router and the electronic device, so as to avoid the situation where the electronic device fails to access the master router using the IP address assigned by the slave router after the connection between the slave router and the master router is restored. In one possible case, before the slave router and the master router are connected in bridge mode, the slave router stores initial configuration information in the slave router so that when the electronic device accesses the slave router, the initial configuration information is used to connect to the electronic device. Since the initial configuration information of the slave router is different from the configuration information during the bridge mode connection, after the connection between the slave router and the master router is restored, the electronic device cannot access the master router based on the initial configuration information of the slave router. The following describes the example of a slave router that is connected to the master router. Figures 9 to 11 The illustrated embodiment is described in detail.

[0157] Fig. 9 A flow chart of a communication method provided in an embodiment of the present application is shown as follows: Fig. 9 As shown, the method is applied to a router network connected by a master router and a slave router through a bridge mode, and the method includes:

[0158] S401: Before a communication connection is first established between a slave router and a master router, the slave router stores first configuration information of the slave router.

[0159] When a communication connection is first established between the slave router and the master router, the master router sends configuration information to the slave router, so that the slave router sets the network identifier and access password of the slave router to the same network identifier and access password as those of the master router based on the configuration information sent by the master router.

[0160] Before the slave router sets the network identification and access password based on the configuration information sent by the master router, the slave router may store its own initial configuration information (ie, the first configuration information).

[0161] S402: When the slave router and the master router are disconnected, the slave router is configured according to the first configuration information and a Dynamic Host Configuration Protocol DHCP service is enabled.

[0162] When the slave router is disconnected from the master router, the slave router can call the stored first configuration information and configure the slave router according to the first configuration information. It should be understood that the first configuration information is the initial configuration information of the slave router, which is different from the configuration information sent by the master router. Therefore, the network identification and access password of the slave router configured based on the first configuration information are different from the network identification and access password of the master router.

[0163] For example, when the slave router and the master router are in a bridge mode connection state, the network identification and access password of the slave router are the same as the network identification and access password of the master router. Fig.10 As shown in (a), the network identification SSID of the master router 300 is luyouqi00, and the access password is 12345678; the network identification SSID of the slave router 200 is luyouqi00, and the access password is 12345678. After the slave router 200 and the master router 300 are disconnected, the network identification and access password of the slave router 200 obtained by the slave router 200 based on the initial configuration information of the slave router 200, for example, Fig.10 As shown in (b), the network identification SSID of the slave router 200 is luyouqi01, and the access password is 87654321, while the network identification SSID of the main router 300 is luyouqi00, and the access password is 12345678, that is, the network identification and access password of the slave router 200 are different from the network identification and access password of the main router 300.

[0164] S403: The first electronic device sends a first connection request to the slave router.

[0165] S404: In response to the first connection request sent by the first electronic device, the slave router allocates a first IP address to the first electronic device based on the first configuration information.

[0166] Continue as Fig.10 As shown in (b), in this case, the network identification SSID set by the slave router 200 based on the first configuration information is luyouqi01, the access password is 87654321, and the IP address 192.168.11.10 is assigned from the router 200 to the first electronic device 100.

[0167] S405: The first electronic device accesses the slave router based on the first IP address and the first configuration information.

[0168] Continue as Fig.10 As shown in (b), the IP address 192.168.11.10 assigned to the first electronic device by the slave router 200 is an IP address in the same network segment as the IP address 192.168.11.1 of the slave router 200, so the first electronic device can access the slave router 200 based on the IP address 192.168.11.10. When the first electronic device 100 accesses the slave router 200 to authenticate its identity, it authenticates its identity through the network identification SSID of luyouqi01 and the access password of 87654321. It should be understood that the first electronic device 100 usually stores the network identification SSID of luyouqi01 and the access password of 87654321 so that it can access the slave router 200 next time.

[0169] The communication method provided in the embodiment of the present application is applied to a router network in which a master router and a slave router are connected through a bridge mode. Before a communication connection is first established between the slave router and the master router, first configuration information of the slave router is stored; when the slave router and the master router are disconnected, the slave router is configured according to the first configuration information, and a dynamic host configuration protocol DHCP service is started; in response to a first connection request sent by a first electronic device, a first IP address is allocated to the first electronic device based on the first configuration information, and the first electronic device accesses the slave router based on the first IP address, that is, after the slave router and the master router are disconnected, the network identifier and access password used by the first electronic device when accessing the slave router are the initial network identifier and initial access password of the slave router before the slave router and the master router are first connected, so that the first electronic device does not store the same network identifier and access password as the master router, so that when the IP address of the first electronic device is the first IP address allocated by the slave router, the main router cannot be accessed through the network identifier and access password stored in the first electronic device, thereby avoiding the situation where the Internet cannot be accessed due to accessing the main router using the first IP address that is not in the same network segment as the IP address of the main router.

[0170] S406: When the connection between the slave router and the master router is restored, the slave router obtains the second configuration information sent by the master router.

[0171] The slave router obtains the second configuration information sent by the master router each time the slave router and the master router are connected, and the master router sends the second configuration information to the slave router each time the slave router and the master router are connected, or the slave router sends the second configuration information to the slave router when the slave router and the master router are connected for the first time. The slave router can store the second configuration information and call the second configuration information each time it is connected to the master router.

[0172] S407: The slave router performs configuration based on the second configuration information and closes the DHCP service.

[0173] It should be understood that the network identification and access password of the slave router and the master router connected in bridge mode are the same, so the network identification and access password obtained by the slave router based on the second configuration information are the same as the network identification and access password of the master router.

[0174] Exemplarily, the network identification SSID obtained by the slave router 200 based on the second configuration information is luyouqi00, and the access password is 12345678, which are the same as the network identification and access password of the main router 300.

[0175] S408: The first electronic device sends a second connection request to the slave router.

[0176] It should be understood that the network identification and access password stored in the first electronic device are the initial network identification and initial access password of the slave router, and therefore the master router cannot be accessed based on the initial network identification and initial access password of the slave router.

[0177] For example, Fig.10 As shown in (c), the network identification SSID stored in the first electronic device 100 is luyouqi01, and the access password is 87654321. The network identification SSID of the main router 300 is luyouqi00, and the access password is 12345678. The first electronic device 100 cannot access the main router 300 based on the network identification SSID luyouqi01 and the access password 87654321, nor can it access the Internet through the main router 300.

[0178] S409: In response to the second connection request, forward the second IP address assigned by the main router to the first electronic device from the router.

[0179] Since the first electronic device cannot access the main router through the stored initial network identifier and the initial access password, and the slave router turns off the DHCP service. In this case, the first electronic device sends a second connection request to the slave router, and the slave router cannot respond to the second connection request and allocate an IP address to the first electronic device. The slave router can forward the second connection request to the main router, and the main router responds to the second connection request, allocates a second IP address to the first electronic device, and sends the second IP address to the slave router, and the slave router forwards the second IP address to the first electronic device.

[0180] S410: The first electronic device accesses the network based on the second IP address and configuration information of the primary router.

[0181] The communication method provided in the embodiment of the present application is applied to a router network in which a master router and a slave router are connected through a bridge mode. Before the first communication connection is established between the slave router and the master router, the first configuration information of the slave router is stored; when the connection between the slave router and the master router is disconnected, the slave router is configured according to the first configuration information, and the dynamic host configuration protocol DHCP service is turned on; in response to a first connection request sent by a first electronic device, a first IP address is allocated to the first electronic device based on the first configuration information, and the first electronic device accesses the slave router based on the first IP address. When the connection between the slave router and the master router is restored, the second configuration information sent by the master router is obtained; the slave router is configured based on the second configuration information, and the DHCP service is turned off; in response to a second connection request sent by the first electronic device, the second IP address allocated by the master router is forwarded to the first electronic device, and the first electronic device accesses the network based on the second IP address. That is, in the slave router, After the slave router is disconnected from the main router, the network identifier and access password used by the first electronic device to access the slave router are the initial network identifier and initial access password of the slave router before the slave router is first connected to the main router. When the connection between the slave router and the main router is restored, the network identifier and access password stored in the first electronic device are the initial network identifier and initial access password of the slave router. The first electronic device cannot directly access the main router based on the stored network identifier and access password. Therefore, the first electronic device must send a second connection request to the main router, so that the main router allocates a second IP address to the first electronic device based on the second connection, and then accesses the main router based on the network identifier and access password matching the main router, and accesses the Internet through the main router. In this way, the first electronic device will not use the first IP address that is not in the same network segment as the IP address of the main router to access the main router, thereby avoiding the situation where the first electronic device cannot access the Internet.

[0182] Fig.11 A flow chart of a communication method provided in an embodiment of the present application is shown as follows: Fig.11 As shown, the method is applied to a slave router in a router network in which a master router and a slave router are connected via a bridge mode, and the method comprises:

[0183] S501. Before a communication connection is first established between a slave router and a master router, first configuration information of the slave router is stored.

[0184] S502: When the slave router is disconnected from the master router, the slave router is configured according to the first configuration information, and a Dynamic Host Configuration Protocol DHCP service is enabled.

[0185] S503: In response to the first connection request sent by the first electronic device, a first IP address is allocated to the first electronic device based on the first configuration information, and the first electronic device accesses the slave router based on the first IP address and the first configuration information.

[0186] The communication method provided in the embodiment of the present application is applied to a slave router in a router network in which a master router and a slave router are connected through a bridge mode. Before a communication connection is first established between the slave router and the master router, first configuration information of the slave router is stored; when the slave router and the master router are disconnected, the slave router is configured according to the first configuration information, and a dynamic host configuration protocol DHCP service is started; in response to a first connection request sent by a first electronic device, a first IP address is allocated to the first electronic device based on the first configuration information, and the first electronic device accesses the slave router based on the first IP address, that is, after the slave router and the master router are disconnected, the network identifier and access password used by the first electronic device when accessing the slave router are the initial network identifier and initial access password of the slave router before the slave router and the master router are first connected, so that the first electronic device does not store the same network identifier and access password as the master router, so that when the IP address of the first electronic device is the first IP address allocated by the slave router, the master router cannot be accessed through the network identifier and access password stored in the first electronic device, thereby avoiding the situation where the Internet cannot be accessed due to accessing the master router using the first IP address that is not in the same network segment as the IP address of the master router.

[0187] It should be understood that, although each step in the flow chart in the above-described embodiment is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is clear explanation in this article, the execution of these steps does not have strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.

[0188] It is understandable that in order to implement the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.

[0189] The embodiment of the present application can divide the functional modules of the electronic device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one module. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. It should be noted that the names of the modules in the embodiment of the present application are schematic and are not limited to the names of the modules in actual implementation.

[0190] Fig.12 A schematic diagram of the structure of a communication device provided in an embodiment of the present application.

[0191] It should be understood that the communication device 600 can perform Figures 4 to 8 The communication method shown; the communication device 600 includes: an acquisition unit 610 and a processing unit 620.

[0192] The processing unit 620 is used to start the Dynamic Host Configuration Protocol DHCP service when the slave router is disconnected from the master router;

[0193] The processing unit 620 is used to determine the type of the first interface in response to the connection request sent by the first electronic device, where the first interface refers to a connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router;

[0194] The processing unit 620 is configured to, if the type of the first interface is a wireless interface, not allocate the first IP address to the first electronic device, and deny the first electronic device from accessing the slave router.

[0195] In one embodiment, the processing unit 620 is configured to allocate a first IP address to the first electronic device if the type of the first interface is a wired interface, and the first electronic device accesses the slave router based on the first IP address.

[0196] In one embodiment, the connection request carries indication information, where the indication information is used to indicate the type of the first interface, and the processing unit 620 is used to determine the type of the first interface based on the indication information carried in the connection request.

[0197] In one embodiment, the processing unit 620 is configured to close the DHCP service when the slave router is connected to the master router again, and the first electronic device obtains the second IP address assigned by the master router and accesses the network based on the second IP address.

[0198] In one embodiment, the processing unit 620 is used to determine whether the connection mode between the slave router and the master router is a bridge mode in response to a connection request sent by the first electronic device; if the connection mode between the slave router and the master router is a bridge mode, determine the type of the first interface.

[0199] In one embodiment, the first electronic device includes a terminal device with a roaming function, where the roaming function refers to a function of not deleting network configuration information in the first electronic device when the connection between the first electronic device and the network device is disconnected.

[0200] It should be noted that the above communication device 600 is embodied in the form of a functional unit. The term "unit" here can be implemented in the form of software and / or hardware, and is not specifically limited to this.

[0201] For example, a "unit" may be a software program, a hardware circuit, or a combination of the two that implements the above functions. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (e.g., a shared processor, a dedicated processor, or a group processor, etc.) and a memory for executing one or more software or firmware programs, a combined logic circuit, and / or other suitable components that support the described functions.

[0202] Therefore, the units of each example described in the embodiments of the present application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

[0203] Fig.13 Another structural schematic diagram of a communication device provided in an embodiment of the present application.

[0204] It should be understood that the communication device 800 can perform Figures 9 to 11 The communication method shown; the communication device 800 includes: an acquisition unit 810 and a processing unit 820.

[0205] The processing unit 820 is used to store the first configuration information of the slave router before the communication connection is first established between the slave router and the master router;

[0206] The processing unit 820 is used to configure the slave router according to the first configuration information and start the Dynamic Host Configuration Protocol DHCP service when the connection between the slave router and the master router is disconnected;

[0207] The processing unit 820 is used to allocate a first IP address to the first electronic device based on the first configuration information in response to the first connection request sent by the first electronic device, and the first electronic device accesses the slave router based on the first IP address and the first configuration information.

[0208] In one embodiment, the processing unit 820 is used to obtain the second configuration information sent by the main router when the connection between the slave router and the main router is restored; configure the first electronic device based on the second configuration information and turn off the DHCP service; in response to the second connection request sent by the first electronic device, forward the second IP address assigned by the main router to the first electronic device, and the first electronic device accesses the network based on the second IP address and the configuration information of the main router.

[0209] The communication device provided in this embodiment is used to execute the communication method of the above embodiment, and the technical principle and technical effect are similar, which will not be repeated here.

[0210] It should be noted that the above communication device 800 is embodied in the form of a functional unit. The term "unit" here can be implemented in the form of software and / or hardware, and is not specifically limited to this.

[0211] For example, a "unit" may be a software program, a hardware circuit, or a combination of the two that implements the above functions. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (e.g., a shared processor, a dedicated processor, or a group processor, etc.) and a memory for executing one or more software or firmware programs, a combined logic circuit, and / or other suitable components that support the described functions.

[0212] Therefore, the units of each example described in the embodiments of the present application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

[0213] Fig.14 A structural schematic diagram of an electronic device provided by the present application is shown. Fig.14 The dotted line in the figure indicates that the unit or the module is optional. The electronic device 700 can be used to implement the communication method described in the above method embodiment.

[0214] The electronic device 700 includes one or more processors 701, which can support the electronic device 700 to implement the communication method in the method embodiment. The processor 701 can be a general-purpose processor or a special-purpose processor. For example, the processor 701 can be a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, such as discrete gates, transistor logic devices or discrete hardware components.

[0215] The processor 701 may be used to control the electronic device 700, execute software programs, and process data of the software programs. The electronic device 700 may also include a communication unit 705 to implement input (reception) and output (transmission) of signals.

[0216] For example, the electronic device 700 may be a chip, the communication unit 705 may be an input and / or output circuit of the chip, or the communication unit 705 may be a communication interface of the chip, and the chip may be a component of a terminal device or other electronic devices.

[0217] For another example, the electronic device 700 may be a terminal device, and the communication unit 705 may be a transceiver of the terminal device, or the communication unit 705 may be a transceiver circuit of the terminal device.

[0218] The electronic device 700 may include one or more memories 702 on which a program 704 is stored. The program 704 can be executed by the processor 701 to generate instructions 703, so that the processor 701 executes the communication method described in the above method embodiment according to the instructions 703.

[0219] Optionally, data may be stored in the memory 702. Optionally, the processor 701 may read data stored in the memory 702. The data may be stored at the same storage address as the program 704, or may be stored at a different storage address than the program 704.

[0220] The processor 701 and the memory 702 may be provided separately or integrated together; for example, integrated on a system on chip (SOC) of a terminal device.

[0221] Exemplarily, the memory 702 can be used to store the relevant program 704 of the communication method provided in the embodiment of the present application, and the processor 701 can be used to call the relevant program 704 of the communication method stored in the memory 702 when executing the communication method shown in the embodiment of the present application, and execute the communication method of the embodiment of the present application; including: when the slave router is disconnected from the master router, starting the Dynamic Host Configuration Protocol DHCP service; in response to the connection request sent by the first electronic device, determining the type of the first interface, the first interface refers to the connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router; if the type of the first interface is a wireless interface, the first IP address is not assigned to the first electronic device, and the first electronic device is denied access to the slave router.

[0222] Exemplarily, the memory 702 can be used to store the relevant program 704 of the communication method provided in the embodiment of the present application, and the processor 701 can be used to call the relevant program 704 of the communication method stored in the memory 702 when executing the communication method shown in the embodiment of the present application, and execute the communication method of the embodiment of the present application; including: before the communication connection is first established between the slave router and the master router, storing the first configuration information of the slave router; when the connection between the slave router and the master router is disconnected, configuring the slave router according to the first configuration information and starting the Dynamic Host Configuration Protocol DHCP service; in response to the first connection request sent by the first electronic device, allocating a first IP address to the first electronic device based on the first configuration information, and the first electronic device accessing the slave router based on the first IP address and the first configuration information.

[0223] The present application also provides a computer program product, which, when executed by the processor 701, implements the communication method described in any method embodiment of the present application.

[0224] The computer program product may be stored in the memory 702 , for example, a program 704 , which is converted into an executable target file that can be executed by the processor 701 after preprocessing, compiling, assembling, and linking.

[0225] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the communication method described in any method embodiment of the present application is implemented. The computer program can be a high-level language program or an executable target program.

[0226] The computer-readable storage medium is, for example, a memory 702. The memory 702 may be a volatile memory or a nonvolatile memory, or the memory 702 may include both a volatile memory and a nonvolatile memory. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0227] In this application, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can be represented by: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0228] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0229] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0230] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0231] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0232] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0233] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0234] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A communication method, characterized in that: The method is applied to a slave router in a router network in which a master router and a slave router are connected via a bridge mode, and the method comprises: When the slave router is disconnected from the master router, enabling a Dynamic Host Configuration Protocol (DHCP) service; In response to a connection request sent by a first electronic device, determining a type of a first interface, wherein the first interface refers to a connection interface between the first electronic device and the slave router, and the connection request is used to request access to the slave router; If the type of the first interface is a wireless interface, the first IP address is not allocated to the first electronic device, and the first electronic device is denied access to the slave router.

2. The method according to claim 1, characterized in that The method further comprises: If the type of the first interface is a wired interface, the first IP address is allocated to the first electronic device, and the first electronic device accesses the slave router based on the first IP address.

3. The method according to claim 1 or 2, characterized in that: The connection request carries indication information, where the indication information is used to indicate a type of the first interface, and the determining the type of the first interface in response to the connection request sent by the first electronic device includes: Based on the indication information carried in the connection request, a type of the first interface is determined.

4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: When the slave router is connected to the master router again, the DHCP service is turned off, the first electronic device obtains the second IP address assigned by the master router, and accesses the network based on the second IP address.

5. The method according to any one of claims 1 to 4, characterized in that: The first electronic device includes a terminal device with a roaming function, where the roaming function refers to a function of not deleting network configuration information in the first electronic device when the connection between the first electronic device and a network device is disconnected.

6. A communication method, characterized in that: The method is applied to a router network connected by a master router and a slave router in a bridge mode, and the method comprises: When the master router and the slave router are disconnected, the slave router starts a Dynamic Host Configuration Protocol DHCP service; The first electronic device sends a connection request to the slave router, where the connection request is used to request access to the slave router; The slave router determines, in response to the connection request, a type of a first interface, where the first interface refers to a connection interface between the first electronic device and the slave router; If the first interface is a wireless interface, the slave router does not allocate a first IP address to the first electronic device, and denies the first electronic device from accessing the slave router.

7. The method according to claim 6, characterized in that The method further comprises: If the first interface is a wired interface, the slave router assigns the first IP address to the first electronic device; The first electronic device accesses the slave router based on the first IP address.

8. The method according to claim 6 or 7, characterized in that: The method further comprises: When the slave router is connected to the master router again, the slave router shuts down the DHCP service; The first electronic device obtains a second IP address assigned by the main router, and accesses a network based on the second IP address.

9. An electronic device, characterized in that: The electronic device comprises means for performing the method as claimed in any one of claims 1 to 5.

10. An electronic device, characterized in that: include: one or more processors; Memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and when the computer programs are executed by the one or more processors, the electronic device performs the method as claimed in any one of claims 1 to 5.

11. A chip system, characterized in that: The chip system includes a processor for calling and running a computer program from a memory, so that an electronic device equipped with the chip system executes the method according to any one of claims 1 to 5.

12. A computer-readable storage medium comprising a computer program, characterized in that: When the computer program is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 5.