[summary of the invention]
Technical problem to be solved by this invention is to provide a kind of operation method and dummy machine system of dummy machine system, to improve the convenience that user uses virtual machine.
The present invention is the operation method that technical scheme that technical solution problem adopts is to provide a kind of dummy machine system, comprising: virtual machine sends the request of renting IP address to Dynamic Host Configuration Protocol server when starting, described request comprises the MAC Address of described virtual machine; Described Dynamic Host Configuration Protocol server after receiving described request to described virtual machine distributing IP address, and determine the corresponding domain name of the MAC Address of described virtual machine according to the MAC Address preset with the mapping table between domain name, and, the IP address of described corresponding domain name and distribution is sent to dns server, and wherein said dns server is receiving described corresponding domain name and the incidence relation set up behind the IP address of distribution between described corresponding domain name and the IP address of distribution; After described Dynamic Host Configuration Protocol server confirms that described virtual machine is closed, the IP address distributed is regained, and sending notice to described dns server, wherein said dns server deletes incidence relation between described corresponding domain name and the IP address of distribution afterwards receiving described notice.
According to one of the present invention preferred embodiment, with the mapping table between domain name, the MAC Address according to presetting determines that the operation of the corresponding domain name of the MAC Address of described virtual machine specifically comprises: a. extracts the MAC Address of described virtual machine from described request; B. judge whether the MAC Address preset exists the record relevant with the MAC Address of described virtual machine to the mapping table between domain name, if so, then perform step c, otherwise perform steps d; C. the corresponding domain name of MAC Address of the domain name in described record as described virtual machine is extracted; D. be that described virtual machine distributes domain name, and using the MAC Address corresponding domain name of the domain name of distribution as described virtual machine, and, the corresponding relation between the domain name of distribution and the MAC Address of described virtual machine is recorded to described mapping table.
According to one of the present invention preferred embodiment, the corresponding domain name of MAC Address of described virtual machine is the standby another name of visiting domain name of described virtual machine.
According to one of the present invention preferred embodiment, described Dynamic Host Configuration Protocol server confirms that the operation that described virtual machine is closed specifically comprises: when described Dynamic Host Configuration Protocol server receives the closedown notice of described virtual machine transmission, confirm that described virtual machine is closed; Or, described Dynamic Host Configuration Protocol server do not receive within the time of preseting length described virtual machine to distribute IP re-rent request time, determine that described virtual machine is closed.
Present invention also offers a kind of dummy machine system, comprise virtual machine, Dynamic Host Configuration Protocol server and dns server, described virtual machine, for sending the request of renting IP address to described Dynamic Host Configuration Protocol server when starting, described request comprises the MAC Address of described virtual machine; Described Dynamic Host Configuration Protocol server, comprises memory manage unit and domain name determining unit, described memory manage unit, for after described Dynamic Host Configuration Protocol server receives described request, to described virtual machine distributing IP address; Domain name determining unit, for after described Dynamic Host Configuration Protocol server receives described request, the MAC Address according to presetting determines the corresponding domain name of the MAC Address of described virtual machine with the mapping table between domain name; Described memory manage unit, also for the IP address of described corresponding domain name and distribution is sent to described dns server; Described dns server, for receiving described corresponding domain name and the incidence relation set up behind the IP address of distribution between described corresponding domain name and the IP address of distribution; Described memory manage unit, also for after determining that described virtual machine is closed, regains the IP address distributed, and sends notice to described dns server; Described dns server, also for deleting incidence relation between described corresponding domain name and the IP address of distribution afterwards receiving described notice.
According to one of the present invention preferred embodiment, domain name determining unit comprises: extract subelement, for extracting the MAC Address of described virtual machine from described request; Judgment sub-unit, for judging whether the MAC Address preset exists the record relevant with the MAC Address of described virtual machine to the mapping table between domain name, if, then extract the MAC Address corresponding domain name of the domain name in described record as described virtual machine, otherwise be that described virtual machine distributes domain name, and using the MAC Address corresponding domain name of the domain name of distribution as described virtual machine, and, the corresponding relation between the domain name of distribution and the MAC Address of described virtual machine is recorded to described mapping table.
According to one of the present invention preferred embodiment, the corresponding domain name of MAC Address of described virtual machine is the standby another name of visiting domain name of described virtual machine.
According to one of the present invention preferred embodiment, described memory manage unit determines that the mode that described virtual machine is closed specifically comprises: when described memory manage unit receives the closedown notice of described virtual machine transmission, confirm that described virtual machine is closed; Or, described memory manage unit do not receive within the time of preseting length described virtual machine to distribute IP re-rent request time, determine that described virtual machine is closed.
As can be seen from the above technical solutions, Dynamic Host Configuration Protocol server in the present invention receive that virtual machine sends rent the request of IP address after, this virtual machine and unique domain name can be bound by the mapping table between default MAC Address and domain name, like this, no matter virtual machine activation how many times, Dynamic Host Configuration Protocol server can determine the unique domain name belonging to this virtual machine, and the IP address and this unique domain name of working as sub-distribution are sent to dns server, domain name is resolved with during the mode accesses virtual machine facilitating user with domain name by the dns server relation that is associated.By above-mentioned mode, the present invention does not need to carry out any change to the realization of virtual machine terminal, just can avoid the defect of the record when virtual machine is restarted on manual amendment's dns server, therefore, the present invention not only substantially increases the convenience that user uses virtual machine, is also conducive to transforming existing dummy machine system because having very strong universality.
[embodiment]
In order to make the object, technical solutions and advantages of the present invention clearly, describe the present invention below in conjunction with the drawings and specific embodiments.
Please refer to Fig. 1, Fig. 1 is the structural schematic block diagram of the embodiment of dummy machine system in the present invention.As shown in Figure 1, the dummy machine system in this embodiment comprises virtual machine 100, Dynamic Host Configuration Protocol server 200 and dns server 300, and virtual machine 100, Dynamic Host Configuration Protocol server 200 and dns server 300 are positioned at same local area network (LAN).
Wherein, virtual machine 100, is positioned in a physical machine, this physical machine can also be run other virtual machines of multiple stage.
Dynamic Host Configuration Protocol server 200 is one and arranges agreement (DynamicHostConfigurationProtocol, DHCP) for obtaining the server of the terminal distribution IP address of IP address in local area network (LAN) in DHCP mode according to DynamicHost.
Virtual machine 100 is pre-configured obtains IP address in the mode of DHCP when starting, like this, when virtual machine 100 starts, the request of renting IP address will be sent to Dynamic Host Configuration Protocol server, an i.e. UDP(UserDatagramProtocol) broadcast packet, containing the MAC(MediaAccessControl of virtual machine 100 in this broadcast packet) address.
Dynamic Host Configuration Protocol server 200 in the present embodiment, comprises memory manage unit 201 and domain name determining unit 202.
Wherein, memory manage unit 201, receive the lease request of virtual machine 100 transmission at Dynamic Host Configuration Protocol server 200 after, to virtual machine 100 distributing IP address.
According to DHCP agreement, can the distributable IP address range of pre-configured Dynamic Host Configuration Protocol server, form IP address pool.Like this, after the request receiving virtual machine 100 transmission, memory manage unit 201 just can extract a current unappropriated IP address assignment to virtual machine 100 from this IP address pool.
Domain name determining unit 202, receive the lease request of virtual machine 100 transmission at Dynamic Host Configuration Protocol server 200 after, according to the MAC Address corresponding domain name of the MAC Address preset with the mapping table determination virtual machine 100 between domain name.For virtual machine 100, MAC Address can its network site of unique identification, and namely no matter virtual machine 100 starts how many times, and its MAC Address all can not change.Domain name determining unit 202 will be introduced by specific embodiment later.
Memory manage unit 201, obtain the corresponding domain name of MAC Address of virtual machine 100 in domain name determining unit 202 after, also for corresponding domain name and the IP address distributed for virtual machine 100 are sent to dns server 300.
Dns server 300, behind the IP address receiving corresponding domain name that memory manage unit 201 sends and distribute for virtual machine 100, the incidence relation between the IP address setting up corresponding domain name and described distribution.The above-mentioned incidence relation that dns server 300 is set up, can be a table record, the corresponding relation between the domain name that this and dns server recording user of the prior art input and IP address be similar.
Memory manage unit 201, further also for after determining that virtual machine 100 is closed, regains the IP address distributing to virtual machine 100 before, and sends notice to dns server 300.Incidence relation between corresponding for the MAC Address of the virtual machine 100 set up before domain name and the IP address distributing to virtual machine 100, after the notice receiving memory manage unit 201 transmission, is deleted by dns server 300.
Address determination unit 201, determine that the mode that virtual machine 100 is closed specifically comprises: when memory manage unit 201 receives the closedown notice of virtual machine 100 transmission, confirm that virtual machine 100 is closed, or, memory manage unit 201 do not receive within the time of preseting length virtual machine 100 to distribute IP re-rent request time, determine that virtual machine 100 is closed.Such as, send to Dynamic Host Configuration Protocol server 200 when virtual machine 100 is normally closed and close notice, at this moment address determination unit 201 can confirm that virtual machine is closed.In addition, if virtual machine 100 is due to exception, as residing physical machine fault, or the situation such as power-off causes closing, and memory manage unit 201 just cannot receive the request of re-renting within the time of preseting length, at this moment also can confirm that virtual machine is closed.
Be introduced below by the execution mode of a specific embodiment to domain name determining unit 202.Please refer to Fig. 2, Fig. 2 is the structural schematic block diagram of an embodiment of domain name determining unit 202 in the present invention.As shown in Figure 2, in this embodiment, domain name determining unit 202 comprises: extract subelement 2021, judgment sub-unit 2022.
Wherein, extract subelement 2021, from the lease request received, extract the MAC Address of virtual machine 100.As elucidated before, virtual machine 100 send request be a UDP(UserDatagramProtocol) broadcast packet, MAC(MediaAccessControl containing virtual machine 100 in this broadcast packet) address, therefore, the MAC Address that subelement 2021 can extract virtual machine 100 from this request is extracted.
Judgment sub-unit 2022, judge whether there is the record relevant with the MAC Address of virtual machine 100 in the mapping table between MAC Address to domain name, if, then extract the MAC Address corresponding domain name of the domain name in the record relevant to the MAC Address of virtual machine 100 as virtual machine 100, otherwise distribute domain name for virtual machine 100, and using the MAC Address corresponding domain name of the domain name of distribution as virtual machine 100, and, the corresponding relation between the domain name of distribution and the MAC Address of virtual machine is recorded in mapping table.
Refer to table 1, table 1 is the schematic construction of the embodiment of mapping table in the present invention between MAC Address and domain name.
Table 1
MAC Address |
Corresponding domain name |
00:12:34:56:78:90 |
001234567890.x.ec2.ctyun.cn |
00:12:34:56:78:91 |
001234567891.x.ec2.ctyun.cn |
00:12:34:56:78:92 |
001234567892.x.ec2.ctyun.cn |
00:12:34:56:78:93 |
001234567893.x.ec2.ctyun.cn |
As a kind of execution mode, default mapping table can be an empty table.During virtual machine 100 initiating switchup, due to record not relevant to the MAC Address of virtual machine 100 in mapping table, therefore judgment sub-unit 2022 will distribute a domain name (such as structure such as corresponding domain in table 1 ranks shown domain name) for virtual machine 100, and the corresponding relation of the MAC Address of the domain name of distribution and virtual machine 100 is recorded in mapping table, like this, when virtual machine 100 is restarted and applies for renting address next time, judgment sub-unit 2022 just can find the record relevant to the MAC Address of virtual machine 100 from mapping table.
Judgment sub-unit is the domain name that virtual machine 100 distributes, and can be any form of the composition, can be that in table 1, corresponding domain ranks shown form, can be also other forms, the present invention limit this.Suppose that the MAC Address of virtual machine 100 is " 00:12:34:56:78:90 " in table 1, its corresponding domain is called " 001234567890.x.ec2.ctyun.cn ", then after virtual machine 100 starts at every turn, user can be conducted interviews to virtual machine 100 by " 001234567890.x.ec2.ctyun.cn ", but, if user does not wish to be conducted interviews to virtual machine 100 by " 001234567890.x.ec2.ctyun.cn " this domain name, but visit domain name by the standby of oneself setting, such as " www.sohu.com " conducts interviews to virtual machine 100, he can in the dns server of public network, " 001234567890.x.ec2.ctyun.cn " is registered as the standby another name of visiting domain name " www.sohu.com " of oneself setting.Like this, input " www.sohu.com " in the run duration of user no matter after which time of virtual machine 100 starts, can normally accesses virtual machine 100, and do not need as prior art, after virtual machine 100 starts at every turn, all need the corresponding relation between manual amendment's domain name and IP address on dns server 300.
As another kind of execution mode, default mapping table also can be the standby mapping table of visiting between domain name belonging to this virtual machine that the MAC Address of the virtual machine configured and user set.Please refer to table 2, table 2 is schematic construction of another embodiment of mapping table.
MAC Address |
Corresponding domain name |
00:12:34:56:78:90 |
www.sina.com |
00:12:34:56:78:91 |
www.baidu.com |
00:12:34:56:78:92 |
www.sohu.com |
00:12:34:56:78:93 |
www.163.com |
According to this mode, user does not need to carry out any setting in the dns server of public network.To the lease Fang Eryan of virtual machine business, only need to provide a configuration interface to be configured standby domain name of visiting before use to using the user of virtual machine business, just can meet the follow-up user demand of user, no matter user is follow-up restarts how many times to virtual machine, does not need to change any setting and standby domain name of visiting just can be used to conduct interviews.
Above the realization of the dummy machine system shown in Fig. 1 is introduced.Be described below by the process of an embodiment to user's accesses virtual machine 100.
What suppose virtual machine 100 is " www.sohu.com " for visiting domain name, the structure of mapping table is as shown in table 1, when user sends access request with the domain name of " www.sohu.com " in a network, at the dns server place of public network, can learn that " www.sohu.com " is the another name of " 001234567890.x.ec2.ctyun.cn ", the analysis request to this alias will be sent.According to the principle of dns resolution, when the dns server of current level cannot be resolved, can to upper level dns server request analysis, until find the IP address in " 001234567890.x.ec2.ctyun.cn " relative recording on dns server 300, so just the access request of user can be issued virtual machine 100 according to the IP address found, thus realize the access to virtual machine 100.But if when user sends the access request to virtual machine 100, virtual machine 100 is in closed condition, at this moment just cannot find relative recording on dns server 300, therefore user just cannot realize the access to virtual machine 100.
Can find out, use method of the present invention, the tenant of virtual machine service can according to oneself need freely open or close virtual machine.When tenant is wanted to use virtual machine externally to carry out Internet service, open virtual machine just to respond the request of calling party, otherwise closedown virtual machine, just can stop external response, this tenant carrying out website test service for use virtual machine is very useful.
Please refer to Fig. 3, Fig. 3 is the schematic flow sheet of the embodiment of the operation method of virtual machine in the present invention.As shown in Figure 3, this embodiment comprises:
Step S401: virtual machine sends the request of renting IP address to Dynamic Host Configuration Protocol server when starting, described request comprises the MAC Address of described virtual machine;
Step S402: described Dynamic Host Configuration Protocol server after receiving described request to described virtual machine distributing IP address, and determine the corresponding domain name of the MAC Address of described virtual machine according to the MAC Address preset with the mapping table between domain name, and, the IP address of described corresponding domain name and distribution is sent to dns server, and wherein said dns server is receiving described corresponding domain name and the incidence relation set up behind the IP address of distribution between described corresponding domain name and the IP address of distribution.
Step S403: after described Dynamic Host Configuration Protocol server confirms that described virtual machine is closed, the IP address distributed is regained, and sending notice to described dns server, wherein said dns server deletes incidence relation between described corresponding domain name and the IP address of distribution afterwards receiving described notice.
According to an embodiment, in step S402, with the mapping table between domain name, the MAC Address according to presetting determines that the operation of the corresponding domain name of the MAC Address of described virtual machine specifically comprises:
S4021: the MAC Address extracting described virtual machine from described request;
S4022: judge whether the MAC Address preset exists the record relevant with the MAC Address of described virtual machine to the mapping table between domain name, if so, then performs step S4023, otherwise performs step S4024;
S4023: extract the MAC Address corresponding domain name of the domain name in described record as described virtual machine;
S4024: for described virtual machine distributes domain name, and using the MAC Address corresponding domain name of the domain name of distribution as described virtual machine, and, the corresponding relation between the domain name of distribution and the MAC Address of described virtual machine is recorded to described mapping table.
According to an embodiment, the corresponding domain name of MAC Address of described virtual machine is the standby another name of visiting domain name of described virtual machine.
According to an embodiment, in step S403, described Dynamic Host Configuration Protocol server confirms that the operation that described virtual machine is closed specifically comprises: when described Dynamic Host Configuration Protocol server receives the closedown notice of described virtual machine transmission, confirm that described virtual machine is closed, or, described Dynamic Host Configuration Protocol server do not receive within the time of preseting length described virtual machine to distribute IP re-rent request time, determine that described virtual machine is closed.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment made, equivalent replacement, improvement etc., all should be included within the scope of protection of the invention.