Retransmission method, device and the computer equipment of message between a kind of different sub-network
Technical field
The present invention relates to the communication technology, retransmission method, device and the computer equipment of message between espespecially a kind of different sub-network.
Background technique
Under virtualized environment, if virtual machine is in different subnets, exchanges visits between virtual machine and need additional three layers
The network equipment such as routing table equipment does message forwarding, increases operation cost and network complexity.
Summary of the invention
In order to solve the above-mentioned technical problems, the present invention provides the retransmission method of message between a kind of different sub-network, device and
Computer equipment can be forwarded the message between different sub-network by virtual switch, save three-layer network pipeline equipment, reduce operation
Cost and network complexity.
In order to reach the object of the invention, the present invention provides a kind of retransmission method of message between different sub-network, the methods
Include:
The ARP request that virtual switch intercepts and captures the gateway ip address that request address is sender's virtual machine configuration broadcasts report
Text returns to APR proxy response to sender's virtual machine, wherein the APR proxy response message is that change sender is virtual
The corresponding MAC of gateway IP of the neighbor table of machine is the message of the MAC Address of virtual switch;
When virtual switch receives the IP packet of virtual machine transmission, judges sender's virtual machine of the IP packet and connect
Whether debit's virtual machine belongs to same subnet, and when being not belonging to same subnet, the MAC Address of the recipient in message is revised as
The MAC Address of the recipient's virtual machine inquired, and forward the modified message.
In a kind of exemplary embodiment, the MAC Address by the recipient in message is revised as the reception inquired
The MAC Address of square virtual machine, comprising:
Virtual switch is according to the MAC Address of the IP address inquire-receive side virtual machine of recipient in the message, virtually
Recipient's virtual machine that the MAC Address of recipient in the message is revised as inquiring by the openflow flow table in interchanger
MAC Address.
In a kind of exemplary embodiment, wherein with having IP address and the MAC of virtual machine in the openflow flow table
The corresponding relationship of location.
In order to reach the object of the invention, the present invention also provides a kind of retransmission unit of message between different sub-network, the dress
It sets including interception module and forwarding module:
The interception module intercepts and captures the gateway ip address that request address is sender's virtual machine configuration for virtual switch
ARP request broadcasting packet, to sender's virtual machine return APR proxy response, wherein the APR proxy response message
For the message for changing the MAC Address that the corresponding MAC of gateway IP of the neighbor table of sender's virtual machine is virtual switch;
It is described, when forwarding module receives the IP packet of virtual machine transmission for virtual switch, judge the IP packet
Sender's virtual machine and recipient's virtual machine whether belong to same subnet, when being not belonging to same subnet, by connecing in message
The MAC Address of debit is revised as the MAC Address of the recipient's virtual machine inquired, and forwards the modified message.
In a kind of exemplary embodiment, the MAC Address of the recipient in message is revised as inquiring by the interception module
The MAC Address of the recipient's virtual machine arrived, comprising:
Interception module in virtual switch is according to the IP address inquire-receive side virtual machine of recipient in the message
MAC Address, what the MAC Address of recipient in the message was revised as inquiring by openflow flow table in the interception module
The MAC Address of recipient's virtual machine.
In a kind of exemplary embodiment, wherein with having IP address and the MAC of virtual machine in the openflow flow table
The corresponding relationship of location.
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, the present invention includes: that virtual switch intercepts and captures request address as sender's virtual machine configuration
The ARP request broadcasting packet of gateway ip address returns to APR proxy response to sender's virtual machine, wherein the APR generation
Reason response message is that the corresponding MAC of gateway IP for the neighbor table for changing sender's virtual machine is the MAC Address of virtual switch
Message;When virtual switch receives the IP packet of virtual machine transmission, sender's virtual machine and the reception of the IP packet are judged
Whether square virtual machine belongs to same subnet, when being not belonging to same subnet, the MAC Address of the recipient in message is revised as looking into
The MAC Address for the recipient's virtual machine ask, and forward the modified message.It can be forwarded by virtual switch different
Message between subnet has saved three-layer network pipeline equipment, cuts operating costs and network complexity.
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.
The flow chart of Fig. 1 retransmission method of message between the different sub-network of the embodiment of the present invention one;
The structural representation of Fig. 2 device where the retransmission method of message between the realization different sub-network of the embodiment of the present invention two
Figure;
The structural schematic diagram of Fig. 3 retransmission unit of message between the different sub-network 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
The retransmission method for present embodiments providing message between a kind of different sub-network, as shown in Figure 1, this method includes S11-
S12:
S11, virtual switch intercept and capture the ARP request broadcast for the gateway ip address that request address is sender's virtual machine configuration
Message returns to APR proxy response to sender's virtual machine, wherein the APR proxy response message is that change sender is empty
The corresponding MAC of gateway IP of the neighbor table of quasi- machine is the message of the MAC Address of virtual switch;
When S12, virtual switch receive the IP packet of virtual machine transmission, sender's virtual machine of the IP packet is judged
Whether belong to same subnet with recipient's virtual machine, when being not belonging to same subnet, the MAC Address of the recipient in message is repaired
It is changed to the MAC Address of recipient's virtual machine inquired, and forwards the modified message.
In the embodiment of the present invention, the message between different sub-network can be forwarded by virtual switch, has saved three-layer network road
Equipment, cuts operating costs and network complexity.
In a kind of exemplary embodiment, the MAC Address of the recipient in message is revised as inquiring by the interception module
The MAC Address of the recipient's virtual machine arrived, comprising:
Interception module in virtual switch is according to the IP address inquire-receive side virtual machine of recipient in the message
MAC Address, what the MAC Address of recipient in the message was revised as inquiring by openflow flow table in the interception module
The MAC Address of recipient's virtual machine.
In a kind of exemplary embodiment, wherein with having IP address and the MAC of virtual machine in the openflow flow table
The corresponding relationship of location.
In a kind of exemplary embodiment, the MAC in ARP broadcasting packet is the MAC of gateway address.The prior art is to pass through
Gateway forwards.
In a kind of exemplary embodiment, virtual machine transmit messages text when, sender's virtual machine 1 sends ARP broadcasting packet first,
When not having gateway, virtual machine not will receive the response of gateway, judge that requesting destination IP is that sender is empty in virtual switch
APR proxy response is issued when the gateway IP of quasi- machine configuration;After virtual machine 1 is by ARP proxy response, modification issues message recipient
MAC Address be the virtual machine MAC Address, after virtual switch receives at this time, the address mac of recipient will be modified as void
The address mac of quasi- machine 2 (recipient) simultaneously forwards.
In a kind of exemplary embodiment, the MAC Address of the recipient in message is revised as the recipient inquired void
The MAC Address of quasi- machine, comprising:
In a kind of exemplary embodiment, virtual switch is virtual according to the IP address inquire-receive side of recipient in message
The MAC Address of machine, the openflow flow table in virtual switch connect what the MAC Address of recipient in message was revised as inquiring
The MAC Address of debit's virtual machine.The present embodiment is by means of this agreement of openflow, by the mapping relations of built-in IP and MAC,
Realize the message intercommunication between different sub-network.
In a kind of exemplary embodiment, the IP address for having virtual machine in openflow flow table is corresponding with MAC Address
Relationship.
In a kind of exemplary embodiment, openflow flow table is after virtual machine is online, and virtual switch is received virtual
The openflow flow table that machine management platform is generated according to the IP address and MAC Address of the virtual machine prestored.It is empty when creating virtual machine
Quasi- machine management platform can be by the IP address of virtual machine and the corresponding preservation of MAC Address, when virtual machine is online, can be according to virtual
The IP address and MAC Address of machine create openflow flow table, are issued on virtual switch.
Embodiment two
Above-described embodiment method is specifically described in the present embodiment.
Attached drawing 2 show the present embodiment realize different sub-network between message retransmission method where device structural schematic diagram,
Two virtual machines belong to different sub-network, and virtual machine 1 belongs to subnet 192.168.1.0/24 network segment, and IP is 192.168.1.2,
Gateway is 192.168.1.1;Virtual machine 2 belongs to subnet 172.16.12.0/24, and IP is 172.16.12.2, and gateway is
172.16.12.1, two virtual machines can realize access mutually by the openflow flow table of virtual switch ovs.
Specific implementation process is as follows:
(1) Ovs virtual switch does ARP proxy response, that is, virtual machine 1 to the gateway IP of virtual machine 1 and virtual machine 2
The message exchanged visits with virtual machine 2, can all be sent to ovs virtual switch.
(2) inside ovs virtual switch, according to built-in preset each virtual machine IP and MAC mapping table, pass through addition
Openflow flow table come modify virtual machine 1 access virtual machine 2 message, modify the MAC Address of recipient's virtual machine of its message
Message for the MAC Address of virtual machine 2, the sending of such virtual machine 1 can normally reach virtual machine 2.Similarly, virtual machine 2 is visited
Ask the message of virtual machine 1, the MAC Address of recipient's virtual machine with being also modified as the MAC of virtual machine 1 by openflow flow table
Location, to be forwarded to virtual machine 1.
The mapping table is the when IP address that saves and corresponding MAC Address for creating virtual machine.Virtual machine booting when
It waits, obtains the IP and MAC of the virtual machine, add openflow flow table.
The present embodiment proposes different sub-network is realized under a kind of virtualized environment between virtual machine exchange visit method, OVS is virtual
Interchanger does ARP proxy response, while built-in preset each virtual machine IP and MAC mapping table to the gateway IP of each virtual machine,
By adding specific openflow flow table on OVS virtual switch, by virtual machine message between forwarding different sub-network, realize
The exchanging visit of virtual machine between different sub-network.
Embodiment three
A kind of retransmission unit of message between different sub-network is present embodiments provided, describes to be also suitable in above method embodiment
In this present embodiment, as shown in figure 3, the device includes interception module 31 and forwarding module 32:
The interception module 31, with intercepting and capturing the gateway IP that request address is sender's virtual machine configuration for virtual switch
The ARP request broadcasting packet of location returns to APR proxy response to sender's virtual machine, wherein the APR proxy response report
Text is the message that the corresponding MAC of gateway IP for the neighbor table for changing sender's virtual machine is the MAC Address of virtual switch;
It is described, when forwarding module 32 receives the IP packet of virtual machine transmission for virtual switch, judge the IP report
Whether the sender's virtual machine and recipient's virtual machine of text belong to same subnet, will be in message when being not belonging to same subnet
The MAC Address of recipient is revised as the MAC Address of the recipient's virtual machine inquired, and forwards the modified message.
In a kind of exemplary embodiment, the MAC Address of the recipient in message is revised as looking by the interception module 31
The MAC Address for the recipient's virtual machine ask, comprising:
Interception module 31 in virtual switch is according to the IP address inquire-receive side virtual machine of recipient in the message
MAC Address, the MAC Address of recipient in the message is revised as inquiring by the openflow flow table in the interception module 31
The MAC Address of the recipient's virtual machine arrived.
In a kind of exemplary embodiment, wherein with having IP address and the MAC of virtual machine in the openflow flow table
The corresponding relationship of location.
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 retransmission method of message between the different sub-network of previous embodiment offer, example can be realized
Such as, method as shown in Figure 1 is executed.
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.