CN114301876A - Address allocation method, system, device and computer readable storage medium - Google Patents

Address allocation method, system, device and computer readable storage medium Download PDF

Info

Publication number
CN114301876A
CN114301876A CN202111593889.5A CN202111593889A CN114301876A CN 114301876 A CN114301876 A CN 114301876A CN 202111593889 A CN202111593889 A CN 202111593889A CN 114301876 A CN114301876 A CN 114301876A
Authority
CN
China
Prior art keywords
address
allocated
preset
network card
distributed
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.)
Granted
Application number
CN202111593889.5A
Other languages
Chinese (zh)
Other versions
CN114301876B (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.)
Shenzhen Skyworth Digital Technology Co Ltd
Original Assignee
Shenzhen Skyworth Digital 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 Shenzhen Skyworth Digital Technology Co Ltd filed Critical Shenzhen Skyworth Digital Technology Co Ltd
Priority to CN202111593889.5A priority Critical patent/CN114301876B/en
Publication of CN114301876A publication Critical patent/CN114301876A/en
Application granted granted Critical
Publication of CN114301876B publication Critical patent/CN114301876B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The invention discloses an address allocation method, which comprises the following steps: acquiring an address allocation request of a network card to be allocated; acquiring an address to be allocated according to the address allocation request and a preset allocation rule, and allocating the address to be allocated to the network card to be allocated; judging whether the address to be distributed is accepted by the network card to be distributed; if the network card to be distributed does not accept the network card to be distributed, obtaining a new address to be distributed according to a first preset regulation rule, and executing the following steps: and judging whether the address to be distributed is accepted by the network card to be distributed. The invention also discloses a system, equipment and a computer readable storage medium. The invention greatly reduces the failure rate of the multi-network card equipment for acquiring the address.

Description

Address allocation method, system, device and computer readable storage medium
Technical Field
The present invention relates to the field of internet technologies, and in particular, to an address allocation method, system, device, and computer-readable storage medium.
Background
At present, the devices with multiple network cards are common, for example, computers, and generally a wireless network card and a wired network card can be supported by default configuration; or the single network card is changed into the multi-network card by supporting the multi-plug of one wired/wireless network card. For such a multi-card device, each network card may be assigned to acquire or maintain an IP address. Therefore, the device itself can perform IP address conflict detection on multiple network cards to avoid abnormal access to the network due to address conflict. However, under the existing DHCP (Dynamic Host Configuration Protocol) address allocation policy, address acquisition may fail, and thus internet access may not be possible. For example, when the network card 1 is in a disconnected network/network card is in a disabled state, and the network card 2 requests the DHCP server to allocate an address, since the network card 1 is in a disconnected network/network card is in a disabled state, the network card 1 does not respond to the ARP detection request of the DHCP server, the DHCP server may consider that the address of the network card 1 is not occupied, and thus allocate the address to the network card 2, which causes address conflict, and causes failure in acquiring an address by the multi-network card device.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide an address allocation method, aiming at solving the technical problem that multi-network card equipment fails to acquire addresses due to address conflict.
In order to achieve the above object, the present invention provides an address allocation method, including the steps of:
acquiring an address allocation request of a network card to be allocated;
acquiring an address to be allocated according to the address allocation request and a preset allocation rule, and allocating the address to be allocated to the network card to be allocated;
judging whether the address to be distributed is accepted by the network card to be distributed;
if the network card to be distributed does not accept the network card to be distributed, obtaining a new address to be distributed according to a first preset regulation rule, and executing the following steps: and judging whether the address to be distributed is accepted by the network card to be distributed.
Preferably, the preset allocation rule includes a preset generation rule and a second preset adjustment rule, and the step of obtaining an address to be allocated according to the address allocation request and the preset allocation rule and allocating the address to be allocated to the network card to be allocated includes:
obtaining a preselected address according to the address allocation request and a preset generation rule;
judging whether the preselected address is occupied or not;
if the preselected address is not occupied, the preselected address is used as an address to be allocated;
if the preselected address is occupied, generating a new preselected address according to a second preset adjustment rule, and executing the following steps: and judging whether the preselected address is occupied or not.
Preferably, the address allocation request includes an MAC address of the network card to be allocated, the preset generation rule includes a preset address algorithm, and the step of obtaining the preselected address according to the address allocation request and the preset generation rule includes:
generating address parameters according to the MAC address of the network card to be distributed and a preset address algorithm;
and generating a preselected address according to the address information of the preset address pool and the address parameter.
Preferably, the step of obtaining a preselected address according to the address allocation request and a preset generation rule includes:
after receiving the address allocation request, acquiring range information of a preset address pool;
and selecting the initial address of the preset address pool as a preselected address according to the range information.
Preferably, the second preset adjustment rule includes a second preset adjustment parameter, and the step of generating a new preselected address according to the second preset adjustment rule includes:
and adjusting the preselected address according to a second preset adjustment parameter to generate a new preselected address.
Preferably, the first preset adjustment rule includes a first preset adjustment parameter, and the step of obtaining a new address to be allocated according to the first preset adjustment rule if the network card to be allocated is not accepted by the network card to be allocated includes:
and adjusting the address to be allocated according to a first preset adjustment parameter to generate a new address to be allocated.
Preferably, the step of determining whether the address to be allocated is accepted by the network card to be allocated includes:
counting the sending times of the network card address allocation request to be allocated within a preset time length;
judging whether the sending times exceed preset times or not;
and if the number of times exceeds the preset number, judging that the address to be distributed is not accepted by the network card to be distributed.
Further, to achieve the above object, the present invention provides an address assignment system including:
the receiving module is used for acquiring an address allocation request of the network card to be allocated;
the allocation module is used for obtaining an address to be allocated according to the address allocation request and a preset allocation rule and allocating the address to be allocated to the network card to be allocated;
the judging module is used for judging whether the address to be distributed is accepted by the network card to be distributed;
an adjusting module, configured to obtain a new address to be allocated according to a first preset adjusting rule if the network card to be allocated is not accepted, and execute the following steps: and judging whether the address to be distributed is accepted by the network card to be distributed.
Further, to achieve the above object, the present invention also provides an address assigning apparatus, including: memory, a processor and an address allocation program stored on the memory and executable on the processor, the address allocation program when executed by the processor implementing the steps of the address allocation method as claimed in any one of the above.
Further, to achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon an address assignment program which, when executed by a processor, implements the steps of the address assignment method as described in any one of the above.
The address allocation method provided by the invention can be used for acquiring the address allocation request sent by the network card to be allocated through the corresponding multi-network-card equipment. And then, according to the address allocation request and a preset allocation rule, acquiring an address to be allocated, and allocating the address to be allocated to the network card to be allocated, wherein the allocable address is an unoccupied address in a preset address pool range. The preset allocation rule may be the DHCP address allocation policy described above, or may be another method for acquiring an address to be allocated for allocation. And after the address to be allocated is allocated to the network card to be allocated, judging whether the address to be allocated is accepted by the network card to be allocated. If the address to be allocated is not accepted by the network card to be allocated, acquiring a new address to be allocated according to a first preset adjustment rule, wherein the new address to be allocated is the address to be allocated which is obtained by executing the following steps: and judging whether the address to be distributed is accepted by the network card to be distributed. The address to be allocated is accepted by the network card to be allocated, so that the condition that the DHCP Server always allocates the same address to cause the failure of acquiring the address and the network connection can not be realized under the condition that the multi-network card equipment can not accept the allocated address is avoided, and the failure rate of the multi-network card equipment for acquiring the address is greatly reduced.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a flowchart illustrating a first embodiment of an address allocation method according to the present invention;
FIG. 2 is a flowchart illustrating a second embodiment of an address allocation method according to the present invention;
FIG. 3 is a schematic diagram of an address assignment system according to an embodiment of the present invention;
fig. 4 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present invention.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings. With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, the recitation of an element by the phrase "comprising an … …" does not exclude the presence of additional like elements in the process, method, article, or apparatus that comprises the element, and further, where similarly-named elements, features, or elements in different embodiments of the disclosure may have the same meaning, or may have different meanings, that particular meaning should be determined by their interpretation in the embodiment or further by context with the embodiment.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope herein. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context. Also, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context indicates otherwise. It will be further understood that the terms "comprises," "comprising," "includes" and/or "including," when used in this specification, specify the presence of stated features, steps, operations, elements, components, items, species, and/or groups, but do not preclude the presence, or addition of one or more other features, steps, operations, elements, components, species, and/or groups thereof. The terms "or," "and/or," "including at least one of the following," and the like, as used herein, are to be construed as inclusive or mean any one or any combination. For example, "includes at least one of: A. b, C "means" any of the following: a; b; c; a and B; a and C; b and C; a and B and C ", again for example," A, B or C "or" A, B and/or C "means" any of the following: a; b; c; a and B; a and C; b and C; a and B and C'. An exception to this definition will occur only when a combination of elements, functions, steps or operations are inherently mutually exclusive in some way.
It should be understood that, although the steps in the flowcharts in the embodiments of the present application are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least some of the steps in the figures may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, in different orders, and may be performed alternately or at least partially with respect to other steps or sub-steps of other steps.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
It should be noted that, step numbers such as S100 and S200 are used herein for the purpose of more clearly and briefly describing the corresponding contents, and do not constitute a substantial limitation on the sequence, and those skilled in the art may perform S200 first and then S100 in the specific implementation, but these should be within the protection scope of the present application.
It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In the following description, suffixes such as "module", "component", or "unit" used to denote elements are used only for the convenience of description of the present application, and have no specific meaning in themselves. Thus, "module", "component" or "unit" may be used mixedly.
The current DHCP (Dynamic Host Configuration Protocol) Address allocation policy is generally allocated in sequence according to a DHCP Address pool range, ARP (Address Resolution Protocol) detection is performed before allocation, and if ARP detects that the Address has an ARP response, the next unallocated Address is allocated. For example, if the DHCP address pool range is 192.168.1.20 to 192.168.1.200, the address allocation is started from 192.168.1.20, and if the ARP probe 192.168.1.20 responds with an ARP response, it indicates that 192.168.1.20 is occupied, and then the ARP probe 192.168.1.21, until an available address is found and allocated to a corresponding network card, and the address is identified as allocated, or the addresses in the address pool are all occupied, the address allocation fails. For a device with multiple network cards, if the allocated address is considered to be unavailable and not acceptable, the method can repeatedly request the available address, but the device has no way to feed back the situation to a DHCP Server (such as a DHCP Server, like a gateway), so that the DHCP Server considers that the address is available and is allocated all the time, and the device considers that the address between the network cards is unreasonable and is not acceptable all the time, thereby causing the device to fail in acquiring the address.
For example, in a computer of WINDOWS system, the address of the network card 1 is 192.168.1.20, and when the network is disconnected/disabled, the network card 2 acquires the address, the DHCP Server considers 192.168.1.20 as an available address and ARP probe 192.168.1.20 does not respond, the address can be allocated, 192.168.1.20 is distributed to the network card 2, the WINDOWS system considers that the address conflicts with the network card 1 and does not accept 192.168.1.20, and continues to request the available address, and if 192.168.1.20 is continuously allocated to the computer, the network card 2 cannot access the network because the address is not accepted all the time.
Referring to fig. 1, a first embodiment of the present invention provides an address allocation method, including the steps of:
step S100, acquiring an address allocation request of a network card to be allocated;
specifically, the network card to be distributed may be a built-in or detachable network card in a multi-network card device. The network card to be allocated may be connected to the network only after acquiring a corresponding IP Address (Internet Protocol Address), so that the corresponding multi-network-card device may implement the Internet access function. And acquiring an address allocation request sent by the network card to be allocated through the corresponding multi-network-card equipment.
Step S200, obtaining an address to be allocated according to the address allocation request and a preset allocation rule, and allocating the address to be allocated to the network card to be allocated;
specifically, the preset allocation rule may be the DHCP address allocation policy described above, or may be another method for acquiring an address to be allocated for allocation. And acquiring an address to be allocated according to the address allocation request and a preset allocation rule, and allocating the address to be allocated to the network card to be allocated, wherein the allocable address is an unoccupied address in a preset address pool range.
Further, the preset distribution rule includes a preset generation rule and a second preset adjustment rule, and the step S200 includes the following steps:
step S210, obtaining a preselected address according to the address allocation request and a preset generation rule;
step S220, judging whether the preselected address is occupied or not;
step S221, if the preselected address is not occupied, the preselected address is used as an address to be allocated;
step S222, if the preselected address is occupied, generating a new preselected address according to a second preset adjustment rule, and executing step S220.
Specifically, the preset allocation rule includes a preset generation rule and a second preset adjustment rule, and the preset generation rule is a rule for generating an address within a preset address pool range. The second preset adjusting rule is used for adjusting the preselected address to obtain an unoccupied preselected address serving as an address to be allocated. And obtaining a preselected address in a preset address pool range according to the address allocation request and a preset generation rule. And then, performing ARP (Address Resolution Protocol) detection operation on the preselected Address, and judging whether the preselected Address is occupied or not according to whether the preselected Address has an ARP response or not. And if the preselected address has no ARP response, indicating that the preselected address is not occupied. If the preselected address is not occupied, taking the preselected address as an address to be allocated, and allocating the address to be allocated to the network card to be allocated; and if the preselected address has an ARP response, indicating that the preselected address is occupied. If the preselected address is occupied, generating a new preselected address according to a second preset adjustment rule, executing step S220, and if the new preselected address generated after the adjustment of the second preset adjustment rule is not occupied, taking the preselected address as an address to be allocated, and allocating the address to be allocated to the network card to be allocated.
Further, step S210 includes the steps of:
step a1, after receiving the address allocation request, obtaining range information of a preset address pool;
step a2, selecting the initial address of the preset address pool as a preselected address according to the range information.
Specifically, when an address allocation request sent by a network card to be allocated through a corresponding multi-network-card device is received, range information of a preset address pool is obtained, where the preset address pool is a set of addresses available for allocation. The range information of the preset address pool comprises a range of addresses which can be used for allocation, and according to the range information, the initial address of the preset address pool is selected as a preselected address. For example, if the predetermined address pool ranges from 192.168.1.20 to 192.168.1.200, the addresses available for allocation are 192.168.1.20, 192.168.1.21, 192.168.1.22 … … and 192.168.1.200. The starting address of the preset address pool is 192.168.1.20, and 192.168.1.20 is used as the preselected address.
Further, the second preset adjustment rule includes a second preset adjustment parameter, and step S222 includes the following steps
And b, adjusting the preselected address according to a second preset adjustment parameter to generate a new preselected address.
Specifically, the second preset adjustment rule includes a second preset adjustment parameter, and the second preset adjustment parameter is used for adjusting the preselected address to generate a new preselected address. The second preset adjustment parameter may be a value selected according to a specific requirement, such as 1, 2, 3, and the like. For example, the second preset adjustment parameter is 1, and when the preselected address 192.168.1.20 is occupied, a new preselected address 192.168.1.21 is generated. Then the following steps are executed: and judging whether the preselected address is occupied or not so as to enable a finally obtained new preselected address to be unoccupied, taking the preselected address as an address to be allocated, and allocating the address to be allocated to the network card to be allocated.
Step S300, judging whether the address to be distributed is accepted by the network card to be distributed;
specifically, after the Address to be allocated is allocated to the network card to be allocated, a corresponding relationship between the Address to be allocated and identification information (such as a MAC Address, a Media Access Control Address, a physical Address) of the network card to be allocated may be recorded, and then, if the number of times that the same Address is allocated to the same network card to be allocated within a certain period of time exceeds a preset number of times or the network card to be allocated still sends an Address allocation request after allocation, it is determined that the Address to be allocated is not accepted by the network card to be allocated.
Still further, in another embodiment, the step S300 further includes the steps of:
step S310, counting the sending times of the network card address allocation request to be allocated in a preset time length;
step S320, judging whether the sending times exceed preset times;
step S321, if the number of times exceeds the preset number, it is determined that the address to be allocated is not accepted by the network card to be allocated.
Specifically, the sending times of the allocation request of the network card address to be allocated within a preset time period (for example, 20 seconds, 30 seconds, or 40 seconds, etc.) may be counted. And then judging whether the sending times exceed a preset number (such as 3 times, 4 times or 5 times). And if the sending times exceed the preset times, judging that the address to be distributed is not accepted by the network card to be distributed. If the sending times do not exceed the preset times, the fact that the address to be allocated is accepted by the network card to be allocated is indicated, address allocation is successful, and other operations do not need to be executed.
Step S400, if the network card to be distributed is not accepted, a new address to be distributed is obtained according to a first preset regulation rule, and the steps are executed: and judging whether the address to be distributed is accepted by the network card to be distributed.
Specifically, if the address to be allocated is not accepted by the network card to be allocated, a new address to be allocated is obtained according to a first preset adjustment rule, and the new address to be allocated is the address to be allocated which is obtained by executing the following steps: and judging whether the address to be distributed is accepted by the network card to be distributed. And the new distributable address is an unoccupied address in a preset address pool range. The first preset adjusting rule is used for adjusting the address to be allocated so as to obtain other unoccupied addresses to be allocated within the range of the preset address pool as new addresses to be allocated. If the address to be allocated is accepted by the network card to be allocated, the address allocation is successful, and other operations are not required to be executed.
Further, the first preset adjustment rule includes a first preset adjustment parameter, and the step S400 includes the following steps:
and step S410, adjusting the address to be allocated according to a first preset adjusting parameter to generate a new address to be allocated.
Specifically, the first preset adjustment rule includes a first preset adjustment parameter, and the first preset adjustment parameter is used for adjusting the address to be allocated to generate a new address to be allocated. The first preset adjustment parameter may be a value selected according to specific requirements, such as 1, 2, 3, and the like. The first preset adjustment parameter may be the same as or different from the second preset adjustment parameter. For example, the first preset adjustment parameter is 1, when the address to be allocated 192.168.1.23 is not accepted by the network card to be allocated, a new address 192.168.1.24 is generated, and when the new address is within the preset address pool range and is not occupied, the new address is taken as a new address to be allocated. Then the following steps are executed: and judging whether the address to be distributed is accepted by the network card to be distributed.
In the first embodiment of the present invention, an address allocation request sent by a corresponding multi-network-card device through a network card to be allocated may be obtained. And then, according to the address allocation request and a preset allocation rule, acquiring an address to be allocated, and allocating the address to be allocated to the network card to be allocated, wherein the allocable address is an unoccupied address in a preset address pool range. The preset allocation rule may be the DHCP address allocation policy described above, or may be another method for acquiring an address to be allocated for allocation. And after the address to be allocated is allocated to the network card to be allocated, judging whether the address to be allocated is accepted by the network card to be allocated. If the address to be allocated is not accepted by the network card to be allocated, acquiring a new address to be allocated according to a first preset adjustment rule, wherein the new address to be allocated is the address to be allocated which is obtained by executing the following steps: and judging whether the address to be distributed is accepted by the network card to be distributed. The address to be allocated is accepted by the network card to be allocated, so that the condition that the DHCP Server always allocates the same address to cause the failure of acquiring the address and the network connection can not be realized under the condition that the multi-network card equipment can not accept the allocated address is avoided, and the failure rate of the multi-network card equipment for acquiring the address is greatly reduced.
Further, referring to fig. 2, a second embodiment of the present invention provides an address allocation method, based on the embodiment shown in fig. 1, where the address allocation request includes an MAC address of a network card to be allocated, the preset generation rule includes a preset address algorithm, and step S210 includes the following steps:
step S211, generating address parameters according to the MAC address of the network card to be distributed and a preset address algorithm;
step S212, generating a preselected address according to the address information of the preset address pool and the address parameter.
Specifically, the Address allocation request may include a MAC Address (physical Address) of the network card to be allocated. Under the condition that no requirement is made on the allocated address, the MAC address of the network card to be allocated in the address allocation request and a preset address algorithm can be used. The preset address algorithm is used for calculating the MAC address to obtain corresponding address parameters, and the MAC address corresponds to the address parameters one to one. The preset address algorithm can be an SDBM hash algorithm, a DJB hash algorithm or a Lose hash algorithm and other algorithms.
For example, if the SDBM hash algorithm is applied to the MAC address, the corresponding code is:
for(j=0,i=0;i<hw_len;i++)
j+=hwaddr[i]+(j<<6)+(j<<16)-j;
and after calculation is carried out according to the MAC address through a preset address algorithm, obtaining an address parameter j corresponding to the MAC address, and if the preset address pool range is 192.168.1.20-192.168.1.80, obtaining a corresponding preselected address of 192.168.1.X, wherein X is 20+ j% (80-20+1), if the address is occupied, adjusting the preselected address, such as the preselected address of 192.168.1.(X +1), until the obtained preselected address is not occupied, and taking the unoccupied preselected address as an address to be allocated. The range of the preset address pool can be modulo to avoid the calculated preselected address exceeding the range of the preset address pool. Further, for example, the code of the DJB hash algorithm is:
for(j=0,i=0;i<hw_len;i++)
j=j*33+(int)hwaddr[i];
for example, the code of the Lose hash algorithm is:
for(j=0,i=0;i<hw_len;i++)
j+=(int)hwaddr[i];
those skilled in the art will appreciate that the choice of the specific pre-selected address algorithm may be selected according to actual requirements.
In this embodiment, a preselected address is generated according to the MAC address of the network card to be allocated in the address allocation request and a preset address algorithm, and then according to the address information of the preset address pool and the address parameter. And the MAC address corresponds to the calculated address parameters one by one. Therefore, the MAC address of the network card to be distributed corresponds to the preselected address one by one, the possibility of repeated preselected addresses is reduced, and the success rate of the multi-network-card equipment for acquiring the addresses is ensured.
As shown in fig. 3, fig. 3 is a schematic diagram of an address allocation system according to an embodiment of the present invention, and in an embodiment of the present invention, an address allocation system is provided, where the address allocation system includes:
the receiving module 10 is configured to obtain an address allocation request of a network card to be allocated;
the allocation module 20 is configured to obtain an address to be allocated according to the address allocation request and a preset allocation rule, and allocate the address to be allocated to the network card to be allocated;
the judging module 30 is configured to judge whether the address to be allocated is accepted by the network card to be allocated;
an adjusting module 40, configured to obtain a new address to be allocated according to a first preset adjusting rule if the network card to be allocated is not accepted, and execute the following steps: and judging whether the address to be distributed is accepted by the network card to be distributed.
Still further, the address assigning system further comprises:
the allocation module 20 is further configured to obtain a preselected address according to the address allocation request and a preset generation rule;
the allocation module 20 is further configured to determine whether the preselected address is occupied;
the allocating module 20 is further configured to use the preselected address as an address to be allocated if the preselected address is not occupied;
the allocating module 20 is further configured to, if the preselected address is occupied, generate a new preselected address according to a second preset adjustment rule, and execute the following steps: and judging whether the preselected address is occupied or not.
Further, the address allocation request includes a MAC address of the network card to be allocated, the preset generation rule includes a preset address algorithm, and the address allocation system further includes:
the allocation module 20 is further configured to generate an address parameter according to the MAC address of the network card to be allocated and a preset address algorithm;
the allocating module 20 is further configured to generate a preselected address according to the address information of the preset address pool and the address parameter.
Still further, the address assigning system further comprises:
the allocation module 20 is further configured to obtain range information of a preset address pool after receiving the address allocation request;
the allocating module 20 is further configured to select a starting address of the preset address pool as a preselected address according to the range information.
Further, the second preset adjustment rule includes a second preset adjustment parameter, and the address assignment system further includes:
the allocating module 20 is further configured to adjust the preselected address according to a second preset adjustment parameter, so as to generate a new preselected address.
Further, the first preset adjustment rule includes a first preset adjustment parameter, and the address assignment system further includes:
the adjusting module 40 is further configured to adjust the address to be allocated according to a first preset adjusting parameter, so as to generate a new address to be allocated.
Still further, the address assigning system further comprises:
the judging module 30 is further configured to count the sending times of the network card address allocation request to be allocated within a preset time length;
the judging module 30 is further configured to judge whether the sending times exceed preset times;
the determining module 30 is further configured to determine that the address to be allocated is not accepted by the network card to be allocated if the preset number of times is exceeded.
As shown in fig. 4, fig. 4 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 4, the apparatus may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Optionally, the device may further include a camera, RF (Radio Frequency) circuitry, sensors, audio circuitry, a WiFi module, and so forth. Such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen, turn off the display screen and/or the backlight according to the brightness of ambient light. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when the mobile terminal is stationary, and can be used for applications (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer and tapping) and the like for recognizing the attitude of the mobile terminal; of course, the mobile terminal may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which are not described herein again.
Those skilled in the art will appreciate that the device configuration shown in fig. 4 does not constitute a limitation of the address assignment device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 4, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and an address assignment application program.
In the apparatus shown in fig. 4, the processor 1001 may be configured to call an address assignment program stored in the memory 1005 and perform the following operations:
acquiring an address allocation request of a network card to be allocated;
acquiring an address to be allocated according to the address allocation request and a preset allocation rule, and allocating the address to be allocated to the network card to be allocated;
judging whether the address to be distributed is accepted by the network card to be distributed;
if the network card to be distributed does not accept the network card to be distributed, obtaining a new address to be distributed according to a first preset regulation rule, and executing the following steps: and judging whether the address to be distributed is accepted by the network card to be distributed.
Still further, the processor 1001 may be further configured to call an address assignment program stored in the memory 1005, and perform the following operations:
obtaining a preselected address according to the address allocation request and a preset generation rule;
judging whether the preselected address is occupied or not;
if the preselected address is not occupied, the preselected address is used as an address to be allocated;
if the preselected address is occupied, generating a new preselected address according to a second preset adjustment rule, and executing the following steps: and judging whether the preselected address is occupied or not.
Further, the address allocation request includes a MAC address of the network card to be allocated, the preset generation rule includes a preset address algorithm, and the processor 1001 may be further configured to call an address allocation program stored in the memory 1005, and perform the following operations:
generating address parameters according to the MAC address of the network card to be distributed and a preset address algorithm;
and generating a preselected address according to the address information of the preset address pool and the address parameter.
Still further, the processor 1001 may be further configured to call an address assignment program stored in the memory 1005, and perform the following operations:
after receiving the address allocation request, acquiring range information of a preset address pool;
and selecting the initial address of the preset address pool as a preselected address according to the range information.
Further, the second preset adjustment rule includes a second preset adjustment parameter, and the processor 1001 may be further configured to call the address assignment program stored in the memory 1005, and perform the following operations:
and adjusting the preselected address according to a second preset adjustment parameter to generate a new preselected address.
Further, the first preset adjustment rule includes a first preset adjustment parameter, and the processor 1001 may be further configured to call an address assignment program stored in the memory 1005, and perform the following operations:
and adjusting the address to be allocated according to a first preset adjustment parameter to generate a new address to be allocated.
Still further, the processor 1001 may be further configured to call an address assignment program stored in the memory 1005, and perform the following operations:
counting the sending times of the network card address allocation request to be allocated within a preset time length;
judging whether the sending times exceed preset times or not;
and if the number of times exceeds the preset number, judging that the address to be distributed is not accepted by the network card to be distributed.
In addition, the embodiment of the invention also provides a computer storage medium.
The computer storage medium stores a computer program, and the computer program, when executed by a processor, implements the operations in the address allocation method provided in the foregoing embodiments, and specific implementation steps may refer to the foregoing embodiments and are not described in detail herein.
It is to be understood that the foregoing scenarios are only examples, and do not constitute a limitation on application scenarios of the technical solutions provided in the embodiments of the present application, and the technical solutions of the present application may also be applied to other scenarios. For example, as can be known by those skilled in the art, with the evolution of system architecture and the emergence of new service scenarios, the technical solution provided in the embodiments of the present application is also applicable to similar technical problems.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The steps in the method of the embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs.
The units in the device in the embodiment of the application can be merged, divided and deleted according to actual needs.
In the present application, the same or similar term concepts, technical solutions and/or application scenario descriptions will be generally described only in detail at the first occurrence, and when the description is repeated later, the detailed description will not be repeated in general for brevity, and when understanding the technical solutions and the like of the present application, reference may be made to the related detailed description before the description for the same or similar term concepts, technical solutions and/or application scenario descriptions and the like which are not described in detail later.
In the present application, each embodiment is described with emphasis, and reference may be made to the description of other embodiments for parts that are not described or illustrated in any embodiment.
The technical features of the technical solution of the present application may be arbitrarily combined, and for brevity of description, all possible combinations of the technical features in the embodiments are not described, however, as long as there is no contradiction between the combinations of the technical features, the scope of the present application should be considered as being described in the present application.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, a controlled terminal, or a network device) to execute the method of each embodiment of the present application.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions according to the embodiments of the present application are all or partially generated when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optic, digital subscriber line) or wirelessly (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, memory Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are included in the scope of the present application.

Claims (10)

1. An address allocation method, characterized in that the address allocation method comprises the steps of:
acquiring an address allocation request of a network card to be allocated;
acquiring an address to be allocated according to the address allocation request and a preset allocation rule, and allocating the address to be allocated to the network card to be allocated;
judging whether the address to be distributed is accepted by the network card to be distributed;
if the network card to be distributed does not accept the network card to be distributed, obtaining a new address to be distributed according to a first preset regulation rule, and executing the following steps: and judging whether the address to be distributed is accepted by the network card to be distributed.
2. The address allocation method according to claim 1, wherein the preset allocation rule includes a preset generation rule and a second preset adjustment rule, and the step of obtaining the address to be allocated according to the address allocation request and the preset allocation rule and allocating the address to be allocated to the network card to be allocated includes:
obtaining a preselected address according to the address allocation request and a preset generation rule;
judging whether the preselected address is occupied or not;
if the preselected address is not occupied, the preselected address is used as an address to be allocated;
if the preselected address is occupied, generating a new preselected address according to a second preset adjustment rule, and executing the following steps: and judging whether the preselected address is occupied or not.
3. The address allocation method according to claim 2, wherein the address allocation request includes a MAC address of the network card to be allocated, the preset generation rule includes a preset address algorithm, and the step of obtaining the preselected address according to the address allocation request and the preset generation rule includes:
generating address parameters according to the MAC address of the network card to be distributed and a preset address algorithm;
and generating a preselected address according to the address information of the preset address pool and the address parameter.
4. The address assignment method of claim 2, wherein the step of obtaining a preselected address based on the address assignment request and a preset generation rule comprises:
after receiving the address allocation request, acquiring range information of a preset address pool;
and selecting the initial address of the preset address pool as a preselected address according to the range information.
5. The address assignment method of claim 2, wherein the second preset adjustment rule includes a second preset adjustment parameter, and the step of generating a new preselected address according to the second preset adjustment rule includes:
and adjusting the preselected address according to a second preset adjustment parameter to generate a new preselected address.
6. The address allocation method according to claim 1, wherein the step of receiving the network card to be allocated and obtaining a new address to be allocated according to the first preset adjustment rule comprises:
and adjusting the address to be allocated according to a first preset adjustment parameter to generate a new address to be allocated.
7. The address allocation method according to any one of claims 1 to 6, wherein the step of determining whether the address to be allocated is accepted by the network card to be allocated includes:
counting the sending times of the network card address allocation request to be allocated within a preset time length;
judging whether the sending times exceed preset times or not;
and if the number of times exceeds the preset number, judging that the address to be distributed is not accepted by the network card to be distributed.
8. An address assignment system, the address assignment system comprising:
the receiving module is used for acquiring an address allocation request of the network card to be allocated;
the allocation module is used for obtaining an address to be allocated according to the address allocation request and a preset allocation rule and allocating the address to be allocated to the network card to be allocated;
the judging module is used for judging whether the address to be distributed is accepted by the network card to be distributed;
an adjusting module, configured to obtain a new address to be allocated according to a first preset adjusting rule if the network card to be allocated is not accepted, and execute the following steps: and judging whether the address to be distributed is accepted by the network card to be distributed.
9. An address assignment device, characterized in that the address assignment device comprises: memory, processor and an address allocation program stored on the memory and executable on the processor, which when executed by the processor implements the steps of the address allocation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon an address assignment program, which when executed by a processor implements the steps of the address assignment method as claimed in any one of claims 1 to 7.
CN202111593889.5A 2021-12-23 2021-12-23 Address allocation method, system, device and computer readable storage medium Active CN114301876B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111593889.5A CN114301876B (en) 2021-12-23 2021-12-23 Address allocation method, system, device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111593889.5A CN114301876B (en) 2021-12-23 2021-12-23 Address allocation method, system, device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN114301876A true CN114301876A (en) 2022-04-08
CN114301876B CN114301876B (en) 2023-11-21

Family

ID=80970567

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111593889.5A Active CN114301876B (en) 2021-12-23 2021-12-23 Address allocation method, system, device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114301876B (en)

Citations (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060253615A1 (en) * 2003-07-07 2006-11-09 Siemens Aktiengesellschaft Allocation of station addresses to communication users in a bus system
US20070097992A1 (en) * 2005-11-03 2007-05-03 Cisco Technology, Inc. System and method for resolving address conflicts in a network
US20070217413A1 (en) * 2002-12-13 2007-09-20 Aladdin Knowledge Systems Ltd. Method For Assigning An IP Address To A Network Connectable Device, And A Device Configured Thereby
US7281036B1 (en) * 1999-04-19 2007-10-09 Cisco Technology, Inc. Method and apparatus for automatic network address assignment
US20080250123A1 (en) * 2007-04-06 2008-10-09 Samsung Electronics Co. Ltd. Network switch and method of preventing ip address collision
US20090006585A1 (en) * 2005-12-30 2009-01-01 Ling Chen Ip Address Allocation Method
US20120173646A1 (en) * 2009-09-11 2012-07-05 Huawei Technologies Co., Ltd. IP Address Automatic Assignment Method, Device, and System
US20120179826A1 (en) * 2009-09-23 2012-07-12 Zte Corporation Address Distribution Method, Device and System Thereof
CN104486452A (en) * 2014-09-23 2015-04-01 华为技术有限公司 Address processing method and related equipment and system
EP2900041A2 (en) * 2014-01-28 2015-07-29 Gerard Lighting Pty Ltd DALI Short Address Conflict Detection
CN105635326A (en) * 2014-10-27 2016-06-01 国基电子(上海)有限公司 Network equipment and IP address assignment method
CN107071083A (en) * 2017-03-31 2017-08-18 广州慧睿思通信息科技有限公司 One kind is based on Embedded many board IP address generation methods and device
WO2017206572A1 (en) * 2016-05-30 2017-12-07 上海斐讯数据通信技术有限公司 Ip address management method for use in network environment having multiple dhcp servers, and dhcp client
CN108989476A (en) * 2018-06-12 2018-12-11 新华三技术有限公司 A kind of address distribution method and device
CN109151093A (en) * 2018-10-24 2019-01-04 郑州云海信息技术有限公司 A kind of method, apparatus, storage medium and computer equipment for distributing IP address
WO2019057167A1 (en) * 2017-09-22 2019-03-28 惠州Tcl移动通信有限公司 Method for obtaining ip address, device, and mobile terminal
CN110311995A (en) * 2019-08-05 2019-10-08 深圳创维数字技术有限公司 Distribution method, device and the computer readable storage medium of IP address
CN110311994A (en) * 2019-08-05 2019-10-08 深圳创维数字技术有限公司 The distribution request method, apparatus and readable storage medium storing program for executing of IP address
CN110708400A (en) * 2019-08-27 2020-01-17 重庆雅讯电源技术有限公司 Network address allocation method, device, node equipment and storage medium
CN112261173A (en) * 2020-10-20 2021-01-22 四川天邑康和通信股份有限公司 DHCP server allocation address conflict detection method relating to convergence gateway
CN112995350A (en) * 2019-12-13 2021-06-18 中盈优创资讯科技有限公司 Network equipment address pool conflict detection method and device

Patent Citations (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7281036B1 (en) * 1999-04-19 2007-10-09 Cisco Technology, Inc. Method and apparatus for automatic network address assignment
US20070217413A1 (en) * 2002-12-13 2007-09-20 Aladdin Knowledge Systems Ltd. Method For Assigning An IP Address To A Network Connectable Device, And A Device Configured Thereby
US20060253615A1 (en) * 2003-07-07 2006-11-09 Siemens Aktiengesellschaft Allocation of station addresses to communication users in a bus system
US20070097992A1 (en) * 2005-11-03 2007-05-03 Cisco Technology, Inc. System and method for resolving address conflicts in a network
US20090006585A1 (en) * 2005-12-30 2009-01-01 Ling Chen Ip Address Allocation Method
US20080250123A1 (en) * 2007-04-06 2008-10-09 Samsung Electronics Co. Ltd. Network switch and method of preventing ip address collision
US20120173646A1 (en) * 2009-09-11 2012-07-05 Huawei Technologies Co., Ltd. IP Address Automatic Assignment Method, Device, and System
US20120179826A1 (en) * 2009-09-23 2012-07-12 Zte Corporation Address Distribution Method, Device and System Thereof
EP2900041A2 (en) * 2014-01-28 2015-07-29 Gerard Lighting Pty Ltd DALI Short Address Conflict Detection
CN104486452A (en) * 2014-09-23 2015-04-01 华为技术有限公司 Address processing method and related equipment and system
CN105635326A (en) * 2014-10-27 2016-06-01 国基电子(上海)有限公司 Network equipment and IP address assignment method
WO2017206572A1 (en) * 2016-05-30 2017-12-07 上海斐讯数据通信技术有限公司 Ip address management method for use in network environment having multiple dhcp servers, and dhcp client
CN107071083A (en) * 2017-03-31 2017-08-18 广州慧睿思通信息科技有限公司 One kind is based on Embedded many board IP address generation methods and device
WO2019057167A1 (en) * 2017-09-22 2019-03-28 惠州Tcl移动通信有限公司 Method for obtaining ip address, device, and mobile terminal
CN108989476A (en) * 2018-06-12 2018-12-11 新华三技术有限公司 A kind of address distribution method and device
CN109151093A (en) * 2018-10-24 2019-01-04 郑州云海信息技术有限公司 A kind of method, apparatus, storage medium and computer equipment for distributing IP address
CN110311995A (en) * 2019-08-05 2019-10-08 深圳创维数字技术有限公司 Distribution method, device and the computer readable storage medium of IP address
CN110311994A (en) * 2019-08-05 2019-10-08 深圳创维数字技术有限公司 The distribution request method, apparatus and readable storage medium storing program for executing of IP address
CN110708400A (en) * 2019-08-27 2020-01-17 重庆雅讯电源技术有限公司 Network address allocation method, device, node equipment and storage medium
CN112995350A (en) * 2019-12-13 2021-06-18 中盈优创资讯科技有限公司 Network equipment address pool conflict detection method and device
CN112261173A (en) * 2020-10-20 2021-01-22 四川天邑康和通信股份有限公司 DHCP server allocation address conflict detection method relating to convergence gateway

Non-Patent Citations (6)

* Cited by examiner, † Cited by third party
Title
RAID DAOUD, ET AL: ""Neural Network Based of a New User IP Address Determination and Address Conflict Elimination"", 《DIYALA JOURNAL OF ENGINEERING SCIENCES》 *
UTTAM GHOSH,ET AL: ""IDSDDIP: a secure distributed dynamic IP configuration scheme for mobile ad hoc networks "", 《INTERNATIONAL JOURNAL OF NETWORK MANAGEMENT 》 *
本刊编辑;: "更换网卡后***无法分配IP地址解决方法", 计算机与网络, no. 11 *
杜治高;钱德沛;刘轶;: "无线传感器网络中的地址分配协议", 软件学报, no. 10 *
田野;盛敏;李建东;: "一种新的传感器网络MAC地址分配算法", 西安电子科技大学学报, no. 05 *
马少恒;韦婧;: "企业内部IP地址的规划管理", 信息与电脑(理论版), no. 07 *

Also Published As

Publication number Publication date
CN114301876B (en) 2023-11-21

Similar Documents

Publication Publication Date Title
US9781597B2 (en) Electronic device and network connection method of electronic device
US20190200287A1 (en) Method for Identifying Access Point and Hotspot and Terminal
CN107896249B (en) Cross-network area data access method, device, equipment and storage medium
US20160037298A1 (en) Method and electronic device for recognizing area
CN110990339B (en) File read-write method, device and platform for distributed storage and readable storage medium
EP3001724B1 (en) Wifi station scheduling and processing method and device
CN111209032A (en) Gray scale publishing method, configuration center server, user terminal, system and medium
CN110855534B (en) Method and apparatus for searching and controlling controllee in smart home system
CN106713028A (en) Service degradation method and apparatus, and distributed task scheduling system
CN113111018A (en) Bus device addressing method and computer readable storage medium
CN109600254B (en) Method for generating full-link log and related system
CN114301876A (en) Address allocation method, system, device and computer readable storage medium
CN110311994B (en) IP address allocation request method, device and readable storage medium
CN114328130B (en) Server monitoring method, system, equipment and computer readable storage medium
CN109951549B (en) Network page access method and device and computer readable storage medium
CN109711193B (en) Storage space sharing method and device
CN111124764A (en) System restoring method, smart television and computer storage medium
CN104954503B (en) Distributor and distribution method
US20190380065A1 (en) Electronic device and wlan relay function control method thereof
CN113365272B (en) Method and system for preventing network from being rubbed
KR20200121657A (en) Apparatus and method for providing update of vehicle
KR101907009B1 (en) Apparatas and method for installation in a digital product
KR20190115361A (en) Electronic device for managing application associated with a key of external electronic device and the method for the same
US20200092713A1 (en) Control method for mobile data sharing and vehicle providing the same
EP3843343B1 (en) Managing an application program priority

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