Summary of the invention
The object of the present invention is to provide a kind of virtual network and its implementation, thus solve the foregoing problems existed in prior art.
To achieve these goals, the technical solution used in the present invention is as follows:
A kind of virtual network, comprising: server, described server comprises virtual machine, virtual switch and virtual gateway; Described virtual machine is communicated with described virtual switch, and described virtual switch is communicated with described virtual gateway; Described virtual switch in multiple described server is interconnected; Described virtual switch can know the MAC Address of the described virtual gateway that described virtual machine sends, and can forbid the MAC Address forwarding the described virtual gateway that described virtual machine sends on the link of TCP connection.
Further, the described virtual machine in each described server is multiple.
Further, described virtual machine is present in different physical addresss.
The implementation method of above-mentioned virtual network, comprises the steps:
S1, creates virtual switch, and indicates the bundling port of described virtual switch; Described virtual switch can know the MAC Address of the described virtual gateway that described virtual machine sends, and can forbid the MAC Address forwarding the described virtual gateway that described virtual machine sends on the link of TCP connection;
S2, creates virtual gateway, configures the described virtual switch that described virtual gateway is connected to;
S3, is communicated with virtual machine with described virtual switch, creates single server virtual network;
S4, repeats step S1-S3, creates multiple described single server virtual network;
S5, the described virtual switch in multiple described single server virtual network is interconnected.
Further, step S1 also comprises, and configures the name of described virtual switch and the management interface of described virtual switch.
Particularly, step S1 adopts and implements with the following method: action command #vde_switch – s/tmp/switch1 – M/tmp/switch1/mgmt; Wherein ,/tmp/switch1 is the name of described virtual switch; / tmp/switch1/mgmt is the management interface of described virtual switch.
Particularly, in step S1, described in indicate the bundling port of described virtual switch, adopt and implement with the following method: action command #vde_switch – s/tmp/switch1 – M/tmp/switch1/mgmt – P20500; Wherein ,/tmp/switch1 is the name of the described virtual switch that described virtual gateway connects; / tmp/switch1/mgmt is the management interface of described virtual switch;-P option is used for the bundling port of described virtual switch.
Further, step S2 also comprises, and opens DHCP service that described virtual gateway provides, IP address resource pond size and IP address.
Particularly, step S2 adopts and implements with the following method: action command #slirpvde – s/tmp/switch1 – D – s192.168.1.28 – e192.168.1.49-n192.168.1.1; Wherein ,/tmp/switch1 is the name of the described virtual switch that described virtual gateway connects;-D option is for opening the DHCP service of described virtual gateway;-s is used to specify the initial distributing IP address of described DHCP service;-e is used to specify the termination distributing IP address of described virtual gateway;-n is used to specify the IP address of described virtual gateway.
Particularly, in step S5, the described virtual switch in described multiple described single server virtual network is interconnected, adopts and implements with the following method: action command #vdeterm/tmp/switch1/mgmt " conn175.10.2.79:20500 "; Wherein ,/tmp/switch1/mgmt is the management interface of described virtual switch.
The invention has the beneficial effects as follows: the virtual network that the embodiment of the present invention provides and its implementation, for multiple server, a virtual gateway is all set on each server, the virtual machine on book server is made to access outer net by the virtual gateway on book server, therefore, the live load of the virtual gateway on each server can not be very large, and the occupied resource of each server also can not be very large, thus can not affect the normal use of each server.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearly understand, below in conjunction with accompanying drawing, the present invention is further elaborated.Should be appreciated that embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
As shown in Figure 2, a kind of virtual network that the embodiment of the present invention provides, comprising: server, described server comprises virtual machine, virtual switch and virtual gateway; Described virtual machine is communicated with described virtual switch, and described virtual switch is communicated with described virtual gateway; Described virtual switch in multiple described server is interconnected; Described virtual switch can know the MAC Address of the described virtual gateway that described virtual machine sends, and can forbid the MAC Address forwarding the described virtual gateway that described virtual machine sends on the link of TCP connection.
In the present invention, in order to make the virtual machine on each server can by the virtual switch accesses outer net that book server is arranged, need to improve existing virtual switch, make virtual switch can not only know the MAC Address of the described virtual gateway that described virtual machine sends, and the MAC Address forwarding the described virtual gateway that described virtual machine sends on the link of TCP connection can be forbidden, virtual switch only in this way, when receiving the MAC Address request of the access book server virtual gateway that virtual machine sends, just can be forwarded in the virtual gateway of corresponding MAC Address, virtual machine is successfully connected to the virtual gateway of book server, by this virtual gateway access outer net.
Simultaneously, in the embodiment of the present invention, virtual machine in each server is except accessing except outer net by the virtual gateway in book server, the virtual switch of another server can also be connected to by TCP link by the virtual switch in book server, interconnected between the virtual switch realizing each server, and then interconnected between the virtual machine realizing each server.
Particularly, realize interconnected between each virtual machine in each server of virtual network in the following way: virtual machine virtual broadcast ARP is to obtain the IP address of virtual gateway, then the virtual gateway of book server can reply its MAC Address, virtual switch identifying purpose MAC Address is broadcast address, be then forwarded to the virtual switch of other servers from TCP link.Virtual gateway on other servers also can reply the identical MAC Address of replying with book server.Virtual gateway on Servers-all all adopts identical MAC Address, and virtual machine internal would not conflict.
Like this, the virtual network that the embodiment of the present invention provides, what not only achieve in network is interconnected, also achieves being communicated with by the virtual gateway on book server and outer net.
Compared with virtual network of the prior art, in the virtual network that the embodiment of the present invention provides, comprise multiple server, virtual machine in each server can by the virtual gateway access outer net arranged in book server, and do not need to be communicated to by virtual switch more other to be provided with on the server of virtual gateway, jointly use a virtual gateway with the virtual machine in other multiple servers.Therefore, use the virtual network that the embodiment of the present invention provides, the load pressure of virtual gateway can be smaller, and virtual gateway can control for the bandwidth of each virtual machine on the server of place simultaneously, expands other function etc.Owing to being provided with a virtual gateway in each server in virtual network, so the occupied resource of each server is all smaller, do not have which server because being provided with virtual gateway occupied a large amount of resource, thus cause normal use to be affected.
As one of ordinary skill will be appreciated, during the virtual network access outer net that the embodiment of the present invention provides, the virtual gateway of each server, by the network interface card of server, is communicated to physical switches, physical switches is communicated to physical gateway, by this physical gateway access outer net.
In addition, the virtual network that the embodiment of the present invention provides, also comprise network management proxy, by providing the api interface of supervising the network, dock with desktop cloud system, thus the order that virtual network can be issued according to the desktop cloud system server of specifying in this virtual network runs the virtual network that mentioned order creates single server, i.e. local network, the parameter in order such as port, dhcp address pool etc. have desktop cloud system dynamic management.
In one embodiment of the invention, the described virtual machine in each described server is multiple.Virtual machine is supplied to tenant, and hardware resource and the Internet resources of virtual machine internal are dynamically allocated to tenant, and the virtual machine number in server is more, and tenant's number that can supply will be more.
More preferably, described virtual machine is present in different physical addresss.Different from the physical machine in physical network, in same local area network (LAN), physical machine is in phase same network segment, and the virtual machine in the virtual network that the embodiment of the present invention provides, different physical addresss can be in, thus realize the free networking of virtual machine and the establishment of distributed network.
As shown in Figure 3, the implementation method of the above-mentioned virtual network that the embodiment of the present invention provides, comprises the steps:
S1, creates virtual switch, and indicates the bundling port of described virtual switch; Described virtual switch can know the MAC Address of the described virtual gateway that described virtual machine sends, and can forbid the MAC Address forwarding the described virtual gateway that described virtual machine sends on the link of TCP connection;
S2, creates virtual gateway, configures the described virtual switch that described virtual gateway is connected to;
S3, is communicated with virtual machine with described virtual switch, creates single server virtual network;
S4, repeats step S1-S3, creates multiple described single server virtual network;
S5, the described virtual switch in multiple described single server virtual network is interconnected.
In the present invention, in order to make the virtual machine on each server can by the virtual switch accesses outer net that book server is arranged, need to improve existing virtual switch, make virtual switch can not only know the MAC Address of the described virtual gateway that described virtual machine sends, and the MAC Address forwarding the described virtual gateway that described virtual machine sends on the link of TCP connection can be forbidden, virtual switch only in this way, when receiving the MAC Address request of the access book server virtual gateway that virtual machine sends, just can be forwarded in the virtual gateway of corresponding MAC Address, virtual machine is successfully connected to the virtual gateway of book server, by this virtual gateway access outer net.
Wherein, step S1 can also comprise, and configures the name of described virtual switch and the management interface of described virtual switch.In the embodiment of the present invention, can adopt and implement with the following method: action command #vde_switch – s/tmp/switch1 – M/tmp/switch1/mgmt; Wherein ,/tmp/switch1 is the name of described virtual switch; / tmp/switch1/mgmt is the management interface of described virtual switch.
In step S1, need the bundling port indicating described virtual switch, the virtual switch on book server can be connected by TCP link with the virtual switch on other servers.In the embodiment of the present invention, the bundling port indicating described virtual switch with the following method can be adopted: action command #vde_switch – s/tmp/switch1 – M/tmp/switch1/mgmt – P20500; Wherein ,/tmp/switch1 is the name of the described virtual switch that described virtual gateway connects; / tmp/switch1/mgmt is the management interface of described virtual switch;-P option is used for the bundling port of described virtual switch.
Step S2 can also comprise, and opens DHCP service that described virtual gateway provides, IP address resource pond size and IP address.In the embodiment of the present invention, step S2 can adopt and implement with the following method: action command #slirpvde – s/tmp/switch1 – D – s192.168.1.28 – e192.168.1.49-n192.168.1.1; Wherein ,/tmp/switch1 is the name of the described virtual switch that described virtual gateway connects;-D option is for opening the DHCP service of described virtual gateway;-s is used to specify the initial distributing IP address of described DHCP service;-e is used to specify the termination distributing IP address of described virtual gateway;-n is used to specify the IP address of described virtual gateway.As one of ordinary skill will be appreciated, when creating the virtual gateway on book server, the address pool of the DHCP service that this virtual gateway is supported will be planned, the address pool of the DHCP service that the virtual gateway of each server is supported can not be intersected.
In step S3, the common technology of this area can be adopted to realize being communicated with of virtual machine and virtual switch.Due in step s 2, be configured with the virtual switch that virtual gateway connects, therefore, after being communicated with virtual machine by virtual switch, just can have formed the virtual network of single server.
In the embodiment of the present invention, in step S4, adopt the identical operation of above-mentioned steps S1-S3, create multiple single server virtual network.
And then perform step S5, by interconnected for the virtual switch in multiple single server virtual network, thus multiple single server virtual network is communicated with, forms complete virtual network.Multiple server can be comprised in this virtual network, multiple virtual machine can be comprised in each server, any virtual machine in each server by the virtual gateway access outer net in the server at place, also can be communicated with the virtual machine in other servers by the virtual switch of place server.
Due in the embodiment of the present invention, need to need between the virtual switch in each server to be communicated with, and need to be connected by TCP link, so in step sl, when creating virtual switch, need the bundling port indicating described virtual switch.
Wherein, step S5, can adopt the virtual switch realized with the following method in multiple single server virtual network interconnected: action command #vdeterm/tmp/switch1/mgmt " conn175.10.2.79:20500 "; Wherein ,/tmp/switch1/mgmt is the management interface of described virtual switch.
In addition, the implementation method of the virtual network that the embodiment of the present invention provides, the api interface of supervising the network is provided by network management proxy, dock with desktop cloud system, thus the order that virtual network can be issued according to the desktop cloud system server of specifying in this virtual network runs the virtual network that mentioned order creates single server, i.e. local network, the parameter in order such as port, dhcp address pool etc. have desktop cloud system dynamic management.
As one of ordinary skill will be appreciated, during the virtual network access outer net that the embodiment of the present invention provides, the virtual gateway of each server, by the network interface card of server, is communicated to physical switches, physical switches is communicated to physical gateway, by this physical gateway access outer net.Connection between the said equipment all can adopt ordinary skill in the art means to realize.
By adopting technique scheme disclosed by the invention, obtain effect useful as follows: the virtual network that the embodiment of the present invention provides and its implementation, for multiple server, a virtual gateway is all set on each server, the virtual machine on this individual server is made to access outer net by the virtual gateway on this server, therefore, the live load of the virtual gateway on each server can not be very large, the occupied resource of each server also can not be very large, thus can not affect the normal use of each server.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.
Those skilled in the art it should be understood that the sequential of the method step that above-described embodiment provides can carry out accommodation according to actual conditions, also can carry out according to actual conditions are concurrent.
The hardware that all or part of step in the method that above-described embodiment relates to can carry out instruction relevant by program has come, described program can be stored in the storage medium that computer equipment can read, for performing all or part of step described in the various embodiments described above method.Described computer equipment, such as: personal computer, server, the network equipment, intelligent mobile terminal, intelligent home device, wearable intelligent equipment, vehicle intelligent equipment etc.; Described storage medium, such as: the storage of RAM, ROM, magnetic disc, tape, CD, flash memory, USB flash disk, portable hard drive, storage card, memory stick, the webserver, network cloud storage etc.
Finally, also it should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operating space, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, commodity or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, commodity or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, commodity or the equipment comprising described key element and also there is other identical element.
The above is only the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications also should look protection scope of the present invention.