Disclosure of Invention
The inventor notices that in the related art, a situation that the user can obtain the IPv6 address but cannot obtain the IPv4 address occurs, or the user can obtain the IPv4 address but cannot obtain the IPv6 address occurs, and at this time, the user can only access part of the network resources and the application. Since the user does not know what causes some network resources to be accessible and some other network resources to be inaccessible, the user experience is greatly affected and even complaints are made.
In order to solve the above problem, the embodiments of the present disclosure propose the following solutions.
According to an aspect of the embodiments of the present disclosure, there is provided an address allocation method, including receiving an allocation request for allocating an address to a user, the address including a first IP address, the first IP address being one of an IPv6 address and an IPv4 address; judging whether a second IP address is allocated to the user currently or not, wherein the second IP address is the other one of the IPv6 address and the IPv4 address; and if a second IP address is allocated to the user currently, allocating a first IP address to the user.
In some embodiments, the first IP address is an IPv6 address and the second IP address is an IPv4 address.
In some embodiments, the address further comprises a second IP address; the method further comprises the following steps: if the second IP address is not allocated to the user currently, waiting for a preset time; judging whether a second IP address is allocated to the user within the preset time; and if a second IP address is allocated to the user within the preset time, allocating a first IP address to the user.
In some embodiments, waiting the preset time includes: judging whether a second IP address which is not allocated exists or not; and if the second IP address which is not distributed exists, waiting for the preset time.
In some embodiments, waiting the preset time includes: waiting the preset time based on the countdown of the timer or the countdown of the counter.
In some embodiments, the method further comprises logging the error when at least one of the following faults occurs: and in the preset time, a second IP address is not allocated to the user, the first IP address is failed to be allocated to the user, and the counter fault and the timer fault occur.
In some embodiments, it is determined whether a second IP address has been allocated to the user based on the MAC address of the user carried by the allocation request.
According to another aspect of the embodiments of the present disclosure, there is provided an address allocating apparatus including: a receiving module configured to receive an allocation request for allocating an address to a user, the address including a first IP address, the first IP address being one of an IPv6 address and an IPv4 address; a judging module configured to judge whether a second IP address is currently allocated to the user, wherein the second IP address is the other one of an IPv6 address and an IPv4 address; and the allocation module is configured to allocate a first IP address to the user if a second IP address is allocated to the user currently.
According to still another aspect of the embodiments of the present disclosure, there is provided an address allocating apparatus including: a memory; and a processor coupled to the memory, the processor configured to perform the method of any of the above embodiments based on instructions stored in the memory.
According to another aspect of the embodiments of the present disclosure, there is provided a dhcp server, including the address allocation apparatus according to any one of the embodiments.
According to a further aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium comprising computer program instructions, wherein the computer program instructions, when executed by a processor, implement the method of any one of the above embodiments.
According to a further aspect of the embodiments of the present disclosure, there is provided a computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the method of any one of the above embodiments.
In the embodiment of the disclosure, whether the second IP address is allocated to the user or not is judged, and then the first IP address is allocated to the user, which is beneficial to associating the acquisition of the first IP address of the user with the acquisition of the second IP address, so that the user is ensured to acquire the first IP address only after acquiring the second IP address, the problem that part of network resources can be accessed and the other part of network resources cannot be accessed is avoided, and the user experience can be effectively improved.
The technical solution of the present disclosure is further described in detail by the accompanying drawings and examples.
Detailed Description
The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
The relative arrangement of the components and steps, the numerical expressions, and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
Meanwhile, it should be understood that the sizes of the respective portions shown in the drawings are not drawn in an actual proportional relationship for the convenience of description.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
In all examples shown and discussed herein, any particular value should be construed as merely illustrative, and not limiting. Thus, other examples of the exemplary embodiments may have different values.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
Fig. 1 is a schematic flow diagram of an address assignment method according to some embodiments of the present disclosure.
At step 102, an assignment request is received to assign an address to a user. Here, the address includes a first IP address, which is one of an IPv6 address and an IPv4 address.
In some embodiments, the allocation request may carry an identification of the user, such as a MAC address. Subsequent steps may be performed by parsing the allocation request to identify the identity of the user. In some embodiments, if the message parsing fails, an error log may be recorded.
At step 104, it is determined whether a second IP address has currently been assigned to the user. Here, the second IP address is the other one of the IPv6 address and the IPv4 address.
For example, it may be determined whether the user has been assigned the second IP address based on the MAC address of the user.
In step 106, if the user is currently assigned the second IP address, the user is assigned the first IP address.
In the above embodiment, by determining whether the second IP address is allocated to the user and then allocating the first IP address to the user, it is beneficial to associate the acquisition of the first IP address of the user with the acquisition of the second IP address, so that the user is ensured that the first IP address can be acquired only after the user acquires the second IP address, the problem that part of network resources can be accessed and the other part of network resources cannot be accessed is avoided, and the user experience can be effectively improved.
The inventor has noted that, due to the transition period from the IPv4 technology to the IPv6 technology, the situation that the IPv6 address can be allocated to the user but the IPv4 address cannot be allocated to the user occurs more frequently, and at this time, the user can access the network resource corresponding to the IPv6 address but cannot access the network resource corresponding to the IPv4 address.
According to some embodiments, the first IP address is an IPv6 address and the second IP address is an IPv4 address. In this case, an allocation request of an IPv6 address sent by the user is received, whether an IP v4 address has been allocated to the user is determined, and if an IPv4 address has been allocated to the user, an IPv6 address is allocated to the user. Therefore, the problem that the user can access the network resource corresponding to the IPv6 address but cannot access the network resource corresponding to the IPv4 address is effectively solved, the user experience is improved, and the user complaints are reduced.
FIG. 2 is a flow diagram of an address assignment method according to further embodiments of the present disclosure. In these embodiments, the first IP address is an IPv6 address and the second IP address is an IPv4 address. The specific implementation of steps 202-206 in the embodiment shown in fig. 2 can refer to the description of fig. 1, and only the steps different from fig. 1 will be described below.
In step 208, if the second IP address is not currently allocated to the user, a preset time is waited.
According to some embodiments, waiting for the preset time is based on a countdown of a timer or a countdown of a counter. It is understood that the preset time may be determined as needed.
In step 210, it is determined whether a second IP address is assigned to the user within a preset time.
In some implementations, a counter is set to a value of N (N >0), and the counter is decremented by one each time it is determined whether a second IP address is assigned to the user. In some implementations, if the value of the counter decreases to a negative number, the counter is considered to be malfunctioning, at which point an error log may be recorded. In some implementations, if the value of the counter/timer is decreased to zero, it is considered that the second IP address is not allocated to the user within the preset time, and the error log may also be recorded at the same time.
In step 212, if the second IP address is allocated to the user within the preset time, the first IP address is allocated to the user.
In the above embodiment, waiting for the preset time is beneficial to improving the success rate of the user for acquiring the first IP address, so that the success rate of the user for acquiring the second IP address is improved, and the user experience is favorably improved.
According to some embodiments, in step 208, it is determined whether there is an unallocated second IP address, and if there is an unallocated second IP address, a preset time is waited. Further, if there is no unallocated second IP address, the preset time is not waited.
In the embodiment, whether to wait for the preset time is determined based on whether the unallocated second IP address exists, so that the number of times of requesting allocation of the address by the user can be reduced, the waiting time of the user can be saved, and the user experience can be improved.
According to some embodiments, an error log may also be logged when assigning the first IP address to the user fails.
In the embodiment, the error log is recorded, so that the user can find out the fault reason when the network cannot be connected, and the user experience is further improved.
The address allocation method provided by the embodiment of the disclosure is suitable for a double-stack address allocation scene of a limited broadband network or a wireless broadband network.
FIG. 3 is a flow diagram of an address assignment method according to further embodiments of the present disclosure. Fig. 4 is a schematic illustration of address assignment success according to some embodiments of the present disclosure. Fig. 5 is a schematic illustration of address assignment failure according to some embodiments of the present disclosure. In these embodiments, the first IP address is an IPv6 address, and the second IP address is an IPv4 address.
At step 302, an assignment request is received to assign an address to a user. For example, the allocation request is sent by an IPv4/IPv6 dual stack terminal (e.g., notebook computer).
At step 304, the allocation request is parsed.
At step 306, a determination is made as to whether the resolution of the allocation request was successful. If yes, go to step 308; if not, go to step 322.
At step 308, it is determined whether the user is currently assigned an IPv4 address. If yes, go to step 310; if not, go to step 318.
At step 310, an IPv6 address is assigned to the user.
At step 312, a determination is made whether assigning an IPv6 address to the user was successful. If yes, go to step 314; if not, go to step 328.
At step 314, a Dynamic Host Configuration Protocol (DHCP) response is sent. For example, the DHCP response is sent to the IPv4/IPv6 dual stack terminal.
At step 316, a success log is recorded. As shown in fig. 4, the IPv4/IPv6 dual-stack terminal obtains an IPv4 address and an IPv6 address, respectively.
At step 318, the counter is set to a value of N.
In step 320, it is determined whether the value N of the counter is less than or equal to zero. If yes, go to step 322; if not, go to step 324.
At step 322, an error log is recorded. As shown in fig. 5, at this time, the IPv4/IPv6 dual-stack terminal cannot obtain the IPv4 address and the IPv6 address, for example, the notebook computer may display a network connection failure.
At step 324, a determination is made whether the user is currently assigned an IPv4 address. If yes, go to step 310; if not, go to step 326.
In step 326, the counter value N is decremented by one.
At step 328, an error log is recorded. It should be understood that at this time, the IPv4/IPv6 dual-stack terminal cannot obtain the IPv4 address and the IPv6 address, and for example, a notebook computer may display a network connection failure.
In the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts in the embodiments are referred to each other. For the device embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Fig. 6 is a schematic block diagram of an address assignment device, according to some embodiments of the present disclosure.
As shown in fig. 6, the address assigning apparatus 600 includes a receiving module 100, a judging module 200, and an assigning module 300.
The receiving module 100 is configured to receive an allocation request for allocating an address to a user, the address including a first IP address, the first IP address being one of an IPv6 address and an IPv4 address.
The determining module 200 is configured to determine whether a second IP address is currently assigned to the user, the second IP address being the other of the IPv6 address and the IPv4 address.
The allocating module 300 is configured to allocate a first IP address to the user if a second IP address has been currently allocated to the user.
FIG. 7 is a schematic block diagram of an address assignment device, according to further embodiments of the present disclosure.
As shown in fig. 7, the address assigning apparatus 700 includes a receiving module 100, a judging module 200, and an assigning module 300. The receiving module 100 includes an IPv4 protocol parsing module 110 and an IPv6 protocol parsing module 120.
The determining module 200 includes an address status request interface 210, an address status query interface 220 and a logic processing unit 230, the address status request interface 210 is configured to interface the IPv6 protocol parsing module 120 and the logic processing unit 230, the address status query interface 220 is configured to interface the IPv4 protocol parsing module 110 and the logic processing unit 230, and the logic processing unit 230 includes an address status processing unit 231 and a fault tolerance processing unit 232.
The assignment module 300 includes an IPv4 address assignment module 310 and an IPv6 address assignment module 320. The IPv4 address assignment module 310 is configured to assign IPv4 addresses based on the notification of the IPv4 protocol resolution module 110. The IPv6 address assignment module 320 is configured to assign IPv6 addresses based on the notification of the IPv6 protocol resolution module 120.
In some embodiments, the IPv4 protocol resolution module 110 is configured to receive an IPv4 address allocation request of the user, notify the IPv4 address allocation module 310 to allocate an IPv4 address to the user, and feed back to the logical processing unit 230 whether the user has been allocated at least one of an IPv4 address and whether there is an unallocated IPv4 address.
In some embodiments, the IPv6 protocol resolution module 120 is configured to receive an IPv6 address assignment request for a user, notify the IPv6 address assignment module 320 to assign an IPv6 address to the user, and query the logical processing unit 230 whether an IPv4 address has been assigned for the user.
In some embodiments, the address state processing unit 231 in the logical processing unit 230 is configured to query the IPv4 protocol resolution module 110 whether an IPv4 address has been allocated for the user, and if an IPv4 address has been allocated for the user, notify the IPv6 protocol resolution module 120 that the IPv4 address allocation is successful, so that the IPv6 protocol resolution module 120 notifies the IPv6 address allocation module 320 to allocate an IPv6 address.
Further, the address state processing unit 231 is further configured to wait for a preset time if no IPv4 address is currently allocated to the user, query the IPv4 protocol analysis module 110 for whether an IPv4 address is allocated to the user within the preset time, and notify the IPv6 protocol analysis module 120 that the IPv4 address is successfully allocated if it is queried that an IPv4 address is already allocated to the user within the preset time, so that the IPv6 protocol analysis module 120 notifies the IPv6 address allocation module 320 to allocate the IPv6 address.
Furthermore, the address status processing unit 231 is further configured to query the IPv4 protocol parsing module 110 whether there is an unallocated IPv4 address, and wait for a preset time if there is an unallocated IPv4 address.
In some embodiments, the fault tolerance processing unit 232 in the logic processing unit 230 is configured to log an error when an error such as query timeout, query failure, etc. occurs, for example, at least one of failure to assign an IPv4 address to a user, failure to assign an IPv6 address to a user, counter failure, and timer failure is not assigned within a preset time, and perform fault tolerance processing according to a preset configuration.
FIG. 8 is a schematic block diagram of an address assignment device, according to further embodiments of the present disclosure.
As shown in fig. 8, the address assignment device 800 includes a memory 801 and a processor 802 coupled to the memory 801, and the processor 802 is configured to execute the method of any of the foregoing embodiments based on instructions stored in the memory 801.
The memory 801 may include, for example, system memory, fixed non-volatile storage media, and the like. The system memory may store, for example, an operating system, application programs, a Boot Loader (Boot Loader), and other programs.
The apparatus 800 may also include an input output interface 803, a network interface 804, a storage interface 805, and the like. The interfaces 803, 804, 805 and the memory 801 and the processor 802 may be connected by a bus 806, for example. The input/output interface 803 provides a connection interface for input/output devices such as a display, a mouse, a keyboard, and a touch panel. The network interface 804 provides a connection interface for various networking devices. The storage interface 805 provides a connection interface for external storage devices such as an SD card and a usb disk.
The embodiment of the disclosure further provides a dynamic host configuration protocol server, which includes the apparatus in any of the above embodiments.
The disclosed embodiments also provide a computer-readable storage medium comprising computer program instructions, which when executed by a processor, implement the method of any of the above embodiments.
The embodiments of the present disclosure also provide a computer program product, including a computer program, where the computer program is executed by a processor to implement the method of any one of the above embodiments.
Thus, various embodiments of the present disclosure have been described in detail. Some details that are well known in the art have not been described in order to avoid obscuring the concepts of the present disclosure. It will be fully apparent to those skilled in the art from the foregoing description how to practice the presently disclosed embodiments.
As will be appreciated by one skilled in the art, embodiments of the present disclosure may be provided as a method, system, or computer program product. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable non-transitory storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present disclosure is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the disclosure. It will be understood that the functions specified in one or more of the flows in the flowcharts and/or one or more of the blocks in the block diagrams can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Although some specific embodiments of the present disclosure have been described in detail by way of example, it should be understood by those skilled in the art that the foregoing examples are for purposes of illustration only and are not intended to limit the scope of the present disclosure. It will be understood by those skilled in the art that various changes may be made in the above embodiments or equivalents may be substituted for elements thereof without departing from the scope and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims.