WO2016107379A1 - Packet sending method and apparatus - Google Patents

Packet sending method and apparatus Download PDF

Info

Publication number
WO2016107379A1
WO2016107379A1 PCT/CN2015/096687 CN2015096687W WO2016107379A1 WO 2016107379 A1 WO2016107379 A1 WO 2016107379A1 CN 2015096687 W CN2015096687 W CN 2015096687W WO 2016107379 A1 WO2016107379 A1 WO 2016107379A1
Authority
WO
WIPO (PCT)
Prior art keywords
packet
service flow
service
processing policy
identifier
Prior art date
Application number
PCT/CN2015/096687
Other languages
French (fr)
Chinese (zh)
Inventor
申思
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2016107379A1 publication Critical patent/WO2016107379A1/en

Links

Images

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a method and apparatus for transmitting a message.
  • the first virtual machine deployed on the first host performs a service interaction with the second virtual machine deployed on the second host
  • the first virtual machine may send a message to the second virtual machine to implement the first virtual Communication between the machine and the second virtual machine.
  • the first virtual machine When the first virtual machine sends a packet to the second virtual machine, the first virtual machine sends a http (Hypertext Transfer Protocol) request to the first host where the first virtual machine is located, where the http request carries the second virtual Address of the machine; the first host encapsulates the http request into a UDP (User Datagram Protocol) packet, and sends the UDP packet to the switch; the switch calculates the UDP packet according to the address of the second virtual machine.
  • the forwarding path sends the packet to the second virtual machine according to the forwarding path of the UDP packet.
  • the switch cannot detect the UDP packet service and cannot perform bandwidth monitoring and path control on the UDP packet.
  • the present invention provides a method and apparatus for transmitting a message.
  • the technical solutions are as follows:
  • the present invention provides a method for transmitting a message, the method comprising:
  • the packet is sent to the second virtual machine according to the processing policy.
  • the processing policy of acquiring the packet according to the service identifier of the service flow includes:
  • the determining, according to the processing policy, whether to send the packet includes:
  • processing policy is used to perform operations other than discarding the message, it is determined to send the message.
  • the sending, by the processing policy, the packet to the second virtual machine includes:
  • the present invention provides a method for sending a message, the method comprising:
  • the obtaining, by the destination address of the service flow, the service identifier of the service flow includes:
  • the present invention provides an apparatus for transmitting a message, the apparatus comprising:
  • the first receiving module is configured to receive a packet sent by the first host where the first virtual machine is located, where the packet carries a service identifier of the service flow, and the service identifier of the service flow is the first host according to the service
  • the destination address of the stream is set and encapsulated into the message
  • a first acquiring module configured to acquire a processing policy of the packet according to the service identifier of the service flow
  • a determining module configured to determine, according to the processing policy, whether to send the message
  • the first sending module is configured to send the packet to the second virtual machine according to the processing policy if the packet is sent.
  • the first acquiring module is configured to obtain the report from a correspondence between a service identifier and a processing policy according to the service identifier of the service flow.
  • the processing strategy of the text is configured to obtain the report from a correspondence between a service identifier and a processing policy according to the service identifier of the service flow.
  • the determining module includes:
  • a first determining unit configured to determine not to send the message if the processing policy is used to discard the message
  • a second determining unit configured to determine to send the message if the processing policy is used to perform operations other than discarding the message.
  • the first sending module includes:
  • a third determining unit configured to determine, according to the identifier of the first virtual machine and the identifier of the second virtual machine, at least one forwarding path used to send the packet;
  • a selecting unit configured to select a forwarding path from the at least one forwarding path according to the processing policy
  • An obtaining unit configured to acquire, according to the processing policy, a bandwidth of the selected forwarding path
  • a setting unit configured to set a bandwidth size of the selected forwarding path according to the acquired bandwidth
  • a sending unit configured to send the packet to the second according to the set forwarding path virtual machine.
  • the present invention provides an apparatus for transmitting a message, the apparatus comprising:
  • a second receiving module configured to receive a service flow sent by the first virtual machine, where the service flow carries a destination address of the service flow
  • a second obtaining module configured to acquire a service identifier of the service flow according to a destination address of the service flow
  • a second sending module configured to encapsulate the service identifier of the service flow into the packet, and send the packet to the switch, so that the switch obtains the processing policy of the packet according to the service identifier of the service flow, And determining, according to the processing policy, whether to send the packet, and if the packet is sent, sending the packet to the second virtual machine according to the processing policy.
  • the second acquiring module is configured to obtain, according to a destination address of the service flow, a correspondence between a destination address and a service identifier. Business identity of the business flow.
  • the present invention provides an apparatus for transmitting a message, the apparatus comprising: a first memory and a first processor, configured to perform the method of transmitting a message as described in the first aspect.
  • the present invention provides an apparatus for transmitting a message, the apparatus comprising: a second memory and a second processor, configured to perform the method of transmitting a message as described in the second aspect.
  • the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
  • FIG. 1-1 is a flowchart of a method for sending a message according to Embodiment 1 of the present invention
  • 1-2 is a flowchart of another method for sending a message according to Embodiment 1 of the present invention.
  • FIG. 2 is a flowchart of a method for sending a message according to Embodiment 2 of the present invention
  • FIG. 3 is a schematic structural diagram of an apparatus for transmitting a message according to Embodiment 3 of the present invention.
  • FIG. 4 is a schematic structural diagram of an apparatus for transmitting a message according to Embodiment 4 of the present invention.
  • FIG. 5 is a schematic structural diagram of an apparatus for transmitting a message according to Embodiment 5 of the present invention.
  • FIG. 6 is a schematic structural diagram of an apparatus for transmitting a message according to Embodiment 6 of the present invention.
  • An embodiment of the present invention provides a method for sending a packet. Referring to FIG. 1-1, the method includes:
  • Step 101a Receive a packet sent by the first host where the first virtual machine is located, where the packet carries the service identifier of the service flow, and the service identifier of the service flow is set by the first host according to the destination address of the service flow and encapsulated into the packet. of;
  • Step 102a Obtain a processing policy of the packet according to the service identifier of the service flow.
  • Step 103a Determine, according to the processing policy, whether to send a message
  • Step 104a If the packet is sent, the packet is sent to the second virtual machine according to the processing policy.
  • An embodiment of the present invention provides a method for sending a packet. Referring to Figure 1-2, the method includes:
  • Step 101b Receive a service flow sent by the first virtual machine, where the service flow carries a destination address of the service flow.
  • Step 102b Obtain a service identifier of the service flow according to the destination address of the service flow.
  • the service identifier of the service flow is encapsulated into the packet, and the packet is sent to the switch, so that the switch obtains the packet processing policy according to the service identifier of the service flow, and determines whether to send the packet according to the processing policy, if the packet is sent. Send the packet to the second virtual machine according to the processing policy.
  • the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow.
  • the packet processing policy is obtained; according to the processing policy, it is determined whether to send the packet; if the packet is sent, the packet is sent to the second according to the processing policy. virtual machine.
  • the packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
  • An embodiment of the present invention provides a method for sending a packet. Referring to FIG. 2, the method includes:
  • Step 201 The first host receives a service flow sent by the first virtual machine, where the service flow carries a destination address of the service flow.
  • the first virtual machine is deployed on the first host, and the second virtual machine is deployed on the second host.
  • the first virtual machine sends the service flow to the second virtual machine
  • the first virtual machine firstly goes to the first virtual machine.
  • a host sends a service flow, where the service flow carries at least the destination address of the service flow, and may also carry the identifier of the first virtual machine and the identifier of the second virtual machine; the first host receives the service flow sent by the first virtual machine, and step 202 is performed. .
  • the destination address can be the destination IP address (Internet Protocol), the destination port, or the destination MAC address (Media Access Control) address.
  • the identifier of the first virtual machine may be the IP address of the first virtual machine, the name of the first virtual machine, or the number of the first virtual machine.
  • the identifier of the second virtual machine may be the IP address of the second virtual machine, The name of the second virtual machine or the number of the second virtual machine.
  • the destination address is the destination port 80
  • the identifier of the first virtual machine is 192.231.31.252
  • the identifier of the second virtual machine is 192.231.31.251.
  • the first virtual machine sends a service flow to the first host.
  • the flow carries the destination port 80
  • the identifier of the first virtual machine is 192.231.31.252
  • the identifier of the second virtual machine is 192.23%.
  • the first host receives the service flow sent by the first virtual machine.
  • Step 202 The first host acquires a service identifier of the service flow according to the destination address of the service flow.
  • the user inputs the destination address and the service identifier to the first controller; the first controller receives the destination address and the service identifier input by the user, and stores the destination address and the service identifier entered by the user in the correspondence between the destination address and the service identifier. In the relationship.
  • the first controller sends a correspondence between the destination address and the service identifier to the first host, and the first host receives the correspondence between the destination address and the service identifier sent by the first controller, and stores the correspondence between the destination address and the service identifier.
  • the step 202 may be: the first host obtains the service identifier of the service flow from the correspondence between the destination address and the service identifier according to the destination address of the service flow.
  • the first controller may be an SDN (Software Defined Network) controller or a VxLAN (Virtual eXtension xLAN) controller.
  • SDN Software Defined Network
  • VxLAN Virtual eXtension xLAN
  • the user inputs the destination address 80 and the service identifier 1025, the destination address 443 and the service identifier 2049, the destination address 5000 and the service identifier 4097, and the destination address 5001 and the service identifier 4098 to the first controller.
  • the first controller receives the purpose of the user input.
  • the address 80 and the service identifier 1025, the destination address 443 and the service identifier 2049, the destination address 5000 and the service identifier 4097, and the destination address 5001 and the service identifier 4098 store the destination address and service identifier entered by the user in Table 1 as follows:
  • the first host obtains the service identifier of the service flow as 1025 from the correspondence between the destination address and the service identifier stored in Table 1 according to the destination address 80 of the service flow.
  • the service identifier field ranges from 65535, and 50 virtual machines can be deployed on one host.
  • the service identifier field corresponding to each virtual machine ranges from 1 to 1024, that is, each virtual machine can define up to 1024 service identifiers for policy control of different services.
  • Step 203 The first host encapsulates the service identifier of the service flow into the packet, and sends a packet to the switch.
  • the packet includes an inner packet and an outer packet.
  • the first host encapsulates the service identifier of the service flow into the outer packet.
  • the outer packet includes the source MAC address, the destination MAC address, the VLAN, the source IP address, the destination IP address, the VxLAN port, and the VxLAN header.
  • the first host obtains the source MAC address, destination MAC address, VLAN, source IP address, and destination IP address of the service flow.
  • the VxLAN port and the VxLAN header encapsulate the service ID of the source MAC address, destination MAC address, VLAN, source IP address, destination IP address, VxLAN port, VxLAN header, and packet of the service flow into the outer packet.
  • the inner layer packet includes the source MAC address, the destination MAC address, and the service flow, and the first host obtains the source MAC address, the destination MAC address, and the service flow of the service flow, and encapsulates the source MAC address, the destination MAC address, and the service flow of the service flow into the inner layer. In the message.
  • Step 204 The switch receives the packet sent by the first host, where the packet carries the service identifier of the service flow.
  • the switch receives the packet sent by the first host, and parses the outer packet of the packet to obtain the service identifier of the service flow. Step 205 is performed.
  • the switch can only parse the outer packet of the packet and cannot parse the inner packet of the packet.
  • Step 205 The switch acquires a processing policy of the packet according to the service identifier of the service flow.
  • the user inputs the service identifier and the processing policy to the second controller.
  • the second controller receives the service identifier and the processing policy input by the user, and stores the service identifier and the processing policy input by the user in the correspondence between the service identifier and the processing policy. In the relationship.
  • the second controller sends a correspondence between the service identifier and the processing policy to the switch, and the switch receives the correspondence between the service identifier and the processing policy sent by the second controller, and stores the correspondence between the service identifier and the processing policy.
  • the switch obtains the processing policy of the packet from the correspondence between the service identifier and the processing policy according to the service identifier of the service flow.
  • the processing policy can be any policy for processing packets, including a processing policy for discarding packets and a processing policy for performing operations other than discarding packets.
  • the processing policy can be a discarding policy or a forwarding policy. , redirection policies, or bandwidth-based path control policies.
  • the second controller may be an SDN controller or an OF (open flow table protocol) controller.
  • the user enters the service identity 1025 and the processing policy to the second controller: normal forwarding, service identity 2049 and processing policy: drop, service identity 4097, and processing policy: redirect to low-weight path, service identity 4098, and processing policy: setting The bandwidth of the forwarding path is 100M, etc.;
  • the second controller receives the service identifier 1025 input by the user and the processing policy: normal forwarding, service identifier 2049, and processing policy: discard, service identifier 4097, and processing policy: redirect to the low-weight path, Service ID 4098 and processing policy: set the bandwidth of the forwarding path to 100M, etc., and store the service identifier and processing policy input by the user in Table 2 as follows:
  • the switch stores the pair of service identifiers and processing policies from Table 2 according to the service identifier 1025.
  • the forwarding policy for obtaining packets in the relationship is normal forwarding.
  • Step 206 The switch determines whether to send the packet according to the processing policy of the packet, if the packet is sent, step 207 is performed; if the packet is not sent, step 212 is performed;
  • the processing policy of the packet is used to discard the packet, it is determined that the packet is not sent; if the processing policy of the packet is used to perform operations other than discarding the packet, it is determined to send the packet. Text.
  • the processing policy of the packet may be a drop policy, a forwarding policy, a redirect policy, or a bandwidth-based path control policy. If the processing policy is a discarding policy, it is determined that the packet is not sent; if the processing policy is a forwarding policy, a redirection policy, or a bandwidth-based path control policy, it is determined to send the packet.
  • Step 207 If the packet is sent, the switch determines at least one forwarding path for sending the packet according to the identifier of the first virtual machine and the identifier of the second virtual machine.
  • the second controller acquires the topology of the physical network where the switch is located, and sends the topology of the physical network to the switch.
  • the switch receives the topology of the physical network sent by the second controller and stores the topology of the physical network.
  • the step 207 may be: if the packet is sent, the switch determines at least one forwarding path for sending the packet according to the identifier of the first virtual machine, the identifier of the second virtual machine, and the topology of the physical network.
  • the at least one forwarding path for sending the packet is determined according to the identifier of the first virtual machine, the identifier of the second virtual machine, and the topology of the physical network.
  • the forwarding path is not described in detail.
  • the switch obtains the path weight of each forwarding path according to the path identifier of each forwarding path in the at least one forwarding path.
  • the user inputs a weighting rule to the second controller, and the weighting rule may be set according to the number of forwarding entities included in the forwarding path.
  • the second controller receives the weighting rule input by the user, and generates a path weight of each forwarding path in the physical network according to the weighting rule, and stores the path identifier of each forwarding path and the path weight corresponding to each forwarding path in the path identifier and In the correspondence of path weights.
  • the second controller sends a correspondence between the path identifier and the path weight to the switch; the switch receives the correspondence between the path identifier and the path weight sent by the second controller, and stores the correspondence between the path identifier and the path weight.
  • each piece is obtained according to the path identifier of each forwarding path in at least one forwarding path.
  • the path weight of the forwarding path can be:
  • the path weight of each forwarding path is obtained from the correspondence between the path identifier and the path weight according to the path identifier of each forwarding path in the at least one forwarding path.
  • the weighting rule input by the user to the second controller is: the path weight of the forwarding path including the forwarding entity between 1-5 is 500, and the path weight of the forwarding path including the forwarding entity between 6-10 is 400.
  • the path weight of the forwarding path including the forwarding entity between 11 and 15 is 300, and the path weight of the forwarding path including the forwarding entity between 16 and 20 is 200, and the path weight of the forwarding path including the forwarding entity is 100.
  • the second controller receives the weighting rule input by the user, and the path weight corresponding to the path 1 is 100 according to the weight rule, the path weight corresponding to the path 2 is 500, the path weight corresponding to the path 3 is 200, and the path weight corresponding to the path 4 is 300.
  • Etc the second controller stores path 1, path 2, path 3, and path 4 and their corresponding path weights in Table 3 below:
  • the switch determines, according to the identifier of the first virtual machine and the identifier of the second virtual machine, that the three paths for sending the packet are path 1, path 2, and path 3, respectively, and according to path 1, path 2, and
  • the path identifier of path 3 the path weights corresponding to path 1, path 2, and path 3 from Table 3 are 100, 500, and 200, respectively.
  • Step 208 The switch selects a forwarding path from at least one forwarding path according to the processing policy of the packet.
  • one forwarding path is randomly selected from at least one forwarding path.
  • the redirection condition included in the processing policy of the packet is obtained, and one forwarding path that satisfies the redirection condition is selected from the at least one forwarding path. For example, if the condition of the redirection is to select the forwarding path with the highest weight, then according to the path weight of each forwarding path, select one forwarding path with the highest path weight from at least one forwarding path; if the redirection condition is to select the forwarding with the lowest weight The path selects a forwarding path with the lowest path weight from at least one forwarding path according to the path weight of each forwarding path.
  • path 1 For example, if the processing strategy of the packet is to redirect to the lowest weight forwarding path, then the path with the lowest path weight selected from path 1, path 2, and path 3 is path 1.
  • Step 209 The switch acquires the bandwidth of the selected forwarding path according to the processing policy of the packet.
  • Each processing policy corresponds to the bandwidth of a forwarding path, and the bandwidth of the selected forwarding path is obtained according to the processing policy of the packet.
  • the bandwidth corresponding to the forwarding policy and the redirection policy is the default bandwidth.
  • the bandwidth corresponding to the bandwidth-based path control policy is the bandwidth included in the processing policy.
  • the bandwidth corresponding to the forwarding policy and the redirection policy is 50M
  • the bandwidth-based path control policy includes the bandwidth corresponding to the forwarding path being 100M.
  • Step 210 The switch sets a bandwidth size of the selected forwarding path according to the acquired bandwidth.
  • the switch sets the bandwidth size of the selected forwarding path to the acquired bandwidth.
  • the bandwidth size of path 1 is set to 100M.
  • Step 211 The switch sends the packet to the second virtual machine according to the set forwarding path.
  • the switch forwards the packet to the second host where the second virtual machine is located according to the set forwarding path, and the second host receives the packet sent by the switch, decapsulates the packet, and obtains the second virtual machine.
  • the identifier and the service flow are sent to the second virtual machine according to the identifier of the second virtual machine.
  • Step 212 If the packet is not sent, the switch discards the packet.
  • the switch does not send the packet and discards the packet.
  • the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
  • An embodiment of the present invention provides an apparatus for transmitting a message.
  • the apparatus includes:
  • the first receiving module 301 is configured to receive a packet sent by the first host where the first virtual machine is located, where the packet carries the service identifier of the service flow, and the service identifier of the service flow is the destination of the first host according to the service flow. Address is set and encapsulated in the message;
  • the first obtaining module 302 is configured to obtain a processing policy of the packet according to the service identifier of the service flow.
  • a determining module 303 configured to determine whether to send a message according to the processing policy
  • the first sending module 304 is configured to send the packet to the second virtual machine according to the processing policy if the packet is sent.
  • the first obtaining module 302 is configured to obtain a processing policy of the packet from the correspondence between the service identifier and the processing policy according to the service identifier of the service flow.
  • the determining module 303 includes:
  • a first determining unit configured to determine that the packet is not sent if the processing policy is used to discard the packet
  • a second determining unit configured to determine to send the message if the processing policy is used to perform operations other than discarding the message.
  • the first sending module 304 includes:
  • a third determining unit configured to determine, according to the identifier of the first virtual machine and the identifier of the second virtual machine, at least one forwarding path for sending the packet
  • a selecting unit configured to select a forwarding path from the at least one forwarding path according to the processing policy
  • An obtaining unit configured to obtain a bandwidth of the selected forwarding path according to the processing policy
  • a setting unit configured to set a bandwidth size of the selected forwarding path according to the acquired bandwidth
  • the sending unit is configured to send the packet to the second virtual machine according to the set forwarding path.
  • the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
  • An embodiment of the present invention provides an apparatus for transmitting a message.
  • the apparatus includes:
  • the second receiving module 401 is configured to receive a service flow sent by the first virtual machine, where the service flow carries a destination address of the service flow;
  • the second obtaining module 402 is configured to obtain a service identifier of the service flow according to the destination address of the service flow.
  • the second sending module 403 is configured to encapsulate the service identifier of the service flow into the packet, and send the packet to the switch.
  • the packet is sent, so that the switch obtains the packet processing policy according to the service identifier of the service flow, and determines whether to send the packet according to the processing policy. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy.
  • the second obtaining module 402 is configured to obtain the service identifier of the service flow from the correspondence between the destination address and the service identifier according to the destination address of the service flow.
  • the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
  • An embodiment of the present invention provides an apparatus for transmitting a message.
  • the apparatus includes: a first memory 501 and a first processor 502, configured to perform the following method of sending a message:
  • the packet is sent to the second virtual machine according to the processing policy.
  • the processing policy for obtaining the packet according to the service identifier of the service flow includes:
  • the determining, according to the processing policy, whether to send the packet includes:
  • processing policy is used to perform operations other than discarding the message, it is determined to send the message.
  • the sending the packet to the second virtual machine according to the processing policy includes:
  • the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
  • An embodiment of the present invention provides an apparatus for transmitting a message.
  • the apparatus includes: a second memory 601 and a second processor 602, configured to perform the following method of sending a message:
  • the obtaining the service identifier of the service flow according to the destination address of the service flow includes:
  • the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
  • the device that sends the packet is sent by the foregoing embodiment, only the division of each functional module is used as an example. In an actual application, the function may be allocated by different functional modules according to requirements. Upon completion, the internal structure of the device is divided into different functional modules to perform all or part of the functions described above.
  • the apparatus for sending a message and the method for sending a message provided by the foregoing embodiment are in the same concept, and the specific implementation process is described in the method embodiment, and details are not described herein again.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Abstract

The present invention relates to the technical field of communications and disclosed are a packet sending method and apparatus. The method comprises: receiving a packet sent by a first main machine in which a first virtual machine resides, the packet carries a service identification of a service flow, the service identification of the service flow is set and encapsulated in the packet by the first main machine according to a destination address of the service flow; according to the service identification of the service flow, obtaining a processing policy of the packet; according to the processing policy, determining whether to send the packet; if so, according to the processing policy, sending the packet to a second virtual machine. The apparatus comprises: a first receiving module, a first obtaining module, a determining module, and a first sending module. Since the packet in the present invention carries the service identification of the service flow, a policy control can be performed on the packet according to the service identification of the service flow.

Description

一种发送报文的方法和装置Method and device for transmitting messages
本申请要求于2014年12月31日提交中国专利局、申请号为201410855294.6、发明名称为“一种发送报文的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 201410855294.6, entitled "A Method and Apparatus for Sending Messages", filed on December 31, 2014, the entire contents of which are incorporated herein by reference. In the application.
技术领域Technical field
本发明涉及通信技术领域,特别涉及一种发送报文的方法和装置。The present invention relates to the field of communications technologies, and in particular, to a method and apparatus for transmitting a message.
背景技术Background technique
随着虚拟机化技术和云处理技术的快速发展,云存储中的每个主机上都会部署多台虚拟机,并且部署在不同主机上的两个虚拟机之间可以进行业务交互。当部署在第一主机上的第一虚拟机与部署在第二主机上的第二虚拟机之间进行业务交互时,第一虚拟机可以向第二虚拟机发送报文,以实现第一虚拟机和第二虚拟机之间的通信。With the rapid development of virtual machine technology and cloud processing technology, multiple virtual machines are deployed on each host in the cloud storage, and business interaction can be performed between two virtual machines deployed on different hosts. When the first virtual machine deployed on the first host performs a service interaction with the second virtual machine deployed on the second host, the first virtual machine may send a message to the second virtual machine to implement the first virtual Communication between the machine and the second virtual machine.
当第一虚拟机向第二虚拟机发送报文时,第一虚拟机向第一虚拟机所在的第一主机发送http(Hypertext transfer protocol,超文本传送协议)请求,该http请求携带第二虚拟机的地址;第一主机将该http请求封装为UDP(User Datagram Protocol,用户数据包协议)报文,并将该UDP报文发送给交换机;交换机根据第二虚拟机的地址计算该UDP报文的转发路径,根据该UDP报文的转发路径向第二虚拟机发送该报文。When the first virtual machine sends a packet to the second virtual machine, the first virtual machine sends a http (Hypertext Transfer Protocol) request to the first host where the first virtual machine is located, where the http request carries the second virtual Address of the machine; the first host encapsulates the http request into a UDP (User Datagram Protocol) packet, and sends the UDP packet to the switch; the switch calculates the UDP packet according to the address of the second virtual machine. The forwarding path sends the packet to the second virtual machine according to the forwarding path of the UDP packet.
在实现本发明的过程中,发明人发现现有技术至少存在以下问题:In the process of implementing the present invention, the inventors have found that the prior art has at least the following problems:
由于交换机无法感知UDP报文的业务,无法对该UDP报文进行带宽监控和路径控制。The switch cannot detect the UDP packet service and cannot perform bandwidth monitoring and path control on the UDP packet.
发明内容Summary of the invention
为了使解决现有技术的问题,本发明提供了一种发送报文的方法和装置。技术方案如下:In order to solve the problems of the prior art, the present invention provides a method and apparatus for transmitting a message. The technical solutions are as follows:
第一方面,本发明提供了一种发送报文的方法,所述方法包括:In a first aspect, the present invention provides a method for transmitting a message, the method comprising:
接收第一虚拟机所在的第一主机发送的报文,所述报文携带业务流的业务标识,所述业务流的业务标识为所述第一主机根据所述业务流的目的地址设置 并封装到所述报文中的;Receiving a packet sent by the first host where the first virtual machine is located, where the packet carries a service identifier of the service flow, and the service identifier of the service flow is set by the first host according to the destination address of the service flow. And encapsulated into the message;
根据所述业务流的业务标识,获取所述报文的处理策略;Obtaining a processing policy of the packet according to the service identifier of the service flow;
根据所述处理策略,确定是否发送所述报文;Determining whether to send the message according to the processing policy;
如果发送所述报文,则根据所述处理策略,将所述报文发送给第二虚拟机。If the packet is sent, the packet is sent to the second virtual machine according to the processing policy.
结合第一方面,在第一方面的第一种可能的实现方式中,所述根据所述业务流的业务标识,获取所述报文的处理策略,包括:With reference to the first aspect, in a first possible implementation manner of the first aspect, the processing policy of acquiring the packet according to the service identifier of the service flow includes:
根据所述业务流的业务标识,从业务标识和处理策略的对应关系中获取所述报文的处理策略。And obtaining, according to the service identifier of the service flow, a processing policy of the packet from a correspondence between the service identifier and the processing policy.
结合第一方面,在第一方面的第二种可能的实现方式中,所述根据所述处理策略,确定是否发送所述报文,包括:With reference to the first aspect, in a second possible implementation manner of the first aspect, the determining, according to the processing policy, whether to send the packet includes:
如果所述处理策略用于丢弃所述报文,则确定不发送所述报文;If the processing policy is used to discard the packet, determining to not send the packet;
如果所述处理策略用于对所述报文执行除丢弃以外的其他操作,则确定发送所述报文。If the processing policy is used to perform operations other than discarding the message, it is determined to send the message.
结合第一方面,在第一方面的第三种可能的实现方式中,所述根据所述处理策略,将所述报文发送给第二虚拟机,包括:With reference to the first aspect, in a third possible implementation manner of the first aspect, the sending, by the processing policy, the packet to the second virtual machine includes:
根据第一虚拟机的标识和第二虚拟机的标识,确定用于发送所述报文的至少一条转发路径;Determining, according to the identifier of the first virtual machine and the identifier of the second virtual machine, at least one forwarding path for sending the packet;
根据所述处理策略,从所述至少一条转发路径中选择转发路径;Determining a forwarding path from the at least one forwarding path according to the processing policy;
根据所述处理策略,获取所述选择的转发路径的带宽;Obtaining a bandwidth of the selected forwarding path according to the processing policy;
根据所述获取的带宽,设置所述选择的转发路径的带宽大小;Setting a bandwidth size of the selected forwarding path according to the acquired bandwidth;
根据所述设置后的转发路径,将所述报文发送给所述第二虚拟机。And sending the packet to the second virtual machine according to the set forwarding path.
第二方面,本发明提供了一种发送报文的方法,所述方法包括:In a second aspect, the present invention provides a method for sending a message, the method comprising:
接收第一虚拟机发送的业务流,所述业务流携带所述业务流的目的地址;Receiving a service flow sent by the first virtual machine, where the service flow carries a destination address of the service flow;
根据所述业务流的目的地址,获取所述业务流的业务标识;Obtaining a service identifier of the service flow according to the destination address of the service flow;
将所述业务流的业务标识封装到报文中,向交换机发送所述报文,使所述交换机根据所述业务流的业务标识获取所述报文的处理策略,并根据所述处理策略确定是否发送所述报文,如果发送所述报文,根据所述处理策略将所述报文发送给第二虚拟机。Encapsulating the service identifier of the service flow into the packet, and sending the packet to the switch, so that the switch obtains the processing policy of the packet according to the service identifier of the service flow, and determines according to the processing policy. Whether the packet is sent, and if the packet is sent, the packet is sent to the second virtual machine according to the processing policy.
结合第二方面,在第二方面的第一种可能的实现方式中,所述根据所述业务流的目的地址,获取所述业务流的业务标识,包括: With reference to the second aspect, in a first possible implementation manner of the second aspect, the obtaining, by the destination address of the service flow, the service identifier of the service flow, includes:
根据所述业务流的目的地址,从目的地址和业务标识的对应关系中获取所述业务流的业务标识。Obtaining, according to the destination address of the service flow, the service identifier of the service flow from the correspondence between the destination address and the service identifier.
第三方面,本发明提供了一种发送报文的装置,所述装置包括:In a third aspect, the present invention provides an apparatus for transmitting a message, the apparatus comprising:
第一接收模块,用于接收第一虚拟机所在的第一主机发送的报文,所述报文携带业务流的业务标识,所述业务流的业务标识为所述第一主机根据所述业务流的目的地址设置并封装到所述报文中的;The first receiving module is configured to receive a packet sent by the first host where the first virtual machine is located, where the packet carries a service identifier of the service flow, and the service identifier of the service flow is the first host according to the service The destination address of the stream is set and encapsulated into the message;
第一获取模块,用于根据所述业务流的业务标识,获取所述报文的处理策略;a first acquiring module, configured to acquire a processing policy of the packet according to the service identifier of the service flow;
确定模块,用于根据所述处理策略,确定是否发送所述报文;a determining module, configured to determine, according to the processing policy, whether to send the message;
第一发送模块,用于如果发送所述报文,则根据所述处理策略,将所述报文发送给第二虚拟机。The first sending module is configured to send the packet to the second virtual machine according to the processing policy if the packet is sent.
结合第三方面,在第三方面第一种可能的实现方式中,所述第一获取模块,用于根据所述业务流的业务标识,从业务标识和处理策略的对应关系中获取所述报文的处理策略。With reference to the third aspect, in a first possible implementation manner of the third aspect, the first acquiring module is configured to obtain the report from a correspondence between a service identifier and a processing policy according to the service identifier of the service flow. The processing strategy of the text.
结合第三方面,在第三方面第二种可能的实现方式中,所述确定模块,包括:With reference to the third aspect, in a second possible implementation manner of the third aspect, the determining module includes:
第一确定单元,用于如果所述处理策略用于丢弃所述报文,则确定不发送所述报文;a first determining unit, configured to determine not to send the message if the processing policy is used to discard the message;
第二确定单元,用于如果所述处理策略用于对所述报文执行除丢弃以外的其他操作,则确定发送所述报文。And a second determining unit, configured to determine to send the message if the processing policy is used to perform operations other than discarding the message.
结合第三方面,在第三方面第三种可能的实现方式中,第一发送模块,包括:With reference to the third aspect, in a third possible implementation manner of the third aspect, the first sending module includes:
第三确定单元,用于根据第一虚拟机的标识和第二虚拟机的标识,确定用于发送所述报文的至少一条转发路径;a third determining unit, configured to determine, according to the identifier of the first virtual machine and the identifier of the second virtual machine, at least one forwarding path used to send the packet;
选择单元,用于根据所述处理策略,从所述至少一条转发路径中选择转发路径;a selecting unit, configured to select a forwarding path from the at least one forwarding path according to the processing policy;
获取单元,用于根据所述处理策略,获取所述选择的转发路径的带宽;An obtaining unit, configured to acquire, according to the processing policy, a bandwidth of the selected forwarding path;
设置单元,用于根据所述获取的带宽,设置所述选择的转发路径的带宽大小;a setting unit, configured to set a bandwidth size of the selected forwarding path according to the acquired bandwidth;
发送单元,用于根据所述设置后的转发路径,将所述报文发送给所述第二 虚拟机。a sending unit, configured to send the packet to the second according to the set forwarding path virtual machine.
第四方面,本发明提供了一种发送报文的装置,所述装置包括:In a fourth aspect, the present invention provides an apparatus for transmitting a message, the apparatus comprising:
第二接收模块,用于接收第一虚拟机发送的业务流,所述业务流携带所述业务流的目的地址;a second receiving module, configured to receive a service flow sent by the first virtual machine, where the service flow carries a destination address of the service flow;
第二获取模块,用于根据所述业务流的目的地址,获取所述业务流的业务标识;a second obtaining module, configured to acquire a service identifier of the service flow according to a destination address of the service flow;
第二发送模块,用于将所述业务流的业务标识封装到报文中,向交换机发送所述报文,使所述交换机根据所述业务流的业务标识获取所述报文的处理策略,并根据所述处理策略确定是否发送所述报文,如果发送所述报文,根据所述处理策略将所述报文发送给第二虚拟机。a second sending module, configured to encapsulate the service identifier of the service flow into the packet, and send the packet to the switch, so that the switch obtains the processing policy of the packet according to the service identifier of the service flow, And determining, according to the processing policy, whether to send the packet, and if the packet is sent, sending the packet to the second virtual machine according to the processing policy.
结合第四方面,在第四方面的第一种可能的实现方式中,所述第二获取模块,用于根据所述业务流的目的地址,从目的地址和业务标识的对应关系中获取所述业务流的业务标识。With reference to the fourth aspect, in a first possible implementation manner of the fourth aspect, the second acquiring module is configured to obtain, according to a destination address of the service flow, a correspondence between a destination address and a service identifier. Business identity of the business flow.
第五方面,本发明提供了一种发送报文的装置,所述装置包括:第一存储器和第一处理器,用于执行如第一方面所述的发送报文的方法。In a fifth aspect, the present invention provides an apparatus for transmitting a message, the apparatus comprising: a first memory and a first processor, configured to perform the method of transmitting a message as described in the first aspect.
第六方面,本发明提供了一种发送报文的装置,所述装置包括:第二存储器和第二处理器,用于执行如第二方面所述的发送报文的方法。In a sixth aspect, the present invention provides an apparatus for transmitting a message, the apparatus comprising: a second memory and a second processor, configured to perform the method of transmitting a message as described in the second aspect.
在本发明中,接收第一虚拟机所在的第一主机发送的报文,该报文携带业务流的业务标识,业务流的业务标识为第一主机根据业务流的目的地址设置并封装到报文中的;根据业务流的业务标识,获取报文的处理策略;根据处理策略,确定是否发送报文;如果发送报文,则根据处理策略,将报文发送给第二虚拟机。由于报文中携带业务流的业务标识,从而能够根据业务流的业务标识对报文进行策略控制。In the present invention, the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
附图说明DRAWINGS
图1-1是本发明实施例1提供的一种发送报文的方法流程图;1-1 is a flowchart of a method for sending a message according to Embodiment 1 of the present invention;
图1-2是本发明实施例1提供的另一种发送报文的方法流程图;1-2 is a flowchart of another method for sending a message according to Embodiment 1 of the present invention;
图2是本发明实施例2提供的一种发送报文的方法流程图; 2 is a flowchart of a method for sending a message according to Embodiment 2 of the present invention;
图3是本发明实施例3提供的一种发送报文的装置结构示意图;3 is a schematic structural diagram of an apparatus for transmitting a message according to Embodiment 3 of the present invention;
图4是本发明实施例4提供的一种发送报文的装置结构示意图;4 is a schematic structural diagram of an apparatus for transmitting a message according to Embodiment 4 of the present invention;
图5是本发明实施例5提供的一种发送报文的装置结构示意图;FIG. 5 is a schematic structural diagram of an apparatus for transmitting a message according to Embodiment 5 of the present invention; FIG.
图6是本发明实施例6提供的一种发送报文的装置结构示意图。FIG. 6 is a schematic structural diagram of an apparatus for transmitting a message according to Embodiment 6 of the present invention.
具体实施方式detailed description
为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施方式作进一步地详细描述。The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
实施例1Example 1
本发明实施例提供了一种发送报文的方法,参见图1-1,其中,该方法包括:An embodiment of the present invention provides a method for sending a packet. Referring to FIG. 1-1, the method includes:
步骤101a:接收第一虚拟机所在的第一主机发送的报文,该报文携带业务流的业务标识,业务流的业务标识为第一主机根据业务流的目的地址设置并封装到报文中的; Step 101a: Receive a packet sent by the first host where the first virtual machine is located, where the packet carries the service identifier of the service flow, and the service identifier of the service flow is set by the first host according to the destination address of the service flow and encapsulated into the packet. of;
步骤102a:根据业务流的业务标识,获取报文的处理策略; Step 102a: Obtain a processing policy of the packet according to the service identifier of the service flow.
步骤103a:根据处理策略,确定是否发送报文; Step 103a: Determine, according to the processing policy, whether to send a message;
步骤104a:如果发送报文,则根据处理策略,将报文发送给第二虚拟机。 Step 104a: If the packet is sent, the packet is sent to the second virtual machine according to the processing policy.
本发明实施例提供了一种发送报文的方法,参见图1-2,其中,该方法包括:An embodiment of the present invention provides a method for sending a packet. Referring to Figure 1-2, the method includes:
步骤101b:接收第一虚拟机发送的业务流,该业务流携带业务流的目的地址; Step 101b: Receive a service flow sent by the first virtual machine, where the service flow carries a destination address of the service flow.
步骤102b:根据业务流的目的地址,获取业务流的业务标识; Step 102b: Obtain a service identifier of the service flow according to the destination address of the service flow.
步骤103b:将业务流的业务标识封装到报文中,向交换机发送报文,使交换机根据业务流的业务标识获取报文的处理策略,并根据处理策略确定是否发送报文,如果发送报文,根据处理策略将报文发送给第二虚拟机。In the step 103b, the service identifier of the service flow is encapsulated into the packet, and the packet is sent to the switch, so that the switch obtains the packet processing policy according to the service identifier of the service flow, and determines whether to send the packet according to the processing policy, if the packet is sent. Send the packet to the second virtual machine according to the processing policy.
在本发明中,接收第一虚拟机所在的第一主机发送的报文,该报文携带业务流的业务标识,业务流的业务标识为第一主机根据业务流的目的地址设置并封装到报文中的;根据业务流的业务标识,获取报文的处理策略;根据处理策略,确定是否发送报文;如果发送报文,则根据处理策略,将报文发送给第二 虚拟机。由于报文中携带业务流的业务标识,从而能够根据业务流的业务标识对报文进行策略控制。In the present invention, the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. In the text, according to the service identifier of the service flow, the packet processing policy is obtained; according to the processing policy, it is determined whether to send the packet; if the packet is sent, the packet is sent to the second according to the processing policy. virtual machine. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
实施例2Example 2
本发明实施例提供了一种发送报文的方法,参见图2,其中,该方法包括:An embodiment of the present invention provides a method for sending a packet. Referring to FIG. 2, the method includes:
步骤201:第一主机接收第一虚拟机发送的业务流,该业务流携带业务流的目的地址;Step 201: The first host receives a service flow sent by the first virtual machine, where the service flow carries a destination address of the service flow.
第一虚拟机部署在第一主机上,第二虚拟机部署在第二主机上;当第一虚拟机向第二虚拟机发送业务流时,第一虚拟机首先向第一虚拟机所在的第一主机发送业务流,该业务流至少携带业务流的目的地址,还可以携带第一虚拟机的标识和第二虚拟机的标识;第一主机接收第一虚拟机发送的业务流,执行步骤202。The first virtual machine is deployed on the first host, and the second virtual machine is deployed on the second host. When the first virtual machine sends the service flow to the second virtual machine, the first virtual machine firstly goes to the first virtual machine. A host sends a service flow, where the service flow carries at least the destination address of the service flow, and may also carry the identifier of the first virtual machine and the identifier of the second virtual machine; the first host receives the service flow sent by the first virtual machine, and step 202 is performed. .
目的地址可以为目的IP(Internet Protocol, 网络之间互连的协议)地址、目的端口或者目的MAC(Media Access Control,介质访问控制)地址等。第一虚拟机的标识可以为第一虚拟机的IP地址、第一虚拟机的名称或者第一虚拟机的编号等;同样,第二虚拟机的标识可以为第二虚拟机的IP地址、第二虚拟机的名称或者第二虚拟机的编号等。The destination address can be the destination IP address (Internet Protocol), the destination port, or the destination MAC address (Media Access Control) address. The identifier of the first virtual machine may be the IP address of the first virtual machine, the name of the first virtual machine, or the number of the first virtual machine. Similarly, the identifier of the second virtual machine may be the IP address of the second virtual machine, The name of the second virtual machine or the number of the second virtual machine.
例如,以目的地址为目的端口80,第一虚拟机的标识为192.231.31.252,第二虚拟机的标识为192.231.31.251为例进行说明,第一虚拟机向第一主机发送业务流,该业务流携带目的端口80,第一虚拟机的标识192.231.31.252和第二虚拟机的标识192.231.31.251。第一主机接收第一虚拟机发送的该业务流。For example, the destination address is the destination port 80, the identifier of the first virtual machine is 192.231.31.252, and the identifier of the second virtual machine is 192.231.31.251. The first virtual machine sends a service flow to the first host. The flow carries the destination port 80, the identifier of the first virtual machine is 192.231.31.252 and the identifier of the second virtual machine is 192.23%. The first host receives the service flow sent by the first virtual machine.
步骤202:第一主机根据业务流的目的地址,获取业务流的业务标识;Step 202: The first host acquires a service identifier of the service flow according to the destination address of the service flow.
在本步骤之前,用户向第一控制器输入目的地址和业务标识;第一控制器接收用户输入的目的地址和业务标识,将用户输入的目的地址和业务标识存储在目的地址和业务标识的对应关系中。Before the step, the user inputs the destination address and the service identifier to the first controller; the first controller receives the destination address and the service identifier input by the user, and stores the destination address and the service identifier entered by the user in the correspondence between the destination address and the service identifier. In the relationship.
第一控制器向第一主机发送目的地址和业务标识的对应关系,第一主机接收第一控制器发送的目的地址和业务标识的对应关系,并存储目的地址和业务标识的对应关系。The first controller sends a correspondence between the destination address and the service identifier to the first host, and the first host receives the correspondence between the destination address and the service identifier sent by the first controller, and stores the correspondence between the destination address and the service identifier.
相应的,步骤202可以为:第一主机根据业务流的目的地址,从目的地址和业务标识的对应关系中获取业务流的业务标识。 Correspondingly, the step 202 may be: the first host obtains the service identifier of the service flow from the correspondence between the destination address and the service identifier according to the destination address of the service flow.
第一控制器可以为SDN(Software Defined Network,软件定义网络)控制器或者VxLAN(Virtual eXtension xLAN,虚拟扩展VLAN协议)控制器等。The first controller may be an SDN (Software Defined Network) controller or a VxLAN (Virtual eXtension xLAN) controller.
例如,用户向第一控制器输入目的地址80和业务标识1025,目的地址443和业务标识2049,目的地址5000和业务标识4097以及目的地址5001和业务标识4098;第一控制器接收用户输入的目的地址80和业务标识1025,目的地址443和业务标识2049,目的地址5000和业务标识4097以及目的地址5001和业务标识4098,将用户输入的目的地址和业务标识存储在如下表1中:For example, the user inputs the destination address 80 and the service identifier 1025, the destination address 443 and the service identifier 2049, the destination address 5000 and the service identifier 4097, and the destination address 5001 and the service identifier 4098 to the first controller. The first controller receives the purpose of the user input. The address 80 and the service identifier 1025, the destination address 443 and the service identifier 2049, the destination address 5000 and the service identifier 4097, and the destination address 5001 and the service identifier 4098 store the destination address and service identifier entered by the user in Table 1 as follows:
表1Table 1
目的地址Destination address 业务标识Business identifier
8080 10251025
443443 20492049
50005000 40974097
50015001 40984098
例如,第一主机根据业务流的目的地址80,从表1存储的目的地址和业务标识的对应关系中获取业务流的业务标识为1025。For example, the first host obtains the service identifier of the service flow as 1025 from the correspondence between the destination address and the service identifier stored in Table 1 according to the destination address 80 of the service flow.
其中,业务标识字段范围是65535,一台主机上可以部署50台虚拟机。对于每个虚拟机对应的业务标识字段范围为1-1024,也即每台虚拟机最多可以定义1024个业务标识,用于对不同的业务进行策略控制。The service identifier field ranges from 65535, and 50 virtual machines can be deployed on one host. The service identifier field corresponding to each virtual machine ranges from 1 to 1024, that is, each virtual machine can define up to 1024 service identifiers for policy control of different services.
步骤203:第一主机将业务流的业务标识封装到报文中,向交换机发送报文;Step 203: The first host encapsulates the service identifier of the service flow into the packet, and sends a packet to the switch.
其中,报文包括内层报文和外层报文,本步骤中第一主机将业务流的业务标识封装到外层报文中。The packet includes an inner packet and an outer packet. In this step, the first host encapsulates the service identifier of the service flow into the outer packet.
其中,外层报文中还包括源MAC、目的MAC、VLAN、源IP、目的IP、VxLAN端口、VxLAN头等,第一主机获取该业务流的源MAC、目的MAC、VLAN、源IP、目的IP、VxLAN端口、VxLAN头,将该业务流的源MAC、目的MAC、VLAN、源IP、目的IP、VxLAN端口、VxLAN头和报文的业务标识同时封装到外层报文中。The outer packet includes the source MAC address, the destination MAC address, the VLAN, the source IP address, the destination IP address, the VxLAN port, and the VxLAN header. The first host obtains the source MAC address, destination MAC address, VLAN, source IP address, and destination IP address of the service flow. The VxLAN port and the VxLAN header encapsulate the service ID of the source MAC address, destination MAC address, VLAN, source IP address, destination IP address, VxLAN port, VxLAN header, and packet of the service flow into the outer packet.
其中,内层报文包括源MAC、目的MAC和业务流,第一主机获取该业务流的源MAC、目的MAC和业务流,将该业务流的源MAC、目的MAC和业务流封装到内层报文中。The inner layer packet includes the source MAC address, the destination MAC address, and the service flow, and the first host obtains the source MAC address, the destination MAC address, and the service flow of the service flow, and encapsulates the source MAC address, the destination MAC address, and the service flow of the service flow into the inner layer. In the message.
步骤204:交换机接收第一主机发送的报文,该报文携带该业务流的业务标识; Step 204: The switch receives the packet sent by the first host, where the packet carries the service identifier of the service flow.
交换机接收第一主机发送的报文,解析该报文的外层报文得到该业务流的业务标识,执行步骤205。The switch receives the packet sent by the first host, and parses the outer packet of the packet to obtain the service identifier of the service flow. Step 205 is performed.
需要说明的是,交换机只能解析报文的外层报文,并不能解析报文的内层报文。It should be noted that the switch can only parse the outer packet of the packet and cannot parse the inner packet of the packet.
步骤205:交换机根据业务流的业务标识,获取该报文的处理策略;Step 205: The switch acquires a processing policy of the packet according to the service identifier of the service flow.
在本步骤之前,用户向第二控制器输入业务标识和处理策略;第二控制器接收用户输入的业务标识和处理策略,将用户输入的业务标识和处理策略存储在业务标识和处理策略的对应关系中。Before the step, the user inputs the service identifier and the processing policy to the second controller. The second controller receives the service identifier and the processing policy input by the user, and stores the service identifier and the processing policy input by the user in the correspondence between the service identifier and the processing policy. In the relationship.
第二控制器向交换机发送业务标识和处理策略的对应关系,交换机接收第二控制器发送的业务标识和处理策略的对应关系,并存储业务标识和处理策略的对应关系。The second controller sends a correspondence between the service identifier and the processing policy to the switch, and the switch receives the correspondence between the service identifier and the processing policy sent by the second controller, and stores the correspondence between the service identifier and the processing policy.
相应的,步骤205可以为:交换机根据业务流的业务标识,从业务标识和处理策略的对应关系中获取该报文的处理策略。Correspondingly, in step 205, the switch obtains the processing policy of the packet from the correspondence between the service identifier and the processing policy according to the service identifier of the service flow.
处理策略可以为任一对报文进行处理的策略,包括用于丢弃报文的处理策略和用于对报文执行除丢弃以外的其他操作的处理策略;例如处理策略可以为丢弃策略、转发策略、重定向策略或者基于带宽的路径控制策略等。The processing policy can be any policy for processing packets, including a processing policy for discarding packets and a processing policy for performing operations other than discarding packets. For example, the processing policy can be a discarding policy or a forwarding policy. , redirection policies, or bandwidth-based path control policies.
第二控制器可以为SDN控制器或者OF(openflow,开放流表协议)控制器。The second controller may be an SDN controller or an OF (open flow table protocol) controller.
例如,用户向第二控制器输入业务标识1025和处理策略:正常转发,业务标识2049和处理策略:丢弃,业务标识4097和处理策略:重定向到低权重路径,业务标识4098和处理策略:设置转发路径的带宽大小为100M等;第二控制器接收用户输入的业务标识1025和处理策略:正常转发,业务标识2049和处理策略:丢弃,业务标识4097和处理策略:重定向到低权重路径,业务标识4098和处理策略:设置转发路径的带宽大小为100M等,将用户输入的业务标识和处理策略存储在如下表2中:For example, the user enters the service identity 1025 and the processing policy to the second controller: normal forwarding, service identity 2049 and processing policy: drop, service identity 4097, and processing policy: redirect to low-weight path, service identity 4098, and processing policy: setting The bandwidth of the forwarding path is 100M, etc.; the second controller receives the service identifier 1025 input by the user and the processing policy: normal forwarding, service identifier 2049, and processing policy: discard, service identifier 4097, and processing policy: redirect to the low-weight path, Service ID 4098 and processing policy: set the bandwidth of the forwarding path to 100M, etc., and store the service identifier and processing policy input by the user in Table 2 as follows:
表2Table 2
业务标识Business identifier 处理策略Processing strategy
10251025 正常转发Normal forwarding
20492049 丢弃throw away
40974097 重定向到低权重路径Redirect to low weight path
40984098 设置转发路径的带宽大小为100MSet the bandwidth of the forwarding path to 100M.
例如,交换机根据业务标识1025,从表2存储的业务标识和处理策略的对 应关系中获取报文的转发策略为正常转发。For example, the switch stores the pair of service identifiers and processing policies from Table 2 according to the service identifier 1025. The forwarding policy for obtaining packets in the relationship is normal forwarding.
步骤206:交换机根据该报文的处理策略,确定是否发送该报文,如果发送该报文,执行步骤207;如果不发送该报文,执行步骤212;Step 206: The switch determines whether to send the packet according to the processing policy of the packet, if the packet is sent, step 207 is performed; if the packet is not sent, step 212 is performed;
具体地,如果该报文的处理策略用于丢弃该报文,则确定不发送该报文;如果该报文的处理策略用于对报文执行除丢弃以外的其他操作,则确定发送该报文。Specifically, if the processing policy of the packet is used to discard the packet, it is determined that the packet is not sent; if the processing policy of the packet is used to perform operations other than discarding the packet, it is determined to send the packet. Text.
例如,该报文的处理策略可以为丢弃策略、转发策略、重定向策略或者基于带宽的路径控制策略等。则如果处理策略为丢弃策略,则确定不发送该报文;如果处理策略为转发策略、重定向策略或者基于带宽的路径控制策略,则确定发送该报文。For example, the processing policy of the packet may be a drop policy, a forwarding policy, a redirect policy, or a bandwidth-based path control policy. If the processing policy is a discarding policy, it is determined that the packet is not sent; if the processing policy is a forwarding policy, a redirection policy, or a bandwidth-based path control policy, it is determined to send the packet.
步骤207:如果发送该报文,则交换机根据第一虚拟机的标识和第二虚拟机的标识,确定用于发送该报文的至少一条转发路径;Step 207: If the packet is sent, the switch determines at least one forwarding path for sending the packet according to the identifier of the first virtual machine and the identifier of the second virtual machine.
在本步骤之前,第二控制器获取交换机所在的物理网络的拓扑结构,向交换机发送物理网络的拓扑结构,交换机接收第二控制器发送的物理网络的拓扑结构,并存储物理网络的拓扑结构。Before the step, the second controller acquires the topology of the physical network where the switch is located, and sends the topology of the physical network to the switch. The switch receives the topology of the physical network sent by the second controller and stores the topology of the physical network.
相应的,步骤207可以为:如果发送该报文,则交换机根据第一虚拟机的标识、第二虚拟机的标识以及物理网络的拓扑结构,确定用于发送该报文的至少一条转发路径。Correspondingly, the step 207 may be: if the packet is sent, the switch determines at least one forwarding path for sending the packet according to the identifier of the first virtual machine, the identifier of the second virtual machine, and the topology of the physical network.
根据第一虚拟机的标识、第二虚拟机的标识以及物理网络的拓扑结构,确定用于发送该报文的至少一条转发路径为现有技术,在此不再详细说明。The at least one forwarding path for sending the packet is determined according to the identifier of the first virtual machine, the identifier of the second virtual machine, and the topology of the physical network. The forwarding path is not described in detail.
进一步地,交换机根据至少一条转发路径中的每条转发路径的路径标识,获取每条转发路径的路径权重。Further, the switch obtains the path weight of each forwarding path according to the path identifier of each forwarding path in the at least one forwarding path.
在本步骤之前,用户向第二控制器输入权重规则,该权重规则可以为根据转发路径包括的转发实体的数量进行设置。第二控制器接收用户输入的权重规则,并根据权重规则生成物理网络中的每条转发路径的路径权重,将每条转发路径的路径标识和每条转发路径对应的路径权重存储在路径标识和路径权重的对应关系中。Before this step, the user inputs a weighting rule to the second controller, and the weighting rule may be set according to the number of forwarding entities included in the forwarding path. The second controller receives the weighting rule input by the user, and generates a path weight of each forwarding path in the physical network according to the weighting rule, and stores the path identifier of each forwarding path and the path weight corresponding to each forwarding path in the path identifier and In the correspondence of path weights.
第二控制器向交换机发送路径标识和路径权重的对应关系;交换机接收第二控制器发送的路径标识和路径权重的对应关系,并存储路径标识和路径权重的对应关系。The second controller sends a correspondence between the path identifier and the path weight to the switch; the switch receives the correspondence between the path identifier and the path weight sent by the second controller, and stores the correspondence between the path identifier and the path weight.
相应的,根据至少一条转发路径中的每条转发路径的路径标识,获取每条 转发路径的路径权重,可以为:Correspondingly, each piece is obtained according to the path identifier of each forwarding path in at least one forwarding path. The path weight of the forwarding path can be:
根据至少一条转发路径中的每条转发路径的路径标识,从路径标识和路径权重的对应关系中获取每条转发路径的路径权重。The path weight of each forwarding path is obtained from the correspondence between the path identifier and the path weight according to the path identifier of each forwarding path in the at least one forwarding path.
例如,用户向第二控制器输入的权重规则为:包括转发实体在1-5之间的转发路径的路径权重为500,包括转发实体在6-10之间的转发路径的路径权重为400,包括转发实体在11-15之间的转发路径的路径权重为300,包括转发实体在16-20之间的转发路径的路径权重为200,包括转发实体大于的转发路径的路径权重为100。第二控制器接收用户输入的权重规则,根据权重规则生成路径1对应的路径权重为100,路径2对应的路径权重为500,路径3对应的路径权重为200,路径4对应的路径权重为300等;第二控制器将路径1、路径2、路径3和路径4及其对应的路径权重存储在如下表3中:For example, the weighting rule input by the user to the second controller is: the path weight of the forwarding path including the forwarding entity between 1-5 is 500, and the path weight of the forwarding path including the forwarding entity between 6-10 is 400. The path weight of the forwarding path including the forwarding entity between 11 and 15 is 300, and the path weight of the forwarding path including the forwarding entity between 16 and 20 is 200, and the path weight of the forwarding path including the forwarding entity is 100. The second controller receives the weighting rule input by the user, and the path weight corresponding to the path 1 is 100 according to the weight rule, the path weight corresponding to the path 2 is 500, the path weight corresponding to the path 3 is 200, and the path weight corresponding to the path 4 is 300. Etc; the second controller stores path 1, path 2, path 3, and path 4 and their corresponding path weights in Table 3 below:
表3table 3
路径标识Path identifier 路径权重Path weight
11 100100
22 500500
33 200200
44 300300
例如,交换机根据第一虚拟机的标识和第二虚拟机的标识,确定出用于发送该报文的3条路径分别为路径1,路径2和路径3;并且,根据路径1、路径2和路径3的路径标识,从表3中获取路径1、路径2和路径3对应的路径权重分别为100、500和200。For example, the switch determines, according to the identifier of the first virtual machine and the identifier of the second virtual machine, that the three paths for sending the packet are path 1, path 2, and path 3, respectively, and according to path 1, path 2, and The path identifier of path 3, the path weights corresponding to path 1, path 2, and path 3 from Table 3 are 100, 500, and 200, respectively.
步骤208:交换机根据该报文的处理策略,从至少一条转发路径中选择转发路径;Step 208: The switch selects a forwarding path from at least one forwarding path according to the processing policy of the packet.
如果该报文的处理策略为转发策略或者基于带宽的路径控制策略,则从至少一条转发路径中随机选择一条转发路径。If the processing policy of the packet is a forwarding policy or a bandwidth-based path control policy, one forwarding path is randomly selected from at least one forwarding path.
如果该报文的处理策略为重定向,则获取该报文的处理策略中包括的重定向条件,从至少一条转发路径中选择一个满足重定向条件的一条转发路径。例如,重定向的条件为选择最高权重的转发路径,则根据每条转发路径的路径权重,从至少一条转发路径中选择一个路径权重最高的转发路径;如果重定向的条件为选择最低权重的转发路径,则根据每条转发路径的路径权重,从至少一条转发路径中选择一个路径权重最低的转发路径。 If the processing policy of the packet is redirection, the redirection condition included in the processing policy of the packet is obtained, and one forwarding path that satisfies the redirection condition is selected from the at least one forwarding path. For example, if the condition of the redirection is to select the forwarding path with the highest weight, then according to the path weight of each forwarding path, select one forwarding path with the highest path weight from at least one forwarding path; if the redirection condition is to select the forwarding with the lowest weight The path selects a forwarding path with the lowest path weight from at least one forwarding path according to the path weight of each forwarding path.
例如,报文的处理策略为重定向到最低权重的转发路径上,则从路径1、路径2和路径3中选择一个路径权重最低的转发路径为路径1。For example, if the processing strategy of the packet is to redirect to the lowest weight forwarding path, then the path with the lowest path weight selected from path 1, path 2, and path 3 is path 1.
步骤209:交换机根据该报文的处理策略,获取选择的转发路径的带宽;Step 209: The switch acquires the bandwidth of the selected forwarding path according to the processing policy of the packet.
每种处理策略对应一个转发路径的带宽大小,根据该报文的处理策略,获取选择的转发路径的带宽大小。Each processing policy corresponds to the bandwidth of a forwarding path, and the bandwidth of the selected forwarding path is obtained according to the processing policy of the packet.
其中,转发策略和重定向策略对应的带宽大小为默认的带宽大小;基于带宽的路径控制策略对应的带宽大小为处理策略中包括的带宽大小。The bandwidth corresponding to the forwarding policy and the redirection policy is the default bandwidth. The bandwidth corresponding to the bandwidth-based path control policy is the bandwidth included in the processing policy.
例如,默认的带宽大小为50M,则转发策略和重定向策略对应的带宽大小为50M,;基于带宽的路径控制策略中包括转发路径对应的带宽为100M。For example, if the default bandwidth is 50M, the bandwidth corresponding to the forwarding policy and the redirection policy is 50M, and the bandwidth-based path control policy includes the bandwidth corresponding to the forwarding path being 100M.
步骤210:交换机根据获取的带宽,设置选择的转发路径的带宽大小;Step 210: The switch sets a bandwidth size of the selected forwarding path according to the acquired bandwidth.
具体地,交换机将选择的转发路径的带宽大小设置为获取的带宽。Specifically, the switch sets the bandwidth size of the selected forwarding path to the acquired bandwidth.
例如,选择的转发路径为路径1,获取的带宽为100M,则将路径1的带宽大小设置为100M。For example, if the selected forwarding path is path 1 and the acquired bandwidth is 100M, the bandwidth size of path 1 is set to 100M.
步骤211:交换机根据设置后的转发路径,将报文发送给第二虚拟机。Step 211: The switch sends the packet to the second virtual machine according to the set forwarding path.
具体地,交换机根据设置后的转发路径,将报文转发给第二虚拟机所在的第二主机,第二主机接收交换机发送的该报文,将该报文进行解封装,得到第二虚拟机的标识和业务流,根据第二虚拟机的标识,将该业务流发送给第二虚拟机。Specifically, the switch forwards the packet to the second host where the second virtual machine is located according to the set forwarding path, and the second host receives the packet sent by the switch, decapsulates the packet, and obtains the second virtual machine. The identifier and the service flow are sent to the second virtual machine according to the identifier of the second virtual machine.
步骤212:如果不发送该报文,则交换机将该报文丢弃。Step 212: If the packet is not sent, the switch discards the packet.
如果处理策略为丢弃策略,则交换机不发送给报文,直接将该报文丢弃。If the processing policy is the discarding policy, the switch does not send the packet and discards the packet.
在本发明中,接收第一虚拟机所在的第一主机发送的报文,该报文携带业务流的业务标识,业务流的业务标识为第一主机根据业务流的目的地址设置并封装到报文中的;根据业务流的业务标识,获取报文的处理策略;根据处理策略,确定是否发送报文;如果发送报文,则根据处理策略,将报文发送给第二虚拟机。由于报文中携带业务流的业务标识,从而能够根据业务流的业务标识对报文进行策略控制。In the present invention, the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
实施例3Example 3
本发明实施例提供了一种发送报文的装置,参见图3,该装置包括:An embodiment of the present invention provides an apparatus for transmitting a message. Referring to FIG. 3, the apparatus includes:
第一接收模块301,用于接收第一虚拟机所在的第一主机发送的报文,报文携带业务流的业务标识,业务流的业务标识为第一主机根据业务流的目的地 址设置并封装到报文中的;The first receiving module 301 is configured to receive a packet sent by the first host where the first virtual machine is located, where the packet carries the service identifier of the service flow, and the service identifier of the service flow is the destination of the first host according to the service flow. Address is set and encapsulated in the message;
第一获取模块302,用于根据业务流的业务标识,获取报文的处理策略;The first obtaining module 302 is configured to obtain a processing policy of the packet according to the service identifier of the service flow.
确定模块303,用于根据处理策略,确定是否发送报文;a determining module 303, configured to determine whether to send a message according to the processing policy;
第一发送模块304,用于如果发送报文,则根据处理策略,将报文发送给第二虚拟机。The first sending module 304 is configured to send the packet to the second virtual machine according to the processing policy if the packet is sent.
优选的,第一获取模块302,用于根据业务流的业务标识,从业务标识和处理策略的对应关系中获取报文的处理策略。Preferably, the first obtaining module 302 is configured to obtain a processing policy of the packet from the correspondence between the service identifier and the processing policy according to the service identifier of the service flow.
优选的,确定模块303,包括:Preferably, the determining module 303 includes:
第一确定单元,用于如果处理策略用于丢弃报文,则确定不发送报文;a first determining unit, configured to determine that the packet is not sent if the processing policy is used to discard the packet;
第二确定单元,用于如果处理策略用于对报文执行除丢弃以外的其他操作,则确定发送报文。And a second determining unit, configured to determine to send the message if the processing policy is used to perform operations other than discarding the message.
优选的,第一发送模块304,包括:Preferably, the first sending module 304 includes:
第三确定单元,用于根据第一虚拟机的标识和第二虚拟机的标识,确定用于发送报文的至少一条转发路径;a third determining unit, configured to determine, according to the identifier of the first virtual machine and the identifier of the second virtual machine, at least one forwarding path for sending the packet;
选择单元,用于根据处理策略,从至少一条转发路径中选择转发路径;a selecting unit, configured to select a forwarding path from the at least one forwarding path according to the processing policy;
获取单元,用于根据处理策略,获取选择的转发路径的带宽;An obtaining unit, configured to obtain a bandwidth of the selected forwarding path according to the processing policy;
设置单元,用于根据获取的带宽,设置选择的转发路径的带宽大小;a setting unit, configured to set a bandwidth size of the selected forwarding path according to the acquired bandwidth;
发送单元,用于根据设置后的转发路径,将报文发送给第二虚拟机。The sending unit is configured to send the packet to the second virtual machine according to the set forwarding path.
在本发明中,接收第一虚拟机所在的第一主机发送的报文,该报文携带业务流的业务标识,业务流的业务标识为第一主机根据业务流的目的地址设置并封装到报文中的;根据业务流的业务标识,获取报文的处理策略;根据处理策略,确定是否发送报文;如果发送报文,则根据处理策略,将报文发送给第二虚拟机。由于报文中携带业务流的业务标识,从而能够根据业务流的业务标识对报文进行策略控制。In the present invention, the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
实施例4Example 4
本发明实施例提供了一种发送报文的装置,参见图4,该装置包括:An embodiment of the present invention provides an apparatus for transmitting a message. Referring to FIG. 4, the apparatus includes:
第二接收模块401,用于接收第一虚拟机发送的业务流,业务流携带业务流的目的地址;The second receiving module 401 is configured to receive a service flow sent by the first virtual machine, where the service flow carries a destination address of the service flow;
第二获取模块402,用于根据业务流的目的地址,获取业务流的业务标识;The second obtaining module 402 is configured to obtain a service identifier of the service flow according to the destination address of the service flow.
第二发送模块403,用于将业务流的业务标识封装到报文中,向交换机发 送报文,使交换机根据业务流的业务标识获取报文的处理策略,并根据处理策略确定是否发送报文,如果发送报文,根据处理策略将报文发送给第二虚拟机。The second sending module 403 is configured to encapsulate the service identifier of the service flow into the packet, and send the packet to the switch. The packet is sent, so that the switch obtains the packet processing policy according to the service identifier of the service flow, and determines whether to send the packet according to the processing policy. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy.
优选的,第二获取模块402,用于根据业务流的目的地址,从目的地址和业务标识的对应关系中获取业务流的业务标识。Preferably, the second obtaining module 402 is configured to obtain the service identifier of the service flow from the correspondence between the destination address and the service identifier according to the destination address of the service flow.
在本发明中,接收第一虚拟机所在的第一主机发送的报文,该报文携带业务流的业务标识,业务流的业务标识为第一主机根据业务流的目的地址设置并封装到报文中的;根据业务流的业务标识,获取报文的处理策略;根据处理策略,确定是否发送报文;如果发送报文,则根据处理策略,将报文发送给第二虚拟机。由于报文中携带业务流的业务标识,从而能够根据业务流的业务标识对报文进行策略控制。In the present invention, the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
实施例5Example 5
本发明实施例提供了一种发送报文的装置,参见图5,该装置包括:第一存储器501和第一处理器502,用于执行如下发送报文的方法:An embodiment of the present invention provides an apparatus for transmitting a message. Referring to FIG. 5, the apparatus includes: a first memory 501 and a first processor 502, configured to perform the following method of sending a message:
接收第一虚拟机所在的第一主机发送的报文,所述报文携带业务流的业务标识,所述业务流的业务标识为所述第一主机根据所述业务流的目的地址设置并封装到所述报文中的;Receiving a packet sent by the first host where the first virtual machine is located, where the packet carries a service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. Into the message;
根据所述业务流的业务标识,获取所述报文的处理策略;Obtaining a processing policy of the packet according to the service identifier of the service flow;
根据所述处理策略,确定是否发送所述报文;Determining whether to send the message according to the processing policy;
如果发送所述报文,则根据所述处理策略,将所述报文发送给第二虚拟机。If the packet is sent, the packet is sent to the second virtual machine according to the processing policy.
优选的,所述根据所述业务流的业务标识,获取所述报文的处理策略,包括:Preferably, the processing policy for obtaining the packet according to the service identifier of the service flow includes:
根据所述业务流的业务标识,从业务标识和处理策略的对应关系中获取所述报文的处理策略。And obtaining, according to the service identifier of the service flow, a processing policy of the packet from a correspondence between the service identifier and the processing policy.
优选的,所述根据所述处理策略,确定是否发送所述报文,包括:Preferably, the determining, according to the processing policy, whether to send the packet includes:
如果所述处理策略用于丢弃所述报文,则确定不发送所述报文;If the processing policy is used to discard the packet, determining to not send the packet;
如果所述处理策略用于对所述报文执行除丢弃以外的其他操作,则确定发送所述报文。If the processing policy is used to perform operations other than discarding the message, it is determined to send the message.
优选的,所述根据所述处理策略,将所述报文发送给第二虚拟机,包括:Preferably, the sending the packet to the second virtual machine according to the processing policy includes:
根据第一虚拟机的标识和第二虚拟机的标识,确定用于发送所述报文的至少一条转发路径; Determining, according to the identifier of the first virtual machine and the identifier of the second virtual machine, at least one forwarding path for sending the packet;
根据所述处理策略,从所述至少一条转发路径中选择转发路径;Determining a forwarding path from the at least one forwarding path according to the processing policy;
根据所述处理策略,获取所述选择的转发路径的带宽;Obtaining a bandwidth of the selected forwarding path according to the processing policy;
根据所述获取的带宽,设置所述选择的转发路径的带宽大小;Setting a bandwidth size of the selected forwarding path according to the acquired bandwidth;
根据所述设置后的转发路径,将所述报文发送给所述第二虚拟机。And sending the packet to the second virtual machine according to the set forwarding path.
在本发明中,接收第一虚拟机所在的第一主机发送的报文,该报文携带业务流的业务标识,业务流的业务标识为第一主机根据业务流的目的地址设置并封装到报文中的;根据业务流的业务标识,获取报文的处理策略;根据处理策略,确定是否发送报文;如果发送报文,则根据处理策略,将报文发送给第二虚拟机。由于报文中携带业务流的业务标识,从而能够根据业务流的业务标识对报文进行策略控制。In the present invention, the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
实施例6Example 6
本发明实施例提供了一种发送报文的装置,参见图6,该装置包括:第二存储器601和第二处理器602,用于执行如下发送报文的方法:An embodiment of the present invention provides an apparatus for transmitting a message. Referring to FIG. 6, the apparatus includes: a second memory 601 and a second processor 602, configured to perform the following method of sending a message:
接收第一虚拟机发送的业务流,所述业务流携带所述业务流的目的地址;Receiving a service flow sent by the first virtual machine, where the service flow carries a destination address of the service flow;
根据所述业务流的目的地址,获取所述业务流的业务标识;Obtaining a service identifier of the service flow according to the destination address of the service flow;
将所述业务流的业务标识封装到报文中,向交换机发送所述报文,使所述交换机根据所述业务流的业务标识获取所述报文的处理策略,并根据所述处理策略确定是否发送所述报文,如果发送所述报文,根据所述处理策略将所述报文发送给第二虚拟机。Encapsulating the service identifier of the service flow into the packet, and sending the packet to the switch, so that the switch obtains the processing policy of the packet according to the service identifier of the service flow, and determines according to the processing policy. Whether the packet is sent, and if the packet is sent, the packet is sent to the second virtual machine according to the processing policy.
优选的,所述根据所述业务流的目的地址,获取所述业务流的业务标识,包括:Preferably, the obtaining the service identifier of the service flow according to the destination address of the service flow includes:
根据所述业务流的目的地址,从目的地址和业务标识的对应关系中获取所述业务流的业务标识。Obtaining, according to the destination address of the service flow, the service identifier of the service flow from the correspondence between the destination address and the service identifier.
在本发明中,接收第一虚拟机所在的第一主机发送的报文,该报文携带业务流的业务标识,业务流的业务标识为第一主机根据业务流的目的地址设置并封装到报文中的;根据业务流的业务标识,获取报文的处理策略;根据处理策略,确定是否发送报文;如果发送报文,则根据处理策略,将报文发送给第二虚拟机。由于报文中携带业务流的业务标识,从而能够根据业务流的业务标识对报文进行策略控制。 In the present invention, the packet sent by the first host where the first virtual machine is located is received, and the packet carries the service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. If the packet is sent, the packet is sent to the second virtual machine according to the processing policy. The packet carries the service identifier of the service flow, so that the packet can be controlled according to the service identifier of the service flow.
需要说明的是:上述实施例提供的发送报文的装置在发送报文时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的发送报文的装置与发送报文的方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that, when the device that sends the packet is sent by the foregoing embodiment, only the division of each functional module is used as an example. In an actual application, the function may be allocated by different functional modules according to requirements. Upon completion, the internal structure of the device is divided into different functional modules to perform all or part of the functions described above. In addition, the apparatus for sending a message and the method for sending a message provided by the foregoing embodiment are in the same concept, and the specific implementation process is described in the method embodiment, and details are not described herein again.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。A person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium. The storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.
以上所述仅为本发明的较佳实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。 The above are only the preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalents, improvements, etc., which are within the spirit and scope of the present invention, should be included in the protection of the present invention. Within the scope.

Claims (14)

  1. 一种发送报文的方法,其特征在于,所述方法包括:A method for sending a message, the method comprising:
    接收第一虚拟机所在的第一主机发送的报文,所述报文携带业务流的业务标识,所述业务流的业务标识为所述第一主机根据所述业务流的目的地址设置并封装到所述报文中的;Receiving a packet sent by the first host where the first virtual machine is located, where the packet carries a service identifier of the service flow, and the service identifier of the service flow is set and encapsulated by the first host according to the destination address of the service flow. Into the message;
    根据所述业务流的业务标识,获取所述报文的处理策略;Obtaining a processing policy of the packet according to the service identifier of the service flow;
    根据所述处理策略,确定是否发送所述报文;Determining whether to send the message according to the processing policy;
    如果发送所述报文,则根据所述处理策略,将所述报文发送给第二虚拟机。If the packet is sent, the packet is sent to the second virtual machine according to the processing policy.
  2. 如权利要求1所述的方法,其特征在于,所述根据所述业务流的业务标识,获取所述报文的处理策略,包括:The method according to claim 1, wherein the obtaining a processing policy of the packet according to the service identifier of the service flow comprises:
    根据所述业务流的业务标识,从业务标识和处理策略的对应关系中获取所述报文的处理策略。And obtaining, according to the service identifier of the service flow, a processing policy of the packet from a correspondence between the service identifier and the processing policy.
  3. 如权利要求1所述的方法,其特征在于,所述根据所述处理策略,确定是否发送所述报文,包括:The method according to claim 1, wherein the determining whether to send the message according to the processing policy comprises:
    如果所述处理策略用于丢弃所述报文,则确定不发送所述报文;If the processing policy is used to discard the packet, determining to not send the packet;
    如果所述处理策略用于对所述报文执行除丢弃以外的其他操作,则确定发送所述报文。If the processing policy is used to perform operations other than discarding the message, it is determined to send the message.
  4. 如权利要求1所述的方法,其特征在于,所述根据所述处理策略,将所述报文发送给第二虚拟机,包括:The method of claim 1, wherein the sending the message to the second virtual machine according to the processing policy comprises:
    根据第一虚拟机的标识和第二虚拟机的标识,确定用于发送所述报文的至少一条转发路径;Determining, according to the identifier of the first virtual machine and the identifier of the second virtual machine, at least one forwarding path for sending the packet;
    根据所述处理策略,从所述至少一条转发路径中选择转发路径;Determining a forwarding path from the at least one forwarding path according to the processing policy;
    根据所述处理策略,获取所述选择的转发路径的带宽;Obtaining a bandwidth of the selected forwarding path according to the processing policy;
    根据所述获取的带宽,设置所述选择的转发路径的带宽大小;Setting a bandwidth size of the selected forwarding path according to the acquired bandwidth;
    根据所述设置后的转发路径,将所述报文发送给所述第二虚拟机。And sending the packet to the second virtual machine according to the set forwarding path.
  5. 一种发送报文的方法,其特征在于,所述方法包括: A method for sending a message, the method comprising:
    接收第一虚拟机发送的业务流,所述业务流携带所述业务流的目的地址;Receiving a service flow sent by the first virtual machine, where the service flow carries a destination address of the service flow;
    根据所述业务流的目的地址,获取所述业务流的业务标识;Obtaining a service identifier of the service flow according to the destination address of the service flow;
    将所述业务流的业务标识封装到报文中,向交换机发送所述报文,使所述交换机根据所述业务流的业务标识获取所述报文的处理策略,并根据所述处理策略确定是否发送所述报文,如果发送所述报文,根据所述处理策略将所述报文发送给第二虚拟机。Encapsulating the service identifier of the service flow into the packet, and sending the packet to the switch, so that the switch obtains the processing policy of the packet according to the service identifier of the service flow, and determines according to the processing policy. Whether the packet is sent, and if the packet is sent, the packet is sent to the second virtual machine according to the processing policy.
  6. 如权利要求5所述的方法,其特征在于,所述根据所述业务流的目的地址,获取所述业务流的业务标识,包括:The method of claim 5, wherein the obtaining the service identifier of the service flow according to the destination address of the service flow comprises:
    根据所述业务流的目的地址,从目的地址和业务标识的对应关系中获取所述业务流的业务标识。Obtaining, according to the destination address of the service flow, the service identifier of the service flow from the correspondence between the destination address and the service identifier.
  7. 一种发送报文的装置,其特征在于,所述装置包括:An apparatus for transmitting a message, the apparatus comprising:
    第一接收模块,用于接收第一虚拟机所在的第一主机发送的报文,所述报文携带业务流的业务标识,所述业务流的业务标识为所述第一主机根据所述业务流的目的地址设置并封装到所述报文中的;The first receiving module is configured to receive a packet sent by the first host where the first virtual machine is located, where the packet carries a service identifier of the service flow, and the service identifier of the service flow is the first host according to the service The destination address of the stream is set and encapsulated into the message;
    第一获取模块,用于根据所述业务流的业务标识,获取所述报文的处理策略;a first acquiring module, configured to acquire a processing policy of the packet according to the service identifier of the service flow;
    确定模块,用于根据所述处理策略,确定是否发送所述报文;a determining module, configured to determine, according to the processing policy, whether to send the message;
    第一发送模块,用于如果发送所述报文,则根据所述处理策略,将所述报文发送给第二虚拟机。The first sending module is configured to send the packet to the second virtual machine according to the processing policy if the packet is sent.
  8. 如权利要求7所述的装置,其特征在于,The device of claim 7 wherein:
    所述第一获取模块,用于根据所述业务流的业务标识,从业务标识和处理策略的对应关系中获取所述报文的处理策略。The first obtaining module is configured to obtain, according to the service identifier of the service flow, a processing policy of the packet from a correspondence between the service identifier and the processing policy.
  9. 如权利要求7所述的装置,其特征在于,所述确定模块,包括:The device of claim 7, wherein the determining module comprises:
    第一确定单元,用于如果所述处理策略用于丢弃所述报文,则确定不发送所述报文;a first determining unit, configured to determine not to send the message if the processing policy is used to discard the message;
    第二确定单元,用于如果所述处理策略用于对所述报文执行除丢弃以外的其他操作,则确定发送所述报文。 And a second determining unit, configured to determine to send the message if the processing policy is used to perform operations other than discarding the message.
  10. 如权利要求7所述的装置,其特征在于,第一发送模块,包括:The device of claim 7, wherein the first sending module comprises:
    第三确定单元,用于根据第一虚拟机的标识和第二虚拟机的标识,确定用于发送所述报文的至少一条转发路径;a third determining unit, configured to determine, according to the identifier of the first virtual machine and the identifier of the second virtual machine, at least one forwarding path used to send the packet;
    选择单元,用于根据所述处理策略,从所述至少一条转发路径中选择转发路径;a selecting unit, configured to select a forwarding path from the at least one forwarding path according to the processing policy;
    获取单元,用于根据所述处理策略,获取所述选择的转发路径的带宽;An obtaining unit, configured to acquire, according to the processing policy, a bandwidth of the selected forwarding path;
    设置单元,用于根据所述获取的带宽,设置所述选择的转发路径的带宽大小;a setting unit, configured to set a bandwidth size of the selected forwarding path according to the acquired bandwidth;
    发送单元,用于根据所述设置后的转发路径,将所述报文发送给所述第二虚拟机。And a sending unit, configured to send the packet to the second virtual machine according to the set forwarding path.
  11. 一种发送报文的装置,其特征在于,所述装置包括:An apparatus for transmitting a message, the apparatus comprising:
    第二接收模块,用于接收第一虚拟机发送的业务流,所述业务流携带所述业务流的目的地址;a second receiving module, configured to receive a service flow sent by the first virtual machine, where the service flow carries a destination address of the service flow;
    第二获取模块,用于根据所述业务流的目的地址,获取所述业务流的业务标识;a second obtaining module, configured to acquire a service identifier of the service flow according to a destination address of the service flow;
    第二发送模块,用于将所述业务流的业务标识封装到报文中,向交换机发送所述报文,使所述交换机根据所述业务流的业务标识获取所述报文的处理策略,并根据所述处理策略确定是否发送所述报文,如果发送所述报文,根据所述处理策略将所述报文发送给第二虚拟机。a second sending module, configured to encapsulate the service identifier of the service flow into the packet, and send the packet to the switch, so that the switch obtains the processing policy of the packet according to the service identifier of the service flow, And determining, according to the processing policy, whether to send the packet, and if the packet is sent, sending the packet to the second virtual machine according to the processing policy.
  12. 如权利要求11所述的装置,其特征在于,The device of claim 11 wherein:
    所述第二获取模块,用于根据所述业务流的目的地址,从目的地址和业务标识的对应关系中获取所述业务流的业务标识。The second obtaining module is configured to obtain, according to the destination address of the service flow, the service identifier of the service flow from the correspondence between the destination address and the service identifier.
  13. 一种发送报文的装置,其特征在于,所述装置包括:第一存储器和第一处理器,用于执行如权利要求1-4任一权利要求所述的发送报文的方法。An apparatus for transmitting a message, the apparatus comprising: a first memory and a first processor, configured to perform the method of transmitting a message according to any of claims 1-4.
  14. 一种发送报文的装置,其特征在于,所述装置包括:第二存储器和第二处理器,用于执行如权利要求5或6所述的发送报文的方法。 An apparatus for transmitting a message, the apparatus comprising: a second memory and a second processor, configured to perform the method of transmitting a message according to claim 5 or 6.
PCT/CN2015/096687 2014-12-31 2015-12-08 Packet sending method and apparatus WO2016107379A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410855294.6A CN104601467B (en) 2014-12-31 2014-12-31 A kind of method and apparatus for sending message
CN201410855294.6 2014-12-31

Publications (1)

Publication Number Publication Date
WO2016107379A1 true WO2016107379A1 (en) 2016-07-07

Family

ID=53126985

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/096687 WO2016107379A1 (en) 2014-12-31 2015-12-08 Packet sending method and apparatus

Country Status (2)

Country Link
CN (1) CN104601467B (en)
WO (1) WO2016107379A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220329527A1 (en) * 2021-04-09 2022-10-13 Microsoft Technology Licensing, Llc Architectures for disaggregating sdn from the host
US11588740B2 (en) 2021-04-09 2023-02-21 Microsoft Technology Licensing, Llc Scaling host policy via distribution
US11799785B2 (en) 2021-04-09 2023-10-24 Microsoft Technology Licensing, Llc Hardware-based packet flow processing

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017066947A1 (en) * 2015-10-22 2017-04-27 华为技术有限公司 Method, device and system for processing service
CN106789757B (en) * 2016-03-29 2020-10-13 新华三技术有限公司 Access control method and device
CN105791304B (en) * 2016-03-31 2019-08-27 联想(北京)有限公司 A kind of message processing method and equipment
CN107395786B (en) * 2017-08-09 2020-12-04 杭州迪普科技股份有限公司 ARP (Address resolution protocol) table item indexing method and device
CN110768884B (en) 2018-07-25 2021-10-15 华为技术有限公司 VXLAN message encapsulation and policy execution method, equipment and system
CN112437009B (en) * 2020-11-27 2022-07-01 网络通信与安全紫金山实验室 SRv6 method, router, routing system and storage medium for end-to-end flow policy

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102299929A (en) * 2011-09-15 2011-12-28 北京天地云箱科技有限公司 Access control method, system and device for virtual machine
CN102549977A (en) * 2009-09-24 2012-07-04 日本电气株式会社 Identification system for inter-virtual-server communication and identification method for inter-virtual-server communication
CN102801729A (en) * 2012-08-13 2012-11-28 福建星网锐捷网络有限公司 Virtual machine message forwarding method, network switching equipment and communication system
CN103905383A (en) * 2012-12-26 2014-07-02 华为技术有限公司 Data message forwarding method, device and system

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0517304D0 (en) * 2005-08-23 2005-10-05 Netronome Systems Inc A system and method for processing and forwarding transmitted information
CN101127691A (en) * 2006-08-17 2008-02-20 王玉鹏 A method for implementing stream-based policy routing on network processor
US8407366B2 (en) * 2010-05-14 2013-03-26 Microsoft Corporation Interconnecting members of a virtual network
JP5585219B2 (en) * 2010-06-03 2014-09-10 富士通株式会社 Switching device and virtual LAN construction method
CN103905309A (en) * 2012-12-28 2014-07-02 中国电信股份有限公司 Method and system of data exchange between virtual machines
CN104184676B (en) * 2013-05-27 2017-08-11 华为技术有限公司 A kind of data center network and its flow equalization method and controller
CN103618679A (en) * 2013-11-25 2014-03-05 上海华为技术有限公司 Service quality control method, device and system
CN103795622B (en) * 2014-01-22 2017-02-15 杭州华三通信技术有限公司 Message forwarding method and device using same
CN104158753B (en) * 2014-06-12 2017-10-24 南京工程学院 Dynamic stream scheduling method and system based on software defined network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102549977A (en) * 2009-09-24 2012-07-04 日本电气株式会社 Identification system for inter-virtual-server communication and identification method for inter-virtual-server communication
CN102299929A (en) * 2011-09-15 2011-12-28 北京天地云箱科技有限公司 Access control method, system and device for virtual machine
CN102801729A (en) * 2012-08-13 2012-11-28 福建星网锐捷网络有限公司 Virtual machine message forwarding method, network switching equipment and communication system
CN103905383A (en) * 2012-12-26 2014-07-02 华为技术有限公司 Data message forwarding method, device and system

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220329527A1 (en) * 2021-04-09 2022-10-13 Microsoft Technology Licensing, Llc Architectures for disaggregating sdn from the host
US11588740B2 (en) 2021-04-09 2023-02-21 Microsoft Technology Licensing, Llc Scaling host policy via distribution
US11652749B2 (en) 2021-04-09 2023-05-16 Microsoft Technology Licensing, Llc High availability for hardware-based packet flow processing
US11757782B2 (en) * 2021-04-09 2023-09-12 Microsoft Technology Licensing, Llc Architectures for disaggregating SDN from the host
US11799785B2 (en) 2021-04-09 2023-10-24 Microsoft Technology Licensing, Llc Hardware-based packet flow processing

Also Published As

Publication number Publication date
CN104601467B (en) 2018-03-13
CN104601467A (en) 2015-05-06

Similar Documents

Publication Publication Date Title
WO2016107379A1 (en) Packet sending method and apparatus
EP3213480B1 (en) Content filtering for information centric networks
EP3213489B1 (en) Content classification and content marking for information centric networks
US9167501B2 (en) Implementing a 3G packet core in a cloud computer with openflow data and control planes
US20220078114A1 (en) Method and Apparatus for Providing Service for Traffic Flow
US10148573B2 (en) Packet processing method, node, and system
US8867361B2 (en) Implementing EPC in a cloud computer with OpenFlow data plane
US9385950B2 (en) Configurable service proxy local identifier mapping
US9571382B2 (en) Method, controller, and system for processing data packet
US20160269284A1 (en) Packet forwarding method and apparatus
EP3140964B1 (en) Implementing a 3g packet core in a cloud computer with openflow data and control planes
US20150334057A1 (en) Packet forwarding
US9509631B2 (en) Quality of service (QoS) for information centric networks
US10361954B2 (en) Method and apparatus for processing modified packet
WO2015109821A1 (en) Service chain management method, system and device
US11616720B2 (en) Packet processing method and system, and device
US20160191385A1 (en) Ccn fragmentation gateway
US10003529B2 (en) Method and system for memory allocation in a software-defined networking (SDN) system
EP3834365A1 (en) Multicast distribution tree versioning for minimizing multicast group traffic disruption
WO2017008712A1 (en) Reachability detection for path between vxlan tunnel end points (vtep)
JP6472876B2 (en) Computer program, apparatus and storage medium
WO2019196914A1 (en) Method for discovering forwarding path, and related device thereof
WO2015039616A1 (en) Method and device for packet processing
WO2015188682A1 (en) Service chain processing method, device and system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15875057

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15875057

Country of ref document: EP

Kind code of ref document: A1