Background
With the continuous development of cloud computing, in a multi-tenant cloud computing environment, a user needs an isolated network environment, which includes an independent address space, complete isolation of network traffic between virtual networks, and independent Quality of Service (QoS) guarantee. In a cloud computing environment, in the prior art, a tunnel encapsulation protocol such as a Virtual Extensible local area network (VxLAN) is adopted to realize isolation of Virtual networks among tenants, but because the tunnel encapsulation protocol, for example, the VxLAN protocol introduces an extra 50 bytes to help realize forwarding of messages, the actual utilization rate of bandwidth is reduced; on the other hand, the VxLAN Protocol relies on multicast/broadcast of an Internet Protocol (IP) Address to help implement Address Resolution Protocol (ARP) addressing, but in a Data Center of an Internet Data Center (IDC), since supported multicast/broadcast is used for Data transmission in a multipoint format, it is difficult to perform Data flow control at an uplink port of the Data Center of the IDC, which may bring a potential risk of network congestion.
In the prior art, on one hand, in a network forwarding process, VxLAN encapsulation is transparent to a user, the size of a data message sent by the user is usually the Maximum Transmission Unit (MTU) of a network card, and after the VxLAN encapsulation is added, the proportion of the total header length of the VxLAN message is increased, so that the actual utilization rate of a network bandwidth is reduced; because the MTU of the network card is the maximum length of the IP packet in the three-layer data packet, when the length of the IP packet exceeds the MTU, the IP packet is cut, so that IP fragmentation is caused, that is, the three-layer data packet is divided into two data packets to be transmitted, packet loss may be caused if the network is abnormal or decapsulated by mistake at the receiving end, and meanwhile, if the receiving end finds that any one fragment in the multiple fragments is lost, the transmitting end is required to retransmit all fragments, so that the retransmission rate is increased, and therefore, reducing the proportion of the header length in the data packet becomes the subject of main research in the industry, and fig. 1 shows a standard VxLAN packet format containing an inner layer two-layer header.
On the other hand, in a Virtual network of a standard VxLAN, Virtual Machine (VM) address learning is implemented by IP multicast/broadcast (RFC 7348). After a VM sends an ARP request, a Virtual extensible local area Network Tunnel port (VxLAN Tunnel End Point, VTEP) in the VxLAN protocol finds a corresponding multicast group according to a Virtual Network Identifier (VNI) corresponding to the VM, and sends the ARP request through multicast (for example, multicast/broadcast), where a mapping relationship between the multicast group and the VNI is issued in advance through a control layer. Since the IDC environment usually disables IP multicast, it is difficult to control the multicast traffic, but too much traffic easily causes severe network congestion in the entire data center; as the scale of the network increases, the resource overhead of ARP addressing depending on multicast is also obviously improved, and the load of the network is increased, so that the realization mode has the bottleneck of safety and expandability in a public cloud computing environment.
Therefore, in the prior art, a standard VxLAN message format is adopted for forwarding the data message, which causes extra overhead of header length, reduces bandwidth utilization rate, and brings extra cost.
Disclosure of Invention
The application aims to provide a method and equipment for sending and receiving a message, and the method and equipment are used for solving the problems that in the prior art, a standard VxLAN message format is adopted for forwarding the data message, so that the overhead of extra header length is caused, the bandwidth utilization rate is reduced, and extra cost is brought.
According to an aspect of the present application, there is provided a method for sending a packet, including:
receiving an internet protocol message to be sent from a source virtual machine, wherein the internet protocol message comprises an internet protocol address of a target virtual machine;
and generating a virtual extensible local area network message based on the Internet protocol message, and sending the virtual extensible local area network message to a switch corresponding to the target virtual machine according to a preset address table.
Further, before receiving the internet protocol packet to be sent to the target virtual machine from the source virtual machine, the method further includes:
receiving an address resolution protocol request which is sent by the source virtual machine and corresponds to the to-be-sent internet protocol message;
and sending address resolution protocol response information to the source virtual machine based on the address resolution protocol request, wherein the address resolution protocol response information comprises a false media access control address.
Further, the receiving, from the source virtual machine, the internet protocol packet to be sent to the target virtual machine includes:
and receiving an internet protocol message sent by the source virtual machine based on the address resolution protocol response information, wherein the internet protocol message comprises the false media access control address.
Further, generating a virtual extensible local area network message based on the internet protocol message, and sending the virtual extensible local area network message to a switch corresponding to a target virtual machine according to a preset address table, including:
acquiring the address table, wherein the address table records the mapping relation between the IP address of the target virtual machine and the IP address of the host machine;
searching the internet protocol address of the host machine corresponding to the internet protocol address of the target virtual machine from the address table, and generating a virtual extensible local area network message based on the internet protocol message and the internet protocol address of the host machine;
and sending the virtual extensible local area network message to a switch corresponding to a target virtual machine, wherein the target virtual machine and the switch corresponding to the target virtual machine are positioned on the same host machine.
Further, searching the address table for the internet protocol address of the host corresponding to the internet protocol address of the target virtual machine includes:
if the internet protocol address of the corresponding host is not found from the address table;
sending a learning message for inquiring the internet protocol address of the corresponding host machine;
and acquiring the corresponding internet protocol address of the host machine returned according to the learning message, and adding the acquired internet protocol address of the corresponding host machine into the address table.
According to another aspect of the present application, there is provided a method for receiving a packet, including:
receiving a virtual extensible local area network message;
and decapsulating the virtual extensible local area network message to obtain an internet protocol message, and sending the internet protocol message to a corresponding target virtual machine according to a preset neighbor table, wherein the internet protocol message comprises an internet protocol address of the target virtual machine, and the neighbor table records a mapping relation between the internet protocol address of the target virtual machine and a target media access control address of the target virtual machine.
Further, decapsulating the virtual extensible local area network packet to obtain an internet protocol packet, and sending the internet protocol packet to a corresponding target virtual machine according to a preset neighbor table, including:
decapsulating the virtual extensible local area network message to obtain an internet protocol message;
acquiring a neighbor table, and searching a target media access control address corresponding to the internet protocol address of the target virtual machine from the neighbor table;
and adding the target media access control address into the Internet protocol message, and sending the Internet protocol message to a target virtual machine.
Further, decapsulating the virtual extensible local area network packet to obtain an internet protocol packet, where the internet protocol packet further includes a false media access control address of the internet protocol address of the target virtual machine;
adding the target media access control address into the internet protocol message, and sending the internet protocol message to a target virtual machine, wherein the method comprises the following steps:
and replacing the fake media access control address with the destination media access control address.
Further, searching a destination mac address corresponding to the ip address of the target virtual machine from the neighbor table, including:
if the corresponding destination mac address is not found in the neighbor table,
sending a learning message for inquiring a corresponding target media access control address;
and acquiring a corresponding target media access control address returned according to the learning message, and adding the acquired corresponding target media access control address into the neighbor table.
According to another aspect of the present application, there is provided an apparatus for sending a packet, wherein the apparatus includes:
the receiving device is used for receiving an internet protocol message to be sent from a source virtual machine, wherein the internet protocol message comprises an internet protocol address of a target virtual machine;
and the sending device is used for generating a virtual extensible local area network message based on the internet protocol message and sending the virtual extensible local area network message to the switch corresponding to the target virtual machine according to a preset address table.
Further, the apparatus further comprises:
the request response device is used for receiving an address resolution protocol request which is sent by the source virtual machine and corresponds to the to-be-sent Internet protocol message;
and sending address resolution protocol response information to the source virtual machine based on the address resolution protocol request, wherein the address resolution protocol response information comprises a false media access control address.
Further, the receiving device is configured to:
and receiving an internet protocol message sent by the source virtual machine based on the address resolution protocol response information, wherein the internet protocol message comprises the false media access control address.
Further, the transmission apparatus includes:
the acquisition unit is used for acquiring the address table, and the address table records the mapping relation between the internet protocol address of the target virtual machine and the internet protocol address of the host machine;
the searching and generating unit is used for searching the internet protocol address of the host machine corresponding to the internet protocol address of the target virtual machine from the address table and generating a virtual extensible local area network message based on the internet protocol message and the internet protocol address of the host machine, wherein the target virtual machine and a corresponding switch thereof are positioned on the same host machine;
and the sending unit is used for sending the virtual extensible local area network message to the switch corresponding to the target virtual machine.
Further, the search generation unit is configured to:
if the internet protocol address of the corresponding host is not found from the address table;
sending a learning message for inquiring the internet protocol address of the corresponding host machine;
and acquiring the corresponding internet protocol address of the host machine returned according to the learning message, and adding the acquired internet protocol address of the corresponding host machine into the address table.
According to another aspect of the present application, there is provided an apparatus for receiving a packet, wherein the apparatus includes:
the message receiving device is used for receiving the virtual extensible local area network message;
and the message sending device is used for decapsulating the virtual extensible local area network message to obtain an internet protocol message, and sending the internet protocol message to the corresponding target virtual machine according to a preset neighbor table, wherein the internet protocol message comprises an internet protocol address of the target virtual machine, and the neighbor table records the mapping relation between the internet protocol address of the target virtual machine and a target media access control address of the target virtual machine.
Further, the message sending apparatus includes:
a decapsulation unit, configured to decapsulate the virtual extensible local area network packet to obtain an internet protocol packet;
the searching unit is used for acquiring a neighbor table and searching a target media access control address corresponding to the internet protocol address of the target virtual machine from the neighbor table;
and the message sending unit is used for adding the target media access control address into the internet protocol message and sending the internet protocol message to the target virtual machine.
Further, the internet protocol packet in the decapsulating unit further includes a false media access control address of the internet protocol address of the target virtual machine;
the message sending unit is used for:
and replacing the fake media access control address with the destination media access control address.
Further, the lookup unit is configured to:
if the corresponding destination mac address is not found in the neighbor table,
sending a learning message for inquiring a corresponding target media access control address;
and acquiring a corresponding target media access control address returned according to the learning message, and adding the acquired corresponding target media access control address into the neighbor table.
There is also provided, in accordance with another aspect of the present application, a computing system comprising one or more computer-readable storage media having thereon computer-executable instructions configured to, when executed by one or more processors of a computing system, cause the computing system to perform a method of sending a message, the method comprising:
receiving an IP message to be sent from a source virtual machine, wherein the IP message comprises an IP address of a target virtual machine;
and generating a VxLAN message based on the IP message, and sending the VxLAN message to a switch corresponding to the target virtual machine according to a preset address table.
There is also provided, in accordance with another aspect of the present application, a computing system comprising one or more computer-readable storage media having thereon computer-executable instructions configured to, when executed by one or more processors of a computing system, cause the computing system to perform a method of receiving a message, the method comprising:
receiving a VxLAN message;
and decapsulating the VxLAN message to obtain an IP message, and sending the IP message to a corresponding target virtual machine according to a preset neighbor table, wherein the IP message comprises an IP address of the target virtual machine, and the neighbor table records a mapping relation between the IP address of the target virtual machine and a target MAC address thereof.
Compared with the prior art, the application provides a method and equipment for sending messages, firstly receiving an internet protocol message to be sent from a source virtual machine, then, the target media access control address in the internet protocol message is removed to generate a virtual extensible local area network message, and finally, the virtual extensible local area network message is sent to the corresponding switch of the target virtual machine according to a preset address table recorded with the mapping relation between the internet protocol address of the target virtual machine and the internet protocol address of the host machine, thereby not only solving the problem of learning the media access control address, meanwhile, the virtual extensible local area network message without the redundant media access control address is adopted, and the message is forwarded based on the internet protocol address of the target virtual machine, so that the bandwidth utilization rate is effectively improved, and the message has better extensibility.
Further, before receiving the to-be-sent internet protocol packet from the source virtual machine, the method further includes: receiving an address resolution protocol request for inquiring a media access control address of a target virtual machine from the source virtual machine, and in order to avoid address resolution protocol addressing depending on multicast in the prior art, the method adopts an internet protocol address based on the target virtual machine to carry out address resolution protocol addressing, so that address resolution protocol response information is sent to the source virtual machine based on the address resolution protocol request, and the address resolution protocol response information contains a false media access control address corresponding to the internet protocol address of the target virtual machine, so that the address resolution protocol request is terminated in a virtual switch, the resource overhead of multicast/broadcast caused by large network scale is avoided, and the purposes of improving network expandability and stability are achieved.
Further, another aspect of the present application provides a method and apparatus for receiving a message, by receiving the virtual extensible local area network message and decapsulating the virtual extensible local area network message to obtain an internet protocol message, writing a target media access control address corresponding to the internet protocol address of the target virtual machine into an internet protocol message according to a preset neighbor table recorded with a mapping relation between the internet protocol address of the target virtual machine and the target media access control address, and based on the destination media access control address, sending the internet protocol message to a corresponding target virtual machine, so that the neighbor table is used to complete the Internet protocol message at the receiving end of the target virtual switch and completely transmit the Internet protocol message to the target virtual machine, therefore, the complete forwarding of the internet protocol message between the source virtual machine and the target virtual machine is realized.
Detailed Description
The present application is described in further detail below with reference to the attached figures.
According to an aspect of the present application, a method for sending a packet at a source switch end is provided, and the method is implemented at a source virtual switch end, and specifically includes step S201 and step S202, where in step S201, an internet protocol packet to be sent is received from a source virtual machine, the internet protocol packet includes an internet protocol address and actual content of a target virtual machine, where the actual content is data information to be actually transmitted in the packet; the step S202 is to generate a Virtual Extensible local area network (VxLAN) message based on the internet protocol message, where the VxLAN message is a VxLAN message for removing a destination Media Access Control (MAC) address; and then, sending the VxLAN message to a switch corresponding to the target virtual machine according to a preset address table, wherein the address table records the mapping relation between the Internet protocol address of the target virtual machine and the Internet protocol address of a host machine, and the target virtual machine and the switch thereof are positioned on the same host machine.
In the following embodiments of the present application, a forwarding process of a packet between a source virtual switch corresponding to a source virtual machine and a switch corresponding to a target virtual machine is described by taking a communication scenario between two virtual machines belonging to a certain virtual network as an example.
Before the step S201 receives an Internet Protocol (IP) packet to be sent from a source virtual machine, the method further includes a step S203, where in the step S203, an address resolution Protocol request corresponding to the IP packet to be sent from the source virtual machine is received; and sending ARP response information to the source virtual machine based on the Address Resolution Protocol (ARP) request.
In step S203, the ARP reply information includes a false MAC address, where the false MAC address is an invalid MAC address of the IP address of the target virtual machine, that is, a non-real MAC address.
For example, fig. 2 shows a schematic flowchart of a method between a source virtual machine and a source virtual switch in this embodiment of the application. When a user's source Virtual Machine (VM 1) is to access a target Virtual Machine VM2 of the same Virtual network, the internet protocol address (IP address) of the source Virtual Machine VM1 is: 192.168.0.1, the IP address of the target virtual machine is: 192.168.0.2, the source virtual switch vSwitch1 first receives an Address Resolution Protocol (ARP) request sent from the source virtual machine VM1 to query the Media Access Control (MAC) Address of the targetvirtual machine VM 2. To avoid relying on multicast for ARP addressing as in the prior art, the present application does not need to address with the MAC address of the target virtual machine VM2, so for the IP of the querying target virtual machine VM 2: 192.168.0.2, the source virtual switch vSwitch1 replies directly with a fake MAC address containing the target virtual machine VM 2: ff, the ARP reply information, as shown by the false MAC address in the neighbor table in fig. 2, terminates the ARP request inside the source virtual switch vSwitch1, avoids the resource overhead caused by sending out the ARP request through multicast/broadcast in a distributed system with a large network scale, thereby achieving the purpose of improving network scalability and stability, and being more efficient.
In the step S203, after the source virtual switch vSwitch1 sends ARP reply information to the source virtual machine VM1, the source virtual switch vSwitch1 receives an IP packet sent by the source virtual machine VM1 based on the ARP reply information, where the IP packet includes a fake MAC address of the targetvirtual machine VM 2.
Here, the IP packet includes not only the IP address of the target virtual machine VM2 and its corresponding false MAC address and actual content, but also the IP address of the source virtual machine VM1 and its corresponding real MAC address, where the actual content includes a communication packet for instructing the source virtual machine to send to the target virtual machine.
Fig. 3 shows a schematic diagram of a method for processing an IP packet by a source virtual switch in the embodiment of the present application, where in the step S201, after receiving an IP packet sent by the source virtual machine VM1 based on ARP reply information, the step S202 includes 3 sub-steps:
step S2021, acquiring the address table, where the address table records a mapping relationship between the IP address of the target virtual machine and the IP address of the host machine. The source virtual switch vSwitch1 searches a routing table for indicating a path where the IP address of the target virtual machine is located according to the IP address of the target virtual machine in the IP message, and matches a route of the subnet in the virtual network according to the routing table to obtain an address table in which a mapping relationship between the IP address of the target virtual machine and the IP address of a host of the target virtual machine is recorded.
Step S2022, searching the IP address of the host machine corresponding to the IP address of the target virtual machine from the address table, and generating a VxLAN message based on the IP message and the IP address of the host machine. And searching a corresponding host machine IP address in the address table through the IP address of the target virtual machine, removing the target MAC address in the IP message and the MAC address of the source virtual machine, and then carrying out VxLAN encapsulation on the IP message without the MAC address and the IP address of the host machine to obtain the VxLAN message, thereby reducing the header length in the VxLAN message and effectively improving the bandwidth utilization rate.
Step S2023, the VxLAN message is sent to a switch corresponding to a target virtual machine, and the target virtual machine and the switch corresponding to the target virtual machine are located on the same host machine. And sending the VxLAN message to a physical network through a User Datagram Protocol (UDP) socket, so that the VxLAN message is sent to a switch in the host machine corresponding to the IP address of the target virtual machine through the physical network.
Further, the searching for the IP address of the host corresponding to the IP address of the target virtual machine from the address table in step S2022 includes:
if the IP address of the corresponding host machine is not found from the address table;
sending a learning message for inquiring the IP address of the corresponding host machine;
and acquiring the IP address of the corresponding host machine returned according to the learning message, and adding the acquired IP address of the corresponding host machine into the address table.
In the step S2022, if the IP address of the target virtual machine is not recorded in the address table in the source virtual switch, in a preferred embodiment of the present application, an idea implementation and an address table generated by using Software Defined Networking (SDN) are selected. Of course, other existing or future implementations and concepts for generating the address table are also contemplated as may be applicable to the present application and are intended to be included within the scope of the present application and are hereby incorporated by reference.
In a preferred embodiment of the present application, the obtaining of the address table in the source virtual switch vSwitch1 may be actively issued by an SDN control plane to obtain the address table in the whole network, or may be learned by the SDN control plane. Wherein learning by the SDN control plane comprises: when the IP address of the target virtual machine in the IP message sent by the source virtual machine VM1 is not recorded in the address table of the source virtual switch vSwitch1, the source virtual switch vSwitch1 sends a learning message for searching the IP address of the corresponding host to the SDN control plane, so as to obtain the IP address of the corresponding host returned according to the learning message from the SDN control plane, encapsulate the obtained IP address of the corresponding host into the VxLAN message, and add the mapping relationship between the IP address of the target virtual machine and the IP address of the corresponding host into the address table, so that not only the IP address of the corresponding host is obtained, but also the purpose of updating the address table is achieved.
When the VxLAN message sent by the source virtual switch vSwitch1 reaches the host corresponding to the IP address of the corresponding host through the physical network, the target virtual switch vSwitch2 in the host corresponding to the IP address of the host performs the following two steps on the VxLAN message. According to another aspect of the present application, a method for receiving a message at a switch end includes the following two steps:
step S601, receiving the VxLAN message;
step S602, decapsulating the VxLAN message to obtain an IP message, and sending the IP message to a corresponding target virtual machine according to a preset neighbor table, wherein the IP message comprises an IP address and actual content of the target virtual machine, and the neighbor table records a mapping relation between the IP address of the target virtual machine and a target MAC address thereof.
In step S602, the vSwitch2 of the destination virtual switch decapsulates the VxLAN packet to obtain an IP packet, where the IP packet includes an IP address and actual content of the target virtual machine, and the actual content includes a communication packet used to instruct the source virtual machine to send to the target virtual machine; then, according to the neighbor table in which the mapping relationship between the IP address of the target virtual machine and the destination MAC address thereof is recorded, the destination MAC address corresponding to the IP address of the target virtual machine is written in an IP message, and the IP message is sent to the target virtual machine VM2 based on the destination MAC address, so that the MAC address corresponding to the IP address of the target virtual machine in the IP message is completed in the target virtual switch vSwitch2 by using the preset neighbor table, and the completed IP message is completely sent to the targetvirtual machine VM 2.
Further, in step S602, the destination virtual switch vSwitch2 decapsulates the received VxLAN packet to obtain an IP packet, adds an MAC address corresponding to the IP address of the target virtual machine to the IP packet, and sends the IP packet to the corresponding target virtual machine, as shown in fig. 4, fig. 4 shows a schematic processing flow diagram of the destination virtual switch of the present application for the VxLAN packet, where the step S602 includes the following three substeps:
and step S6021, decapsulating the VxLAN message to obtain an IP message. And (3) decapsulating the VxLAN message to obtain an IP message, wherein the VxLAN message is removed of the destination MAC address, and in order to add the removed destination MAC address corresponding to the IP address of the target virtual machine VM2 into the IP message without the destination MAC address, the step S6022 is performed to completely send the IP message to the corresponding target virtual machine VM2 based on the destination MAC address.
Step S6022, a neighbor table is obtained, and the destination MAC address corresponding to the IP address of the target virtual machine is searched from the neighbor table. In order to obtain the destination MAC address corresponding to the IP address of the target virtual machine VM2, the destination MAC address corresponding to the IP address of the target virtual machine is searched from the neighbor table in which the mapping relationship between the IP address of the target virtual machine and the destination MAC address is recorded, so as to complete the destination MAC address corresponding to the IP address of the target virtual machine in the IP message.
And step S6023, adding the target MAC address into the IP message, and sending the IP message to a target virtual machine. Because the IP packet further includes a false MAC address corresponding to the IP address of the target virtual machine, the false MAC address in the IP packet is replaced with the destination MAC address obtained from the neighbor table to obtain a completed IP packet, and the completed IP packet is sent to the target virtual machine VM2 corresponding to the destination MAC address, so that the purpose of completing the IP packet is facilitated by the neighbor table, and packet communication between the source virtual machine VM1 and the target virtual machine VM2 is realized.
Further, the step S6022 searches the destination MAC address corresponding to the IP address of the target virtual machine from the neighbor table, including:
if the corresponding destination MAC address is not found from the neighbor table,
sending a learning message for inquiring a corresponding destination MAC address;
and acquiring a corresponding destination MAC address returned according to the learning message, and adding the acquired corresponding destination MAC address into the neighbor table.
In step S6022, if the IP address of the target virtual machine is not recorded in the neighbor table in the destination virtual switch, in a preferred embodiment of the present application, an idea of using Software Defined Network (SDN) is selected to implement and generate the neighbor table. Of course, other existing or future implementations and concepts for generating the neighbor table are also contemplated as may be applicable to the present application and are intended to be included within the scope of the present application and are hereby incorporated by reference.
In a preferred embodiment of the present application, the acquisition of the neighbor table in the destination virtual switch vSwitch2 may be actively issued by an SDN control plane to acquire the neighbor table in the whole network, or may be learned by the SDN control plane. Wherein learning by the SDN control plane comprises: when the destination virtual switch vSwitch2 decapsulates the VxLAN message from the receiving source to obtain an IP message, if the IP address of the target virtual machine is not recorded in the neighbor table of the destination virtual switch vSwitch2, the destination virtual switch vSwitch2 will send a learning message to the SDN control plane looking for the destination MAC address, to obtain the corresponding destination MAC address returned from the learning packet from the SDN control plane, and the obtained corresponding destination MAC address replaces a false MAC address corresponding to the IP address of the target virtual machine in the IP message, simultaneously adding the mapping relation of the IP address of the target virtual machine and the destination MAC address thereof into the neighbor table, therefore, the target MAC address corresponding to the IP address of the target virtual machine in the IP message is completed, and the purpose of updating the neighbor table in the target virtual switch is achieved.
According to another aspect of the present application, there is also provided an apparatus for sending a message at a source switch. Thedevice 1 includes a receiving apparatus 801 and a sending apparatus 802, where the receiving apparatus 801 is configured to receive an IP packet to be sent from a source virtual machine, where the IP packet includes an IP address of a target virtual machine; the sending device 802 generates a VxLAN message based on the IP message, and sends the VxLAN message to a switch corresponding to the target virtual machine according to a preset address table.
Here, thedevice 1 includes, but is not limited to, a client device, a network device, and a device in which the client device and the network device are integrated through a network. The network device includes an electronic device capable of automatically performing numerical calculation and information processing according to instructions set or stored in advance, and hardware thereof includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a programmable gate array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like. Including, but not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a VPN network, a wireless Ad Hoc network (Ad Hoc network), etc. Preferably, thedevice 1 may also be a script program running on a device formed by integrating the user device and a network device through a network. In a preferred embodiment of the present application, thedevice 1 is preferably a source virtual switch, however, it should be understood by those skilled in the art that thedevice 1 is only a preferred embodiment of the present application, and other existing or future existingdevices 1 may also be included in the scope of the present application, if applicable, and are hereby incorporated by reference.
The above devices are operated continuously, and herein, those skilled in the art should understand that "continuously" means that the above devices are operated in real time or according to the set or real-time adjusted operating mode requirement.
In the following preferred embodiments of the present application, a forwarding process of a packet between a source virtual switch corresponding to a source virtual machine and a switch corresponding to a target virtual machine is described by taking a communication scenario between two virtual machines belonging to a certain virtual network as an example.
Before receiving, in the receiving apparatus 801, an IP packet to be sent to a target virtual machine from a source virtual machine, thedevice 1 further includes a request responding apparatus 803, where the request responding apparatus 803 receives an ARP request corresponding to the IP packet to be sent, which is sent by the source virtual machine; and sending ARP response information to the source virtual machine based on the ARP request.
In the request response unit 803, the ARP response information includes a fake MAC address, where the fake MAC address is an invalid MAC address of the IP address of the target virtual machine, i.e. a non-real MAC address.
For example, when a user's source Virtual Machine (VM 1) is to access a target Virtual Machine VM2 of the same Virtual network, the internet protocol addresses (IP addresses) of the source Virtual Machine VM1 are: 192.168.0.1, the IP address of the target virtual machine is: 192.168.0.2, first, the source virtual switch vSwitch1 receives an Address Resolution Protocol (ARP) request for inquiring about a Media Access Control (MAC) Address of the target virtual machine VM2, which is sent from the source virtual machine VM1, as shown in fig. 2. To avoid relying on multicast for ARP addressing as in the prior art, the present application does not need to address with the MAC address of the target virtual machine VM2, so for the IP of the querying target virtual machine VM 2: 192.168.0.2, the source virtual switch vSwitch1 replies directly with a fake MAC address containing the target virtual machine VM 2: ff, the ARP reply information, as shown by the false MAC address in the neighbor table in fig. 2, terminates the ARP request inside the source virtual switch vSwitch1, avoids the resource overhead caused by sending out the ARP request through multicast/broadcast in a distributed system with a large network scale, thereby achieving the purpose of improving network scalability and stability, and being more efficient.
After the request responding apparatus 803 sends ARP responding information to the source virtual machine VM1, the receiving apparatus 801 in the source virtual switch vSwitch1 receives an IP packet sent by the source virtual machine VM1 based on the ARP responding information, where the IP packet includes a fake MAC address of the targetvirtual machine VM 2.
Here, the IP packet includes not only the IP address of the target virtual machine VM2 and its corresponding false MAC address and actual content, but also the IP address of the source virtual machine VM1 and its corresponding real MAC address, where the actual content includes a communication packet for instructing the source virtual machine to send to the target virtual machine.
After receiving, in the receiving apparatus 801, an IP packet sent by the source virtual machine VM1 based on ARP reply information, the sending apparatus 802 includes: the device comprises an acquisition unit (not shown), a search generation unit (not shown) and a sending unit (not shown), wherein the acquisition unit (not shown), the search generation unit (not shown) and the sending unit (not shown) are used for generating a VxLAN message based on the IP message and sending the VxLAN message to a switch corresponding to a target virtual machine according to a preset address table.
The obtaining unit (not shown) is configured to obtain the address table, where the address table records a mapping relationship between an IP address of a target virtual machine and an IP address of a host of the target virtual machine. The source virtual switch vSwitch1 searches a routing table for indicating a path where the IP address of the target virtual machine is located according to the IP address of the target virtual machine in the IP packet, and matches a route of the subnet in the virtual network according to the routing table to obtain an address table in which a mapping relationship between the IP address of the target virtual machine and the IP address of the host is recorded, as shown in fig. 3.
The search generation unit (not shown) is configured to search the address table for the IP address of the host corresponding to the IP address of the target virtual machine, and generate a VxLAN message based on the IP message and the IP address of the host. The IP address of the corresponding host machine in the address table is searched through the IP address of the target virtual machine, the target MAC address in the IP message and the MAC address of the source virtual machine are removed, then the IP message without the MAC address and the IP address of the host machine are subjected to VxLAN encapsulation to obtain the VxLAN message, so that the header length in the VxLAN message is reduced, and the bandwidth utilization rate is effectively improved, as shown in FIG. 3.
The sending unit (not shown) is configured to send the VxLAN packet to a switch corresponding to a target virtual machine, where the target virtual machine and the switch corresponding to the target virtual machine are located on the same host machine. And sending the VxLAN message to a physical network through a User Datagram Protocol (UDP) socket, so that the VxLAN message is sent to a switch in the host machine corresponding to the IP address of the target virtual machine through the physical network, as shown in FIG. 3.
Further, the look-up generating unit (not shown) is configured to:
if the IP address of the corresponding host machine is not found from the address table;
sending a learning message for inquiring the IP address of the corresponding host machine;
and acquiring the IP address of the corresponding host machine returned according to the learning message, and adding the acquired IP address of the corresponding host machine into the address table.
In the lookup generating unit (not shown), if the IP address of the target virtual machine is not recorded in the address table in the source virtual switch, in a preferred embodiment of the present application, an idea implementation and an address table generation method for Software Defined Network (SDN) are selected for reference. Of course, other existing or future implementations and concepts for generating the address table are also contemplated as may be applicable to the present application and are intended to be included within the scope of the present application and are hereby incorporated by reference.
In a preferred embodiment of the present application, the obtaining of the address table in the source virtual switch vSwitch1 may be actively issued by an SDN control plane to obtain the address table in the whole network, or may be learned by the SDN control plane. Wherein learning by the SDN control plane comprises: when the IP address of the target virtual machine in the IP message sent by the source virtual machine VM1 is not recorded in the address table of the source virtual switch vSwitch1, the source virtual switch vSwitch1 sends a learning message for searching the IP address of the corresponding host to the SDN control plane, so as to obtain the IP address of the corresponding host returned according to the learning message from the SDN control plane, encapsulate the obtained IP address of the corresponding host into the VxLAN message, and add the mapping relationship between the IP address of the target virtual machine and the IP address of the corresponding host into the address table, so that not only the IP address of the corresponding host is obtained, but also the purpose of updating the address table is achieved.
When the VxLAN message sent by the source virtual switch vSwitch1 reaches the host corresponding to the IP address of the corresponding host through the physical network, the structure of the destination virtual switch vSwitch2 in the host corresponding to the IP address of the host is as indevice 1.
Fig. 5 is a schematic structural diagram of an apparatus for receiving a message at a switch end according to an aspect of the present application, where theapparatus 2 includes amessage receiving device 101 and amessage sending device 102, where themessage receiving device 101 is configured to receive the VxLAN message; themessage sending device 102 is configured to decapsulate the VxLAN message to obtain an IP message, and send the IP message to a corresponding target virtual machine according to a preset neighbor table, where the IP message includes an IP address of the target virtual machine, and the neighbor table records a mapping relationship between the IP address of the target virtual machine and a destination MAC address of the target virtual machine.
Themessage sending device 102 decapsulates the VxLAN message to obtain an IP message, where the IP message includes an IP address and actual content of a target virtual machine, and the actual content includes a communication data packet used for indicating a source virtual machine to send to the target virtual machine; then, according to the neighbor table in which the mapping relationship between the IP address of the target virtual machine and the destination MAC address thereof is recorded, the destination MAC address corresponding to the IP address of the target virtual machine is written in an IP message, and the IP message is sent to the target virtual machine VM2 based on the destination MAC address, so that the MAC address corresponding to the IP address of the target virtual machine in the IP message is completed in the target virtual switch vSwitch2 by using the preset neighbor table, and the completed IP message is completely sent to the targetvirtual machine VM 2.
Further, themessage sending device 102 decapsulates the received VxLAN message to obtain an IP message, adds an MAC address corresponding to the IP address of the target virtual machine to the IP message, and sends the MAC address to the corresponding target virtual machine, as shown in fig. 4.
Further, themessage sending apparatus 102 includes: a decapsulating unit (not shown), a lookup unit (not shown), and a messaging unit (not shown); wherein,
and the decapsulation unit (not shown) is used for decapsulating the VxLAN message to obtain an IP message. As the VxLAN message is decapsulated to obtain an IP message, because the destination MAC address has been removed from the VxLAN message, in order to add the removed destination MAC address corresponding to the IP address of the target virtual machine VM2 into the IP message without the destination MAC address, the IP message is to be completely sent to the corresponding target virtual machine VM2 based on the destination MAC address, as shown in fig. 4.
The searching unit (not shown) is configured to obtain a neighbor table, and search a destination MAC address corresponding to the IP address of the target virtual machine from the neighbor table. In order to obtain the destination MAC address corresponding to the IP address of the target virtual machine VM2, the destination MAC address corresponding to the IP address of the target virtual machine is searched from the neighbor table in which the mapping relationship between the IP address of the target virtual machine and the destination MAC address is recorded, so as to complete the destination MAC address corresponding to the IP address of the target virtual machine in the IP message.
And a message sending unit (not shown) configured to add the destination MAC address to the IP message, and send the IP message to a target virtual machine. Because the IP packet further includes a false MAC address corresponding to the IP address of the target virtual machine, the false MAC address in the IP packet is replaced with the destination MAC address obtained from the neighbor table to obtain a completed IP packet, and the completed IP packet is sent to the target virtual machine VM2 corresponding to the destination MAC address, so that the purpose of completing the IP packet is facilitated through the neighbor table, and packet communication between the source virtual machine VM1 and the target virtual machine VM2 is realized, as shown in fig. 4.
Further, the lookup unit (not shown) is configured to:
if the corresponding destination MAC address is not found from the neighbor table,
sending a learning message for inquiring a corresponding destination MAC address;
and acquiring a corresponding destination MAC address returned according to the learning message, and adding the acquired corresponding destination MAC address into the neighbor table.
In the lookup unit (not shown), if the IP address of the target virtual machine is not recorded in the neighbor table in the destination virtual switch, in a preferred embodiment of the present application, an idea of using Software Defined Network (SDN) for reference is selected to implement and generate the neighbor table. Of course, other existing or future implementations and concepts for generating the neighbor table are also contemplated as may be applicable to the present application and are intended to be included within the scope of the present application and are hereby incorporated by reference.
In a preferred embodiment of the present application, the acquisition of the neighbor table in the destination virtual switch vSwitch2 may be actively issued by an SDN control plane to acquire the neighbor table in the whole network, or may be learned by the SDN control plane. Wherein learning by the SDN control plane comprises: when the destination virtual switch vSwitch2 decapsulates the VxLAN message from the receiving source to obtain an IP message, if the IP address of the target virtual machine is not recorded in the neighbor table of the destination virtual switch vSwitch2, the destination virtual switch vSwitch2 will send a learning message to the SDN control plane looking for the destination MAC address, to obtain the corresponding destination MAC address returned from the learning packet from the SDN control plane, and the obtained corresponding destination MAC address replaces a false MAC address corresponding to the IP address of the target virtual machine in the IP message, simultaneously adding the mapping relation of the IP address of the target virtual machine and the destination MAC address thereof into the neighbor table, therefore, the target MAC address corresponding to the IP address of the target virtual machine in the IP message is completed, and the purpose of updating the neighbor table in the target virtual switch is achieved.
In a preferred application embodiment of the present application, a service traffic communication scenario between two virtual machines belonging to a virtual network is further described, where the service traffic in the preferred application embodiment is mainly a scenario of a small data packet, and by using the method for sending and receiving a message according to the present invention, a ratio of a control message (IP message) can be reduced, and an actual bandwidth utilization rate can be improved. For example, if the length of an IP packet in most of service flows to be sent from a source virtual machine to a target virtual machine is 100 bytes, if the IP packet is encapsulated by using a conventional VxLAN protocol so as to obtain an encapsulated VxLAN packet with a total length of 150 bytes, the IP packet is subjected to a destination MAC address removal and encapsulation by using the method for sending a packet according to the present application so as to obtain a VxLAN packet, and the VxLAN packet is sent to the target virtual machine based on a preset address table, where the total length of the VxLAN packet is 136 bytes, so that the actual utilization rate of a bandwidth is effectively increased by 10%.
Compared with the prior art, the method and the device for sending the message are characterized in that the IP message to be sent to the target virtual machine is received from the source virtual machine, then the target MAC address in the IP message is removed to generate the VxLAN message, and finally the VxLAN message is sent to the switch corresponding to the target virtual machine according to the preset address table recorded with the mapping relation between the IP address of the target virtual machine and the IP address of the host machine.
Further, before receiving the IP packet to be sent to the target virtual machine from the source virtual machine, the method further includes: the method comprises the steps of receiving an ARP request which is sent by a source virtual machine and inquires about the MAC address of a target virtual machine, and avoiding the ARP addressing depending on multicast in the prior art, wherein the ARP addressing is carried out by adopting the IP address based on the target virtual machine, so that ARP response information containing a false MAC address corresponding to the IP address of the target virtual machine is sent to the source virtual machine based on the ARP request, the ARP request is ended in a virtual switch, the resource overhead of multicast/broadcast brought by large network scale is avoided, and the purposes of improving the expandability and stability of the network are achieved.
Further, another aspect of the present application provides a method and an apparatus for receiving a packet, where an IP packet is obtained by receiving and decapsulating the VxLAN packet, a destination MAC address corresponding to an IP address of a target virtual machine is written in the IP packet according to a preset neighbor table in which a mapping relationship between the IP address of the target virtual machine and the destination MAC address is recorded, and the IP packet is sent to the corresponding target virtual machine based on the destination MAC address, so that the neighbor table is used to complete the IP packet at a receiving end of a destination virtual switch, and the IP packet is completely sent to the target virtual machine, thereby implementing complete forwarding of the IP packet between a source virtual machine and the target virtual machine.
There is also provided, in accordance with another aspect of the present application, a computing system comprising one or more computer-readable storage media having thereon computer-executable instructions configured to, when executed by one or more processors of a computing system, cause the computing system to perform a method of sending a message, the method comprising:
receiving an IP message to be sent from a source virtual machine, wherein the IP message comprises an IP address of a target virtual machine;
and generating a VxLAN message based on the IP message, and sending the VxLAN message to a switch corresponding to the target virtual machine according to a preset address table.
There is also provided, in accordance with another aspect of the present application, a computing system comprising one or more computer-readable storage media having thereon computer-executable instructions configured to, when executed by one or more processors of a computing system, cause the intermediary computing system to perform a method of receiving a message, the method comprising:
receiving a VxLAN message;
and decapsulating the VxLAN message to obtain an IP message, and sending the IP message to a corresponding target virtual machine according to a preset neighbor table, wherein the IP message comprises an IP address of the target virtual machine, and the neighbor table records a mapping relation between the IP address of the target virtual machine and a target MAC address thereof.
It should be noted that the present application may be implemented in software and/or a combination of software and hardware, for example, implemented using Application Specific Integrated Circuits (ASICs), general purpose computers or any other similar hardware devices. In one embodiment, the software programs of the present application may be executed by a processor to implement the steps or functions described above. Likewise, the software programs (including associated data structures) of the present application may be stored in a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like. Additionally, some of the steps or functions of the present application may be implemented in hardware, for example, as circuitry that cooperates with the processor to perform various steps or functions.
In addition, some of the present application may be implemented as a computer program product, such as computer program instructions, which when executed by a computer, may invoke or provide methods and/or techniques in accordance with the present application through the operation of the computer. Program instructions which invoke the methods of the present application may be stored on a fixed or removable recording medium and/or transmitted via a data stream on a broadcast or other signal-bearing medium and/or stored within a working memory of a computer device operating in accordance with the program instructions. An embodiment according to the present application comprises an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform a method and/or a solution according to the aforementioned embodiments of the present application.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the apparatus claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.