Background technology
At present, the wireless user terminal mode of obtaining the IP address is generally dynamically and obtains.In the network application scene of obtaining dynamic IP addressing as shown in Figure 1, comprise a plurality of AP, switch, router and BAS (the Broadband Access Server that wireless user terminal, AC hang down, BAS Broadband Access Server), wherein BAS comprises DHCP (Dynamic Host Configuration Protocol, DHCP) server is responsible for user terminal and distributes dynamic IP addressing.After the wireless user terminal start, at first receive AP (Wireless Access Point, WAP (wireless access point)) Fa She radio signals, when receiving the radio signals of a plurality of AP, wireless user terminal determines that an AP sets up and the incidence relation of this AP in the middle of a plurality of AP, later wireless user terminal is by this AP and the mutual message of network side.
User terminal does not initially have the IP address, and the AP (Wireless Access Point, WAP (wireless access point)) by association is to network side broadcasting DHCP Discover (discovery) message.Network side can have a plurality of Dynamic Host Configuration Protocol server, and a plurality of Dynamic Host Configuration Protocol server can receive the DHCP Discover message of AP broadcasting, and sends the response message of DHCP Discover message to user terminal.User terminal is therefrom selected a response message (response message that for example receives at first), and sends the request message of IP address to the Dynamic Host Configuration Protocol server that sends this response message, and the AP by association is to this selected Dynamic Host Configuration Protocol server request IP address.Receive in the IP address that the Dynamic Host Configuration Protocol server of IP address request never occupied and select an IP address, this IP address is carried at the AP by the user terminal association sends to user terminal in DHCP Offer (providing) message, is user terminal distributing IP address.In addition, described selected Dynamic Host Configuration Protocol server also further is the predetermined lease time of this IP address setting.
After user terminal obtained this dynamic IP addressing, just can use Dynamic Host Configuration Protocol server was its IP address allocated and the mutual message of network side.Behind the lease expires of IP address, if user terminal need continue to use this IP address, user terminal can send the renewed treaty message to Dynamic Host Configuration Protocol server, and Dynamic Host Configuration Protocol server guarantees that preferentially this user terminal continues to use this IP address.If behind the lease expires, Dynamic Host Configuration Protocol server does not receive the renewed treaty message of user terminal; Perhaps before the lease expires of IP address, Dynamic Host Configuration Protocol server receives DHCP Release (release) message that user terminal sends, and then Dynamic Host Configuration Protocol server is released to the user terminal IP address allocated.Yet, when user terminal shuts down unusually (for example sudden power), because can't sending DHCP Release message informing Dynamic Host Configuration Protocol server, user terminal discharges IP address allocated, so the IP address that this user terminal obtains will be in occupied state always, up to Dynamic Host Configuration Protocol server is the lease expires of this IP address setting, causes the wasting of resources of IP address.
In the prior art, though can be by adjusting the lease time (for example being adjusted into 1 hour) of IP address from one day, alleviate because the IP address resource waste that the unusual shutdown of user terminal causes, but, for still at the normal user terminal that uses, for the lease time in the IP address arrives after date, can continue to use this IP address, then certainly will send the renewed treaty message at the lease time forward direction Dynamic Host Configuration Protocol server that expires, therefore, the shortening of lease time will cause Dynamic Host Configuration Protocol server need handle a large amount of renewed treaty messages, thereby increase the burden of Dynamic Host Configuration Protocol server, influence the performance of Dynamic Host Configuration Protocol server, and this method is in case renew a contract, can discharges by idle IP address when still needing by the time IP address lease expires.
Summary of the invention
The invention provides the method and apparatus that a kind of Dynamic Host Configuration Protocol server discharges the IP address, when stopping using the IP address, in time notify Dynamic Host Configuration Protocol server to be released to the user terminal IP address allocated at user terminal.
The invention provides the method that a kind of dynamic host configuration protocol DHCP server discharges the IP address, described this method is applied to comprise in the system of Dynamic Host Configuration Protocol server, WAP (wireless access point) and wireless user terminal, wireless user terminal dynamically obtains the IP address to Dynamic Host Configuration Protocol server, and this method further comprises:
Described WAP (wireless access point) is obtained the process of IP address by the monitoring users terminal to Dynamic Host Configuration Protocol server, obtains the IP address of user terminal;
Described WAP (wireless access point) detects the data traffic of user terminal, when finding to have user terminal to continue not have data traffic in the given time, send the DHCPRelease message packet of described user terminal to Dynamic Host Configuration Protocol server, the notice Dynamic Host Configuration Protocol server discharges the IP address that this user terminal takies;
Dynamic Host Configuration Protocol server receives the DHCP Release message that described WAP (wireless access point) sends, and discharges the IP address of being left unused by user terminal of wherein carrying.
Described WAP (wireless access point) monitoring users terminal also comprises after Dynamic Host Configuration Protocol server obtains the process of IP address:
The IP address of the IP address of described WAP (wireless access point) recording user terminal and the corresponding relation of MAC Address and Dynamic Host Configuration Protocol server.
The data traffic that described WAP (wireless access point) detects user terminal comprises:
Described WAP (wireless access point) is provided with timer for the MAC Address that each that writes down has corresponding IP address;
When described WAP (wireless access point) was obtained the user terminal to transmit data flow in Preset Time, then the timing with the timer of this user terminal MAC Address correspondence was updated to initial value; Otherwise, continue timing.
Described notice Dynamic Host Configuration Protocol server discharges the IP address that this user terminal takies and comprises:
Described WAP (wireless access point) is according to continuing not have the user terminal MAC Address of data traffic to search its corresponding IP address;
Described WAP (wireless access point) is carried this IP address in DHCP Release message, send this DHCP Release message to the Dynamic Host Configuration Protocol server of correspondence.
The invention provides a kind of equipment that is applied to the aforesaid right requirement, described equipment is integrated in the WAP (wireless access point) as WAP (wireless access point) or functional module, is applied to comprise that this equipment comprises in the system of Dynamic Host Configuration Protocol server, WAP (wireless access point) and user terminal:
Address acquisition unit is used for obtaining the process of IP address by the monitoring users terminal to Dynamic Host Configuration Protocol server, obtains the IP address of user terminal;
Detecting unit is used to detect the data traffic of user terminal;
Notification unit is connected with described detecting unit, is used for when described detecting unit has found that user terminal continues not have data traffic in the given time the DHCP Release message to the IP address that this user terminal of Dynamic Host Configuration Protocol server transmission release takies.
Described equipment further comprises record cell, is used for the user terminal IP address that obtains according to address acquisition unit, the IP address of the IP address of recording user terminal and the corresponding relation of MAC Address and Dynamic Host Configuration Protocol server.
Described equipment also comprises timer unit, and the MAC Address that is used in the described record cell each to have corresponding IP address is provided with timer; And
In the given time, when detecting unit obtains the user terminal to transmit data flow, then the timing with the timer of this MAC Address correspondence is updated to initial value; Otherwise continue timing.
Described notification unit also is used for:
In record cell, search corresponding IP address according to the MAC Address of the user terminal that does not send data traffic;
In DHCP Release message, carry the IP address of this user terminal that does not send data traffic, send this DHCP Release message to the Dynamic Host Configuration Protocol server of correspondence.
Compared with prior art, the present invention can guarantee when user terminal is stopped using unusually, the IP address that it dynamically obtains does not need by the time IP address lease expires just to notify Dynamic Host Configuration Protocol server to discharge this IP address, improve the service efficiency of IP address, in addition, because the lease time to the IP address does not shorten, and does not have additionally to increase the burden of Dynamic Host Configuration Protocol server, has guaranteed the normal performance of existing Dynamic Host Configuration Protocol server.
Embodiment
Core concept of the present invention is: wireless access point AP is obtained the process of IP address by the monitoring users terminal to Dynamic Host Configuration Protocol server, obtains the IP address of user terminal; Wireless access point AP detects the data traffic of user terminal, when finding to have user terminal to continue not have data traffic in the given time, the notice Dynamic Host Configuration Protocol server discharges the IP address that this user terminal takies, to solve the active user when disconnecting unusually, wireless network IP address can not in time discharge and then cause the problem of system resource waste.
For making the present invention clearer, below in conjunction with concrete application scenarios shown in Figure 2, introduce the method that Dynamic Host Configuration Protocol server provided by the invention discharges the IP address in detail, may further comprise the steps:
Step 201, wireless access point AP monitoring users terminal is obtained the process of IP address to Dynamic Host Configuration Protocol server.
Concrete, user terminal does not initially have the IP address, needs to adopt flow process shown in Figure 1 to obtain the IP address to the network side Dynamic Host Configuration Protocol server, and obtaining by broadcasting DHCP Discover message of this IP address initiated.Because user terminal is not known the network under self, does not know the purpose Dynamic Host Configuration Protocol server, therefore, source address is set to 0.0.0.0 in DHCP Discover message, destination address is set to 255.255.255.255.The MAC Address of this message carrying user terminal self is so that network equipment is known the user terminal particular location.
The Dynamic Host Configuration Protocol server of network side is searched unappropriated IP address after receiving DHCP Discover message, if exist, then is IP address of user terminal selecting therein, and by DHCP Offer message this IP address is sent to user terminal.After user terminal obtains this IP address, also need by AP to network side broadcasting DHCP request message, to inform network equipment user self IP address.For after the Dynamic Host Configuration Protocol server of user terminal distributing IP address receives DHCP request message, send DHCP ACK (Acknowledge to user terminal, confirm) response, to confirm the formally effective of IP lease, finish a complete DHCP IP address assignment process.For the Dynamic Host Configuration Protocol server of different user terminal distributing IP addresses can be identical or different.
In the mutual process of above-mentioned user terminal and Dynamic Host Configuration Protocol server, AP exists as relaying always, and promptly all mutual message of user terminal and Dynamic Host Configuration Protocol server are all passed through the related AP forwarding of user terminal.In the present invention, the reciprocal process of AP monitoring users terminal and Dynamic Host Configuration Protocol server, message is being carried out in the repeating process, obtain the corresponding relation of IP address, MAC Address, IP address and the MAC Address of user terminal, and the IP address of corresponding Dynamic Host Configuration Protocol server, and store these address correspondence relationship information.
Step 202, wireless access point AP detects the data traffic of user terminal, and when not detecting the data traffic of user terminal in Preset Time, WAP (wireless access point) sends DHCPRelease message to Dynamic Host Configuration Protocol server.
Concrete, in the application scenarios of the present invention, AP need be known the IP address of which user terminal by idle, and reaches standby time or surpassed default maximum duration.In order to achieve this end, the MAC Address with corresponding IP address that AP also is required to be self study is provided with timer, and when the source MAC of flow was identical with the MAC Address of user terminal, timer refreshed, otherwise timer is timing always, reaches when presetting maximum duration to report to the police.For example, the timer initial value can be set to 0, refreshes the timing zero clearing with timer at every turn.Among the present invention, can also be set to the maximum duration value by the timer initial value, decimal reduction time value then, timer is reported to the police when being decremented to 0, when timer refreshes in the timing course, timer value is re-set as the maximum duration value.
Timer among the present invention can be preferably logical timer for hardware timer or logical timer.For a plurality of MAC Address, the logical timer corresponding with each MAC Address is set respectively, and by the timing of AP by corresponding software administration logical timer.For example, the initial value that each logical timer is set is the maximum duration value, this time value changes with the clock of AP equipment self, for example every the default values such as time value minimizing 1 or 5 of 1s with logical timer, when the timing in the logical timer is 0, logical timer is reported to the police, AP is known has user terminal to continue there is not flow between default, find the IP address of the MAC Address corresponding with logical timer and this MAC Address respective user terminal, this IP address need be discharged by Dynamic Host Configuration Protocol server.AP is according to the pre-configured DHCP Release message of setting up, the IP address that comprises user terminal in this message, the purpose IP address of this message is the IP address for the Dynamic Host Configuration Protocol server of user terminal distributing IP address, AP by searching the user terminal that has write down the IP address and the corresponding relation of the IP address of Dynamic Host Configuration Protocol server obtain this purpose IP address.For example, can pre-configured DHCP Release message format among the AP, the IP address field, purpose IP address field of reserving user terminal filled during by the follow-up DHCP of foundation Release message.After setting up DHCP Release message, AP sends this DHCP Release message to network side.The relation record of user terminal MAC Address, the dynamic IP addressing of obtaining and the dhcp server ip address correspondence of setting up before simultaneously, AP also will delete.
Step 203, Dynamic Host Configuration Protocol server receives the DHCP Release message that wireless access point AP sends, and obtains and discharge the IP address of the user terminal that wherein carries.
By adopting method provided by the invention, WAP (wireless access point) monitoring users terminal is obtained the process of IP address to Dynamic Host Configuration Protocol server, the IP address of storage user terminal; WAP (wireless access point) detects the data traffic that receives, if do not receive the data traffic of user terminal in the Preset Time, then send the DHCP Release message of carrying user terminal IP address to Dynamic Host Configuration Protocol server, the notice Dynamic Host Configuration Protocol server is released to the user terminal IP address allocated, thereby can be when user terminal be stopped using the IP address, do not need by the time IP address lease expires just to notify Dynamic Host Configuration Protocol server to discharge this IP address, improve the service efficiency of IP address, in addition, because the lease time to the IP address does not shorten, do not have additionally to increase the burden of Dynamic Host Configuration Protocol server, guaranteed the normal performance of existing Dynamic Host Configuration Protocol server.
The invention provides the equipment that a kind of dynamic host configuration protocol DHCP server discharges the IP address, be integrated in the wireless access point AP as wireless access point AP or functional module, be applied to comprise in the system of Dynamic Host Configuration Protocol server, WAP (wireless access point) and user terminal, as shown in Figure 3, this equipment comprises:
Address acquisition unit 10 is used for obtaining the process of IP address by the monitoring users terminal to Dynamic Host Configuration Protocol server, obtains the IP address of user terminal.Concrete, address acquisition unit 10 is when WAP (wireless access point) transfer Dynamic Host Configuration Protocol server and user terminal interactive messages, monitor the reciprocal process of Dynamic Host Configuration Protocol server and user terminal, obtain the corresponding relation between the IP address of Dynamic Host Configuration Protocol server of the MAC Address of IP address, user terminal of user terminal and correspondence.
Detecting unit 20 is used to detect the data traffic of user terminal.Concrete, detecting unit 20 obtains the data traffic that user terminal sends, and detects the mutual situation of data flow of user terminal and network side according to the source MAC of this data traffic.
Notification unit 30 is connected with described detecting unit 20, is used for when described detecting unit 20 is found to have user terminal to continue not have data traffic in the given time the DHCP Release message to the IP address that this user terminal of Dynamic Host Configuration Protocol server transmission release takies.Concrete, notification unit 30 is searched the IP address of this user terminal correspondence according to the user terminal MAC Address that continues not send data traffic in the default maximum duration, in DHCP Release message, carry this IP address, and the IP address of the Dynamic Host Configuration Protocol server that obtains according to address acquisition unit 10, send DHCP Release message to the Dynamic Host Configuration Protocol server that distributes this IP address for user terminal.
Also further comprise record cell 40 and timer unit 50 in the equipment provided by the invention.Wherein,
Record cell 40 is connected with detecting unit 20 with address acquisition unit 10, is used for the user terminal IP address that recording address acquiring unit 10 obtains, the corresponding relation between the IP address of the MAC Address of user terminal and Dynamic Host Configuration Protocol server.
Timer unit 50, be connected with detecting unit 20, the MAC Address that is used in the record cell 40 each to have corresponding IP address is provided with timer, and in the given time, when detecting unit 20 obtains the user terminal to transmit data flow, then the timing with the timer of this MAC Address correspondence is updated to initial value; Otherwise continue timing; When the timing of timer reached scheduled time detecting unit 20 and do not detect the user terminal to transmit data flow, notification unit 30 sent the DHCP Release message that discharges the IP address that this user terminal that does not send data traffic takies to Dynamic Host Configuration Protocol server.
Notification unit 30 can also be connected with record cell 40, is used for the IP address of the IP address of Dynamic Host Configuration Protocol server of its records of Notification Record unit 40 deletion and user terminal and sends DHCP Release message to Dynamic Host Configuration Protocol server.
By adopting equipment provided by the invention, WAP (wireless access point) monitoring users terminal is obtained the process of IP address to Dynamic Host Configuration Protocol server, the IP address of storage user terminal; WAP (wireless access point) detects the data traffic that receives, if do not receive the data traffic of user terminal in the Preset Time, then send the DHCP Release message of carrying user terminal IP address to Dynamic Host Configuration Protocol server, the notice Dynamic Host Configuration Protocol server is released to the user terminal IP address allocated, thereby can be when user terminal be stopped using the IP address, do not need by the time IP address lease expires in time to notify Dynamic Host Configuration Protocol server to discharge this IP address at once, improve the service efficiency of IP address, and owing to the lease time of IP address is not shortened, do not have additionally to increase the burden of Dynamic Host Configuration Protocol server, guaranteed the normal performance of existing Dynamic Host Configuration Protocol server.
Through the above description of the embodiments, those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential general hardware platform, can certainly pass through hardware, but the former is better execution mode under a lot of situation.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words can embody with the form of software product, this computer software product is stored in the storage medium, comprise that some instructions are with so that a computer equipment (can be a personal computer, server, the perhaps network equipment etc.) carry out the described method of each embodiment of the present invention.
It will be appreciated by those skilled in the art that accompanying drawing is the schematic diagram of a preferred embodiment, module in the accompanying drawing or flow process might not be that enforcement the present invention is necessary.
It will be appreciated by those skilled in the art that the module in the device among the embodiment can be distributed in the device of embodiment according to the embodiment description, also can carry out respective change and be arranged in the one or more devices that are different from present embodiment.The module of the foregoing description can be merged into a module, also can further split into a plurality of submodules.
The invention described above embodiment sequence number is not represented the quality of embodiment just to description.
More than disclosed only be several specific embodiment of the present invention, still, the present invention is not limited thereto, any those skilled in the art can think variation all should fall into protection scope of the present invention.