CN105635326A - Network equipment and IP address assignment method - Google Patents
Network equipment and IP address assignment method Download PDFInfo
- Publication number
- CN105635326A CN105635326A CN201410580736.0A CN201410580736A CN105635326A CN 105635326 A CN105635326 A CN 105635326A CN 201410580736 A CN201410580736 A CN 201410580736A CN 105635326 A CN105635326 A CN 105635326A
- Authority
- CN
- China
- Prior art keywords
- address
- user terminal
- dhcp
- network equipment
- module
- 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.)
- Pending
Links
Landscapes
- Small-Scale Networks (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention provides an IP address assignment method. The method comprises the steps of receiving a DHCP packet transmitted from a user terminal, wherein the DHCP packet comprises an IP address request; searching the MAC address of the user terminal from the DHCP packet; according to the searched MAC address and predefined calculation rules, calculating a corresponding IP address; and allocating the IP address to the user terminal. The invention also provides network equipment, wherein the IP address assignment method is applied to the network equipment. According to the technical scheme of the invention, fixed IP addresses can be conveniently allocated to user terminals.
Description
Technical field
The present invention relates to a kind of data processing technique, especially relate to a kind of network equipment and IP address distribution method.
Background technology
Forward in the application of (Forwarding) at IP, when setting forwarding rule (Forwardingrule), need to set according to the IP address that user terminal distributes from the network terminal. When next time, user terminal was restarted, the IP address being assigned to likely can be different, and need again to revise the information of Forwardingrule, cause the inconvenience in use. General solution can use static lease table (StaticLeaseTable) to specify the IP address of some user terminal, when receiving the request of user terminal, from StaticLeaseTable, search this IP address specified distribute to user terminal, if recycling existing mode when being absent from the IP address specified to redistribute IP address for this user terminal. But, StaticLeaseTable must advance planning and manually setting, and if want to change the IP address specified, it is necessary to change Forwardingrule and StaticLeaseTable simultaneously.
Summary of the invention
In view of the foregoing, it is necessary to a kind of IP address distribution method is provided, it is possible to convenient for the IP address that user terminal distribution is fixing.
In view of the foregoing, there is a need to provide the network equipment of this IP address distribution method of a kind of application, it is possible to convenient for the IP address that user terminal distribution is fixing.
Described IP address distribution method includes step: receiving the DHCP package that user terminal sends, described DHCP package includes IP Address requests; The MAC Address of described user terminal is inquired about from described DHCP package; According to the MAC Address inquired and predetermined computation rule, calculate the IP address of correspondence; And described user terminal is distributed in described IP address.
The described network equipment includes: receiver module, and for receiving the DHCP package that described user terminal sends, described DHCP package includes IP Address requests; Enquiry module, for inquiring about the MAC Address of described user terminal from described DHCP package; Computing module, for according to the MAC Address inquired and predetermined computation rule, calculating the IP address of correspondence; And distribution module, for described user terminal is distributed in described IP address.
Compared to prior art, the described network equipment and IP address distribution method, it is possible to be the fixing IP address of user terminal distribution by the method for salary distribution of semi-automatic static ip address, to simplify time that the network equipment sets and to reduce the chance made mistakes.
Accompanying drawing explanation
Fig. 1 is the functional block diagram of inventive network equipment preferred embodiment.
Fig. 2 is the flow chart of IP address distribution method preferred embodiment of the present invention.
Main element symbol description
The network equipment | 2 |
User terminal | 4 |
IP address allocation system | 10 |
Memorizer | 20 |
Processor | 30 |
Receiver module | 100 |
Enquiry module | 200 |
Computing module | 300 |
Judge module | 400 |
Distribution module | 500 |
Following detailed description of the invention will further illustrate the present invention in conjunction with above-mentioned accompanying drawing.
Detailed description of the invention
Consult shown in Fig. 1, be the functional block diagram of inventive network equipment 2 preferred embodiment. The network equipment 2 includes IP address allocation system 10, memorizer 20 and processor 30. In the present embodiment, the network equipment 2 can be gateway, DHCP(DynamicHostConfigurationProtocol, DHCP) equipment etc. such as server, it is connected to one or more user terminal 4 in a wired or wireless fashion. IP address allocation system 10 is for distributing IP address for user terminal 4.
Described IP address allocation system 10 includes receiver module 100, enquiry module 200, computing module 300, judge module 400 and distribution module 500. Described module is configured to be performed by one or more processors (the present embodiment is processor 30), to complete the present invention. Module alleged by the present invention has been the computer program code segments of a specific function. Memorizer 20 is for storing the data such as the program code of IP address allocation system 10.
Described receiver module 100 is for receiving the DHCP package that user terminal 4 sends, and this DHCP package includes IP Address requests.
Described enquiry module 200 for inquiring about the MAC(MediaAccessControl of user terminal 4, medium access control from the DHCP package received) address. In the present embodiment, enquiry module 200 can inquire about the chaddr field of DHCPfield part in DHCP package or the clientidentifier field of DHCPoption part, to obtain the MAC Address of user terminal 4.
Described computing module 300 is for according to the MAC Address inquired and predetermined computation rule, calculating the IP address of correspondence. In the present embodiment, first this MAC Address is converted to hashed value by hash (Hash) algorithm by computing module 300. Then by this hashed value size divided by DHCPpoolsize(DHCP pond), obtain remainder, wherein DHCPpoolsize is that EndIP(terminates IP) with StartIP(IP) difference, and StartIP and EndIP is that the network equipment 2 is set in advance. Finally calculate StartIP and this remainder sum, the IP address of correspondence can be obtained.
Such as, it is 00-C0-9F-7F-06-95 that enquiry module 200 inquires the MAC Address of user terminal 4, and this MAC Address is converted to hashed value 3666777544 by hashing algorithm by computing module 300. If StartIP is 192.168.0.100, EndIP is 192.168.0.254, then DHCP pond be sized to 155. Computing module 300 is by this hashed value size divided by this DHCP pond, and obtaining remainder is 3666777544%155=49. StartIP is added by last computing module 300 with this remainder, and the IP address calculating correspondence is 192.168.0.100+49=192.168.0.149.
Described judge module 400 is for judging whether the IP address calculated currently is taken by other user terminals 4.
Described distribution module 500 is for when this IP address does not have occupied, distributing to this user terminal 4 by this IP address.
Described distribution module 500 is additionally operable to, when this IP address is occupied, adopt existing mode to redistribute IP address for this user terminal 4. In the present embodiment, described existing mode distributes IP address for starting to be sequentially user terminal 4 from StartIP. Such as, StartIP is 192.168.0.10, distribution module 500 is that to distribute IP address be 192.168.0.10 to first user terminal 4, is that to distribute IP address be 192.168.0.11 to second user terminal 4, and distributing IP address for third party terminal 4 is 192.168.0.12.
Consult shown in Fig. 2, be the flow chart of IP address distribution method preferred embodiment of the present invention. Described IP address distribution method is applied in the network equipment 2, performs the program code of storage in memorizer 20 by processor 30 and realizes.
Step S10, receives the DHCP package that user terminal 4 sends, and this DHCP package includes IP Address requests.
Step S12, inquires about the MAC Address of user terminal 4 from the DHCP package received. In the present embodiment, it is possible to inquire about the chaddr field of DHCPfield part in DHCP package or the clientidentifier field of DHCPoption part, to obtain the MAC Address of user terminal 4.
Step S14, according to the MAC Address inquired and predetermined computation rule, calculates the IP address of correspondence. In the present embodiment, first this MAC Address is converted to hashed value by hashing algorithm. Then by this hashed value size divided by DHCPpoolsize(DHCP pond), obtain remainder, wherein DHCPpoolsize is that EndIP(terminates IP) with StartIP(IP) difference, and StartIP and EndIP is that the network equipment 2 is set in advance. Finally calculate StartIP and this remainder sum, the IP address of correspondence can be obtained.
Such as, the MAC Address of user terminal 4 is 00-C0-9F-7F-06-95, and by hashing algorithm, this MAC Address is converted to hashed value 3666777544. If StartIP is 192.168.0.100, EndIP is 192.168.0.254, then DHCP pond be sized to 155. By this hashed value size divided by this DHCP pond, obtaining remainder is 3666777544%155=49. Finally being added with this remainder by StartIP, the IP address calculating correspondence is 192.168.0.100+49=192.168.0.149.
Step S16, it is judged that whether the IP address calculated currently is taken by other user terminals 4. If this IP address does not have occupied, then perform step S18. If this IP address is occupied, then perform step S20.
Step S18, distributes to this user terminal 4 by this IP address.
Step S20, adopts existing mode to redistribute IP address for this user terminal 4. In the present embodiment, described existing mode distributes IP address for starting to be sequentially user terminal 4 from StartIP. Such as, StartIP is 192.168.0.10, is that to distribute IP address be 192.168.0.10 to first user terminal 4, is that to distribute IP address be 192.168.0.11 to second user terminal 4, and distributing IP address for third party terminal 4 is 192.168.0.12.
Above example is only in order to illustrate technical scheme and unrestricted, although the present invention being described in detail with reference to preferred embodiment, it will be understood by those within the art that, technical scheme can be modified or equivalent replacement, without deviating from the spirit and scope of technical solution of the present invention.
Claims (8)
1. an IP address distribution method, is applied in the network equipment, it is characterised in that the method comprising the steps of:
Receiving DHCP (DHCP) package that user terminal sends, described DHCP package includes IP Address requests;
Medium access control (MAC) address of described user terminal is inquired about from described DHCP package;
According to the MAC Address inquired and predetermined computation rule, calculate the IP address of correspondence; And
Described user terminal is distributed in described IP address.
2. IP address distribution method as claimed in claim 1, it is characterised in that MAC Address that described basis inquires and predetermined computation rule, the step of the IP address calculating correspondence includes step:
Described MAC Address is converted to hashed value by hashing algorithm;
By the described hashed value size divided by DHCP pond, obtain remainder, described DHCP pond be sized to terminate the IP difference with IP, described IP and to terminate IP be that the network equipment presets; And
Calculate described IP and described remainder sum, obtain the IP address of correspondence.
3. IP address distribution method as claimed in claim 1, it is characterised in that the step of the described MAC Address inquiring about described user terminal from described DHCP package includes:
Inquire about the chaddr field of DHCPfield part in described DHCP package or the clientidentifier field of DHCPoption part, to obtain the MAC Address of described user terminal.
4. IP address distribution method as claimed in claim 1, it is characterized in that, MAC Address that the method inquires in described basis and predetermined computation rule, calculate correspondence IP address step and the described step that described IP address is distributed to described user terminal between further comprise the steps of:
Judge whether described IP address is currently taken by other user terminals;
When described IP address does not have occupied, perform the described step that described IP address is distributed to described user terminal; And
When described IP address is occupied, adopting the mode starting sequentially to distribute from described IP is that described user terminal redistributes IP address.
5. a network equipment, the described network equipment is connected to user terminal, it is characterised in that the described network equipment includes:
Receiver module, for receiving DHCP (DHCP) package that described user terminal sends, described DHCP package includes IP Address requests;
Enquiry module, for inquiring about medium access control (MAC) address of described user terminal from described DHCP package;
Computing module, for according to the MAC Address inquired and predetermined computation rule, calculating the IP address of correspondence; And
Distribution module, for distributing to described user terminal by described IP address.
6. the network equipment as claimed in claim 5, it is characterised in that described computing module is additionally operable to:
Described MAC Address is converted to hashed value by hashing algorithm;
By the described hashed value size divided by DHCP pond, obtain remainder, described DHCP pond be sized to terminate the IP difference with IP, described IP and to terminate IP be that the network equipment presets; And
Calculate described IP and described remainder sum, obtain the IP address of correspondence.
7. the network equipment as claimed in claim 5, it is characterized in that, the clientidentifier field of described enquiry module chaddr field or DHCPoption part by inquiring about DHCPfield part in described DHCP package, it is thus achieved that the MAC Address of described user terminal.
8. the network equipment as claimed in claim 5, it is characterised in that the described network equipment also includes judge module, is used for judging whether described IP address is currently taken by other user terminals; When described judge module judges that described IP address does not have occupied, described user terminal is distributed in described IP address by described distribution module; When described judge module judges that described IP address is occupied, described distribution module adopts the mode starting sequentially to distribute from described IP to be that described user terminal redistributes IP address.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410580736.0A CN105635326A (en) | 2014-10-27 | 2014-10-27 | Network equipment and IP address assignment method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410580736.0A CN105635326A (en) | 2014-10-27 | 2014-10-27 | Network equipment and IP address assignment method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105635326A true CN105635326A (en) | 2016-06-01 |
Family
ID=56049796
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410580736.0A Pending CN105635326A (en) | 2014-10-27 | 2014-10-27 | Network equipment and IP address assignment method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105635326A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106790741A (en) * | 2016-11-24 | 2017-05-31 | 上海易杵行智能科技有限公司 | A kind of method that cascade device based on link layer data communications distributes the network address automatically |
CN110085014A (en) * | 2019-04-30 | 2019-08-02 | 重庆政勤实业有限公司 | A kind of wireless control system |
CN110798507A (en) * | 2019-09-30 | 2020-02-14 | 互联网域名系统北京市工程研究中心有限公司 | Method and system for DHCP address allocation memory |
CN112193278A (en) * | 2019-07-08 | 2021-01-08 | 中车唐山机车车辆有限公司 | Train network management system |
CN113630300A (en) * | 2020-05-09 | 2021-11-09 | 华为技术有限公司 | Method and node for message transmission |
CN114301876A (en) * | 2021-12-23 | 2022-04-08 | 深圳创维数字技术有限公司 | Address allocation method, system, device and computer readable storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW200428818A (en) * | 2003-06-06 | 2004-12-16 | Hon Hai Prec Ind Co Ltd | Method for dynamically allocating IP addresses for hosts on a network |
US20070143486A1 (en) * | 2005-11-29 | 2007-06-21 | Kuk Chang Kang | Method and apparatus for supporting user mobility by allowing guest access in internet service network, and billing method based on the same |
CN101083670A (en) * | 2006-06-02 | 2007-12-05 | 鸿富锦精密工业(深圳)有限公司 | Address distributing system and method |
CN103685592A (en) * | 2012-09-20 | 2014-03-26 | 杭州华三通信技术有限公司 | Wireless bridge and method for realizing DHCP address application |
-
2014
- 2014-10-27 CN CN201410580736.0A patent/CN105635326A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW200428818A (en) * | 2003-06-06 | 2004-12-16 | Hon Hai Prec Ind Co Ltd | Method for dynamically allocating IP addresses for hosts on a network |
US20070143486A1 (en) * | 2005-11-29 | 2007-06-21 | Kuk Chang Kang | Method and apparatus for supporting user mobility by allowing guest access in internet service network, and billing method based on the same |
CN101083670A (en) * | 2006-06-02 | 2007-12-05 | 鸿富锦精密工业(深圳)有限公司 | Address distributing system and method |
CN103685592A (en) * | 2012-09-20 | 2014-03-26 | 杭州华三通信技术有限公司 | Wireless bridge and method for realizing DHCP address application |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106790741A (en) * | 2016-11-24 | 2017-05-31 | 上海易杵行智能科技有限公司 | A kind of method that cascade device based on link layer data communications distributes the network address automatically |
CN106790741B (en) * | 2016-11-24 | 2020-07-14 | 上海易杵行智能科技有限公司 | Method for automatically allocating network addresses to cascade equipment based on link layer data communication |
CN110085014A (en) * | 2019-04-30 | 2019-08-02 | 重庆政勤实业有限公司 | A kind of wireless control system |
CN112193278A (en) * | 2019-07-08 | 2021-01-08 | 中车唐山机车车辆有限公司 | Train network management system |
CN110798507A (en) * | 2019-09-30 | 2020-02-14 | 互联网域名系统北京市工程研究中心有限公司 | Method and system for DHCP address allocation memory |
CN110798507B (en) * | 2019-09-30 | 2022-05-03 | 互联网域名系统北京市工程研究中心有限公司 | Method and system for DHCP address allocation memory |
CN113630300A (en) * | 2020-05-09 | 2021-11-09 | 华为技术有限公司 | Method and node for message transmission |
CN113630300B (en) * | 2020-05-09 | 2023-08-08 | 华为技术有限公司 | Method and node for message transmission |
CN114301876A (en) * | 2021-12-23 | 2022-04-08 | 深圳创维数字技术有限公司 | Address allocation method, system, device and computer readable storage medium |
CN114301876B (en) * | 2021-12-23 | 2023-11-21 | 深圳创维数字技术有限公司 | Address allocation method, system, device and computer readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105635326A (en) | Network equipment and IP address assignment method | |
CN107257392B (en) | Method and device for setting equipment serial number and computer readable storage medium | |
CN107026907B (en) | Load balancing method, load balancer and load balancing system | |
JP6643760B2 (en) | Short link processing method, device, and server | |
CN105959405B (en) | CDN video scheduling system, method and CDN dispatch server and client | |
CN109085999B (en) | Data processing method and processing system | |
CN110196860B (en) | Unique identifier allocation method and device, electronic equipment and storage medium | |
CN105791254B (en) | Network request processing method and device and terminal | |
US20170017480A1 (en) | Method and apparatus for updating an application in a user terminal | |
CN110764688B (en) | Method and device for processing data | |
US20180081889A1 (en) | Data Processing Method and Apparatus | |
CN113452808A (en) | Domain name resolution method, device, equipment and storage medium | |
CN107659473A (en) | Connection control method, system, routing server and computer-readable recording medium | |
CN108616896B (en) | Operator identification method and device and internet access system | |
US20170104683A1 (en) | Dynamically segmenting traffic for a/b testing in a distributed computing environment | |
CN104144170A (en) | URL filtering method, device and system | |
CN106992999B (en) | Cross-server data communication processing method | |
CN108429641B (en) | Network equipment management method and device | |
CN111741109B (en) | Proxy-based access method, device, equipment and storage medium | |
CN109144690A (en) | task processing method and device | |
CN109842482B (en) | Information synchronization method, system and terminal equipment | |
CN111736761A (en) | Data distribution method, device, storage system and computer readable storage medium | |
CN106534285B (en) | Access method and device | |
CN109104506B (en) | Method and device for determining domain name resolution rule and computer readable storage medium | |
CN111770208A (en) | Control method and device for Internet of things equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20180226 Address after: 201613 Shanghai city south of Songjiang Export Processing Zone Road No. 1925 Applicant after: Ambit Microsystems (Shanghai) Co., Ltd. Address before: 201613 Shanghai City, Songjiang District Songjiang Export Processing Zone South Road No. 1925 Applicant before: Ambit Microsystems (Shanghai) Co., Ltd. Applicant before: Hon Hai Precision Industry Co., Ltd. |
|
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20160601 |