CN109981822B - Alternative address allocation method based on DHCP detection, storage medium and terminal - Google Patents

Alternative address allocation method based on DHCP detection, storage medium and terminal Download PDF

Info

Publication number
CN109981822B
CN109981822B CN201910344702.4A CN201910344702A CN109981822B CN 109981822 B CN109981822 B CN 109981822B CN 201910344702 A CN201910344702 A CN 201910344702A CN 109981822 B CN109981822 B CN 109981822B
Authority
CN
China
Prior art keywords
dhcp server
dhcp
wireless
main wireless
steps
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910344702.4A
Other languages
Chinese (zh)
Other versions
CN109981822A (en
Inventor
吴梦非
杨涛
彭琮
赵品富
黄磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Cetron Yikong Technology Co ltd
Original Assignee
Wuhan Cetron Yikong Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Cetron Yikong Technology Co ltd filed Critical Wuhan Cetron Yikong Technology Co ltd
Priority to CN201910344702.4A priority Critical patent/CN109981822B/en
Publication of CN109981822A publication Critical patent/CN109981822A/en
Application granted granted Critical
Publication of CN109981822B publication Critical patent/CN109981822B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses an alternative address allocation method, a storage medium and a terminal based on DHCP detection, belonging to the technical field of computer network communication, wherein the method comprises the following steps: the main wireless AP broadcasts a message of closing the DHCP server to other wireless APs, and the other wireless APs immediately close the DHCP server after receiving the broadcast message; the method comprises the steps that a main wireless AP detects whether a DHCP server exists in a local area network or not, if not, the main wireless AP immediately starts the own DHCP server to distribute an IP address for a terminal, otherwise, the main wireless AP judges whether the lease time of the DHCP server is more than a first time or not, if so, the main wireless AP stops detecting whether other DHCP servers exist in the local area network or not, otherwise, the main wireless AP waits for the end of the current lease time and returns to the step that the main wireless AP broadcasts a message of closing the DHCP servers to other wireless APs. The invention solves the problem of local area network communication when a plurality of wireless APs are under the switch and no other gateway equipment exists.

Description

Alternative address allocation method based on DHCP detection, storage medium and terminal
Technical Field
The invention relates to the technical field of computer network communication, in particular to an alternative address allocation method based on DHCP detection, a storage medium and a terminal.
Background
Under the condition of large house area, such as villas, companies and public places, when Wi-Fi coverage is realized, a plurality of wireless APs are required to cooperate to complete the Wi-Fi coverage of a large-area scene.
Currently, more and more developers are starting to sell hardbound rooms, hardbound rooms mean that wireless APs and switches are installed in advance, and some smart devices can also be installed, such as: the device can be controlled by network, such as curtains, lamps, monitors and the like. When the building is delivered, a client wants to show the control of the internet of things equipment, but because the optical modem is not installed, a local area network formed by wireless AP equipment connected with the switch has no gateway, all the connected internet of things equipment cannot be used, and the gateway equipment needs to exist in the local area network.
Disclosure of Invention
The invention aims to solve the communication problem of a local area network when a plurality of wireless APs are under a switch and no other gateway equipment exists in the prior art, and provides an alternative address allocation method based on DHCP detection, a storage medium and a terminal.
The purpose of the invention is realized by the following technical scheme: a method for allocating alternative addresses based on DHCP detection comprises the following steps:
s01: the main wireless AP broadcasts a message of closing the DHCP server to other wireless APs, and the other wireless APs immediately close the DHCP server after receiving the broadcast message;
s02: the main wireless AP detects whether a DHCP server exists in the local area network or not;
s03: and if the DHCP server does not exist, the main wireless AP immediately starts the DHCP server of the main wireless AP to distribute the IP address for the terminal.
Specifically, the method further comprises:
s04: if the DHCP server exists, the master wireless AP determines whether the lease time of the DHCP server is greater than the first time, if so, the master wireless AP stops detecting whether the DHCP server exists in the local area network, and if not, the master wireless AP returns to step S01 after waiting for the first time.
Specifically, the first time is a DHCP server lease time of the wireless AP setting WIFI, specifically 120 s.
Specifically, step S02 further includes:
and the main wireless AP detects whether other equipment with the DHCP function exists in the local area network for three times continuously by taking the second detection time as a period, and the second time is specifically 10 s.
Specifically, in step S03, if there is no DHCP server, the step of the master wireless AP immediately starting its own DHCP server further includes:
s031: the main wireless AP starts a local DHCP client to detect whether a DHCP server still exists in the local area network or not by taking the first time as a period.
The present invention also includes a storage medium having stored thereon computer instructions which, when executed, perform the steps of the above-described alternative address assignment method based on DHCP probe.
The invention also includes a terminal, which includes a memory and a processor, wherein the memory stores computer instructions capable of running on the processor, and the processor executes the steps of the alternative address allocation method based on the DHCP probe when running the computer instructions.
The invention relates to an alternative address allocation method based on DHCP detection, which comprises the following steps:
and other wireless APs receive the message of closing the DHCP server sent by the main wireless AP, and the other wireless APs immediately close the DHCP server after receiving the broadcast message.
The present invention also includes a storage medium having stored thereon computer instructions which, when executed, perform the steps of the above-described alternative address assignment method based on DHCP probe.
The invention also includes a terminal, which includes a memory and a processor, wherein the memory stores computer instructions capable of running on the processor, and the processor executes the steps of the alternative address allocation method based on the DHCP probe when running the computer instructions.
Compared with the prior art, the invention has the beneficial effects that:
the invention detects the DHCP server in the local area network through the main wireless AP, and when detecting that no equipment with gateway function is connected in the local area network, the IP address is distributed to the terminal through the main wireless AP, thereby realizing the function that the terminal in the local area network can communicate when a plurality of wireless APs are under the switch and no other gateway equipment exists.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the figure:
FIG. 1 is a flowchart of a method of example 1 of the present invention.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it should be noted that directions or positional relationships indicated by "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", and the like are directions or positional relationships described based on the drawings, and are only for convenience of description and simplification of description, and do not indicate or imply that the device or element referred to must have a specific orientation, be configured and operated in a specific orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the present invention, it should be noted that, unless otherwise explicitly stated or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
In addition, the technical features involved in the different embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
Example 1
As shown in fig. 1, in embodiment 1, a method for allocating an alternative address based on DHCP probe is implemented based on the following technical solution, where all wireless APs are connected to a switch, and the switch is connected to an optical modem to complete Wi-Fi coverage in a large scene, if a certain area is not installed with a gateway device such as an optical modem, a local area network formed by the wireless AP devices connected to the switch in the area has no gateway, that is, terminals in the area cannot perform information interaction, and in order to solve a communication problem of the local area network when a plurality of wireless APs are under the switch and no other gateway devices exist, the method provides an alternative address allocation method based on DHCP probe, and specifically includes the following steps:
s01: the main wireless AP broadcasts a message of closing the DHCP server to other wireless APs, and the other wireless APs immediately close the DHCP server after receiving the broadcast message;
s02: the main wireless AP detects whether a DHCP server still exists in the local area network; in particular, there may be other devices with DHCP functions in the local area network that have activated the DHCP server function. The main wireless AP is the wireless AP with the longest running time in the plurality of wireless APs and is responsible for the management functions of configuration, keep-alive and the like of all the wireless APs accessed to the switch. As a preferred option, the master wireless AP starts a local DHCP client to detect whether a DHCP server exists in the local area network three times continuously with a second detection time as a period, where the second detection time is specifically 10 s. Further, the local DHCP client sends a message requesting an IP address, and if the DHCP client receives the message sent by the DHCP server and allocating IP address information to the DHCP server, it indicates that the DHCP server exists in the local area network.
S03: if the DHCP server does not exist, the main wireless AP immediately starts the DHCP server of the main wireless AP to distribute an IP address for the terminal; the terminal includes but is not limited to an internet of things terminal device.
S04: if the DHCP server exists, the master wireless AP determines whether the lease time of the DHCP server is greater than the first time, if so, the master wireless AP stops detecting whether the DHCP server exists in the local area network, otherwise, after waiting for the first time, the master wireless AP starts to execute the method from step S01. The first time is the DHCP server lease time of WIFI set for the wireless AP, and is specifically 120 s. Further, the main Ap starts a local DHCP client to detect whether there is a DHCP server under the local area network, and if there is a DHCP server, the DHCP server allocates an IP to the DHCP client, and issues a lease time to the local DHCP client of the main Ap.
Further, step S03 specifically includes:
s031: if the DHCP server does not exist, the main wireless AP immediately starts the DHCP server of the main wireless AP to distribute an IP address for the terminal; specifically, if the DHCP server does not exist, it indicates that there is no device with a gateway function in the local area network, and in this case, the master wireless AP starts its own DHCP server to allocate an IP address to the terminal.
S032: starting a local DHCP client of a main wireless AP to detect whether a DHCP server still exists in a local area network or not by taking first time as a period; in particular, in practical applications, a user may connect external other devices with DHCP to the switch, and therefore real-time detection is required to prevent the problem of IP address collision caused by the presence of multiple DHCP servers within a local area network.
Further, step S04 specifically includes the following steps:
s041: if the DHCP server exists, the main wireless AP judges whether the lease time of the DHCP server is more than 120s of the DHCP server lease time of WIFI set by the wireless AP;
s042: if the lease time of the DHCP server is more than 120s, the local area network is connected with equipment with a gateway function, and the detection of the DHCP server in the local area network is stopped;
s043: if the lease time of the DHCP server is less than 120S, it indicates that the current DHCP server is on another wireless AP and not on the current master wireless AP, and after the master wireless AP waits for 120S, the master wireless AP starts to execute the method from step S01 to close the DHCP servers on other wireless APs and start its own DHCP server.
The embodiment also comprises a system of the alternative address allocation method based on DHCP detection, wherein the system comprises an information sending unit, an information receiving unit and a judging unit.
Further, the information sending unit is used for the main wireless AP to broadcast a message of closing the DHCP server to other wireless APs.
Further, the information receiving unit is used for the other wireless APs to receive the message of closing the DHCP server broadcast by the main wireless AP.
Further, the judging unit is used for the main wireless AP to judge whether the lease time of the DHCP server started in the local area network is longer than the lease time of the DHCP server set with WIFI by the wireless AP.
The present embodiments also provide a storage medium having stored thereon computer instructions which, when executed, perform the steps of the alternative address assignment method based on DHCP probe.
Based on such understanding, the technical solution of the present embodiment or parts of the technical solution may be essentially implemented in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The embodiment also provides a terminal, which includes a memory and a processor, where the memory stores computer instructions executable on the processor, and the processor executes the steps of the alternative address allocation method based on DHCP probe in embodiment 1 when executing the computer instructions. The processor may be a single or multi-core central processing unit or a specific integrated circuit, or one or more integrated circuits configured to implement the present invention.
Each functional unit in the embodiments provided by the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
Example 2
The embodiment provides an alternative address allocation method based on DHCP probe, which has the same inventive concept as embodiment 1, and takes other wireless APs as an execution subject, and the method includes:
and other wireless APs receive the message of closing the DHCP server sent by the main wireless AP, and the other wireless APs immediately close the DHCP server after receiving the broadcast message.
The present embodiment further provides a storage medium, on which computer instructions are stored, and the computer instructions execute the steps of the alternative address allocation method based on DHCP probe in embodiment 2 when the computer instructions are executed.
Based on such understanding, the technical solution of the present embodiment or parts of the technical solution may be essentially implemented in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The embodiment also provides a terminal, which includes a memory and a processor, where the memory stores computer instructions executable on the processor, and the processor executes the steps of the alternative address allocation method based on DHCP probe in embodiment 2 when executing the computer instructions. The processor may be a single or multi-core central processing unit or a specific integrated circuit, or one or more integrated circuits configured to implement the present invention.
Each functional unit in the embodiments provided by the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The invention detects the DHCP server in the local area network through the main wireless AP, and when detecting that no equipment with gateway function is connected in the local area network, the IP address is distributed to the terminal through the main wireless AP, thereby realizing the function that the terminal in the local area network can communicate when a plurality of wireless APs are under the switch and no other gateway equipment exists.
The above detailed description is for the purpose of describing the invention in detail, and it should not be construed that the detailed description is limited to the description, and it will be apparent to those skilled in the art that various modifications and substitutions can be made without departing from the spirit of the invention.

Claims (8)

1. The alternative address allocation method based on DHCP detection is characterized in that: the method comprises the following steps:
the main wireless AP broadcasts a message of closing the DHCP server to other wireless APs, and the other wireless APs immediately close the DHCP server after receiving the broadcast message;
the main wireless AP detects whether a DHCP server exists in the local area network or not;
if the DHCP server does not exist, the main wireless AP immediately starts the DHCP server of the main wireless AP to distribute an IP address for the terminal;
the method further comprises the following steps:
if the DHCP server exists, the main wireless AP judges whether the lease time of the DHCP server is longer than a first time, if so, the main wireless AP stops detecting whether the DHCP server exists in the local area network, and if not, the main wireless AP returns to the step that the main wireless AP broadcasts a message of closing the DHCP server to other wireless APs after waiting for the first time;
the first time is the DHCP server lease time of the wireless AP for setting WIFI, and is specifically 120 s.
2. The method of claim 1, wherein the method comprises: if no DHCP server exists, the step that the main wireless AP immediately starts the DHCP server of the main wireless AP further comprises the following steps:
and starting a local DHCP client of the main wireless AP to detect whether a DHCP server still exists in the local area network or not by taking the first time as a period.
3. The method of claim 1, wherein the method comprises:
and the main wireless AP detects whether other equipment with the DHCP function exists in the local area network for three times continuously by taking the second detection time as a period, and the DHCP server is started.
4. A storage medium having stored thereon computer instructions, characterized in that: the computer instructions are operable to perform the steps of the DHCP probe based alternative address allocation method of any one of claims 1 to 3.
5. A terminal comprising a memory and a processor, the memory having stored thereon computer instructions executable on the processor, the terminal comprising: the processor, when executing the computer instructions, performs the steps of the DHCP probe based alternative address assignment method of any one of claims 1 to 3.
6. The alternative address allocation method based on DHCP detection is characterized in that: the method comprises the following steps:
and other wireless APs receive the message of closing the DHCP server sent by the main wireless AP, and the other wireless APs immediately close the DHCP server after receiving the broadcast message.
7. A storage medium having stored thereon computer instructions, characterized in that: the computer instructions are operable to perform the steps of the DHCP probe based alternative address allocation method of claim 6.
8. A terminal comprising a memory and a processor, the memory having stored thereon computer instructions executable on the processor, the terminal comprising: the processor, when executing the computer instructions, performs the steps of the DHCP probe based alternative address assignment method of claim 6.
CN201910344702.4A 2019-04-26 2019-04-26 Alternative address allocation method based on DHCP detection, storage medium and terminal Active CN109981822B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910344702.4A CN109981822B (en) 2019-04-26 2019-04-26 Alternative address allocation method based on DHCP detection, storage medium and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910344702.4A CN109981822B (en) 2019-04-26 2019-04-26 Alternative address allocation method based on DHCP detection, storage medium and terminal

Publications (2)

Publication Number Publication Date
CN109981822A CN109981822A (en) 2019-07-05
CN109981822B true CN109981822B (en) 2022-01-25

Family

ID=67086574

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910344702.4A Active CN109981822B (en) 2019-04-26 2019-04-26 Alternative address allocation method based on DHCP detection, storage medium and terminal

Country Status (1)

Country Link
CN (1) CN109981822B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113329105B (en) * 2021-06-10 2022-09-06 深圳市炬力北方微电子有限公司 Redundancy method of distributed self-adaptive DHCP service and related equipment
CN113905050B (en) * 2021-08-30 2023-07-18 成都市联洲国际技术有限公司 Method, device and system for detecting internet access information

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286909A (en) * 2008-06-10 2008-10-15 华中科技大学 Method of automatically constructing wireless distributed system
CN107517123A (en) * 2016-06-17 2017-12-26 智易科技股份有限公司 Local area network topology management system and method
CN108650336A (en) * 2018-04-13 2018-10-12 普联技术有限公司 IP address dynamic allocation method, device and storage medium, wireless relay apparatus
CN108668107A (en) * 2017-03-28 2018-10-16 中南大学 A kind of wireless video relay transmission system and method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105635327B (en) * 2014-10-28 2019-08-06 新华三技术有限公司 A kind of method and apparatus of address distribution

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286909A (en) * 2008-06-10 2008-10-15 华中科技大学 Method of automatically constructing wireless distributed system
CN107517123A (en) * 2016-06-17 2017-12-26 智易科技股份有限公司 Local area network topology management system and method
CN108668107A (en) * 2017-03-28 2018-10-16 中南大学 A kind of wireless video relay transmission system and method
CN108650336A (en) * 2018-04-13 2018-10-12 普联技术有限公司 IP address dynamic allocation method, device and storage medium, wireless relay apparatus

Also Published As

Publication number Publication date
CN109981822A (en) 2019-07-05

Similar Documents

Publication Publication Date Title
CN111934918B (en) Network isolation method and device for container instances in same container cluster
CN109792287B (en) Method and device for transmitting response message
CN107113892B (en) Method and device for automatically networking gateway equipment
US9100303B2 (en) Methods, devices, and systems for allocating IP address
CN109981822B (en) Alternative address allocation method based on DHCP detection, storage medium and terminal
CN107925978B (en) Network, cloud-based server, and registration method for service
CN106713522B (en) Wireless fidelity Wi-Fi connection method and mobile terminal
CN111432044A (en) Multi-link equipment MAC address management method and device and multi-link equipment
CN113612861B (en) Remote access method, system and computer readable storage medium
CN111294416A (en) Method for obtaining IP address and related product
WO2014075259A1 (en) Processing method and network device for international mobile equipment identity (imei) information
TW201406103A (en) Server and service mode setting method
CN114615272B (en) Method and system for scheduling media data forwarding server
CN114980273A (en) Wireless network configuration method and device, readable storage medium and terminal equipment
CN106657424B (en) Method, equipment and system for realizing domain name service in Internet of things
CN111935832A (en) Network resource allocation method and device and computer equipment
CN107041019B (en) Method for releasing IP address by wireless access point, user terminal and storage device
CN112512134A (en) Communication tunnel establishment method, device, equipment and storage medium
CN112911026A (en) Address application method, device and equipment
CN110691428A (en) Heartbeat packet sending method, device, equipment and storage medium
EP2680493A1 (en) A device and a method at the device for configuring a wireless interface
CN114500548B (en) Method and system for accessing equipment terminal to cloud platform and related components
WO2015157945A1 (en) Information transmission method, device, and system
CN109982427B (en) Information processing method and device
WO2022062856A1 (en) Resource management method and apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Alternative address allocation method, storage medium, and terminal based on DHCP detection

Granted publication date: 20220125

Pledgee: Guanggu Branch of Wuhan Rural Commercial Bank Co.,Ltd.

Pledgor: WUHAN CETRON YIKONG TECHNOLOGY CO.,LTD.

Registration number: Y2024980009482

PE01 Entry into force of the registration of the contract for pledge of patent right