CN105376347A - IP address allocation method and system - Google Patents

IP address allocation method and system Download PDF

Info

Publication number
CN105376347A
CN105376347A CN201510922880.2A CN201510922880A CN105376347A CN 105376347 A CN105376347 A CN 105376347A CN 201510922880 A CN201510922880 A CN 201510922880A CN 105376347 A CN105376347 A CN 105376347A
Authority
CN
China
Prior art keywords
address
numerical value
network segment
initial
value
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
CN201510922880.2A
Other languages
Chinese (zh)
Other versions
CN105376347B (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.)
Taizhou Jiji Intellectual Property Operation Co.,Ltd.
Original Assignee
Shanghai Feixun Data Communication 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 Shanghai Feixun Data Communication Technology Co Ltd filed Critical Shanghai Feixun Data Communication Technology Co Ltd
Priority to CN201510922880.2A priority Critical patent/CN105376347B/en
Publication of CN105376347A publication Critical patent/CN105376347A/en
Application granted granted Critical
Publication of CN105376347B publication Critical patent/CN105376347B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/30Managing network names, e.g. use of aliases or nicknames
    • H04L61/3015Name registration, generation or assignment
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/668Internet protocol [IP] address subnets

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention provides an IP address allocation method and system. The method includes the following steps that: when an IP address allocation request sent by an electronic device is received, the subnet mask and MAC address of the electronic device are obtained from the IP address allocation request; an initial IP address is obtained according to the obtained subnet mask, MAC address and a preset algorithm; whether the initial IP address is available in an IP address pool is judged, if the initial IP address is available in the IP address pool, an IP address the same with the initial IP address is obtained from the IP address pool, and is fed back to the electronic device, otherwise, one-plus operation is performed on the initial IP address at least for once, so that an allocatable final IP address can be obtained from the IP address pool, and at the same time, an IP address the same with the final IP address is obtained from the IP address pool and is fed back to the electronic device. With the IP address allocation method and system of the invention adopted, the IP address of the electronic device can be kept constant, and a situation that different MAC addresses are corresponding to the same IP address can be avoided.

Description

A kind of IP address assignment method and system
Technical field
The present invention relates to technical field of network management, be specially a kind of IP address assignment method and system.
Background technology
Inside current general company, employee is numerous, and the terminal equipments such as computer are also a lot, and IP address applications is great, and company can utilize IP address Access Management Access employee equipment, and employee's Related Work also must access IP address; Equally all can utilize IP address management computer in each local area network (LAN) of school, connect teacher classmate etc.; During company's test router project, especially in maximum throughput test, beating between IP address is flowed.These widely used IP addresses, in reality, are not stable, and IP address because various situation, need be able to be redistributed, and just mean different with meeting on the very large probability in IP address before yet.At present when router is connected with multiple stage terminal, terminal equipment breaks connection for various reasons, then router can redistribute new IP address to terminal, and the old IP address before being generally different from, mobility like this is unfavorable for management, utilize IP address to visit some connections of terminal and application, and lose time.
Also have the scheme keeping IP address constant in currently available technology, one is MAC-IP binding: manually in the IP address that route internal input is corresponding to MAC Address, form binding relationship, the terminal equipment of connection obtains IP address according to MAC Address.This mode Problems existing is: a large amount of IP address needs manual configuration, and workload is large and loaded down with trivial details.Another is the binding of domain name and IP address: by the domain name be easily understood, and utilizes dns server binding IP address, and user can visit application in the terminal of the IP address of binding with it or terminal and service by domain name.This mode Problems existing is: in the domain name of client configuration dns server, and by resolving domain name, visit the IP address parsed, workflow is loaded down with trivial details, and needs to there is dns server in network, cannot work if do not have; And a lot of application does not support domain name access with service, is directly accessed by IP address, without the need to domain name and IP address binding.
Summary of the invention
The shortcoming of prior art in view of the above, the object of the present invention is to provide a kind of IP address assignment method and system, loaded down with trivial details, the problem that workload is large that exist when keeping IP address of terminal constant for solving in existing method.
For achieving the above object and other relevant objects, the invention provides a kind of IP address assignment method, obtain the process of IP address for electronic equipment from the router of distributing IP address, described IP address assignment method comprises: when receiving the IP address assignment request that electronic equipment sends, obtain subnet mask and the MAC Address of described electronic equipment from described IP address assignment request; The initial ip address corresponding with described MAC Address is obtained according to the described subnet mask obtained, described MAC Address and preset algorithm; Judge whether described initial ip address can be used in IP address pool, if, then from described IP address pool, obtain the IP address identical with described initial ip address and this IP address is fed back to described electronic equipment, if not, then add-one operation is at least one times carried out to described initial ip address and obtain the final IP address that can be assigned with in described IP address pool, from described IP address pool, obtain the IP address identical with described final IP address simultaneously and this IP address is fed back to described electronic equipment.
Preferably, described preset algorithm comprises: the numerical value judging four network segments in described subnet mask, be the numerical value that numerical value in the network segment of fixed value is set in the corresponding network segment of described initial ip address by numerical value in described subnet mask, the binary numeral byte of described MAC Address being carried out XOR generation is converted to the numerical value as all the other network segments of described initial ip address after decimal value.
Preferably, if the numerical value of first three network segment is fixed value in described subnet mask, the numerical value of last network segment is variate-value, then using corresponding for the numerical value of first three network segment of the described subnet mask numerical value as first three network segment of described initial ip address, the binary numeral generated after six of described MAC Address bytes successively XOR is converted to the numerical value of the numerical value after decimal value as last network segment of described initial ip address.
Preferably, if the numerical value of the first two network segment is fixed value in described subnet mask, the numerical value of latter two network segment is variate-value, then using corresponding for the numerical value of the first two network segment of the described subnet mask numerical value as the first two network segment of described initial ip address, respectively using after first three byte of described MAC Address successively XOR with rear three bytes successively XOR after the binary numeral that generates be converted to the numerical value of the numerical value after decimal value as latter two network segment of described initial ip address.
Preferably, if the numerical value of first network segment is fixed value in described subnet mask, the numerical value of rear three network segments is variate-value, then using corresponding for the numerical value of first of described subnet mask network segment numerical value as first network segment of described initial ip address, respectively using after the first two byte of described MAC Address successively XOR, middle two bytes successively after XOR and the binary numeral that generates after XOR successively of latter two byte be converted to the numerical value of the numerical value after decimal value as rear three network segments of described initial ip address.
For achieving the above object, the present invention also provides a kind of IP address assignment system, obtain the process of IP address for electronic equipment from the router of distributing IP address, described IP address assignment system comprises: data obtaining module, for when receiving the IP address assignment request that electronic equipment sends, from described IP address assignment request, obtain subnet mask and the MAC Address of described electronic equipment; Initial ip address acquisition module, is connected with described data obtaining module, for obtaining the initial ip address corresponding with described MAC Address according to the described subnet mask obtained, described MAC Address and preset algorithm; Judge module, is connected with the IP address pool in router with described initial ip address acquisition module, for judging whether described initial ip address can be used in IP address pool; Final IP address acquisition module, be connected with described judge module with described initial ip address acquisition module respectively, for when described initial ip address is unavailable in IP address pool, add-one operation is at least one times carried out to described initial ip address and obtains the final IP address that can be assigned with in described IP address pool; IP address assignment module, be connected with described initial ip address acquisition module, described final IP address acquisition module and described judge module respectively, for when described initial ip address is available in IP address pool, the IP address identical with described initial ip address is obtained from described IP address pool, when described initial ip address is unavailable in IP address pool, from described IP address pool, obtain the IP address identical with described final IP address; IP address feedback module, is connected with described IP address assignment module, for the IP address obtained from described IP address pool is fed back to described electronic equipment.
Preferably, preset algorithm in described initial ip address acquisition module comprises: the numerical value judging four network segments in described subnet mask, be the numerical value that numerical value in the network segment of fixed value is set in the corresponding network segment of described initial ip address by numerical value in described subnet mask, the binary numeral byte of described MAC Address being carried out XOR generation is converted to the numerical value as all the other network segments of described initial ip address after decimal value.
Preferably, if the numerical value of first three network segment is fixed value in described subnet mask, the numerical value of last network segment is variate-value, then using corresponding for the numerical value of first three network segment of the described subnet mask numerical value as first three network segment of described initial ip address, the binary numeral generated after six of described MAC Address bytes successively XOR is converted to the numerical value of the numerical value after decimal value as last network segment of described initial ip address.
Preferably, if the numerical value of the first two network segment is fixed value in described subnet mask, the numerical value of latter two network segment is variate-value, then using corresponding for the numerical value of the first two network segment of the described subnet mask numerical value as the first two network segment of described initial ip address, respectively using after first three byte of described MAC Address successively XOR with rear three bytes successively XOR after the binary numeral that generates be converted to the numerical value of the numerical value after decimal value as latter two network segment of described initial ip address.
Preferably, if the numerical value of first network segment is fixed value in described subnet mask, the numerical value of rear three network segments is variate-value, then using corresponding for the numerical value of first of described subnet mask network segment numerical value as first network segment of described initial ip address, respectively using after the first two byte of described MAC Address successively XOR, middle two bytes successively after XOR and the binary numeral that generates after XOR successively of latter two byte be converted to the numerical value of the numerical value after decimal value as rear three network segments of described initial ip address.
As mentioned above, a kind of IP address assignment method and system of the present invention, have following beneficial effect:
1, the present invention is according to the subnet mask of electronic equipment, MAC Address obtains the initial ip address corresponding with described MAC Address with preset algorithm, if initial ip address is available in IP address pool, then from described IP address pool, obtain the IP address identical with described initial ip address and this IP address is fed back to described electronic equipment, if initial ip address is unavailable in IP address pool, add-one operation is at least one times carried out to described initial ip address and obtains the final IP address that can be assigned with in described IP address pool, from described IP address pool, obtain the IP address identical with described final IP address simultaneously and this IP address is fed back to described electronic equipment, so MAC Address and IP address one_to_one corresponding can be got up by the present invention automatically, avoid occurring that different MAC Address corresponds on identical IP address, allow electronic equipments many again can obtain unique IP address, during management ip address, only need to arrange once, need not change again later, effectively raise utilance and the operating efficiency of each IP address.
2, the present invention is without the need to the support by similar services such as dns servers, utilizes domain name to visit IP address, makes workflow simple, also can not exist because support region name does not cause the appearance of the analogues such as work obstruction.
3, the present invention is by bundling MAC Address and IP address, like this, would not occur that IP address is stolen and normally can not use the situation of network, effectively can ensure the safety of network and the application of user.And in some application using IP address, the IP obtained by the present invention only need be obtained once, later will without the need to being configured again, because IP is not in variation.
Accompanying drawing explanation
Fig. 1 is shown as the schematic flow sheet of IP address assignment method of the present invention.
Fig. 2 is shown as the structural representation of IP address assignment system of the present invention.
Element numbers explanation
1IP address allocation system
11 data obtaining module
12 initial ip address acquisition modules
13 judge modules
14IP address assignment module
15IP address feedback module
16 final IP address acquisition module
S11 ~ S16 step
Embodiment
Below by way of specific instantiation, embodiments of the present invention are described, those skilled in the art the content disclosed by this specification can understand other advantages of the present invention and effect easily.The present invention can also be implemented or be applied by embodiments different in addition, and the every details in this specification also can based on different viewpoints and application, carries out various modification or change not deviating under spirit of the present invention.
The object of the present embodiment is to provide a kind of IP address assignment method and system, loaded down with trivial details, the problem that workload is large that exist when keeping IP address of terminal constant for solving in existing method.To principle and the execution mode of a kind of IP address assignment method and system of the present embodiment be elaborated below, and make those skilled in the art not need creative work can understand a kind of IP address assignment method and system of the present embodiment.
The present embodiment provides a kind of IP address assignment method and system, and obtain the process of IP address for the router of electronic equipment from distributing IP address, wherein, described electronic equipment includes but not limited to PC, mobile phone or PAD.The present embodiment is based on the MAC Address uniqueness of electronic equipment, obtain and MAC Address IP address one to one, even if electronic equipment breaks and connection between router, as long as MAC Address is constant, after again connecting above, the IP address of electronic equipment is just constant, solve the problem that when redistributing IP address after again connecting, newly assigned IP address is not identical with electronic equipment former IP address, the electronic equipment advantageously connected under management same router, and each keeper of electronic equipment also eliminates repeatedly the trouble of configuration of IP address.
Particularly, as shown in Figure 1, the present embodiment provides a kind of IP address assignment method, and obtain the process of IP address for the router of electronic equipment from distributing IP address, described IP address assignment method comprises the following steps.
Step S11, when receiving the IP address assignment request that electronic equipment sends, obtains subnet mask and the MAC Address of described electronic equipment from described IP address assignment request.
Step S12, obtains the initial ip address corresponding with described MAC Address according to the described subnet mask obtained, described MAC Address and preset algorithm.
Step S13, whether disconnected described initial ip address can be used in IP address pool, if so, then then performs step S14, if all, then then performs step S15.
Step S14, obtains the IP address identical with described initial ip address and this IP address is fed back to described electronic equipment from described IP address pool.
Step S15, carries out add-one operation at least one times to described initial ip address and obtains the final IP address that can be assigned with in described IP address pool.
Step S16, obtains the IP address identical with described final IP address and this IP address is fed back to described electronic equipment from described IP address pool.
Below step S11 is described in detail to step S16.
Step S11, when receiving the IP address assignment request that electronic equipment sends, obtains subnet mask and the MAC Address of described electronic equipment from described IP address assignment request.
Particularly, in the present embodiment, when electronic equipment is connected to associated router, electronic equipment can distribute to oneself IP address by Request routing device, namely electronic equipment can send an IP address assignment request to router, wherein, some information of electronic equipment are included in described IP address assignment request, the subnet mask of such as electronic equipment and MAC Address.
Step S12, obtains the initial ip address corresponding with described MAC Address according to the described subnet mask obtained, described MAC Address and preset algorithm.
Particularly, in the present embodiment, described preset algorithm comprises: the numerical value judging four network segments in described subnet mask, be the numerical value that numerical value in the network segment of fixed value is set in the corresponding network segment of described initial ip address by numerical value in described subnet mask, the binary numeral byte of described MAC Address being carried out XOR generation is converted to the numerical value as all the other network segments of described initial ip address after decimal value.Wherein, in the present embodiment, in the network segment of described subnet mask, fixed value is 255, in the network segment of described subnet mask variate-value be less than 255 natural number, namely the scope of described variate-value is 0≤variate-value≤255.
Further, in the present embodiment, if the numerical value of first three network segment is fixed value in described subnet mask, the numerical value of last network segment is variate-value, then using corresponding for the numerical value of first three network segment of the described subnet mask numerical value as first three network segment of described initial ip address, the binary numeral generated after six of described MAC Address bytes successively XOR is converted to the numerical value of the numerical value after decimal value as last network segment of described initial ip address.
Such as, if the situation of subnet mask a.b.c.d tetra-network segments is a=255, b=255, c=255,0<=d<=255, such as subnet mask is 255.255.255.0, and so the IP address sources of last network segment is in the XOR successively of 6 bytes of MAC Address.Suppose that MAC Address is D0-67-E5-00-C1-52, be then 1 to D0 XOR, 67 XORs are 1, E5 XOR is 1,00 XOR be 0, C1 XOR is 1,52 XORs are 1, be then 111011 to the binary numeral generated after six bytes of MAC Address successively XOR, being converted to decimal value is 59, then initial ip address is 255.255.255.59.
Further, in the present embodiment, if the numerical value of the first two network segment is fixed value in described subnet mask, the numerical value of latter two network segment is variate-value, then using corresponding for the numerical value of the first two network segment of the described subnet mask numerical value as the first two network segment of described initial ip address, respectively using after first three byte of described MAC Address successively XOR with rear three bytes successively XOR after the binary numeral that generates be converted to the numerical value of the numerical value after decimal value as latter two network segment of described initial ip address.
Such as, if the situation of subnet mask a.b.c.d tetra-network segments is a=255, b=255,0=<c<255,0<=d<255, such as subnet mask is 255.255.0.0, and the IP address of latter two network segment derives from the XOR of first three byte of MAC Address and the XOR of rear three bytes respectively so.Suppose that MAC Address is D0-67-E5-00-C1-52, be 1,67 XORs be then 1, E5 XOR to D0 XOR be 1, the binary numeral generated after the XOR of i.e. first three byte of MAC Address is 111, to be converted to decimal value be 7,00 XOR be 0, C1 XOR is 1,52 XORs are 1, the binary numeral generated after the XOR of i.e. rear three bytes of MAC Address is 011, and being converted to decimal value is 3, then initial ip address is 255.255.7.3.
Further, in the present embodiment, if the numerical value of first network segment is fixed value in described subnet mask, the numerical value of rear three network segments is variate-value, then using corresponding for the numerical value of first of described subnet mask network segment numerical value as first network segment of described initial ip address, respectively using after the first two byte of described MAC Address successively XOR, middle two bytes successively after XOR and the binary numeral that generates after XOR successively of latter two byte be converted to the numerical value of the numerical value after decimal value as rear three network segments of described initial ip address.
Such as, if the situation of subnet mask a.b.c.d tetra-network segments is 0<=a<=255,0=<b<255,0=<c<255,0<=d<255, such as subnet mask is 255.0.0.0, and the IP address of so last three network segments derives from the XOR of the XOR of the first two byte of MAC Address, middle two byte XORs and latter two byte respectively.Suppose that MAC Address is D0-67-E5-00-C1-52, be then 1 to D0 XOR, 67 XORs are 1, the binary numeral generated after the XOR of i.e. the first two byte of MAC Address is 11, being converted to decimal value is 3, E5 XOR is 1, 00 XOR is 0, the binary numeral generated after the XOR of i.e. two bytes in centre of MAC Address is 10, being converted to decimal value is 2, C1 XOR is 1, 52 XORs are 1, the binary numeral generated after the XOR of i.e. latter two byte of MAC Address is 11, being converted to decimal value is 3, then initial ip address is 255.3.2.3.
Step S13, whether disconnected described initial ip address can be used in IP address pool, if so, then then performs step S14, if all, then then performs step S15.
Step S14, obtains the IP address identical with described initial ip address and this IP address is fed back to described electronic equipment from described IP address pool.
Step S15, carries out add-one operation at least one times to described initial ip address and obtains the final IP address that can be assigned with in described IP address pool.
Particularly, in the present embodiment, such as initial ip address is 255.255.7.3, this IP address is unavailable in IP address pool, then add-one operation is carried out to 255.255.7.3, any one or numerical value that is several or last network segment by initial ip address add 1, such as 1 is added to the numerical value of last network segment, namely existing initial ip address becomes 255.255.7.4, then continue to judge whether 255.255.7.4 can use in IP address pool, if available, using this IP address as final IP address, if unavailable, then continue to carry out add-one operation to 255.255.7.4, become 255.255.7.5, then judge whether 255.255.7.5 can use in IP address pool, circulation like this, until obtain IP address available in IP address pool using this IP address as final IP address.
Step S16, obtains the IP address identical with described final IP address and this IP address is fed back to described electronic equipment from described IP address pool.
So the IP address assignment method of the present embodiment achieves the function obtaining IP address one to one according to MAC Address, be applicable to manage the multiple electronic equipment connected on the router.The IP address assignment method of the present embodiment is by carrying out a series of calculating to MAC Address, obtain an IP address, a series of judgement is being carried out to the address obtained, and situation algorithm process afterwards, the IP address that final acquisition one is unique, not only effective but also any repetition can not be had with the address in address pool, finally distribute to electronic equipment, the IP address that electronic equipment obtains can not change along with any extraneous circumstance, effectively decrease the time repeatedly obtaining address, put forward the utilance of higher ip address, improve the stability connected between various electronic equipment.
For realizing above-mentioned IP address distribution method, the present embodiment correspondence provides a kind of IP address assignment system, obtain the process of IP address, for electronic equipment particularly, in the present embodiment from the router of distributing IP address, as shown in Figure 2, described IP address assignment system 1 comprises: data obtaining module 11, initial ip address acquisition module 12, judge module 13, IP address assignment module 14, IP address feedback module 15 and final IP address acquisition module 16.
In the present embodiment, described data obtaining module 11, for when receiving the IP address assignment request that electronic equipment sends, obtains subnet mask and the MAC Address of described electronic equipment from described IP address assignment request.
Particularly, in the present embodiment, when electronic equipment is connected to associated router, electronic equipment can distribute to oneself IP address by Request routing device, namely electronic equipment can send an IP address assignment request to router, wherein, some information of electronic equipment are included in described IP address assignment request, the subnet mask of such as electronic equipment and MAC Address.
In the present embodiment, described initial ip address acquisition module 12 is connected with described data obtaining module 11, for obtaining the initial ip address corresponding with described MAC Address according to the described subnet mask obtained, described MAC Address and preset algorithm.
Particularly, in the present embodiment, preset algorithm in described initial ip address acquisition module 12 comprises: the numerical value judging four network segments in described subnet mask, be the numerical value that numerical value in the network segment of fixed value is set in the corresponding network segment of described initial ip address by numerical value in described subnet mask, the binary numeral byte of described MAC Address being carried out XOR generation is converted to the numerical value as all the other network segments of described initial ip address after decimal value.
Further, in the present embodiment, if the numerical value of first three network segment is fixed value in described subnet mask, the numerical value of last network segment is variate-value, then using corresponding for the numerical value of first three network segment of the described subnet mask numerical value as first three network segment of described initial ip address, the binary numeral generated after six of described MAC Address bytes successively XOR is converted to the numerical value of the numerical value after decimal value as last network segment of described initial ip address.
Such as, if the situation of subnet mask a.b.c.d tetra-network segments is a=255, b=255, c=255,0<=d<=255, such as subnet mask is 255.255.255.0, and so the IP address sources of last network segment is in the XOR successively of 6 bytes of MAC Address.Suppose that MAC Address is D0-67-E5-00-C1-52, be then 1 to D0 XOR, 67 XORs are 1, E5 XOR is 1,00 XOR be 0, C1 XOR is 1,52 XORs are 1, be then 111011 to the binary numeral generated after six bytes of MAC Address successively XOR, being converted to decimal value is 59, then initial ip address is 255.255.255.59.
Further, in the present embodiment, if the numerical value of the first two network segment is fixed value in described subnet mask, the numerical value of latter two network segment is variate-value, then using corresponding for the numerical value of the first two network segment of the described subnet mask numerical value as the first two network segment of described initial ip address, respectively using after first three byte of described MAC Address successively XOR with rear three bytes successively XOR after the binary numeral that generates be converted to the numerical value of the numerical value after decimal value as latter two network segment of described initial ip address.
Such as, if the situation of subnet mask a.b.c.d tetra-network segments is a=255, b=255,0=<c<255,0<=d<255, such as subnet mask is 255.255.0.0, and the IP address of latter two network segment derives from the XOR of first three byte of MAC Address and the XOR of rear three bytes respectively so.Suppose that MAC Address is D0-67-E5-00-C1-52, be 1,67 XORs be then 1, E5 XOR to D0 XOR be 1, the binary numeral generated after the XOR of i.e. first three byte of MAC Address is 111, to be converted to decimal value be 7,00 XOR be 0, C1 XOR is 1,52 XORs are 1, the binary numeral generated after the XOR of i.e. rear three bytes of MAC Address is 011, and being converted to decimal value is 3, then initial ip address is 255.255.7.3.
Further, in the present embodiment, if the numerical value of first network segment is fixed value in described subnet mask, the numerical value of rear three network segments is variate-value, then using corresponding for the numerical value of first of described subnet mask network segment numerical value as first network segment of described initial ip address, respectively using after the first two byte of described MAC Address successively XOR, middle two bytes successively after XOR and the binary numeral that generates after XOR successively of latter two byte be converted to the numerical value of the numerical value after decimal value as rear three network segments of described initial ip address.
Such as, if the situation of subnet mask a.b.c.d tetra-network segments is 0<=a<=255,0=<b<255,0=<c<255,0<=d<255, such as subnet mask is 255.0.0.0, and the IP address of so last three network segments derives from the XOR of the XOR of the first two byte of MAC Address, middle two byte XORs and latter two byte respectively.Suppose that MAC Address is D0-67-E5-00-C1-52, be then 1 to D0 XOR, 67 XORs are 1, the binary numeral generated after the XOR of i.e. the first two byte of MAC Address is 11, being converted to decimal value is 3, E5 XOR is 1, 00 XOR is 0, the binary numeral generated after the XOR of i.e. two bytes in centre of MAC Address is 10, being converted to decimal value is 2, C1 XOR is 1, 52 XORs are 1, the binary numeral generated after the XOR of i.e. latter two byte of MAC Address is 11, being converted to decimal value is 3, then initial ip address is 255.3.2.3.
In the present embodiment, described judge module 13 is connected with the IP address pool in router with described initial ip address acquisition module 12, for judging whether described initial ip address can be used in IP address pool.
In the present embodiment, described IP address assignment module 14 is connected with described initial ip address acquisition module 12, described final IP address acquisition module 16 and described judge module 13 respectively, for when described initial ip address is available in IP address pool, from described IP address pool, obtain the IP address identical with described initial ip address.
In the present embodiment, described IP address feedback module 15 is connected with described IP address assignment module 14, for the IP address obtained from described IP address pool is fed back to described electronic equipment.
In the present embodiment, described final IP address acquisition module 16 is connected with described judge module 13 with described initial ip address acquisition module 12 respectively, for when described initial ip address is unavailable in IP address pool, add-one operation is at least one times carried out to described initial ip address and obtains the final IP address that can be assigned with in described IP address pool.Then described IP address assignment module 14 obtains the IP address identical with described final IP address from described IP address pool.
Particularly, in the present embodiment, in described final IP address acquisition module 16, such as initial ip address is 255.255.7.3, this IP address is unavailable in IP address pool, then add-one operation is carried out to 255.255.7.3, any one or numerical value that is several or last network segment by initial ip address add 1, such as 1 is added to the numerical value of last network segment, namely existing initial ip address becomes 255.255.7.4, then continue to judge whether 255.255.7.4 can use in IP address pool, if available, using this IP address as final IP address, if unavailable, then continue to carry out add-one operation to 255.255.7.4, become 255.255.7.5, then judge whether 255.255.7.5 can use in IP address pool, circulation like this, until obtain IP address available in IP address pool using this IP address as final IP address.
In sum, the present invention is according to the subnet mask of electronic equipment, MAC Address obtains the initial ip address corresponding with described MAC Address with preset algorithm, if initial ip address is available in IP address pool, then from described IP address pool, obtain the IP address identical with described initial ip address and this IP address is fed back to described electronic equipment, if initial ip address is unavailable in IP address pool, add-one operation is at least one times carried out to described initial ip address and obtains the final IP address that can be assigned with in described IP address pool, from described IP address pool, obtain the IP address identical with described final IP address simultaneously and this IP address is fed back to described electronic equipment, so MAC Address and IP address one_to_one corresponding can be got up by the present invention automatically, avoid occurring that different MAC Address corresponds on identical IP address, allow electronic equipments many again can obtain unique IP address, during management ip address, only need to arrange once, need not change again later, effectively raise utilance and the operating efficiency of each IP address, the present invention, without the need to the support by similar services such as dns servers, utilizes domain name to visit IP address, makes workflow simple, also can not exist because support region name does not cause the appearance of the analogues such as work obstruction, the present invention, by MAC Address and IP address being bundled, like this, would not occur that IP address is stolen and normally can not use the situation of network, effectively can ensure the safety of network and the application of user.And in some application using IP address, the IP obtained by the present invention only need be obtained once, later will without the need to being configured again, because IP is not in variation.So the present invention effectively overcomes various shortcoming of the prior art and tool high industrial utilization.
Above-described embodiment is illustrative principle of the present invention and effect thereof only, but not for limiting the present invention.Any person skilled in the art scholar all without prejudice under spirit of the present invention and category, can modify above-described embodiment or changes.Therefore, such as have in art usually know the knowledgeable do not depart from complete under disclosed spirit and technological thought all equivalence modify or change, must be contained by claim of the present invention.

Claims (10)

1. an IP address assignment method, obtains the process of IP address for the router of electronic equipment from distributing IP address, it is characterized in that: described IP address assignment method comprises:
When receiving the IP address assignment request that electronic equipment sends, from described IP address assignment request, obtain subnet mask and the MAC Address of described electronic equipment;
The initial ip address corresponding with described MAC Address is obtained according to the described subnet mask obtained, described MAC Address and preset algorithm;
Judge whether described initial ip address can be used in IP address pool, if, then from described IP address pool, obtain the IP address identical with described initial ip address and this IP address is fed back to described electronic equipment, if not, then add-one operation is at least one times carried out to described initial ip address and obtain the final IP address that can be assigned with in described IP address pool, from described IP address pool, obtain the IP address identical with described final IP address simultaneously and this IP address is fed back to described electronic equipment.
2. IP address assignment method according to claim 1, is characterized in that: described preset algorithm comprises:
Judge the numerical value of four network segments in described subnet mask, be the numerical value that numerical value in the network segment of fixed value is set in the corresponding network segment of described initial ip address by numerical value in described subnet mask, the binary numeral byte of described MAC Address being carried out XOR generation is converted to the numerical value as all the other network segments of described initial ip address after decimal value.
3. IP address assignment method according to claim 2, it is characterized in that: if the numerical value of first three network segment is fixed value in described subnet mask, the numerical value of last network segment is variate-value, then using corresponding for the numerical value of first three network segment of the described subnet mask numerical value as first three network segment of described initial ip address, the binary numeral generated after six of described MAC Address bytes successively XOR is converted to the numerical value of the numerical value after decimal value as last network segment of described initial ip address.
4. IP address assignment method according to claim 2, it is characterized in that: if the numerical value of the first two network segment is fixed value in described subnet mask, the numerical value of latter two network segment is variate-value, then using corresponding for the numerical value of the first two network segment of the described subnet mask numerical value as the first two network segment of described initial ip address, respectively using after first three byte of described MAC Address successively XOR with rear three bytes successively XOR after the binary numeral that generates be converted to the numerical value of the numerical value after decimal value as latter two network segment of described initial ip address.
5. IP address assignment method according to claim 2, it is characterized in that: if the numerical value of first network segment is fixed value in described subnet mask, the numerical value of rear three network segments is variate-value, then using corresponding for the numerical value of first of described subnet mask network segment numerical value as first network segment of described initial ip address, respectively by after the first two byte of described MAC Address successively XOR, middle two bytes successively after XOR and the binary numeral that generates after XOR successively of latter two byte be converted to the numerical value of the numerical value after decimal value as rear three network segments of described initial ip address.
6. an IP address assignment system, obtains the process of IP address for the router of electronic equipment from distributing IP address, it is characterized in that: described IP address assignment system comprises:
Data obtaining module, for when receiving the IP address assignment request that electronic equipment sends, obtains subnet mask and the MAC Address of described electronic equipment from described IP address assignment request;
Initial ip address acquisition module, is connected with described data obtaining module, for obtaining the initial ip address corresponding with described MAC Address according to the described subnet mask obtained, described MAC Address and preset algorithm;
Judge module, is connected with the IP address pool in router with described initial ip address acquisition module, for judging whether described initial ip address can be used in IP address pool;
Final IP address acquisition module, be connected with described judge module with described initial ip address acquisition module respectively, for when described initial ip address is unavailable in IP address pool, add-one operation is at least one times carried out to described initial ip address and obtains the final IP address that can be assigned with in described IP address pool;
IP address assignment module, be connected with described initial ip address acquisition module, described final IP address acquisition module and described judge module respectively, for when described initial ip address is available in IP address pool, the IP address identical with described initial ip address is obtained from described IP address pool, when described initial ip address is unavailable in IP address pool, from described IP address pool, obtain the IP address identical with described final IP address;
IP address feedback module, is connected with described IP address assignment module, for the IP address obtained from described IP address pool is fed back to described electronic equipment.
7. IP address assignment system according to claim 6, is characterized in that: the preset algorithm in described initial ip address acquisition module comprises:
Judge the numerical value of four network segments in described subnet mask, be the numerical value that numerical value in the network segment of fixed value is set in the corresponding network segment of described initial ip address by numerical value in described subnet mask, the binary numeral byte of described MAC Address being carried out XOR generation is converted to the numerical value as all the other network segments of described initial ip address after decimal value.
8. IP address assignment system according to claim 7, it is characterized in that: if the numerical value of first three network segment is fixed value in described subnet mask, the numerical value of last network segment is variate-value, then using corresponding for the numerical value of first three network segment of the described subnet mask numerical value as first three network segment of described initial ip address, the binary numeral generated after six of described MAC Address bytes successively XOR is converted to the numerical value of the numerical value after decimal value as last network segment of described initial ip address.
9. IP address assignment system according to claim 7, it is characterized in that: if the numerical value of the first two network segment is fixed value in described subnet mask, the numerical value of latter two network segment is variate-value, then using corresponding for the numerical value of the first two network segment of the described subnet mask numerical value as the first two network segment of described initial ip address, respectively using after first three byte of described MAC Address successively XOR with rear three bytes successively XOR after the binary numeral that generates be converted to the numerical value of the numerical value after decimal value as latter two network segment of described initial ip address.
10. IP address assignment system according to claim 7, it is characterized in that: if the numerical value of first network segment is fixed value in described subnet mask, the numerical value of rear three network segments is variate-value, then using corresponding for the numerical value of first of described subnet mask network segment numerical value as first network segment of described initial ip address, respectively by after the first two byte of described MAC Address successively XOR, middle two bytes successively after XOR and the binary numeral that generates after XOR successively of latter two byte be converted to the numerical value of the numerical value after decimal value as rear three network segments of described initial ip address.
CN201510922880.2A 2015-12-11 2015-12-11 A kind of IP address distribution method and system Active CN105376347B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510922880.2A CN105376347B (en) 2015-12-11 2015-12-11 A kind of IP address distribution method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510922880.2A CN105376347B (en) 2015-12-11 2015-12-11 A kind of IP address distribution method and system

Publications (2)

Publication Number Publication Date
CN105376347A true CN105376347A (en) 2016-03-02
CN105376347B CN105376347B (en) 2019-06-18

Family

ID=55378141

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510922880.2A Active CN105376347B (en) 2015-12-11 2015-12-11 A kind of IP address distribution method and system

Country Status (1)

Country Link
CN (1) CN105376347B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106067837A (en) * 2016-05-18 2016-11-02 珠海格力电器股份有限公司 Multi-connected air conditioning unit and address setting method and device thereof
CN106603750A (en) * 2017-01-24 2017-04-26 株洲中车时代电气股份有限公司 Method and system for configuring local static network address
CN108076162A (en) * 2016-11-18 2018-05-25 中兴通讯股份有限公司 A kind of mobile terminal networking methods and device
CN108156275A (en) * 2017-12-20 2018-06-12 北京金山云网络技术有限公司 IP address distribution method, device, electronic equipment and storage medium
CN110225144A (en) * 2018-03-02 2019-09-10 华为技术有限公司 Obtain and provide method, user equipment and the management server of service
US11930081B2 (en) 2021-08-27 2024-03-12 Samsung Electronics Co., Ltd. Display apparatus, electronic apparatus, and operating methods thereof

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030115367A1 (en) * 2001-12-18 2003-06-19 Brother Kogyo Kabushiki Kaisha Address deducing system for deducing network settings
CN102123181A (en) * 2010-12-09 2011-07-13 广东高新兴通信股份有限公司 Method for automatically configuring IP address to network device
WO2015014195A1 (en) * 2013-07-31 2015-02-05 华为技术有限公司 Address resource allocation method, management device, request device, and system
CN104394242A (en) * 2014-11-21 2015-03-04 华为技术有限公司 IP (internet protocol) address allocation method and device
CN104580029A (en) * 2015-01-26 2015-04-29 杭州华三通信技术有限公司 Address distribution method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030115367A1 (en) * 2001-12-18 2003-06-19 Brother Kogyo Kabushiki Kaisha Address deducing system for deducing network settings
CN102123181A (en) * 2010-12-09 2011-07-13 广东高新兴通信股份有限公司 Method for automatically configuring IP address to network device
WO2015014195A1 (en) * 2013-07-31 2015-02-05 华为技术有限公司 Address resource allocation method, management device, request device, and system
CN104394242A (en) * 2014-11-21 2015-03-04 华为技术有限公司 IP (internet protocol) address allocation method and device
CN104580029A (en) * 2015-01-26 2015-04-29 杭州华三通信技术有限公司 Address distribution method and device

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106067837A (en) * 2016-05-18 2016-11-02 珠海格力电器股份有限公司 Multi-connected air conditioning unit and address setting method and device thereof
CN106067837B (en) * 2016-05-18 2018-11-30 珠海格力电器股份有限公司 multi-connected air conditioning unit and address setting method and device thereof
CN108076162A (en) * 2016-11-18 2018-05-25 中兴通讯股份有限公司 A kind of mobile terminal networking methods and device
CN106603750A (en) * 2017-01-24 2017-04-26 株洲中车时代电气股份有限公司 Method and system for configuring local static network address
CN106603750B (en) * 2017-01-24 2019-11-12 株洲中车时代电气股份有限公司 A kind of method and system configuring local static network address
CN108156275A (en) * 2017-12-20 2018-06-12 北京金山云网络技术有限公司 IP address distribution method, device, electronic equipment and storage medium
CN110225144A (en) * 2018-03-02 2019-09-10 华为技术有限公司 Obtain and provide method, user equipment and the management server of service
CN110225144B (en) * 2018-03-02 2021-03-23 华为技术有限公司 Method for obtaining and providing service, user equipment and management server
US11444915B2 (en) 2018-03-02 2022-09-13 Huawei Technologies Co., Ltd. Service obtaining and providing methods, user equipment, and management server
US11930081B2 (en) 2021-08-27 2024-03-12 Samsung Electronics Co., Ltd. Display apparatus, electronic apparatus, and operating methods thereof

Also Published As

Publication number Publication date
CN105376347B (en) 2019-06-18

Similar Documents

Publication Publication Date Title
CN105376347A (en) IP address allocation method and system
CN104780115B (en) Load-balancing method and system in cloud computing environment
CN109871224A (en) A kind of gray scale dissemination method, system, medium and equipment based on user identifier
CN105812488A (en) Cloud computing distributed service cluster system and method of using the system
CN104734931A (en) Method and device for establishing link between virtual network functions
CN102004673A (en) Processing method and system of multi-core processor load balancing
CN104579887A (en) Cloud gateway as well as cloud gateway creation and configuration system and method
RU2008138577A (en) NETWORK SYSTEM
CN109151025B (en) Load balancing method and device based on URL, computer storage medium and equipment
CN105099898A (en) PPPOE (point-to-point protocol over Ethernet) message forwarding method and BRAS (broadband remote access server)
CN104601742A (en) Message transmission method and device
CN105450774A (en) Load balancing method and load balancing device for DNS
CN106301772A (en) Cipher set-up method, device and for arranging the device of password
Gao et al. A new algorithm with coordinated node and link mapping for virtual network embedding based on LP relaxation
CN105472025A (en) Load balancing method and device based on DNS (domain name system)
EP2517408A2 (en) Fault tolerant and scalable load distribution of resources
CN111614760A (en) Method and device for balanced distribution access of Internet of things equipment
CN118012622A (en) Heterogeneous cloud-based resource arrangement method, device and medium
CN105939344A (en) TCP (Transmission Control Protocol) connection establishing method and device
CN105376343A (en) Router address distribution method, router address distribution device and server in VPN
CN106936643B (en) Equipment linkage method and terminal equipment
CN104852986A (en) Method and device for providing newly-added function
CN104468194A (en) Network device compatible method and forwarding server
CN104994137B (en) A kind of method of network readezvous point agency
CN104168206A (en) Adapter gateway load balancing control method, device and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20201105

Address after: 318015 no.2-3167, zone a, Nonggang City, no.2388, Donghuan Avenue, Hongjia street, Jiaojiang District, Taizhou City, Zhejiang Province

Patentee after: Taizhou Jiji Intellectual Property Operation Co.,Ltd.

Address before: 201616 Shanghai city Songjiang District Sixian Road No. 3666

Patentee before: Phicomm (Shanghai) Co.,Ltd.

TR01 Transfer of patent right