Control method, device, equipment, medium and program product for router obtaining IP

By discarding DHCP Discover and DHCP Offer messages in the wireless relay network, the network anomaly problem caused by the wired connection between the secondary router and the main router is solved, and the stable operation of the wireless relay network is achieved.

CN115967702BActive Publication Date: 2025-09-26SHENZHEN GONGJIN ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211520193.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-30
Publication Date
2025-09-26
Estimated Expiration
2042-11-30

AI Technical Summary

Technical Problem

In a wireless relay network, the secondary router and the primary router are connected via a wired connection, causing network anomalies.

Method used

By obtaining DHCP messages in real time, it is determined whether they are DHCP Discover messages or DHCP Offer messages, and if they are such messages, they are discarded to prohibit the secondary router from sending IP address acquisition requests to the DHCP server.

Benefits of technology

This prevents the secondary router from obtaining an IP address through a wired method, prevents network anomalies from occurring, and ensures the normal operation of the wireless relay network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115967702B_ABST
    Figure CN115967702B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, apparatus, device, medium, and program product for controlling a router to obtain an IP address. The method is applied to a router in a wireless relay network. The method comprises: obtaining a DHCP message in real time; determining whether the DHCP message is a DHCP Discover message; and if the DHCP message is a DHCP Discover message, discarding the DHCP Discover message to prohibit a secondary router from sending an IP address acquisition request to a DHCP server. Thus, the present invention prohibits a router from obtaining an IP address by discarding the DHCP Discover message sent by the secondary router to the DHCP server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of routers, and in particular to a control method, device, equipment, storage medium and program product for a router to obtain an IP address. Background Art

[0002] When using a router, the wireless signal may be weakened due to the influence of space, for example, it is far away from the wireless router, or the router is connected to a wall. Therefore, wireless repeaters are usually used to enhance the wireless signal and expand the coverage of the wireless signal.

[0003] However, during the process of building a wireless relay network, users who have no experience in building wireless relay networks will connect the main router to the secondary (auxiliary) router through a wired method. As a result, after the wireless relay network is built, the secondary router will still obtain an IP address through a wired connection, causing the secondary router to be connected to the network in a loop with both wired and wireless connections, thereby causing network abnormalities. Summary of the Invention

[0004] The embodiment of the present invention discloses a control method, device, equipment, storage medium and program product for a router to obtain an IP address, so as to solve the network abnormality problem caused by the wired connection between a secondary router and a main router in a wireless relay network.

[0005] The present invention discloses a control method for a router to obtain an IP address, which is applied to a router in a wireless relay network. The method comprises:

[0006] Get DHCP messages in real time;

[0007] Determine whether the DHCP message is a DHCP Discover message;

[0008] If the DHCP message is a DHCP Discover message, the DHCP Discover message is discarded to prohibit the secondary router from sending an IP address acquisition request to the DHCP server.

[0009] Optionally, after obtaining the DHCP message in real time, the method further includes:

[0010] Determining whether the DHCP message is a DHCP Offer message;

[0011] If the DHCP message is a DHCP Offer message, the DHCP Offer message is discarded to prohibit the secondary router from obtaining an IP address from the DHCP Offer message.

[0012] In the above method, optionally, determining whether the DHCP message is a DHCP Discover message includes:

[0013] Obtaining the message type of the DHCP message;

[0014] According to the message type of the DHCP message, it is determined whether the DHCP message is a DHCP Discover message.

[0015] Optionally, in the above method, the real-time acquisition of DHCP messages includes:

[0016] Obtain the message data sent and received by the router in real time;

[0017] Determine whether the message data is an IP message;

[0018] If the message is an IP message, it is determined whether the IP message is a DHCP message to obtain the DHCP message.

[0019] The above method may optionally further include, before obtaining the DHCP message in real time:

[0020] Determine whether there is a wired connection between the secondary router and the primary router;

[0021] If there is a wired connection between the secondary router and the primary router, the step of obtaining the DHCP message in real time is triggered.

[0022] The present invention also discloses a control device for a router to obtain an IP address, comprising:

[0023] A message acquisition unit, used to acquire DHCP messages in real time;

[0024] A first message determination unit, configured to determine whether the DHCP message is a DHCP Discover message;

[0025] The first message discarding unit is configured to discard the DHCPDiscover message when the DHCP message is a DHCPDiscover message, so as to prohibit the secondary router from sending an IP address acquisition request to the DHCP server.

[0026] The above device may optionally further include:

[0027] A second message determination unit, configured to determine whether the DHCP message is a DHCP Offer message;

[0028] The second message discarding unit is configured to discard the DHCPOffer message when the DHCP message is a DHCP Offer message, so as to prohibit the secondary router from obtaining an IP address from the DHCP Discover message.

[0029] The present invention discloses a computer device, comprising a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, any one of the above-mentioned control methods for a router to obtain an IP address is implemented.

[0030] The present invention discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the control method for a router to obtain an IP address as described in any one of the above items is realized.

[0031] The present invention discloses a computer program product, which includes a computer program. When the computer program is executed by a processor, the control method for a router to obtain an IP address is implemented.

[0032] In summary, the present invention discloses a method, apparatus, device, storage medium, and program product for controlling a router to obtain an IP address. The method comprises determining a DHCP message sent or received by a secondary router in a wireless relay network, obtaining a DHCP Discover message in the DHCP message, and then discarding the DHCP Discover message to prohibit the secondary router from sending an IP address acquisition request to a DHCP server. It can be seen that the present invention discards the DHCP Discover message in which the secondary router requests an IP address from the DHCP server, so that the DHCP server cannot receive the secondary router's IP acquisition request, and the DHCP server cannot assign an IP address to the secondary router. Thus, the purpose of prohibiting the secondary router from obtaining an IP address via a wired method can be achieved, thereby avoiding network anomalies in the wireless relay network. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0034] Figure 1 This is a flow chart of a control method for a router to obtain an IP address disclosed in the first embodiment of the present invention;

[0035] Figure 2This is another implementation flow chart of a control method for a router to obtain an IP address disclosed in the first embodiment of the present invention;

[0036] Figure 3 This is a partial implementation flow chart of a control method for a router to obtain an IP address disclosed in the first embodiment of the present invention;

[0037] Figure 4 This is a partial implementation flow chart of a control method for a router to obtain an IP address disclosed in the first embodiment of the present invention;

[0038] Figure 5 This is another implementation flow chart of a control method for a router to obtain an IP address disclosed in the first embodiment of the present invention;

[0039] Figure 6 This is a schematic diagram of the structure of a control device for obtaining an IP address from a router disclosed in the second embodiment of the present invention;

[0040] Figure 7 This is another structural diagram of a control device for obtaining an IP address from a router disclosed in the second embodiment of the present invention;

[0041] Figure 8 This is a schematic diagram of the structure of a computer device disclosed in Example 3 of the present invention. DETAILED DESCRIPTION

[0042] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0043] The present invention discloses a control method, device, equipment, storage medium and program product for a router to obtain an IP address, which is applied to a sub-router in a wireless relay network. By judging the obtained DHCP message, when the DHCP message is a DHCP Discover message, the DHCP message is discarded, thereby prohibiting the sub-router from sending an IP address acquisition request to the DHCP server. It can be understood that the obtained DHCP message obtained in the present invention can be a DHCP message sent out by the sub-router, or a received DHCP message. When it is determined that the DHCP message is a DHCP Discover message, the DHCP message is discarded. It can be seen that in the present invention, by discarding the DHCP Discover message in which the sub-router requests an IP address from the DHCP server, the DHCP server cannot receive the IP acquisition request of the sub-router, and the DHCP server cannot assign an IP address to the sub-router. Accordingly, the purpose of prohibiting the sub-router from obtaining an IP address through a wired method can be achieved. The following is an illustration through a specific embodiment.

[0044] It should be noted that the method of the present invention is applied to a router in a wireless relay network. The router can be a primary router or a secondary router, which is not limited in this embodiment.

[0045] Example 1

[0046] like Figure 1 FIG. 1 is a flowchart of a control method for obtaining an IP address by a router disclosed in Embodiment 1 of the present invention, which is specifically as follows:

[0047] S101: Obtaining DHCP messages in real time.

[0048] In a specific implementation, the method of this embodiment can be applied to a primary router or a secondary router in a wireless relay network. When applied to a secondary router, the method acquires DHCP messages sent from the secondary router's WAN port and received by the secondary router's WAN port in real time, thereby acquiring DHCP messages. When applied to a primary router, the method acquires DHCP messages transmitted from the secondary router's WAN port and DHCP messages that the primary router needs to transmit to the secondary router's WAN port in real time, thereby acquiring DHCP messages. Based on this, the subsequent steps of the method for controlling the router to obtain an IP address are executed based on the acquired DHCP messages.

[0049] S102: Determine whether the DHCP message is a DHCP Discover message.

[0050] When the acquired DHCP message is a DHCP Discover message, step S103 is executed; when the acquired DHCP message is not a DHCP Discover message, normal message processing is performed.

[0051] In a specific implementation, this embodiment can determine whether a DHCP message is a DHCP Discover message by obtaining the message type of the DHCP message. When the message type of the DHCP message is Discover, the DHCP message is determined to be a DHCP Discover message, and step S103 is executed to discard the DHCP Discover message to prohibit the secondary router from sending an IP address acquisition request to the DHCP server. When the message type of the DHCP message is not Discover, the message is processed according to the normal message process.

[0052] S103: discarding the DHCP Discover message to prohibit the secondary router from sending an IP address acquisition request to the DHCP server.

[0053] Among them, the DHCP Discover message is the message sent by the router to the DHCP server to request an IP address. When the DHCP server receives the DHCP Discover message, it will assign an IP address to the secondary router. Therefore, by discarding the DHCP Discover message, the DHCP server is prevented from receiving the DHCP Discover message sent by the secondary router, thereby prohibiting the router from obtaining an IP address.

[0054] In summary, the first embodiment of the present invention discloses a method for controlling a router to obtain an IP address. The method comprises judging a DHCP message sent or received by a router in a wireless relay network, obtaining a DHCP Discover message in the DHCP message, and then discarding the DHCP Discover message to prohibit a secondary router from sending an IP address acquisition request to a DHCP server. As can be seen, the present invention discards the DHCP Discover message in which the secondary router requests an IP address from the DHCP server, so that the DHCP server cannot receive the secondary router's IP acquisition request, and the DHCP server cannot assign an IP address to the secondary router. Thus, the purpose of prohibiting the secondary router from obtaining an IP address through a wired method can be achieved.

[0055] Based on Figure 1 In the specific implementation, after step S101, the following steps are also included: Figure 2 As shown:

[0056] S104: Determine whether the DHCP message is a DHCP Offer message.

[0057] When the acquired DHCP message is a DHCP Offer message, step S105 is executed; when the acquired DHCP message is not a DHCP Offer message, normal message processing is performed.

[0058] In a specific implementation, this embodiment can determine whether a DHCP message is a DHCP Offer message by obtaining the message type of the DHCP message. If the message type of the DHCP message is Offer, the DHCP message is determined to be a DHCP Offer message, and step S105 is executed to discard the DHCP Offer message to prohibit the secondary router from obtaining an IP address from the DHCP Discover message. If the message type of the DHCP message is not Offer, the message is processed according to the normal message process.

[0059] S105: discard the DHCP Offer message to prohibit the secondary router from obtaining an IP address from the DHCP Offer message.

[0060] A DHCP offer message is a message sent by a DHCP server to a router containing a pre-assigned IP address. When a router receives a DHCP offer message, it obtains the pre-assigned IP address. Therefore, by discarding the DHCP offer message, the router is prevented from obtaining the pre-assigned IP address contained in the DHCP offer message, thereby preventing the router from obtaining an IP address.

[0061] Based on Figure 1 In the specific implementation, step S102 can be implemented by the following steps: Figure 3 As shown:

[0062] S301: Obtain the message type of the DHCP message.

[0063] S302: Determine, based on the message type of the DHCP message, whether the DHCP message is a DHCP Discover message.

[0064] S302: Confirm that the DHCP message is a DHCP Discover message.

[0065] In a specific implementation, this embodiment can obtain the message type of a DHCP message by obtaining the value of the Message Type field in the message. For example, when the value of the Message Type field in a DHCP message is 0x01, the current message is determined to be a DHCP Discover message. For another example, when the value of the Message Type field in a DHCP message is 0x02, the current message is determined to be a DHCP Offer message. Based on this, the message type of the DHCP message is obtained.

[0066] Based on Figure 1 In the specific implementation, step S101 can be implemented by the following steps: Figure 4 As shown:

[0067] S401: Acquire the message data sent and received by the router in real time.

[0068] S402: Determine whether the message data is an IP message.

[0069] If the message data is an IP message, step S403 is executed; if the message is not an IP message, the normal message flow is followed.

[0070] In a specific implementation, this embodiment can determine whether a message is an IP message by obtaining the message type. For example, when the obtained message type value is 0x0800, the message is determined to be an IP message. If the obtained message type value is 0x0800, the message is determined to be an IP message, and step S403 is executed to determine whether the IP message is a DHCP message. If the obtained message type value is not 0x0800, the message is processed according to the normal message flow. Based on this, the IP message can be filtered out from the message.

[0071] S403: Determine whether the IP message is a DHCP message.

[0072] In a specific implementation, this embodiment can determine whether an IP message is a DHCP message by obtaining the port number of the IP message. For example, when the port number of the IP message is 67 or 68, it is determined that the current IP message is a DHCP message. Accordingly, the DHCP message is obtained.

[0073] S404: Determine that the IP message is a DHCP message.

[0074] Based on Figure 1 In the specific implementation, the following steps are also included before step S101: Figure 5 As shown:

[0075] S106: Determine whether there is a wired connection between the secondary router and the primary router.

[0076] The secondary router and the main router are routers in the wireless relay network.

[0077] When the wireless relay mode is enabled, it is determined whether there is a wired connection between the secondary router and the primary router. If there is a wired connection between the secondary router and the primary router, step S502 is executed, that is, step S101 and subsequent steps are executed. In other words, when there is a wired connection between the secondary router and the primary router, step S101 and subsequent steps are executed.

[0078] It should be understood that the size of the serial numbers of the steps in the above embodiments 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 invention.

[0079] Example 2

[0080] like Figure 6 The figure shows an implementation flow chart of a control device for obtaining an IP address of a router disclosed in the second embodiment of the present invention, which is specifically as follows:

[0081] In a specific implementation, the apparatus in this embodiment includes the following units:

[0082] The message acquisition unit 601 is used to acquire the DHCP message;

[0083] A first message determination unit 602 is configured to determine whether a DHCP message is a DHCP Discover message;

[0084] The first message discarding unit 603 is configured to discard the DHCPDiscover message when the DHCP message is a DHCPDiscover message, so as to prohibit the secondary router from sending an IP address acquisition request to the DHCP server.

[0085] In summary, the second embodiment of the present invention discloses a control device for a router to obtain an IP address. The device judges the DHCP message sent or received by the router in the wireless relay network, obtains the DHCP Discover message in the DHCP message, and then discards the DHCP Discover message to prohibit the secondary router from sending an IP address acquisition request to the DHCP server. It can be seen that in the present invention, by discarding the DHCP Discover message in which the secondary router requests the DHCP server for an IP address, the DHCP server cannot receive the secondary router's IP acquisition request, and the DHCP server cannot assign an IP address to the secondary router. Accordingly, the purpose of prohibiting the secondary router from obtaining an IP address through a wired method can be achieved.

[0086] In a specific implementation, the device in this embodiment further includes the following units: Figure 7 As shown:

[0087] The second message determination unit 604 is configured to determine whether the DHCP message is a DHCP Offer message;

[0088] The second message discarding unit 605 is configured to discard the DHCP Offer message when the DHCP message is a DHCP Offer message, so as to prohibit the secondary router from obtaining an IP address from the DHCP Discover message.

[0089] In one implementation, the first message determination unit 602 is specifically configured to:

[0090] Get the message type of the DHCP message;

[0091] Determine whether the DHCP message is a DHCP Discover message based on the message type.

[0092] In one implementation, the message acquiring unit 601 is specifically configured to:

[0093] Obtain the message data sent and received by the router in real time;

[0094] Determine whether the message data is an IP message;

[0095] If the message is an IP message, it is determined whether the IP message is a DHCP message to obtain the DHCP message.

[0096] In a specific implementation, the apparatus in this embodiment further includes the following units:

[0097] The connection determination unit is configured to determine whether there is a wired connection between the secondary router and the primary router; and trigger the message acquisition unit 601 when there is a wired connection between the secondary router and the primary router.

[0098] Example 3

[0099] like Figure 8 As shown in the figure, the third embodiment of the present invention discloses a schematic diagram of the structure of a computer device, which may refer to the vehicle stability controller or engine drive controller in the embodiment of the present application. Its internal structure is as follows Figure 8 As shown. The computer device includes a processor, memory, and a network interface via a system bus. The processor of the computer device is used to provide computing and control capabilities. The network interface of the computer device is used to communicate with external devices via a network connection. When executed by the processor, the computer program implements the various steps of a method for controlling a router to obtain an IP address.

[0100] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are performed:

[0101] Get DHCP messages in real time;

[0102] Determine whether the DHCP message is a DHCP Discover message;

[0103] If the DHCP message is a DHCP Discover message, the DHCP Discover message is discarded to prohibit the secondary router from sending an IP address acquisition request to the DHCP server.

[0104] Example 4

[0105] A fourth embodiment of the present invention discloses a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the steps of a method for controlling a router to obtain an IP address. The computer-readable storage medium may be non-volatile or volatile.

[0106] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0107] Get DHCP messages in real time;

[0108] Determine whether the DHCP message is a DHCP Discover message;

[0109] If the DHCP message is a DHCP Discover message, the DHCP Discover message is discarded to prohibit the secondary router from sending an IP address acquisition request to the DHCP server.

[0110] Example 5

[0111] A fifth embodiment of the present invention discloses a computer program product, which includes a computer program. When the computer program is executed by a processor, the computer program implements the steps of the method for controlling a router to obtain an IP address as described in any of the above embodiments.

[0112] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, which can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0113] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0114] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.

Claims

1. A control method for a router to obtain an IP, characterized in that: Applied to a router in a wireless relay network, the method comprises: Get DHCP messages in real time; Determine whether the DHCP message is a DHCP Discover message; If the DHCP message is a DHCP Discover message, discard the DHCP Discover message to prohibit the secondary router from sending an IP address acquisition request to the DHCP server; Before obtaining the DHCP message in real time, the method further includes: Determine whether there is a wired connection between the secondary router and the primary router; If there is a wired connection between the secondary router and the primary router, the step of obtaining the DHCP message in real time is triggered.

2. The method according to claim 1, wherein After acquiring the DHCP message in real time, the method further includes: Determining whether the DHCP message is a DHCP Offer message; If the DHCP message is a DHCP Offer message, the DHCP Offer message is discarded to prohibit the secondary router from obtaining an IP address from the DHCP Offer message.

3. The method according to claim 1, wherein The determining whether the DHCP message is a DHCPDiscover message includes: Obtaining the message type of the DHCP message; According to the message type of the DHCP message, it is determined whether the DHCP message is a DHCP Discover message.

4. The method according to claim 1, wherein The real-time acquisition of DHCP messages includes: Obtain the message data sent and received by the router in real time; Determine whether the message data is an IP message; If the message is an IP message, it is determined whether the IP message is a DHCP message to obtain the DHCP message.

5. A control device for a router to obtain an IP, characterized in that: include: A message acquisition unit, used to acquire DHCP messages in real time; A first message determination unit, configured to determine whether the DHCP message is a DHCP Discover message; a first message discarding unit, configured to discard the DHCPDiscover message when the DHCP message is a DHCPDiscover message, so as to prohibit the secondary router from sending an IP address acquisition request to the DHCP server; The system further includes a connection judgment unit, which is used to: Determine whether there is a wired connection between the secondary router and the primary router; If there is a wired connection between the secondary router and the primary router, the message acquisition unit is triggered to acquire the DHCP message in real time.

6. The device according to claim 5, characterized in that Also includes: A second message determination unit, configured to determine whether the DHCP message is a DHCP Offer message; The second message discarding unit is configured to discard the DHCP Offer message when the DHCP message is a DHCP Offer message, so as to prohibit the secondary router from obtaining an IP address from the DHCP Discover message.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method for controlling a router to obtain an IP address as claimed in any one of claims 1 to 4 is implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the control method for a router to obtain an IP address as claimed in any one of claims 1 to 4 is implemented.

9. A computer program product, comprising a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Method for forbidding wireless router DHCP to acquire address in college campus network

    CN113038472A

  • Wired and wireless hybrid networking control method and device, medium and electronic equipment

    CN113163344A