CN109151093A - A kind of method, apparatus, storage medium and computer equipment for distributing IP address - Google Patents
A kind of method, apparatus, storage medium and computer equipment for distributing IP address Download PDFInfo
- Publication number
- CN109151093A CN109151093A CN201811241573.8A CN201811241573A CN109151093A CN 109151093 A CN109151093 A CN 109151093A CN 201811241573 A CN201811241573 A CN 201811241573A CN 109151093 A CN109151093 A CN 109151093A
- Authority
- CN
- China
- Prior art keywords
- address
- allocated
- distributed
- broadcasting packet
- judging result
- 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.)
- Withdrawn
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5007—Internet protocol [IP] addresses
- H04L61/5014—Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/10—Mapping addresses of different types
- H04L61/103—Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5046—Resolving address allocation conflicts; Testing of addresses
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a kind of method, apparatus, storage medium and computer equipments for distributing IP address, can be avoided the existing IP address of distribution.The described method includes: after receiving the IP address request message of virtual machine, sent to all virtual machines include IP address to be allocated broadcasting packet, judge whether the IP address to be allocated has distributed;It when judging result is to have distributed, retransmits the broadcasting packet comprising new IP address to be allocated and judges whether the new IP address to be allocated has distributed, until judging result is unallocated;It is that unappropriated IP address distributes to the virtual machine by the judging result.Using the embodiment of the present invention, the DHCP method for avoiding distribution from occupying IP address is realized under virtualized environment, and DHCP distribution is avoided to occupy suspension failure caused by IP conflicts.
Description
Technical field
The present invention relates to computer technology, espespecially a kind of method, apparatus, storage medium and computer for distributing IP address is set
It is standby.
Background technique
Under virtualized environment, the IP address of virtual machine is manual static configuration a bit, some are by dynamic DHCP
It obtains, if virtual machine is got by DHCP mode when having occupied IP, IP conflict will be generated, lead to the virtual machine
Network is obstructed, causes network failure.
Summary of the invention
In order to solve the above-mentioned technical problems, the present invention provides it is a kind of distribute the method, apparatus of IP address, storage medium and
Computer equipment can be avoided the existing IP address of distribution.
In order to reach the object of the invention, the present invention provides a kind of methods for distributing IP address, which comprises
After the IP address request message for receiving virtual machine, sent to all virtual machines wide comprising IP address to be allocated
Casting text, judges whether the IP address to be allocated has distributed;
When judging result is to have distributed, retransmits the broadcasting packet comprising new IP address to be allocated and judge institute
State whether new IP address to be allocated has distributed, until judging result is unallocated;
It is that unappropriated IP address distributes to the virtual machine by the judging result.
It is described to judge whether the IP address to be allocated has distributed in a kind of exemplary embodiment, comprising:
Whether there is back message to judge the IP to be allocated according to the broadcasting packet comprising IP address to be allocated
Whether address has been distributed.
In a kind of exemplary embodiment, wherein the broadcasting packet is free Address Resolution Protocol ARP broadcasting packet;
The back message is Address Resolution Protocol ARP back message.
In a kind of exemplary embodiment, the IP address to be allocated is from preset comprising IP address to be allocated
It is obtained in address pool.
In order to reach the object of the invention, the present invention also provides a kind of device for distributing IP address, described device includes sentencing
Disconnected module retransmits module and distribution module, including:
The judgment module after the IP address request message for receiving virtual machine, includes to the transmission of all virtual machines
The broadcasting packet of IP address to be allocated, judges whether the IP address to be allocated has distributed;
The retransmission module, for retransmitting comprising new IP to be allocated when judging result is to have distributed
The broadcasting packet of address simultaneously judges whether the new IP address to be allocated has distributed, until judging result is unallocated;
The distribution module, for being that unappropriated IP address distributes to the virtual machine by the judging result.
In a kind of exemplary embodiment, the judgment module judges whether the IP address to be allocated has distributed, packet
It includes:
Whether the judgment module has back message to judge institute according to the broadcasting packet comprising IP address to be allocated
State whether IP address to be allocated has distributed.
In a kind of exemplary embodiment, wherein the broadcasting packet is free Address Resolution Protocol ARP broadcasting packet;
The back message is Address Resolution Protocol ARP back message.
In a kind of exemplary embodiment, the IP address to be allocated is from preset comprising IP address to be allocated
It is obtained in address pool.
In order to reach the object of the invention, the present invention also provides a kind of computer readable storage mediums, are stored thereon with meter
Calculation machine program, when which is executed by processor the step of the realization above method.
In order to reach the object of the invention, the present invention also provides a kind of computer equipment, including memory, processor and
The computer program that can be run on a memory and on a processor is stored, the processor is realized above-mentioned when executing described program
Step in method.
Compared with prior art, after the present invention includes the IP address request message for receiving virtual machine, to all virtual machines
The broadcasting packet comprising IP address to be allocated is sent, judges whether the IP address to be allocated has distributed;Work as judging result
When to have distributed, the broadcasting packet comprising new IP address to be allocated is retransmitted and with judging the new IP to be allocated
Whether location has been distributed, until judging result is unallocated;It is that unappropriated IP address distributes to the void by the judging result
Quasi- machine.The DHCP method for avoiding distribution from occupying IP address is realized under virtualized environment, and DHCP distribution is avoided to occupy IP punching
Suspension failure caused by prominent.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification
It obtains it is clear that understand through the implementation of the invention.The objectives and other advantages of the invention can be by specification, right
Specifically noted structure is achieved and obtained in claim and attached drawing.
Detailed description of the invention
Attached drawing is used to provide to further understand technical solution of the present invention, and constitutes part of specification, with this
The embodiment of application technical solution for explaining the present invention together, does not constitute the limitation to technical solution of the present invention.
Fig. 1 is the flow chart of the method for the distribution IP address of the embodiment of the present invention one;
Fig. 2 is another flow chart of the method for the distribution IP address of the embodiment of the present invention two;
Fig. 3 is the structural schematic diagram of the device of the distribution IP address of the embodiment of the present invention three;
Fig. 4 is the structural schematic diagram of the computer equipment of the embodiment of the present invention three.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention
Embodiment be described in detail.It should be noted that in the absence of conflict, in the embodiment and embodiment in the application
Feature can mutual any combination.
Step shown in the flowchart of the accompanying drawings can be in a computer system such as a set of computer executable instructions
It executes.Also, although logical order is shown in flow charts, and it in some cases, can be to be different from herein suitable
Sequence executes shown or described step.
Embodiment one
A kind of method for distributing IP address is present embodiments provided, as shown in Figure 1, this method includes S11-S13:
S11, after receiving the IP address request message of virtual machine, sending to all virtual machines includes IP address to be allocated
Broadcasting packet, judge whether IP address to be allocated has distributed;
S12, when judging result is to have distributed, retransmit the broadcasting packet comprising new IP address to be allocated and simultaneously sentence
Whether new IP address to be allocated of breaking has distributed, until judging result is unallocated;
It S13, is that unappropriated IP address distributes to virtual machine by judging result.
The DHCP method for avoiding distribution from occupying IP address is realized under virtualized environment, and DHCP distribution is avoided to occupy IP
Suspension failure caused by conflicting.
In a kind of exemplary embodiment, judge whether IP address to be allocated has distributed, comprising:
Whether have whether back message judges IP address to be allocated according to the broadcasting packet comprising IP address to be allocated
It has distributed.
When not receiving back message in preset time, judging result is unallocated;When receiving back message, sentence
Disconnected result is to have distributed.
In a kind of exemplary embodiment, all virtual machines are the void that a VLAN is belonged to the virtual machine of IP address requesting
Quasi- machine.Address requests message can be DHCP DISCOVER request message.
In a kind of exemplary embodiment, wherein broadcasting packet is free Address Resolution Protocol ARP broadcasting packet;It responds
Message is Address Resolution Protocol ARP back message.
In a kind of exemplary embodiment, IP address to be allocated is from the preset address comprising IP address to be allocated
It is obtained in pond.
In the embodiment of the present invention, after the IP address request message for receiving virtual machine, to all virtual machines send comprising to
The broadcasting packet of the IP address of distribution, judges whether the IP address to be allocated has distributed;When judging result is to have distributed,
It retransmits the broadcasting packet comprising new IP address to be allocated and judges whether the new IP address to be allocated has divided
Match, until judging result is unallocated;It is that unappropriated IP address distributes to the virtual machine by the judging result.Virtual
Change the DHCP method realized under environment and distribution is avoided to occupy IP address, DHCP distribution is avoided to occupy suspension caused by IP conflicts
Failure.
Embodiment two
Above-described embodiment method is specifically described in the present embodiment, as shown in Fig. 2, two virtual machines belong to it is identical
VLAN, wherein the IP configuration of virtual machine 1 is dynamic acquisition IP, and the IP configuration of virtual machine 2 is static IP, which is
192.168.1.20.Dynamic Host Configuration Protocol server is communicated by virtual switch OVS with the two virtual machines.The present embodiment is in virtualization ring
Under border, Dynamic Host Configuration Protocol server detects whether there is the IP address to be distributed by sending gratuitous ARP, if there is no the IP to be distributed
The IP is just distributed to virtual machine and used by address, Dynamic Host Configuration Protocol server.Implementation process the following steps are included:
(1) Dynamic Host Configuration Protocol server receives the DHCP DISCOVER request message of the sending of virtual machine 1.
(2) before distributing IP to virtual machine 1, Dynamic Host Configuration Protocol server detects the IP address to be distributed, and Dynamic Host Configuration Protocol server is sent
One Target IP is the gratuitous ARP broadcasting packet of 192.168.1.20, which can be transferred to virtual machine 1 by virtual switch
With virtual machine 2, Dynamic Host Configuration Protocol server waits 3 seconds to receive ARP back message.
(3) it since virtual machine 1 does not have IP address, is given a response so will not broadcast this gratuitous ARP.Due to virtual machine
2 IP is 192.168.1.20, and the Target IP of this gratuitous ARP broadcasting packet is 192.168.1.20, so virtual machine 2 returns
This gratuitous ARP is answered to broadcast.
(4) Dynamic Host Configuration Protocol server receives the ARP back message of virtual machine 2, illustrates that this IP192.168.1.20 is empty
Quasi- machine occupies, and Dynamic Host Configuration Protocol server marks the IP that wouldn't can be used, and Dynamic Host Configuration Protocol server selects next to be distributed in dhcp address pool
IP address, such as 192.168.1.100 sends the gratuitous ARP broadcasting packet that Target IP is 192.168.1.100 again.
(5) Dynamic Host Configuration Protocol server waits 3 seconds, due to virtual machine 1 and virtual machine 2 all without occupy 192.168.1.100 this
IP, so not having ARP response, this IP 192.168.1.100 is just distributed to virtual machine by Dynamic Host Configuration Protocol server after 3 seconds time-out
1。
The function of increasing detection IP in Dynamic Host Configuration Protocol server detects whether there is the IP to be distributed by sending gratuitous ARP
Address, if there is no the IP address to be distributed, which is just distributed to virtual machine and used by Dynamic Host Configuration Protocol server.
Embodiment three
A kind of device for distributing IP address is present embodiments provided, description is also applied for this implementation in above method embodiment
In example, as shown in figure 3, the device includes judgment module 31, retransmits module 32 and distribution module 33, including:
Judgment module 31, after the IP address request message for receiving virtual machine, to all virtual machines send comprising to
The broadcasting packet of the IP address of distribution, judges whether IP address to be allocated has distributed;
Module 32 is retransmitted, for retransmitting comprising new IP to be allocated when judging result is to have distributed
The broadcasting packet of location simultaneously judges whether new IP address to be allocated has distributed, until judging result is unallocated;
Distribution module 33, for being that unappropriated IP address distributes to virtual machine by judging result.
In a kind of exemplary embodiment, judgment module 31 judges whether IP address to be allocated has distributed, comprising:
It is to be allocated whether judgment module 31 according to the broadcasting packet comprising IP address to be allocated has back message to judge
Whether IP address has distributed.
In a kind of exemplary embodiment, wherein broadcasting packet is free Address Resolution Protocol ARP broadcasting packet;It responds
Message is Address Resolution Protocol ARP back message.
In a kind of exemplary embodiment, IP address to be allocated is from the preset address comprising IP address to be allocated
It is obtained in pond.
The embodiment of the present invention also provides a kind of computer storage medium, and the computer storage medium is stored with computer journey
Sequence;After the computer program is performed, the method that the distribution IP address of previous embodiment offer is provided, for example, executing
Method as shown in Figure 1.
The embodiment of the present invention also provides a kind of computer equipment, can be structure as shown in Figure 4, including processor
41, memory 42 and storage on a memory and the computer program that can run on a processor, processor execution institute
Part or Overall Steps in embodiment one or embodiment two can be realized when stating program.
It will appreciated by the skilled person that whole or certain steps, system, dress in method disclosed hereinabove
Functional module/unit in setting may be implemented as software, firmware, hardware and its combination appropriate.In hardware embodiment,
Division between the functional module/unit referred in the above description not necessarily corresponds to the division of physical assemblies;For example, one
Physical assemblies can have multiple functions or a function or step and can be executed by several physical assemblies cooperations.Certain groups
Part or all components may be implemented as by processor, such as the software that digital signal processor or microprocessor execute, or by
It is embodied as hardware, or is implemented as integrated circuit, such as specific integrated circuit.Such software can be distributed in computer-readable
On medium, computer-readable medium may include computer storage medium (or non-transitory medium) and communication media (or temporarily
Property medium).As known to a person of ordinary skill in the art, term computer storage medium is included in for storing information (such as
Computer readable instructions, data structure, program module or other data) any method or technique in the volatibility implemented and non-
Volatibility, removable and nonremovable medium.Computer storage medium include but is not limited to RAM, ROM, EEPROM, flash memory or its
His memory technology, CD-ROM, digital versatile disc (DVD) or other optical disc storages, magnetic holder, tape, disk storage or other
Magnetic memory apparatus or any other medium that can be used for storing desired information and can be accessed by a computer.This
Outside, known to a person of ordinary skill in the art to be, communication media generally comprises computer readable instructions, data structure, program mould
Other data in the modulated data signal of block or such as carrier wave or other transmission mechanisms etc, and may include any information
Delivery media.
Claims (10)
1. a kind of method for distributing IP address, which is characterized in that the described method includes:
After the IP address request message for receiving virtual machine, the broadcast report comprising IP address to be allocated is sent to all virtual machines
Text, judges whether the IP address to be allocated has distributed;
When judging result is to have distributed, retransmits the broadcasting packet comprising new IP address to be allocated and judge described new
IP address to be allocated whether distributed, until judging result be it is unallocated;
It is that unappropriated IP address distributes to the virtual machine by the judging result.
2. judging whether the IP address to be allocated has divided the method according to claim 1, wherein described
Match, comprising:
Whether there is back message to judge the IP address to be allocated according to the broadcasting packet comprising IP address to be allocated
Whether distribute.
3. according to the method described in claim 2, it is characterized in that, wherein, the broadcasting packet is free address resolution protocol
ARP broadcasting packet;The back message is Address Resolution Protocol ARP back message.
4. the method according to claim 1, wherein the IP address to be allocated is from preset comprising wait divide
It is obtained in the address pool for the IP address matched.
5. a kind of device for distributing IP address, which is characterized in that described device includes judgment module, retransmits module and distribution
Module, including:
The judgment module, after the IP address request message for receiving virtual machine, to all virtual machines send comprising to point
The broadcasting packet for the IP address matched, judges whether the IP address to be allocated has distributed;
The retransmission module, for retransmitting comprising new IP address to be allocated when judging result is to have distributed
Broadcasting packet and judge whether the new IP address to be allocated has distributed, until judging result is unallocated;
The distribution module, for being that unappropriated IP address distributes to the virtual machine by the judging result.
6. device according to claim 5, which is characterized in that the judgment module judges that the IP address to be allocated is
It is no to have distributed, comprising:
The judgment module according to the broadcasting packet comprising IP address to be allocated whether have back message judgement it is described to
Whether the IP address of distribution has distributed.
7. device according to claim 6, which is characterized in that wherein, the broadcasting packet is free address resolution protocol
ARP broadcasting packet;The back message is Address Resolution Protocol ARP back message.
8. device according to claim 5, which is characterized in that the IP address to be allocated is from preset comprising wait divide
It is obtained in the address pool for the IP address matched.
9. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is held by processor
The step of any one of claim 1-4 the method is realized when row.
10. a kind of computer equipment, can run on a memory and on a processor including memory, processor and storage
Computer program, which is characterized in that realize that any one of claim 1-4 right such as is wanted when the processor executes described program
Seek the step in the method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811241573.8A CN109151093A (en) | 2018-10-24 | 2018-10-24 | A kind of method, apparatus, storage medium and computer equipment for distributing IP address |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811241573.8A CN109151093A (en) | 2018-10-24 | 2018-10-24 | A kind of method, apparatus, storage medium and computer equipment for distributing IP address |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109151093A true CN109151093A (en) | 2019-01-04 |
Family
ID=64809388
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811241573.8A Withdrawn CN109151093A (en) | 2018-10-24 | 2018-10-24 | A kind of method, apparatus, storage medium and computer equipment for distributing IP address |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109151093A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114301876A (en) * | 2021-12-23 | 2022-04-08 | 深圳创维数字技术有限公司 | Address allocation method, system, device and computer readable storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103957288A (en) * | 2014-04-28 | 2014-07-30 | 福建星网锐捷网络有限公司 | Method, device and equipment for IP address dynamic allocation |
US20140359136A1 (en) * | 2012-06-28 | 2014-12-04 | Alcatel-Lucent | Subnet prioritization for ip address allocation from a dhcp server |
CN104378455A (en) * | 2014-11-13 | 2015-02-25 | 杭州华三通信技术有限公司 | IP address distribution method and device |
CN107332945A (en) * | 2017-07-02 | 2017-11-07 | 郑州云海信息技术有限公司 | A kind of virtual machine IP address acquisition methods and device |
CN107707687A (en) * | 2017-10-10 | 2018-02-16 | 郑州云海信息技术有限公司 | A kind of method and apparatus of virtual machine IP address configuration |
CN108667957A (en) * | 2018-05-21 | 2018-10-16 | 联想(北京)有限公司 | IP address distribution method, the first electronic equipment and first server |
-
2018
- 2018-10-24 CN CN201811241573.8A patent/CN109151093A/en not_active Withdrawn
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140359136A1 (en) * | 2012-06-28 | 2014-12-04 | Alcatel-Lucent | Subnet prioritization for ip address allocation from a dhcp server |
CN103957288A (en) * | 2014-04-28 | 2014-07-30 | 福建星网锐捷网络有限公司 | Method, device and equipment for IP address dynamic allocation |
CN104378455A (en) * | 2014-11-13 | 2015-02-25 | 杭州华三通信技术有限公司 | IP address distribution method and device |
CN107332945A (en) * | 2017-07-02 | 2017-11-07 | 郑州云海信息技术有限公司 | A kind of virtual machine IP address acquisition methods and device |
CN107707687A (en) * | 2017-10-10 | 2018-02-16 | 郑州云海信息技术有限公司 | A kind of method and apparatus of virtual machine IP address configuration |
CN108667957A (en) * | 2018-05-21 | 2018-10-16 | 联想(北京)有限公司 | IP address distribution method, the first electronic equipment and first server |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
---|---|---|
US10187459B2 (en) | Distributed load balancing system, health check method, and service node | |
US10819538B2 (en) | Method and apparatus for establishing link between virtualized network functions | |
CN108307002B (en) | DHCP message processing method and device | |
EP2731010A1 (en) | Method, device, and system for migrating configuration information during live migration of virtual machine | |
US9479611B2 (en) | Method, device, and system for implementing communication after virtual machine migration | |
CN103618621B (en) | A kind of software defined network SDN method of automatic configuration, equipment and system | |
US9026625B2 (en) | System and method of MAC address assignment using dynamic MAC address protocol | |
CN106878480B (en) | DHCP service process sharing method and device | |
CN102281333A (en) | Method and system for avoiding IP address conflict, DHCP server and DHCP client | |
CN103001868A (en) | Method and device used for synchronous ARP (Address Resolution Protocol) list item of virtual router redundancy protocol backup set | |
US20190079896A1 (en) | Virtualizing connection management for virtual remote direct memory access (rdma) devices | |
CN104468869A (en) | Method for allocating IP addresses to terminals and method and device for obtaining IP addresses | |
EP4050475B1 (en) | Image forming apparatus, method, and system for firmware upgrade | |
WO2022111113A1 (en) | Frequency channel switching method, terminal, base station, and storage medium | |
US11005706B2 (en) | Method for configuring forwarding table for user equipment, apparatus, and system | |
CN114124812A (en) | Method and device for maintaining consistency of table items and electronic equipment | |
CN109151093A (en) | A kind of method, apparatus, storage medium and computer equipment for distributing IP address | |
CN110019475B (en) | Data persistence processing method, device and system | |
CN107547674B (en) | Address allocation method and device | |
CN109428824B (en) | Host topology generation method and system | |
CN106302075B (en) | A kind of method and device creating logical volume | |
CN111064819B (en) | Address backup method and device | |
CN103442098A (en) | Method, system and server for allocating virtual IP addresses | |
CN104580547A (en) | IP (internet protocol) configuration method and device for Linux operation system | |
CN114448941A (en) | Network equipment management method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20190104 |
|
WW01 | Invention patent application withdrawn after publication |