[go: up one dir, main page]

CN106034077B - A kind of dynamic route collocating method, apparatus and system - Google Patents

A kind of dynamic route collocating method, apparatus and system Download PDF

Info

Publication number
CN106034077B
CN106034077B CN201510119094.9A CN201510119094A CN106034077B CN 106034077 B CN106034077 B CN 106034077B CN 201510119094 A CN201510119094 A CN 201510119094A CN 106034077 B CN106034077 B CN 106034077B
Authority
CN
China
Prior art keywords
routing
virtual machine
table entry
virtual
dynamic
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201510119094.9A
Other languages
Chinese (zh)
Other versions
CN106034077A (en
Inventor
李琳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201510119094.9A priority Critical patent/CN106034077B/en
Priority to PCT/CN2016/076633 priority patent/WO2016146077A1/en
Publication of CN106034077A publication Critical patent/CN106034077A/en
Application granted granted Critical
Publication of CN106034077B publication Critical patent/CN106034077B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • H04L45/028Dynamic adaptation of the update intervals, e.g. event-triggered updates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • H04L45/08Learning-based routing, e.g. using neural networks or artificial intelligence
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明实施例公开了一种动态路由配置方法、装置及系统,涉及计算机领域,用以解决使用分布式网关时手动配置路由工作量大且调整不方便的问题。具体方案为:SDN控制器接收动态路由代理发送的路由学习消息;SDN控制器根据外部路由信息更新至少一个第一路由表项;SDN控制器在接收到虚拟机的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项;SDN控制器向虚拟机的虚拟交换机发送第一流表项,以指示虚拟机的虚拟交换机根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发来自虚拟机的数据包。

The embodiment of the invention discloses a dynamic routing configuration method, device and system, which relate to the field of computers and are used to solve the problem of large workload and inconvenient adjustment of manual routing configuration when using a distributed gateway. The specific solution is as follows: the SDN controller receives the route learning message sent by the dynamic routing agent; the SDN controller updates at least one first routing table entry according to the external routing information; the SDN controller receives the information from the virtual machine sent by the virtual switch of the virtual machine When a data packet is used, the second routing table entry is converted into the first flow table entry; the SDN controller sends the first flow table entry to the virtual switch of the virtual machine to instruct the virtual switch of the virtual machine to pass the virtual machine's virtual switch according to the first flow table entry. Distributed gateways deployed on switches forward packets from virtual machines.

Description

一种动态路由配置方法、装置及系统A kind of dynamic routing configuration method, device and system

技术领域technical field

本发明涉及计算机领域,尤其涉及一种动态路由配置方法、装置及系统。The present invention relates to the field of computers, and in particular, to a dynamic routing configuration method, device and system.

背景技术Background technique

软件定义网络(英文:Software Defined Network,缩写:SDN)是一种将网络设备的控制面与数据面分离开的网络。目前,SDN中常用的一种技术是OpenFlow技术,采用该技术,SDN控制器可以通过控制虚拟交换机上的流表来控制虚拟交换机对数据包的转发。随着SDN技术的不断成熟,越来越多的运营商/云服务提供商将SDN作为管理数据中心的优选方案。Software Defined Network (English: Software Defined Network, abbreviation: SDN) is a network that separates the control plane and the data plane of a network device. At present, a technology commonly used in SDN is OpenFlow technology. Using this technology, the SDN controller can control the forwarding of data packets by the virtual switch by controlling the flow table on the virtual switch. As SDN technology continues to mature, more and more operators/cloud service providers take SDN as the preferred solution for managing data centers.

在数据中心内部,一台物理服务器上可以部署一个或多个虚拟机,每个虚拟机向数据中心外部设备发送数据包时需要经过集中式网关和边界网关。但是,随着数据中心规模的扩大,数据中心内部的虚拟机与数据中心外部设备之间的数据流量剧增,经过集中式网关的数据流量也会非常大,因此,可能会导致集中式网关的负载过大而影响网络性能。Inside a data center, one or more virtual machines can be deployed on a physical server, and each virtual machine needs to go through a centralized gateway and a border gateway when sending data packets to devices outside the data center. However, with the expansion of the data center, the data traffic between the virtual machines inside the data center and the devices outside the data center increases dramatically, and the data traffic through the centralized gateway is also very large. The load is too heavy and the network performance is affected.

为了分担集中式网关的负载,可以考虑使用分布式网关,在每个虚拟机的虚拟交换机(即虚拟机接入的虚拟交换机)上部署一个分布式网关,每个虚拟机通过各自的虚拟交换机上部署的分布式网关向数据中心外部设备发送数据包。但是,为了使虚拟机能够向数据中心外部设备发送数据包,需要在每个分布式网关上分别配置边界网关与数据中心外部设备之间的路由,若手动配置这些路由,则工作量会很大,而且当网络拓扑发生变化时,手动调整这些路由很不方便。In order to share the load of the centralized gateway, you can consider using a distributed gateway, deploy a distributed gateway on the virtual switch of each virtual machine (that is, the virtual switch to which the virtual machine is connected), and each virtual machine passes through its own virtual switch. The deployed distributed gateway sends packets to devices outside the data center. However, in order for the virtual machine to send data packets to devices outside the data center, routes between the border gateway and the devices outside the data center need to be configured on each distributed gateway. If these routes are manually configured, the workload will be heavy. , and it is inconvenient to manually adjust these routes when the network topology changes.

发明内容SUMMARY OF THE INVENTION

本发明的实施例提供一种动态路由配置方法、装置及系统,用以解决使用分布式网关时手动配置路由工作量大且调整不方便的问题。Embodiments of the present invention provide a dynamic routing configuration method, device, and system, which are used to solve the problem of large workload and inconvenient adjustment of manually configuring routing when using a distributed gateway.

为达到上述目的,本发明的实施例采用如下技术方案:To achieve the above object, the embodiments of the present invention adopt the following technical solutions:

本发明实施例的第一方面,提供一种动态路由配置方法,应用于软件定义网络SDN中,所述SDN通过边界网关与外部网络相连,所述SDN中包含:SDN控制器、至少两个虚拟机、所述虚拟机的虚拟交换机和动态路由代理,所述虚拟机的虚拟交换机上部署有分布式网关,所述方法包括:A first aspect of the embodiments of the present invention provides a dynamic routing configuration method, which is applied to a software-defined network SDN, where the SDN is connected to an external network through a border gateway, and the SDN includes: an SDN controller, at least two virtual A distributed gateway is deployed on the virtual switch of the virtual machine, a virtual switch of the virtual machine, and a dynamic routing agent, and the method includes:

所述SDN控制器接收所述动态路由代理发送的路由学习消息,所述路由学习消息中携带有外部路由信息,所述外部路由信息用于表征外部设备与边界网关之间的路由关系;The SDN controller receives a route learning message sent by the dynamic routing agent, where the route learning message carries external routing information, and the external routing information is used to represent the routing relationship between the external device and the border gateway;

所述SDN控制器根据所述外部路由信息更新至少一个第一路由表项,所述至少一个第一路由表项中的每个第一路由表项中包含所述外部设备的地址和向所述外部设备发送数据包时所要经过的边界网关的地址;The SDN controller updates at least one first routing table entry according to the external routing information, and each first routing table entry in the at least one first routing table entry includes the address of the external device and the address to the external device. The address of the border gateway through which the external device sends data packets;

所述SDN控制器在接收到虚拟机的虚拟交换机发送的来自所述虚拟机的数据包时,将第二路由表项转化为第一流表项,所述第二路由表项为所述至少一个第一路由表项中的一个路由表项,所述第二路由表项中包含的外部设备的地址与所述来自所述虚拟机的数据包的目的地址相同,所述虚拟机为所述至少两个虚拟机中的任意一个虚拟机;When receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the SDN controller converts a second routing table entry into a first flow table entry, and the second routing table entry is the at least one flow table entry. A routing table entry in the first routing table entry, the address of the external device included in the second routing table entry is the same as the destination address of the data packet from the virtual machine, and the virtual machine is the at least any one of the two virtual machines;

所述SDN控制器向所述虚拟机的虚拟交换机发送所述第一流表项,以指示所述虚拟机的虚拟交换机根据所述第一流表项,通过所述虚拟机的虚拟交换机上部署的分布式网关转发所述来自所述虚拟机的数据包。The SDN controller sends the first flow entry to the virtual switch of the virtual machine to instruct the virtual switch of the virtual machine to pass the distribution deployed on the virtual switch of the virtual machine according to the first flow entry. A gateway forwards the data packets from the virtual machine.

结合第一方面,在第一方面的第一种可能的实现方式中,所述方法还包括:With reference to the first aspect, in a first possible implementation manner of the first aspect, the method further includes:

所述SDN控制器从至少一个第三路由表项中获取内部路由信息,所述至少一个第三路由表项中的每个第三路由表项中包含所述虚拟机的地址和向所述虚拟机发送数据包时所要经过的分布式网关的地址,所述向所述虚拟机发送数据包时所要经过的分布式网关为所述虚拟机的虚拟交换机上部署的分布式网关,所述内部路由信息用于表征所述虚拟机与所述虚拟机的虚拟交换机上部署的分布式网关之间的路由关系;The SDN controller obtains the internal routing information from at least one third routing table entry, and each third routing table entry in the at least one third routing table entry includes the address of the virtual machine and the address to the virtual machine. The address of the distributed gateway through which the machine sends data packets, the distributed gateway through which the data packet is sent to the virtual machine is the distributed gateway deployed on the virtual switch of the virtual machine, and the internal routing The information is used to represent the routing relationship between the virtual machine and the distributed gateway deployed on the virtual switch of the virtual machine;

所述SDN控制器向所述动态路由代理发送携带有所述内部路由信息的第一路由发布消息,所述第一路由发布消息用于指示所述动态路由代理向边界网关发布所述内部路由信息;The SDN controller sends a first route advertisement message carrying the internal routing information to the dynamic routing agent, where the first routing advertisement message is used to instruct the dynamic routing agent to publish the internal routing information to the border gateway ;

其中,所述SDN控制器中存储有路由表,所述路由表包含所述至少一个第一路由表项和所述至少一个第三路由表项。Wherein, a routing table is stored in the SDN controller, and the routing table includes the at least one first routing table entry and the at least one third routing table entry.

结合第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,在所述SDN控制器从至少一个第三路由表项中获取内部路由信息之前,所述方法还包括:With reference to the first possible implementation manner of the first aspect, in the second possible implementation manner of the first aspect, before the SDN controller acquires internal routing information from at least one third routing table entry, the Methods also include:

所述SDN控制器获取所述虚拟机的路由信息,所述虚拟机的路由信息包含所述虚拟机的地址和所述虚拟机的虚拟交换机上部署的分布式网关的地址;The SDN controller acquires routing information of the virtual machine, where the routing information of the virtual machine includes the address of the virtual machine and the address of the distributed gateway deployed on the virtual switch of the virtual machine;

所述SDN控制器根据所述虚拟机的路由信息生成所述第三路由表项。The SDN controller generates the third routing table entry according to the routing information of the virtual machine.

结合第一方面的第二种可能的实现方式,在第一方面的第三种可能的实现方式中,在所述SDN控制器根据所述虚拟机的路由信息生成所述第三路由表项之后,所述方法还包括:With reference to the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, after the SDN controller generates the third routing table entry according to the routing information of the virtual machine , the method also includes:

所述SDN控制器将所述第三路由表项转化为第二流表项,并向所述虚拟机的虚拟交换机发送所述第二流表项。The SDN controller converts the third routing entry into a second flow entry, and sends the second flow entry to the virtual switch of the virtual machine.

结合第一方面和上述可能的实现方式,在第一方面的第四种可能的实现方式中,所述动态路由代理部署在所述虚拟机上,或者,所述动态路由代理部署在服务器上。With reference to the first aspect and the above possible implementation manners, in a fourth possible implementation manner of the first aspect, the dynamic routing agent is deployed on the virtual machine, or the dynamic routing agent is deployed on a server.

结合第一方面的第四种可能的实现方式,在第一方面的第五种可能的实现方式中,所述SDN中还包含集中式网关;所述路由表还包含第四路由表项;所述第四路由表项中包含所述虚拟机的网际协议IP所属的网段的IP地址和所述集中式网关的IP地址;With reference to the fourth possible implementation manner of the first aspect, in the fifth possible implementation manner of the first aspect, the SDN further includes a centralized gateway; the routing table further includes a fourth routing table entry; The fourth routing table entry includes the IP address of the network segment to which the Internet Protocol IP of the virtual machine belongs and the IP address of the centralized gateway;

所述方法还包括:The method also includes:

所述SDN控制器从所述第四路由表项中获取集中路由信息,所述集中路由信息用于表征所述虚拟机与所述集中式网关之间的路由关系;obtaining, by the SDN controller, centralized routing information from the fourth routing table entry, where the centralized routing information is used to represent a routing relationship between the virtual machine and the centralized gateway;

所述SDN控制器向所述动态路由代理发送携带有所述集中路由信息的第二路由发布消息,所述第二路由发布消息用于指示所述动态路由代理向边界网关发布所述集中路由信息。The SDN controller sends a second route advertisement message carrying the centralized routing information to the dynamic routing agent, where the second routing advertisement message is used to instruct the dynamic routing agent to publish the centralized routing information to the border gateway .

本发明实施例的第二方面,提供一种动态路由配置方法,应用于软件定义网络SDN中,所述SDN通过边界网关与外部网络相连,所述SDN中包含:SDN控制器、至少两个虚拟机、所述虚拟机的虚拟交换机和动态路由代理,所述虚拟机的虚拟交换机上部署有分布式网关,所述方法包括:In a second aspect of the embodiments of the present invention, a dynamic routing configuration method is provided, which is applied in a software-defined network SDN, where the SDN is connected to an external network through a border gateway, and the SDN includes: an SDN controller, at least two virtual A distributed gateway is deployed on the virtual switch of the virtual machine, a virtual switch of the virtual machine, and a dynamic routing agent, and the method includes:

所述动态路由代理接收边界网关发送的外部路由信息,所述外部路由信息用于表征外部设备与边界网关之间的路由关系;The dynamic routing agent receives external routing information sent by the border gateway, where the external routing information is used to represent the routing relationship between the external device and the border gateway;

所述动态路由代理向所述SDN控制器发送携带所述外部路由信息的路由学习消息,以使得所述SDN控制器根据所述外部路由信息更新至少一个第一路由表项,进而使得所述SDN控制器在接收到虚拟机的虚拟交换机发送的来自所述虚拟机的数据包时,将第二路由表项转化为第一流表项,并向所述虚拟机的虚拟交换机发送所述第一流表项;The dynamic routing agent sends a route learning message carrying the external routing information to the SDN controller, so that the SDN controller updates at least one first routing table entry according to the external routing information, thereby enabling the SDN controller to update at least one first routing table entry. When receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the controller converts the second routing table entry into the first flow table entry, and sends the first flow table to the virtual switch of the virtual machine item;

其中,所述至少一个第一路由表项中的每个第一路由表项中包含所述外部设备的地址和向所述外部设备发送数据包时所要经过的边界网关的地址;所述第二路由表项为所述至少一个第一路由表项中的一个路由表项,所述第二路由表项中包含的外部设备的地址与所述来自所述虚拟机的数据包的目的地址相同,所述虚拟机为所述至少两个虚拟机中的任意一个虚拟机。Wherein, each first routing table entry in the at least one first routing table entry contains the address of the external device and the address of the border gateway through which the data packet is sent to the external device; the second routing table entry The routing table entry is one of the at least one first routing table entry, and the address of the external device included in the second routing table entry is the same as the destination address of the data packet from the virtual machine, The virtual machine is any one of the at least two virtual machines.

结合第二方面,在第二方面的第一种可能的实现方式中,所述方法还包括:With reference to the second aspect, in a first possible implementation manner of the second aspect, the method further includes:

所述动态路由代理接收所述SDN控制器发送的第一路由发布消息,所述第一路由发布消息中携带有内部路由信息,所述内部路由信息用于表征所述虚拟机与所述虚拟机的虚拟交换机上部署的分布式网关之间的路由关系;The dynamic routing agent receives the first route advertisement message sent by the SDN controller, where the first route advertisement message carries internal routing information, and the internal routing information is used to represent the virtual machine and the virtual machine The routing relationship between the distributed gateways deployed on the virtual switches;

所述动态路由代理向边界网关发布所述内部路由信息。The dynamic routing agent publishes the internal routing information to the border gateway.

结合第二方面的第一种可能的实现方式,在第二方面的第二种可能的实现方式中,所述动态路由代理接收边界网关发送的外部路由信息,包括:With reference to the first possible implementation manner of the second aspect, in a second possible implementation manner of the second aspect, the dynamic routing agent receives the external routing information sent by the border gateway, including:

所述动态路由代理基于动态路由协议,接收边界网关发送的外部路由信息;The dynamic routing agent receives the external routing information sent by the border gateway based on the dynamic routing protocol;

所述动态路由代理向边界网关发布所述内部路由信息,包括:The dynamic routing agent publishes the internal routing information to the border gateway, including:

所述动态路由代理基于所述动态路由协议,向边界网关发布所述内部路由信息。The dynamic routing agent publishes the internal routing information to the border gateway based on the dynamic routing protocol.

结合第二方面和上述可能的实现方式,在第二方面的第三种可能的实现方式中,所述动态路由代理部署在所述虚拟机上,或者,所述动态路由代理部署在服务器上。With reference to the second aspect and the above possible implementation manners, in a third possible implementation manner of the second aspect, the dynamic routing agent is deployed on the virtual machine, or the dynamic routing agent is deployed on a server.

结合第二方面的第三种可能的实现方式,在第二方面的第四种可能的实现方式中,所述SDN中还包含集中式网关;所述方法还包括:With reference to the third possible implementation manner of the second aspect, in a fourth possible implementation manner of the second aspect, the SDN further includes a centralized gateway; the method further includes:

所述动态路由代理接收所述SDN控制器发送的第二路由发布消息,所述第二路由发布消息中携带有集中路由信息,所述集中路由信息用于表征所述虚拟机与所述集中式网关之间的路由关系;The dynamic routing agent receives the second route advertisement message sent by the SDN controller, the second route advertisement message carries centralized routing information, and the centralized routing information is used to represent the virtual machine and the centralized routing information. The routing relationship between gateways;

所述动态路由代理向边界网关发布所述集中路由信息。The dynamic routing agent publishes the centralized routing information to the border gateway.

结合第二方面的第四种可能的实现方式,在第二方面的第五种可能的实现方式中,所述动态路由代理向边界网关发布所述集中路由信息,包括:With reference to the fourth possible implementation manner of the second aspect, in a fifth possible implementation manner of the second aspect, the dynamic routing agent publishes the centralized routing information to the border gateway, including:

所述动态路由代理基于所述动态路由协议,向边界网关发布所述集中路由信息。The dynamic routing agent publishes the centralized routing information to the border gateway based on the dynamic routing protocol.

本发明实施例的第三方面,提供一种软件定义网络SDN控制器,应用于SDN中,所述SDN通过边界网关与外部网络相连,所述SDN中包含:所述SDN控制器、至少两个虚拟机、所述虚拟机的虚拟交换机和动态路由代理,所述虚拟机的虚拟交换机上部署有分布式网关,所述SDN控制器包括:In a third aspect of the embodiments of the present invention, a software-defined network SDN controller is provided, which is applied in SDN, the SDN is connected to an external network through a border gateway, and the SDN includes: the SDN controller, at least two A virtual machine, a virtual switch of the virtual machine and a dynamic routing agent, a distributed gateway is deployed on the virtual switch of the virtual machine, and the SDN controller includes:

接收单元,用于接收所述动态路由代理发送的路由学习消息,所述路由学习消息中携带有外部路由信息,所述外部路由信息用于表征外部设备与边界网关之间的路由关系;a receiving unit, configured to receive a routing learning message sent by the dynamic routing agent, where the routing learning message carries external routing information, and the external routing information is used to represent the routing relationship between the external device and the border gateway;

更新单元,用于根据所述外部路由信息更新至少一个第一路由表项,所述至少一个第一路由表项中的每个第一路由表项中包含所述外部设备的地址和向所述外部设备发送数据包时所要经过的边界网关的地址;An update unit, configured to update at least one first routing table entry according to the external routing information, where each first routing table entry in the at least one first routing table entry contains the address of the external device and the address to the external device. The address of the border gateway through which the external device sends data packets;

路由转换单元,用于在接收到虚拟机的虚拟交换机发送的来自所述虚拟机的数据包时,将第二路由表项转化为第一流表项,所述第二路由表项为所述至少一个第一路由表项中的一个路由表项,所述第二路由表项中包含的外部设备的地址与所述来自所述虚拟机的数据包的目的地址相同,所述虚拟机为所述至少两个虚拟机中的任意一个虚拟机;a route conversion unit, configured to convert a second routing table entry into a first flow table entry when receiving a data packet from the virtual machine sent by the virtual switch of the virtual machine, where the second routing table entry is the at least one A routing table entry in a first routing table entry, the address of the external device contained in the second routing table entry is the same as the destination address of the data packet from the virtual machine, and the virtual machine is the Any one of at least two virtual machines;

第一发送单元,用于向所述虚拟机的虚拟交换机发送所述第一流表项,以指示所述虚拟机的虚拟交换机根据所述第一流表项,通过所述虚拟机的虚拟交换机上部署的分布式网关转发所述来自所述虚拟机的数据包。a first sending unit, configured to send the first flow entry to the virtual switch of the virtual machine, to instruct the virtual switch of the virtual machine to deploy on the virtual switch of the virtual machine according to the first flow entry The distributed gateway forwards the packets from the virtual machine.

结合第三方面,在第三方面的第一种可能的实现方式中,所述SDN控制器还包括:With reference to the third aspect, in a first possible implementation manner of the third aspect, the SDN controller further includes:

获取单元,用于从至少一个第三路由表项中获取内部路由信息,所述至少一个第三路由表项中的每个第三路由表项中包含所述虚拟机的地址和向所述虚拟机发送数据包时所要经过的分布式网关的地址,所述向所述虚拟机发送数据包时所要经过的分布式网关为所述虚拟机的虚拟交换机上部署的分布式网关,所述内部路由信息用于表征所述虚拟机与所述虚拟机的虚拟交换机上部署的分布式网关之间的路由关系;The obtaining unit is configured to obtain internal routing information from at least one third routing table entry, where each third routing table entry in the at least one third routing table entry contains the address of the virtual machine and the address to the virtual machine. The address of the distributed gateway through which the machine sends data packets, the distributed gateway through which the data packet is sent to the virtual machine is the distributed gateway deployed on the virtual switch of the virtual machine, and the internal routing The information is used to represent the routing relationship between the virtual machine and the distributed gateway deployed on the virtual switch of the virtual machine;

第二发送单元,用于向所述动态路由代理发送携带有所述内部路由信息的第一路由发布消息,所述第一路由发布消息用于指示所述动态路由代理向边界网关发布所述内部路由信息;a second sending unit, configured to send a first route advertisement message carrying the internal routing information to the dynamic routing agent, where the first route advertisement message is used to instruct the dynamic routing agent to publish the internal routing information to the border gateway routing information;

其中,所述SDN控制器中存储有路由表,所述路由表包含所述至少一个第一路由表项和所述至少一个第三路由表项。Wherein, a routing table is stored in the SDN controller, and the routing table includes the at least one first routing table entry and the at least one third routing table entry.

结合第三方面的第一种可能的实现方式,在第三方面的第二种可能的实现方式中,所述获取单元,还用于在从至少一个第三路由表项中获取内部路由信息之前,获取所述虚拟机的路由信息,所述虚拟机的路由信息包含所述虚拟机的地址和所述虚拟机的虚拟交换机上部署的分布式网关的地址;With reference to the first possible implementation manner of the third aspect, in the second possible implementation manner of the third aspect, the acquiring unit is further configured to acquire internal routing information from at least one third routing table entry before acquiring the internal routing information , obtaining routing information of the virtual machine, where the routing information of the virtual machine includes the address of the virtual machine and the address of the distributed gateway deployed on the virtual switch of the virtual machine;

所述SDN控制器还包括:The SDN controller also includes:

生成单元,用于根据所述虚拟机的路由信息生成所述第三路由表项。A generating unit, configured to generate the third routing table entry according to the routing information of the virtual machine.

结合第三方面的第二种可能的实现方式,在第三方面的第三种可能的实现方式中,所述路由转换单元,还用于在所述生成单元根据所述虚拟机的路由信息生成所述第三路由表项之后,将所述第三路由表项转化为第二流表项;With reference to the second possible implementation manner of the third aspect, in a third possible implementation manner of the third aspect, the route conversion unit is further configured to generate, in the generation unit according to the routing information of the virtual machine After the third routing table entry, converting the third routing table entry into a second flow table entry;

所述第一发送单元,还用于向所述虚拟机的虚拟交换机发送所述第二流表项。The first sending unit is further configured to send the second flow entry to the virtual switch of the virtual machine.

结合第三方面和上述可能的实现方式,在第三方面的第四种可能的实现方式中,所述动态路由代理部署在所述虚拟机上,或者,所述动态路由代理部署在服务器上。With reference to the third aspect and the above possible implementation manners, in a fourth possible implementation manner of the third aspect, the dynamic routing agent is deployed on the virtual machine, or the dynamic routing agent is deployed on a server.

结合第三方面的第四种可能的实现方式,在第三方面的第五种可能的实现方式中,所述SDN中还包含集中式网关;所述路由表还包含第四路由表项;所述第四路由表项中包含所述虚拟机的网际协议IP所属的网段的IP地址和所述集中式网关的IP地址;With reference to the fourth possible implementation manner of the third aspect, in a fifth possible implementation manner of the third aspect, the SDN further includes a centralized gateway; the routing table further includes a fourth routing table entry; The fourth routing table entry includes the IP address of the network segment to which the Internet Protocol IP of the virtual machine belongs and the IP address of the centralized gateway;

所述获取单元,还用于从所述第四路由表项中获取集中路由信息,所述集中路由信息用于表征所述虚拟机与所述集中式网关之间的路由关系;The obtaining unit is further configured to obtain centralized routing information from the fourth routing table entry, where the centralized routing information is used to represent the routing relationship between the virtual machine and the centralized gateway;

所述第二发送单元,用于向所述动态路由代理发送携带有所述集中路由信息的第二路由发布消息,所述第二路由发布消息用于指示所述动态路由代理向边界网关发布所述集中路由信息。The second sending unit is configured to send a second route advertisement message carrying the centralized routing information to the dynamic routing agent, where the second route advertisement message is used to instruct the dynamic routing agent to publish the information to the border gateway. The centralized routing information is described.

本发明实施例的第四方面,提供一种动态路由代理,应用于软件定义网络SDN中,所述SDN通过边界网关与外部网络相连,所述SDN中包含:SDN控制器、至少两个虚拟机、所述虚拟机的虚拟交换机和所述动态路由代理,所述虚拟机的虚拟交换机上部署有分布式网关,所述动态路由代理包括:In a fourth aspect of the embodiments of the present invention, a dynamic routing agent is provided, which is applied in a software-defined network SDN, the SDN is connected to an external network through a border gateway, and the SDN includes: an SDN controller, at least two virtual machines , the virtual switch of the virtual machine and the dynamic routing agent, a distributed gateway is deployed on the virtual switch of the virtual machine, and the dynamic routing agent includes:

接收单元,用于接收边界网关发送的外部路由信息,所述外部路由信息用于表征外部设备与边界网关之间的路由关系;a receiving unit, configured to receive external routing information sent by the border gateway, where the external routing information is used to represent the routing relationship between the external device and the border gateway;

发送单元,用于向所述SDN控制器发送携带所述外部路由信息的路由学习消息,以使得所述SDN控制器根据所述外部路由信息更新至少一个第一路由表项,进而使得所述SDN控制器在接收到虚拟机的虚拟交换机发送的来自所述虚拟机的数据包时,将第二路由表项转化为第一流表项,并向所述虚拟机的虚拟交换机发送所述第一流表项;A sending unit, configured to send a route learning message carrying the external routing information to the SDN controller, so that the SDN controller updates at least one first routing table entry according to the external routing information, thereby enabling the SDN controller to update at least one first routing table entry. When receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the controller converts the second routing table entry into the first flow table entry, and sends the first flow table to the virtual switch of the virtual machine item;

其中,所述至少一个第一路由表项中的每个第一路由表项中包含所述外部设备的地址和向所述外部设备发送数据包时所要经过的边界网关的地址;所述第二路由表项为所述至少一个第一路由表项中的一个路由表项,所述第二路由表项中包含的外部设备的地址与所述来自所述虚拟机的数据包的目的地址相同,所述虚拟机为所述至少两个虚拟机中的任意一个虚拟机。Wherein, each first routing table entry in the at least one first routing table entry contains the address of the external device and the address of the border gateway through which the data packet is sent to the external device; the second routing table entry The routing table entry is one of the at least one first routing table entry, and the address of the external device included in the second routing table entry is the same as the destination address of the data packet from the virtual machine, The virtual machine is any one of the at least two virtual machines.

结合第四方面,在第四方面的第一种可能的实现方式中,所述接收单元,还用于接收所述SDN控制器发送的第一路由发布消息,所述第一路由发布消息中携带有内部路由信息,所述内部路由信息用于表征所述虚拟机与所述虚拟机的虚拟交换机上部署的分布式网关之间的路由关系;With reference to the fourth aspect, in a first possible implementation manner of the fourth aspect, the receiving unit is further configured to receive a first route advertisement message sent by the SDN controller, where the first route advertisement message carries There is internal routing information, and the internal routing information is used to represent the routing relationship between the virtual machine and the distributed gateway deployed on the virtual switch of the virtual machine;

所述发送单元,还用于向边界网关发布所述内部路由信息。The sending unit is further configured to publish the internal routing information to the border gateway.

结合第四方面的第一种可能的实现方式,在第四方面的第二种可能的实现方式中,所述动态路由代理还包括:With reference to the first possible implementation manner of the fourth aspect, in the second possible implementation manner of the fourth aspect, the dynamic routing agent further includes:

控制单元,用于控制所述接收单元基于动态路由协议,接收边界网关发送的外部路由信息;a control unit, configured to control the receiving unit to receive the external routing information sent by the border gateway based on the dynamic routing protocol;

所述控制单元,还用于控制所述发送单元基于所述动态路由协议,向边界网关发布所述内部路由信息。The control unit is further configured to control the sending unit to publish the internal routing information to the border gateway based on the dynamic routing protocol.

结合第四方面和上述可能的实现方式,在第四方面的第三种可能的实现方式中,所述动态路由代理部署在所述虚拟机上,或者,所述动态路由代理部署在服务器上。With reference to the fourth aspect and the above possible implementation manners, in a third possible implementation manner of the fourth aspect, the dynamic routing agent is deployed on the virtual machine, or the dynamic routing agent is deployed on a server.

结合第四方面的第三种可能的实现方式,在第四方面的第四种可能的实现方式中,所述SDN中还包含集中式网关;With reference to the third possible implementation manner of the fourth aspect, in the fourth possible implementation manner of the fourth aspect, the SDN further includes a centralized gateway;

所述接收单元,还用于接收所述SDN控制器发送的第二路由发布消息,所述第二路由发布消息中携带有集中路由信息,所述集中路由信息用于表征所述虚拟机与所述集中式网关之间的路由关系;The receiving unit is further configured to receive a second route advertisement message sent by the SDN controller, where the second route advertisement message carries centralized routing information, and the centralized routing information is used to represent the virtual machine and the Describe the routing relationship between centralized gateways;

所述发送单元,还用于向边界网关发布所述集中路由信息。The sending unit is further configured to publish the centralized routing information to the border gateway.

结合第四方面的第四种可能的实现方式,在第四方面的第五种可能的实现方式中,所述控制单元,还用于控制所述发送单元基于所述动态路由协议,向边界网关发布所述集中路由信息。With reference to the fourth possible implementation manner of the fourth aspect, in a fifth possible implementation manner of the fourth aspect, the control unit is further configured to control the sending unit to send a message to the border gateway based on the dynamic routing protocol Publish the centralized routing information.

本发明实施例的第五方面,提供一种动态路由配置系统,所述系统包括:软件定义网络SDN控制器、至少两个虚拟机、所述虚拟机的虚拟交换机和动态路由代理,所述虚拟机的虚拟交换机上部署有分布式网关;A fifth aspect of the embodiments of the present invention provides a dynamic routing configuration system, the system includes: a software-defined network SDN controller, at least two virtual machines, a virtual switch of the virtual machines, and a dynamic routing agent, the virtual A distributed gateway is deployed on the virtual switch of the machine;

所述SDN控制器,用于接收所述动态路由代理发送的路由学习消息,所述路由学习消息中携带有外部路由信息,所述外部路由信息用于表征外部设备与边界网关之间的路由关系;根据所述外部路由信息更新至少一个第一路由表项,所述至少一个第一路由表项中的每个第一路由表项中包含所述外部设备的地址和向所述外部设备发送数据包时所要经过的边界网关的地址;在接收到虚拟机的虚拟交换机发送的来自所述虚拟机的数据包时,将第二路由表项转化为第一流表项,所述第二路由表项为所述至少一个第一路由表项中的一个路由表项,所述第二路由表项中包含的外部设备的地址与所述来自所述虚拟机的数据包的目的地址相同,所述虚拟机为所述至少两个虚拟机中的任意一个虚拟机;向所述虚拟机的虚拟交换机发送所述第一流表项,以指示所述虚拟机的虚拟交换机根据所述第一流表项,通过所述虚拟机的虚拟交换机上部署的分布式网关转发所述来自所述虚拟机的数据包;The SDN controller is configured to receive a routing learning message sent by the dynamic routing agent, where the routing learning message carries external routing information, and the external routing information is used to represent the routing relationship between the external device and the border gateway ; Update at least one first routing table entry according to the external routing information, and each first routing table entry in the at least one first routing table entry contains the address of the external device and sends data to the external device. The address of the border gateway to pass through when the packet is received; when receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the second routing table entry is converted into a first flow table entry, the second routing table entry is a routing entry in the at least one first routing entry, the address of the external device included in the second routing entry is the same as the destination address of the data packet from the virtual machine, the virtual The machine is any one of the at least two virtual machines; the first flow entry is sent to the virtual switch of the virtual machine to instruct the virtual switch of the virtual machine to pass the first flow entry according to the first flow entry. the distributed gateway deployed on the virtual switch of the virtual machine forwards the data packet from the virtual machine;

所述动态路由代理,用于接收所述边界网关发送的所述外部路由信息;向所述SDN控制器发送携带所述外部路由信息的所述路由学习消息,以使得所述SDN控制器根据所述外部路由信息更新所述至少一个第一路由表项,进而使得所述SDN控制器在接收到所述虚拟机的虚拟交换机发送的来自所述虚拟机的数据包时,将所述第二路由表项转化为所述第一流表项,并向所述虚拟机的虚拟交换机发送所述第一流表项。The dynamic routing agent is configured to receive the external routing information sent by the border gateway; and send the routing learning message carrying the external routing information to the SDN controller, so that the SDN controller can The external routing information updates the at least one first routing table entry, so that when the SDN controller receives the data packet from the virtual machine sent by the virtual switch of the virtual machine, the second routing table is The entry is converted into the first flow entry, and the first flow entry is sent to the virtual switch of the virtual machine.

本发明实施例提供的动态路由配置方法、装置及系统,SDN控制器根据接收到的路由学习消息中携带的外部路由信息更新至少一个第一路由表项;SDN控制器在接收到虚拟机(SDN中包含的任意一个虚拟机)的虚拟交换机发送的来自该虚拟机的数据包时,将第二路由表项转化为第一流表项,并向该虚拟机的虚拟交换机发送第一流表项,以使得该虚拟机的虚拟交换机根据第一流表项,通过该虚拟机的虚拟交换机上部署的分布式网关转发该来自该虚拟机的数据包。其中,第二路由表项为至少一个第一路由表项中的一个路由表项,第二路由表项中包含的外部设备的地址与该来自该虚拟机的数据包的目的地址相同。这样,当该虚拟机需要向外部设备发送数据包时,该虚拟机的虚拟交换机就可以根据第一流表项,通过该虚拟机的虚拟交换机上部署的分布式网关转发该数据包,而无需手动在分布式网关上配置边界网关和外部设备之间的路由,从而可以解决现有技术中采用分布式网关时手动配置路由工作量大的问题;此外,当网络拓扑发生变化时,采用本发明实施例中的动态路由配置方法,SDN控制器可以根据路由学习消息中携带的外部路由信息动态更新第一路由表项,从而可以动态调整边界网关和外部设备之间的路由,以解决现有技术中采用分布式网关时调整不方便的问题。In the dynamic routing configuration method, device, and system provided by the embodiments of the present invention, the SDN controller updates at least one first routing table entry according to the external routing information carried in the received routing learning message; When the data packet from the virtual machine is sent by the virtual switch of any virtual machine included in the virtual machine), the second routing table entry is converted into the first flow table entry, and the first flow table entry is sent to the virtual switch of the virtual machine, to The virtual switch of the virtual machine is caused to forward the data packet from the virtual machine through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry. The second routing table entry is one routing table entry in at least one first routing table entry, and the address of the external device included in the second routing table entry is the same as the destination address of the data packet from the virtual machine. In this way, when the virtual machine needs to send a data packet to an external device, the virtual switch of the virtual machine can forward the data packet through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry, without manual The route between the border gateway and the external device is configured on the distributed gateway, so that the problem of heavy workload of manually configuring the route when the distributed gateway is adopted in the prior art can be solved; in addition, when the network topology changes, the present invention is adopted to implement In the dynamic routing configuration method in the example, the SDN controller can dynamically update the first routing table entry according to the external routing information carried in the routing learning message, so that the routing between the border gateway and the external device can be dynamically adjusted to solve the problem in the prior art. Inconvenient adjustment when using distributed gateways.

附图说明Description of drawings

图1为本发明实施例中的SDN的组成示意图;FIG. 1 is a schematic diagram of the composition of an SDN in an embodiment of the present invention;

图2为本发明实施例中的一种动态路由配置方法流程图;2 is a flowchart of a dynamic routing configuration method in an embodiment of the present invention;

图3为本发明实施例中的另一种动态路由配置方法流程图;3 is a flowchart of another dynamic routing configuration method in an embodiment of the present invention;

图4为本发明实施例中的另一种动态路由配置方法流程图;4 is a flowchart of another dynamic routing configuration method in an embodiment of the present invention;

图5为本发明实施例中的另一种动态路由配置方法流程图;5 is a flowchart of another dynamic routing configuration method in an embodiment of the present invention;

图6为本发明实施例中的另一种动态路由配置方法流程图;6 is a flowchart of another dynamic routing configuration method in an embodiment of the present invention;

图7为本发明实施例中的一种SDN控制器的组成示意图;7 is a schematic diagram of the composition of an SDN controller in an embodiment of the present invention;

图8为本发明实施例中的另一种SDN控制器的组成示意图;FIG. 8 is a schematic diagram of the composition of another SDN controller in an embodiment of the present invention;

图9为本发明实施例中的另一种SDN控制器的组成示意图;FIG. 9 is a schematic diagram of the composition of another SDN controller in an embodiment of the present invention;

图10为本发明实施例中的一种动态路由代理的组成示意图;10 is a schematic diagram of the composition of a dynamic routing proxy in an embodiment of the present invention;

图11为本发明实施例中的另一种动态路由代理的组成示意图;11 is a schematic diagram of the composition of another dynamic routing proxy in an embodiment of the present invention;

图12为本发明实施例中的另一种SDN控制器的组成示意图;12 is a schematic diagram of the composition of another SDN controller in an embodiment of the present invention;

图13为本发明实施例中的另一种动态路由代理的组成示意图;13 is a schematic diagram of the composition of another dynamic routing proxy in an embodiment of the present invention;

图14为本发明实施例中的另一种动态路由代理的组成示意图;14 is a schematic diagram of the composition of another dynamic routing proxy in an embodiment of the present invention;

图15为本发明实施例中的一种动态路由配置系统的组成示意图。FIG. 15 is a schematic diagram of the composition of a dynamic routing configuration system in an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

本发明实施例应用于SDN,SDN通过边界网关与外部网络相连,如图1所示,SDN中包含SDN控制器、至少两个虚拟机、虚拟机的虚拟交换机(即虚拟机接入的虚拟交换机)和动态路由代理。其中,多个虚拟机可以接入同一个虚拟交换机,但是每个虚拟机只接入一个虚拟交换机,即每个虚拟机的虚拟交换机是唯一的。虚拟机和虚拟机的虚拟交换机部署在服务器上,一台服务器上可以部署多个虚拟机。虚拟机发送的数据包可以经过分布式网关和边界网关的转发到达外部设备。本发明实施例中的动态路由代理与边界网关之间通过动态路由协议进行控制面交互。常用的动态路由协议包括:边界网关协议(英文:Border GatewayProtocol,缩写:BGP)和开放式最短路径优先(英文:Open Shortest Path First,缩写:OSPF)协议等,具体的动态路由协议的描述可以参考现有技术中的相关描述,本发明实施例这里不再赘述。The embodiment of the present invention is applied to an SDN. The SDN is connected to an external network through a border gateway. As shown in FIG. 1 , the SDN includes an SDN controller, at least two virtual machines, and a virtual switch of the virtual machine (that is, a virtual switch accessed by the virtual machine). ) and dynamic routing proxies. Wherein, multiple virtual machines can be connected to the same virtual switch, but each virtual machine is only connected to one virtual switch, that is, the virtual switch of each virtual machine is unique. Virtual machines and virtual switches of virtual machines are deployed on servers, and multiple virtual machines can be deployed on one server. Data packets sent by virtual machines can be forwarded to external devices through distributed gateways and border gateways. Control plane interaction is performed between the dynamic routing agent and the border gateway in the embodiment of the present invention through a dynamic routing protocol. Commonly used dynamic routing protocols include: Border Gateway Protocol (English: Border Gateway Protocol, abbreviation: BGP) and Open Shortest Path First (English: Open Shortest Path First, abbreviation: OSPF) protocol, etc. The description of the specific dynamic routing protocol can refer to Relevant descriptions in the prior art are not repeated in this embodiment of the present invention.

本发明实施例提供一种动态路由配置方法,如图2所示,包括:An embodiment of the present invention provides a dynamic routing configuration method, as shown in FIG. 2 , including:

S101、SDN控制器接收动态路由代理发送的路由学习消息。S101. The SDN controller receives the route learning message sent by the dynamic routing agent.

其中,路由学习消息中携带有外部路由信息,外部路由信息用于表征外部设备与边界网关之间的路由关系。SDN控制器可以在网络初始配置完成后接收路由学习消息,也可以在外部设备与边界网关之间的路由关系发生变化时接收路由学习消息。外部路由信息可以用于表征一个外部设备与边界网关之间的路由关系,外部路由信息也可以用于表征多个外部设备与边界网关之间的路由关系。The route learning message carries external routing information, and the external routing information is used to represent the routing relationship between the external device and the border gateway. The SDN controller can receive the route learning message after the initial configuration of the network is completed, and can also receive the route learning message when the routing relationship between the external device and the border gateway changes. The external routing information can be used to represent the routing relationship between one external device and the border gateway, and the external routing information can also be used to represent the routing relationship between multiple external devices and the border gateway.

需要说明的是,本发明实施例中的动态路由代理可以部署在虚拟机上,也可以部署在服务器上,动态路由代理中配置有可以用于与边界网关进行通信的网卡。动态路由代理可以是一个功能模块,也可以是一个物理实体,当动态路由代理部署在服务器上时,可以将动态路由代理所在的服务器称为动态路由代理。It should be noted that the dynamic routing agent in the embodiment of the present invention may be deployed on a virtual machine or a server, and a network card that can be used for communicating with the border gateway is configured in the dynamic routing agent. The dynamic routing agent can be a functional module or a physical entity. When the dynamic routing agent is deployed on a server, the server where the dynamic routing agent is located can be called a dynamic routing agent.

S102、SDN控制器根据外部路由信息更新至少一个第一路由表项。S102. The SDN controller updates at least one first routing table entry according to the external routing information.

其中,SDN控制器中存储有路由表,本发明实施例中将路由表中的每一项称为路由表项。该路由表中包含至少一个第一路由表项,每个第一路由表项中包含一个外部设备的地址和向该外部设备发送数据包时所要经过的边界网关的地址。The SDN controller stores a routing table, and in the embodiment of the present invention, each item in the routing table is referred to as a routing table entry. The routing table includes at least one first routing table entry, and each first routing table entry includes an address of an external device and an address of a border gateway through which data packets are sent to the external device.

外部设备的地址可以为外部设备的网际协议(英文:Internet Protocol,缩写:IP)地址,也可以为外部设备的媒体接入控制(Media Access Control,缩写:MAC)地址,本发明实施例对此不做限定。The address of the external device may be an Internet Protocol (English: Internet Protocol, abbreviation: IP) address of the external device, or may be a Media Access Control (Media Access Control, abbreviation: MAC) address of the external device, to which the embodiment of the present invention is directed Not limited.

边界网关的地址可以为边界网关的IP地址,也可以为边界网关的MAC地址,本发明实施例对此不做限定。The address of the border gateway may be the IP address of the border gateway, or may be the MAC address of the border gateway, which is not limited in this embodiment of the present invention.

需要说明的是,每个第一路由表项中还可以包含子网掩码、优先级等,第一路由表项的格式可以参考现有技术中路由表的格式,本发明对第一路由表项的格式不做限定。It should be noted that each first routing table entry may also include a subnet mask, priority, etc. The format of the first routing table entry may refer to the format of the routing table in the prior art. The format of the item is not limited.

S103、SDN控制器在接收到虚拟机的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项。S103. When receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the SDN controller converts the second routing table entry into the first flow table entry.

其中,第二路由表项为至少一个第一路由表项中的一个路由表项,第二路由表项中包含的外部设备的地址与来自该虚拟机的数据包的目的地址相同,本步骤中的虚拟机为至少两个虚拟机中的任意一个虚拟机。The second routing table entry is a routing table entry in at least one first routing table entry, and the address of the external device contained in the second routing table entry is the same as the destination address of the data packet from the virtual machine. In this step The virtual machine is any one of at least two virtual machines.

第一流表项用于指示虚拟机的虚拟交换机转发数据包时的转发规则。本发明实施例对第一流表项的格式不做限定,第一流表项的格式可以参考现有技术中流表项的相关描述。The first flow entry is used to indicate a forwarding rule when the virtual switch of the virtual machine forwards the data packet. This embodiment of the present invention does not limit the format of the first flow entry. For the format of the first flow entry, reference may be made to the related description of the flow entry in the prior art.

S104、SDN控制器向虚拟机的虚拟交换机发送第一流表项,以指示虚拟机的虚拟交换机根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发来自该虚拟机的数据包。S104. The SDN controller sends a first flow entry to the virtual switch of the virtual machine to instruct the virtual switch of the virtual machine to forward the data packet from the virtual machine through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry .

示例性的,假设虚拟机1(虚拟机1为SDN中包含的任意一个虚拟机)要向外部设备1发送数据包,外部设备1的IP地址为10.10.10.5,则虚拟机1先将该数据包发送给虚拟交换机1(即虚拟机1的虚拟交换机);虚拟交换机1查找虚拟交换机1上是否存储有目的地址为10.10.10.5的流表项;若虚拟交换机1上存储有目的地址为10.10.10.5的流表项,则虚拟交换机1根据该流表项,通过虚拟交换机1上部署的分布式网关转发该数据包;若虚拟交换机1上没有存储有目的地址为10.10.10.5的流表项,则虚拟交换机1将该数据包发送至SDN控制器,SDN控制器将与该目的地址对应的第二路由表项转化为第一流表项下发至虚拟交换机1,虚拟交换机1再根据第一流表项,通过虚拟交换机1上部署的分布式网关转发该数据包。Exemplarily, it is assumed that virtual machine 1 (virtual machine 1 is any virtual machine included in the SDN) wants to send a data packet to external device 1, and the IP address of external device 1 is 10.10.10.5, then virtual machine 1 first sends the data packet. The packet is sent to virtual switch 1 (that is, the virtual switch of virtual machine 1); virtual switch 1 searches whether virtual switch 1 stores a flow table entry with a destination address of 10.10.10.5; if virtual switch 1 stores a destination address of 10.10. 10.5 flow entry, virtual switch 1 forwards the data packet through the distributed gateway deployed on virtual switch 1 according to the flow entry; if virtual switch 1 does not store a flow entry with destination address 10.10.10.5, Then the virtual switch 1 sends the data packet to the SDN controller, and the SDN controller converts the second routing table entry corresponding to the destination address into a first flow table entry and sends it to the virtual switch 1, and the virtual switch 1 then according to the first flow table. item, the packet is forwarded through the distributed gateway deployed on virtual switch 1.

本发明实施例提供的动态路由配置方法,SDN控制器根据接收到的路由学习消息中携带的外部路由信息更新至少一个第一路由表项;SDN控制器在接收到虚拟机(SDN中包含的任意一个虚拟机)的虚拟交换机发送的来自该虚拟机的数据包时,将第二路由表项转化为第一流表项,并向该虚拟机的虚拟交换机发送第一流表项,以使得该虚拟机的虚拟交换机根据第一流表项,通过该虚拟机的虚拟交换机上部署的分布式网关转发该来自该虚拟机的数据包。其中,第二路由表项为至少一个第一路由表项中的一个路由表项,第二路由表项中包含的外部设备的地址与该来自该虚拟机的数据包的目的地址相同。这样,当该虚拟机需要向外部设备发送数据包时,该虚拟机的虚拟交换机就可以根据第一流表项,通过该虚拟机的虚拟交换机上部署的分布式网关转发该数据包,而无需手动在分布式网关上配置边界网关和外部设备之间的路由,从而可以解决现有技术中采用分布式网关时手动配置路由工作量大的问题;此外,当网络拓扑发生变化时,采用本发明实施例中的动态路由配置方法,SDN控制器可以根据路由学习消息中携带的外部路由信息动态更新第一路由表项,从而可以动态调整边界网关和外部设备之间的路由,以解决现有技术中采用分布式网关时调整不方便的问题。In the dynamic routing configuration method provided by the embodiment of the present invention, the SDN controller updates at least one first routing table entry according to the external routing information carried in the received routing learning message; When a data packet from the virtual machine is sent by the virtual switch of a virtual machine), the second routing table entry is converted into the first flow table entry, and the first flow table entry is sent to the virtual switch of the virtual machine, so that the virtual machine The virtual switch forwards the data packet from the virtual machine through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry. The second routing table entry is one routing table entry in at least one first routing table entry, and the address of the external device included in the second routing table entry is the same as the destination address of the data packet from the virtual machine. In this way, when the virtual machine needs to send a data packet to an external device, the virtual switch of the virtual machine can forward the data packet through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry, without manual The route between the border gateway and the external device is configured on the distributed gateway, so that the problem of heavy workload of manually configuring the route when the distributed gateway is adopted in the prior art can be solved; in addition, when the network topology changes, the present invention is adopted to implement In the dynamic routing configuration method in the example, the SDN controller can dynamically update the first routing table entry according to the external routing information carried in the routing learning message, so that the routing between the border gateway and the external device can be dynamically adjusted to solve the problem in the prior art. Inconvenient adjustment when using distributed gateways.

进一步的,如图3所示,本发明实施例提供的动态路由配置方法还可以包括:Further, as shown in FIG. 3 , the dynamic routing configuration method provided by the embodiment of the present invention may further include:

S105、SDN控制器从至少一个第三路由表项中获取内部路由信息。S105. The SDN controller acquires internal routing information from at least one third routing table entry.

其中,SDN控制器中存储的路由表中除了包含至少一个第一路由表项之外,还包含至少一个第三路由表项。至少一个第三路由表项中的每个第三路由表项中包含虚拟机的地址和向虚拟机发送数据包时所要经过的分布式网关的地址,向虚拟机发送数据包时所要经过的分布式网关为虚拟机的虚拟交换机上部署的分布式网关,内部路由信息用于表征虚拟机与虚拟机的虚拟交换机上部署的分布式网关之间的路由关系。The routing table stored in the SDN controller includes at least one first routing table entry and at least one third routing table entry. Each third routing table entry in the at least one third routing table entry contains the address of the virtual machine and the address of the distributed gateway to pass through when sending data packets to the virtual machine, and the distribution to pass through when sending data packets to the virtual machine. The virtual gateway is a distributed gateway deployed on the virtual switch of the virtual machine, and the internal routing information is used to represent the routing relationship between the virtual machine and the distributed gateway deployed on the virtual switch of the virtual machine.

需要说明的是,大规模的数据中心通常会支持多个租户(租户为使用数据中心资源的用户,例如,一个企业可以为一个租户),多个租户共享数据中心的资源。本发明实施例中的SDN控制器也可以支持多个租户的场景。具体的,SDN控制器中可以存储多个路由表,每个路由表对应一个租户。SDN控制器可以对每个路由表进行独立管理。对应的,动态路由代理上也可以部署多个动态路由代理实例,每个动态路由代理实例对应一个租户,每个动态路由代理实例都可以实现本发明实施例中的动态路由代理的功能。SDN控制器可以对动态路由代理上部署的所有动态路由代理实例进行生命周期的管理。It should be noted that a large-scale data center usually supports multiple tenants (tenants are users who use data center resources, for example, an enterprise can be one tenant), and multiple tenants share data center resources. The SDN controller in the embodiment of the present invention may also support a scenario of multiple tenants. Specifically, the SDN controller may store multiple routing tables, and each routing table corresponds to one tenant. The SDN controller can manage each routing table independently. Correspondingly, multiple dynamic routing proxy instances may also be deployed on the dynamic routing proxy, each dynamic routing proxy instance corresponds to a tenant, and each dynamic routing proxy instance may implement the function of the dynamic routing proxy in the embodiment of the present invention. The SDN controller can manage the life cycle of all dynamic routing proxy instances deployed on the dynamic routing proxy.

S106、SDN控制器向动态路由代理发送携带有内部路由信息的第一路由发布消息,第一路由发布消息用于指示动态路由代理向边界网关发布内部路由信息。S106: The SDN controller sends a first route advertisement message carrying internal routing information to the dynamic routing agent, where the first route advertisement message is used to instruct the dynamic routing agent to publish the internal routing information to the border gateway.

这样,边界网关就可以获得虚拟机与虚拟机的虚拟交换机上部署的分布式网关之间的路由关系,边界网关可以根据内部路由信息更新边界网关上存储的路由表项。当外部设备要向虚拟机发送数据包时,外部设备先将该数据包发送至边界网关,边界网关就可以根据边界网关上存储的路由表项,将该数据包转发至虚拟机的虚拟交换机上部署的分布式网关,再由虚拟机的虚拟交换机上部署的分布式网关将该数据包发送至虚拟机。In this way, the border gateway can obtain the routing relationship between the virtual machine and the distributed gateway deployed on the virtual switch of the virtual machine, and the border gateway can update the routing table entries stored on the border gateway according to the internal routing information. When an external device wants to send a data packet to the virtual machine, the external device first sends the data packet to the border gateway, and the border gateway can forward the data packet to the virtual switch of the virtual machine according to the routing table entry stored on the border gateway The distributed gateway is deployed, and the distributed gateway deployed on the virtual switch of the virtual machine sends the packet to the virtual machine.

需要说明的是,在本发明实施例中,S105-S106可以在S101-S 104之前执行,S105-S106也可以在S101-S104之后执行。It should be noted that, in this embodiment of the present invention, S105-S106 may be executed before S101-S104, and S105-S106 may also be executed after S101-S104.

进一步的,在SDN控制器从至少一个第三路由表项中获取内部路由信息之前,SDN控制器可以获取至少两个虚拟机中的一个虚拟机的路由信息,再根据该虚拟机的路由信息生成一个第三路由表项。其中,该虚拟机的路由信息包含该虚拟机的地址和该虚拟机的虚拟交换机上部署的分布式网关的地址。Further, before the SDN controller obtains the internal routing information from the at least one third routing table entry, the SDN controller may obtain the routing information of one virtual machine in the at least two virtual machines, and then generate the routing information according to the routing information of the virtual machine. A third routing table entry. The routing information of the virtual machine includes the address of the virtual machine and the address of the distributed gateway deployed on the virtual switch of the virtual machine.

进一步的,在SDN控制器根据该虚拟机的路由信息生成第三路由表项之后,SDN控制器可以将第三路由表项转化为第二流表项,并向该虚拟机的虚拟交换机发送第二流表项,第二流表项可以用于指示该虚拟机的虚拟交换机向该虚拟机转发数据包时的转发规则。Further, after the SDN controller generates the third routing table entry according to the routing information of the virtual machine, the SDN controller can convert the third routing table entry into the second flow table entry, and send the third routing table entry to the virtual switch of the virtual machine. A second flow entry, where the second flow entry may be used to indicate a forwarding rule when the virtual switch of the virtual machine forwards the data packet to the virtual machine.

可选的,SDN中还可以包含集中式网关;SDN控制器中存储的路由表中还可以包含第四路由表项;第四路由表项中包含虚拟机的网际协议IP所属的网段的IP地址和集中式网关的IP地址。Optionally, the SDN may further include a centralized gateway; the routing table stored in the SDN controller may further include a fourth routing table entry; the fourth routing table entry includes the IP of the network segment to which the Internet Protocol IP of the virtual machine belongs. address and IP address of the centralized gateway.

本发明实施例提供的动态路由配置方法还可以包括:SDN控制器从第四路由表项中获取集中路由信息,集中路由信息用于表征虚拟机与集中式网关之间的路由关系;SDN控制器向动态路由代理发送携带有集中路由信息的第二路由发布消息,第二路由发布消息用于指示动态路由代理向边界网关发布集中路由信息。The dynamic routing configuration method provided by the embodiment of the present invention may further include: the SDN controller obtains centralized routing information from the fourth routing table entry, where the centralized routing information is used to represent the routing relationship between the virtual machine and the centralized gateway; the SDN controller A second route announcement message carrying centralized routing information is sent to the dynamic routing agent, where the second route announcement message is used to instruct the dynamic routing agent to release the centralized routing information to the border gateway.

需要说明的是,本发明实施例中的第三路由表项与第四路由表项不同,第三路由表项为主机路由,第四路由表项为网段路由。SDN控制器可以控制动态路由代理向边界网关发布主机路由,也可以控制动态路由代理向边界网关发布网段路由。SDN控制器中可以设置分布式网关开关,当分布式网关开关打开时,动态路由代理向边界网关发布主机路由,主机路由可以用于指示向每一个虚拟机发送数据包时分别所要经过的分布式网关,例如,向IP地址为192.168.100.5的虚拟机1发送数据包时要经过虚拟机1的虚拟交换机上部署的分布式网关,向IP地址为192.168.100.125的虚拟机2发送数据包时要经过虚拟机2的虚拟交换机上部署的分布式网关;当分布式网关开关关闭时,动态路由代理向边界网关发布网段路由,网段路由可以用于指示向IP地址属于同一个网段的虚拟机发送数据包时都要经过集中式网关,例如,向IP地址为192.168.100.1-192.168.100.255的虚拟机发送数据包时要经过集中式网关。在多租户场景下,不同的租户可以使用不同的网关,例如,一个租户使用分布式网关,另一个租户使用集中式网关。It should be noted that the third routing table entry in the embodiment of the present invention is different from the fourth routing table entry, the third routing table entry is the host route, and the fourth routing table entry is the network segment route. The SDN controller can control the dynamic routing agent to publish host routes to the border gateway, and can also control the dynamic routing agent to publish network segment routes to the border gateway. A distributed gateway switch can be set in the SDN controller. When the distributed gateway switch is turned on, the dynamic routing agent advertises the host route to the border gateway. Gateway, for example, when sending data packets to virtual machine 1 with IP address 192.168.100.5, it needs to go through the distributed gateway deployed on the virtual switch of virtual machine 1, and when sending data packets to virtual machine 2 with IP address 192.168.100.125, it needs to Through the distributed gateway deployed on the virtual switch of virtual machine 2; when the distributed gateway switch is turned off, the dynamic routing agent advertises the network segment route to the border gateway, and the network segment route can be used to indicate to the virtual machine whose IP address belongs to the same network segment. When sending data packets from the virtual machine, the centralized gateway is required. In a multi-tenant scenario, different tenants can use different gateways, for example, one tenant uses a distributed gateway and another tenant uses a centralized gateway.

本发明实施例提供一种动态路由配置方法,如图4所示,包括:An embodiment of the present invention provides a dynamic routing configuration method, as shown in FIG. 4 , including:

S201、动态路由代理接收边界网关发送的外部路由信息,外部路由信息用于表征外部设备与边界网关之间的路由关系。S201. The dynamic routing agent receives external routing information sent by the border gateway, where the external routing information is used to represent the routing relationship between the external device and the border gateway.

其中,动态路由代理可以在网络初始配置完成后接收外部路由信息,也可以在外部设备与边界网关之间的路由关系发生变化时接收外部路由信息。The dynamic routing agent can receive external routing information after the initial network configuration is completed, and can also receive external routing information when the routing relationship between the external device and the border gateway changes.

本发明实施例中的动态路由代理可以部署在虚拟机上,也可以部署在服务器上。The dynamic routing agent in the embodiment of the present invention may be deployed on a virtual machine, or may be deployed on a server.

S202、动态路由代理向SDN控制器发送携带外部路由信息的路由学习消息,以使得SDN控制器根据外部路由信息更新至少一个第一路由表项,进而使得SDN控制器在接收到虚拟机的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项,并向虚拟机的虚拟交换机发送第一流表项。S202. The dynamic routing agent sends a route learning message carrying external routing information to the SDN controller, so that the SDN controller updates at least one first routing table entry according to the external routing information, so that the SDN controller receives the virtual switch of the virtual machine When sending the data packet from the virtual machine, the second routing table entry is converted into the first flow table entry, and the first flow table entry is sent to the virtual switch of the virtual machine.

其中,至少一个第一路由表项中的每个第一路由表项中包含一个外部设备的地址和向该外部设备发送数据包时所要经过的边界网关的地址;第二路由表项为至少一个第一路由表项中的一个路由表项,第二路由表项中包含的外部设备的地址与来自虚拟机的数据包的目的地址相同,虚拟机为至少两个虚拟机中的任意一个虚拟机。Wherein, each first routing table entry in the at least one first routing table entry contains the address of an external device and the address of the border gateway to be passed when sending data packets to the external device; the second routing table entry is at least one A routing table entry in the first routing table entry, the address of the external device contained in the second routing table entry is the same as the destination address of the data packet from the virtual machine, and the virtual machine is any one of at least two virtual machines. .

进一步的,动态路由代理可以包括:“主”动态路由代理和“备”动态路由代理。“主”动态路由代理和“备”动态路由代理为两个功能完全相同的动态路由代理。通常情况下,“主”动态路由代理运行。SDN控制器与“主”动态路由代理之间可以建立“心跳”机制,即“主”动态路由代理可以周期性的向SDN控制器发送一个自定义的结构体(也称“心跳包”或“心跳帧”),若SDN控制器可以正常接收该“心跳包”,则SDN控制器可以确定“主”动态路由代理正常运行;若SDN控制器无法正常接收该“心跳包”,则SDN控制器可以确定“主”动态路由代理出现故障或发生宕机,此时,SDN控制器控制“备”动态路由代理运行,以保证可靠性。其中,“心跳”机制的具体内容和“心跳包”的具体格式可以参考现有技术中的相关描述,本发明实施例这里不再详细赘述。Further, the dynamic routing agent may include: a "main" dynamic routing agent and a "standby" dynamic routing agent. The "primary" dynamic routing proxy and the "standby" dynamic routing proxy are two dynamic routing proxies with identical functions. Typically, the "main" dynamic routing proxy runs. A "heartbeat" mechanism can be established between the SDN controller and the "main" dynamic routing agent, that is, the "main" dynamic routing agent can periodically send a custom structure (also called "heartbeat packet" or "heartbeat packet") to the SDN controller. Heartbeat frame”), if the SDN controller can receive the “heartbeat packet” normally, the SDN controller can determine that the “main” dynamic routing agent is running normally; if the SDN controller cannot receive the “heartbeat packet” normally, the SDN controller It can be determined that the "primary" dynamic routing agent fails or is down. At this time, the SDN controller controls the operation of the "standby" dynamic routing agent to ensure reliability. For the specific content of the "heartbeat" mechanism and the specific format of the "heartbeat packet", reference may be made to relevant descriptions in the prior art, and details are not described here in this embodiment of the present invention.

本发明实施例提供的动态路由配置方法,动态路由代理向SDN控制器发送携带外部路由信息的路由学习消息,以使得SDN控制器根据外部路由信息更新至少一个第一路由表项,进而使得SDN控制器在接收到虚拟机的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项,并向虚拟机的虚拟交换机发送第一流表项。这样,虚拟机的虚拟交换机就可以根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发来自虚拟机的数据包,而无需手动在分布式网关上配置边界网关和外部设备之间的路由,从而可以解决现有技术中采用分布式网关时手动配置路由工作量大的问题;此外,当网络拓扑发生变化时,采用本发明实施例中的动态路由配置方法,动态路由代理可以通过外部路由信息获取网络拓扑变化后的外部设备与边界网关之间的路由关系,并通过向SDN控制器发送路由学习消息指示SDN控制器动态更新第一路由表项,从而可以动态调整边界网关和外部设备之间的路由,以解决现有技术中采用分布式网关时调整不方便的问题。In the dynamic routing configuration method provided by the embodiment of the present invention, the dynamic routing agent sends a routing learning message carrying external routing information to the SDN controller, so that the SDN controller updates at least one first routing table entry according to the external routing information, thereby enabling the SDN controller to update at least one first routing table entry. When receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the router converts the second routing table entry into the first flow table entry, and sends the first flow table entry to the virtual switch of the virtual machine. In this way, the virtual switch of the virtual machine can forward the data packets from the virtual machine through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry, without manually configuring the border gateway and the external device on the distributed gateway. Therefore, when the distributed gateway is used in the prior art, the problem of large workload of manual routing configuration can be solved; in addition, when the network topology changes, using the dynamic routing configuration method in the embodiment of the present invention, the dynamic routing agent can Obtain the routing relationship between the external device and the border gateway after the network topology changes through the external routing information, and instruct the SDN controller to dynamically update the first routing table entry by sending a route learning message to the SDN controller, so that the border gateway and the border gateway can be dynamically adjusted. Routing between external devices to solve the problem of inconvenient adjustment when using distributed gateways in the prior art.

进一步的,如图5所示,本发明实施例提供的动态路由配置方法还可以包括:Further, as shown in FIG. 5 , the dynamic routing configuration method provided by the embodiment of the present invention may further include:

S203、动态路由代理接收SDN控制器发送的第一路由发布消息。S203. The dynamic routing agent receives the first route advertisement message sent by the SDN controller.

其中,第一路由发布消息中携带有内部路由信息,内部路由信息用于表征虚拟机与虚拟机的虚拟交换机上部署的分布式网关之间的路由关系。The first route advertisement message carries internal routing information, and the internal routing information is used to represent the routing relationship between the virtual machine and the distributed gateway deployed on the virtual switch of the virtual machine.

S204、动态路由代理向边界网关发布内部路由信息。S204, the dynamic routing agent advertises the internal routing information to the border gateway.

这样,边界网关就可以获得虚拟机与虚拟机的虚拟交换机上部署的分布式网关之间的路由关系,边界网关可以根据内部路由信息更新边界网关上存储的路由表项。当外部设备要向虚拟机发送数据包时,外部设备先将该数据包发送至边界网关,边界网关就可以根据边界网关上存储的路由表项,将该数据包转发至虚拟机的虚拟交换机上部署的分布式网关,再由虚拟机的虚拟交换机上部署的分布式网关将该数据包发送至虚拟机。In this way, the border gateway can obtain the routing relationship between the virtual machine and the distributed gateway deployed on the virtual switch of the virtual machine, and the border gateway can update the routing table entries stored on the border gateway according to the internal routing information. When an external device wants to send a data packet to the virtual machine, the external device first sends the data packet to the border gateway, and the border gateway can forward the data packet to the virtual switch of the virtual machine according to the routing table entry stored on the border gateway The distributed gateway is deployed, and the distributed gateway deployed on the virtual switch of the virtual machine sends the packet to the virtual machine.

需要说明的是,在本发明实施例中,S203-S204可以在S201-S202之前执行,S203-S204也可以在S201-S202之后执行。It should be noted that, in this embodiment of the present invention, S203-S204 may be executed before S201-S202, and S203-S204 may also be executed after S201-S202.

进一步的,动态路由代理可以基于动态路由协议,接收边界网关发送的外部路由信息;动态路由代理也可以基于动态路由协议,向边界网关发布内部路由信息。其中,动态路由协议可以为BGP或OSPF等。Further, the dynamic routing agent can receive the external routing information sent by the border gateway based on the dynamic routing protocol; the dynamic routing agent can also publish the internal routing information to the border gateway based on the dynamic routing protocol. The dynamic routing protocol may be BGP or OSPF.

可选的,SDN中还可以包含集中式网关;本发明实施例提供的动态路由配置方法还可以包括:动态路由代理接收SDN控制器发送的第二路由发布消息,第二路由发布消息中携带有集中路由信息,集中路由信息用于表征虚拟机与集中式网关之间的路由关系;动态路由代理向边界网关发布集中路由信息。Optionally, the SDN may further include a centralized gateway; the dynamic routing configuration method provided by the embodiment of the present invention may further include: the dynamic routing agent receives the second route advertisement message sent by the SDN controller, and the second route advertisement message carries the Centralized routing information. The centralized routing information is used to represent the routing relationship between the virtual machine and the centralized gateway; the dynamic routing agent publishes the centralized routing information to the border gateway.

进一步的,动态路由代理也可以基于动态路由协议,向边界网关发布集中路由信息。Further, the dynamic routing agent can also publish centralized routing information to the border gateway based on the dynamic routing protocol.

本发明实施例还提供一种动态路由的配置方法,如图6所示,包括:An embodiment of the present invention also provides a dynamic routing configuration method, as shown in FIG. 6 , including:

S301、动态路由代理接收边界网关发送的外部路由信息。S301. The dynamic routing agent receives the external routing information sent by the border gateway.

其中,外部路由信息用于表征外部设备与边界网关之间的路由关系。动态路由代理可以在网络初始配置完成后接收外部路由信息,也可以在外部设备与边界网关之间的路由关系发生变化时接收外部路由信息。The external routing information is used to represent the routing relationship between the external device and the border gateway. The dynamic routing agent can receive external routing information after the initial configuration of the network is completed, and can also receive external routing information when the routing relationship between the external device and the border gateway changes.

本发明实施例中的动态路由代理可以部署在虚拟机上,也可以部署在服务器上。The dynamic routing agent in the embodiment of the present invention may be deployed on a virtual machine, or may be deployed on a server.

S302、动态路由代理向SDN控制器发送携带外部路由信息的路由学习消息。S302. The dynamic routing agent sends a route learning message carrying external routing information to the SDN controller.

S303、SDN控制器根据外部路由信息更新至少一个第一路由表项。S303. The SDN controller updates at least one first routing table entry according to the external routing information.

其中,至少一个第一路由表项中的每个第一路由表项中包含一个外部设备的地址和向该外部设备发送数据包时所要经过的边界网关的地址。Wherein, each first routing table entry in the at least one first routing table entry includes an address of an external device and an address of a border gateway through which a data packet is sent to the external device.

S304、虚拟机1向虚拟交换机1发送数据包1,数据包1的目的地址为外部设备1的地址。S304 , the virtual machine 1 sends the data packet 1 to the virtual switch 1 , and the destination address of the data packet 1 is the address of the external device 1 .

其中,虚拟机1为SDN中包含的任意一个虚拟机,虚拟交换机1为虚拟机1的虚拟交换机。The virtual machine 1 is any virtual machine included in the SDN, and the virtual switch 1 is a virtual switch of the virtual machine 1 .

S305、虚拟交换机1向SDN控制器发送数据包1。S305, the virtual switch 1 sends the data packet 1 to the SDN controller.

S306、SDN控制器将第二路由表项转化为第一流表项。S306. The SDN controller converts the second routing table entry into the first flow table entry.

其中,第二路由表项为至少一个第一路由表项中的一个路由表项,第二路由表项中包含的外部设备1的地址。Wherein, the second routing table entry is one routing table entry in the at least one first routing table entry, and the address of the external device 1 contained in the second routing table entry.

S307、SDN控制器向虚拟交换机1发送第一流表项,以指示虚拟交换机1根据第一流表项,通过虚拟交换机1上部署的分布式网关转发数据包1。S307: The SDN controller sends the first flow entry to the virtual switch 1 to instruct the virtual switch 1 to forward the data packet 1 through the distributed gateway deployed on the virtual switch 1 according to the first flow entry.

S308、SDN控制器从至少一个第三路由表项中获取内部路由信息。S308. The SDN controller acquires internal routing information from at least one third routing table entry.

其中,SDN控制器中存储有路由表,路由表包含至少一个第一路由表项和至少一个第三路由表项。至少一个第三路由表项中的每个第三路由表项中包含虚拟机的地址和向该虚拟机发送数据包时所要经过的分布式网关的地址,向虚拟机发送数据包时所要经过的分布式网关为虚拟机的虚拟交换机上部署的分布式网关,内部路由信息用于表征虚拟机与虚拟机的虚拟交换机上部署的分布式网关之间的路由关系。The SDN controller stores a routing table, and the routing table includes at least one first routing table entry and at least one third routing table entry. Each third routing table entry in the at least one third routing table entry contains the address of the virtual machine and the address of the distributed gateway to be passed when sending data packets to the virtual machine, and the address of the distributed gateway to be passed when sending data packets to the virtual machine. The distributed gateway is a distributed gateway deployed on the virtual switch of the virtual machine, and the internal routing information is used to represent the routing relationship between the virtual machine and the distributed gateway deployed on the virtual switch of the virtual machine.

S309、SDN控制器向动态路由代理发送携带有内部路由信息的第一路由发布消息。S309. The SDN controller sends a first route advertisement message carrying internal routing information to the dynamic routing agent.

S310、动态路由代理向边界网关发布内部路由信息。S310. The dynamic routing agent advertises the internal routing information to the border gateway.

这样,边界网关就可以获得虚拟机与虚拟机的虚拟交换机上部署的分布式网关之间的路由关系,边界网关可以根据内部路由信息更新边界网关上存储的路由表项。当外部设备要向虚拟机发送数据包时,外部设备先将该数据包发送至边界网关,边界网关就可以根据边界网关上存储的路由表项,将该数据包转发至虚拟机的虚拟交换机上部署的分布式网关,再由虚拟机的虚拟交换机上部署的分布式网关将该数据包发送至虚拟机。In this way, the border gateway can obtain the routing relationship between the virtual machine and the distributed gateway deployed on the virtual switch of the virtual machine, and the border gateway can update the routing table entries stored on the border gateway according to the internal routing information. When an external device wants to send a data packet to the virtual machine, the external device first sends the data packet to the border gateway, and the border gateway can forward the data packet to the virtual switch of the virtual machine according to the routing table entry stored on the border gateway The distributed gateway is deployed, and the distributed gateway deployed on the virtual switch of the virtual machine sends the packet to the virtual machine.

本发明实施例提供的动态路由配置方法,SDN控制器根据接收到的路由学习消息中携带的外部路由信息更新至少一个第一路由表项;SDN控制器在接收到虚拟机1(SDN中包含的任意一个虚拟机)的虚拟交换机(虚拟交换机1)发送的数据包1时,将第二路由表项转化为第一流表项,并向虚拟交换机1发送第一流表项,以使得虚拟交换机1根据第一流表项,通过虚拟交换机1上部署的分布式网关转发数据包1。其中,第二路由表项为至少一个第一路由表项中的一个路由表项,第二路由表项中包含的外部设备的地址与数据包1的目的地址相同。这样,当虚拟机1需要向外部设备发送数据包1时,虚拟交换机1就可以根据第一流表项,通过虚拟交换机1上部署的分布式网关转发该数据包1,而无需手动在分布式网关上配置边界网关和外部设备之间的路由,从而可以解决现有技术中采用分布式网关时手动配置路由工作量大的问题;此外,当网络拓扑发生变化时,采用本发明实施例中的动态路由配置方法,SDN控制器可以根据路由学习消息中携带的外部路由信息动态更新第一路由表项,从而可以动态调整边界网关和外部设备之间的路由,以解决现有技术中采用分布式网关时调整不方便的问题。In the dynamic routing configuration method provided by the embodiment of the present invention, the SDN controller updates at least one first routing table entry according to the external routing information carried in the received routing learning message; When the data packet 1 sent by the virtual switch (virtual switch 1) of any virtual machine), the second routing table entry is converted into the first flow table entry, and the first flow table entry is sent to the virtual switch 1, so that the virtual switch 1 The first flow table entry forwards the data packet 1 through the distributed gateway deployed on the virtual switch 1 . The second routing table entry is one routing table entry in the at least one first routing table entry, and the address of the external device included in the second routing table entry is the same as the destination address of the data packet 1 . In this way, when the virtual machine 1 needs to send the data packet 1 to the external device, the virtual switch 1 can forward the data packet 1 through the distributed gateway deployed on the virtual switch 1 according to the first flow entry, without manually The route between the border gateway and the external device is configured on the top of the router, so that the problem of a large workload of manually configuring the route when the distributed gateway is adopted in the prior art can be solved; in addition, when the network topology changes, the dynamic In the routing configuration method, the SDN controller can dynamically update the first routing table entry according to the external routing information carried in the routing learning message, so that the routing between the border gateway and the external device can be dynamically adjusted, so as to solve the problem of using distributed gateways in the prior art. Time adjustment is not convenient.

本发明实施例还提供一种SDN控制器,应用于SDN中,SDN通过边界网关与外部网络相连,SDN中包含:SDN控制器、至少两个虚拟机、虚拟机的虚拟交换机和动态路由代理,虚拟机的虚拟交换机上部署有分布式网关,如图7所示,SDN控制器包括:接收单元41、更新单元42、路由转换单元43和第一发送单元44。An embodiment of the present invention further provides an SDN controller, which is applied to an SDN. The SDN is connected to an external network through a border gateway, and the SDN includes: an SDN controller, at least two virtual machines, a virtual switch of the virtual machines, and a dynamic routing agent, A distributed gateway is deployed on the virtual switch of the virtual machine. As shown in FIG. 7 , the SDN controller includes: a receiving unit 41 , an updating unit 42 , a routing conversion unit 43 and a first sending unit 44 .

接收单元41,用于接收动态路由代理发送的路由学习消息,路由学习消息中携带有外部路由信息,外部路由信息用于表征外部设备与边界网关之间的路由关系。The receiving unit 41 is configured to receive a routing learning message sent by the dynamic routing agent, where the routing learning message carries external routing information, and the external routing information is used to represent the routing relationship between the external device and the border gateway.

更新单元42,用于根据外部路由信息更新至少一个第一路由表项,至少一个第一路由表项中的每个第一路由表项中包含一个外部设备的地址和向该外部设备发送数据包时所要经过的边界网关的地址。The updating unit 42 is configured to update at least one first routing table entry according to the external routing information, and each first routing table entry in the at least one first routing table entry contains an address of an external device and sends a data packet to the external device The address of the border gateway to pass through.

路由转换单元43,用于在接收到虚拟机的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项,第二路由表项为至少一个第一路由表项中的一个路由表项,第二路由表项中包含的外部设备的地址与来自虚拟机的数据包的目的地址相同,虚拟机为至少两个虚拟机中的任意一个虚拟机。The routing conversion unit 43 is configured to convert the second routing table entry into a first flow table entry when receiving a data packet from the virtual machine sent by the virtual switch of the virtual machine, and the second routing table entry is at least one first routing table entry The address of the external device contained in the second routing table entry is the same as the destination address of the data packet from the virtual machine, and the virtual machine is any one of the at least two virtual machines.

第一发送单元44,用于向虚拟机的虚拟交换机发送第一流表项,以指示虚拟机的虚拟交换机根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发来自虚拟机的数据包。The first sending unit 44 is configured to send the first flow entry to the virtual switch of the virtual machine to instruct the virtual switch of the virtual machine to forward the data from the virtual machine through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry. data pack.

进一步的,如图8所示,本发明实施例提供的SDN控制器还包括:获取单元45和第二发送单元46。Further, as shown in FIG. 8 , the SDN controller provided by the embodiment of the present invention further includes: an obtaining unit 45 and a second sending unit 46 .

获取单元45,用于从至少一个第三路由表项中获取内部路由信息,至少一个第三路由表项中的每个第三路由表项中包含虚拟机的地址和向虚拟机发送数据包时所要经过的分布式网关的地址,向虚拟机发送数据包时所要经过的分布式网关为虚拟机的虚拟交换机上部署的分布式网关,内部路由信息用于表征虚拟机与虚拟机的虚拟交换机上部署的分布式网关之间的路由关系。The obtaining unit 45 is configured to obtain internal routing information from at least one third routing table entry, and each third routing table entry in the at least one third routing table entry includes the address of the virtual machine and the time when the data packet is sent to the virtual machine. The address of the distributed gateway to pass through. The distributed gateway to pass through when sending data packets to the virtual machine is the distributed gateway deployed on the virtual switch of the virtual machine. The internal routing information is used to represent the virtual machine and the virtual switch of the virtual machine. Routing relationships between deployed distributed gateways.

第二发送单元46,用于向动态路由代理发送携带有内部路由信息的第一路由发布消息,第一路由发布消息用于指示动态路由代理向边界网关发布内部路由信息。The second sending unit 46 is configured to send a first route advertisement message carrying internal routing information to the dynamic routing agent, where the first routing advertisement message is used to instruct the dynamic routing agent to publish the internal routing information to the border gateway.

其中,SDN控制器中存储有路由表,路由表包含至少一个第一路由表项和至少一个第三路由表项。The SDN controller stores a routing table, and the routing table includes at least one first routing table entry and at least one third routing table entry.

进一步的,获取单元45,还用于在从至少一个第三路由表项中获取内部路由信息之前,获取虚拟机的路由信息,虚拟机的路由信息包含虚拟机的地址和虚拟机的虚拟交换机上部署的分布式网关的地址。Further, the obtaining unit 45 is further configured to obtain the routing information of the virtual machine before obtaining the internal routing information from at least one third routing table entry, and the routing information of the virtual machine includes the address of the virtual machine and the virtual switch of the virtual machine. The address of the deployed distributed gateway.

如图9所示,该SDN控制器还包括:生成单元47。As shown in FIG. 9 , the SDN controller further includes: a generating unit 47 .

生成单元47,用于根据虚拟机的路由信息生成第三路由表项。The generating unit 47 is configured to generate a third routing table entry according to the routing information of the virtual machine.

进一步的,路由转换单元43,还用于在生成单元47根据虚拟机的路由信息生成第三路由表项之后,将第三路由表项转化为第二流表项。Further, the route converting unit 43 is further configured to convert the third routing entry into the second flow entry after the generating unit 47 generates the third routing entry according to the routing information of the virtual machine.

第一发送单元44,还用于向虚拟机的虚拟交换机发送第二流表项。The first sending unit 44 is further configured to send the second flow entry to the virtual switch of the virtual machine.

进一步的,动态路由代理可以部署在虚拟机上,动态路由代理也可以部署在服务器上。Further, the dynamic routing agent can be deployed on the virtual machine, and the dynamic routing agent can also be deployed on the server.

可选的,SDN中还包含集中式网关;路由表还包含第四路由表项;第四路由表项中包含虚拟机的网际协议IP所属的网段的IP地址和集中式网关的IP地址。Optionally, the SDN further includes a centralized gateway; the routing table further includes a fourth routing table entry; the fourth routing table entry includes the IP address of the network segment to which the Internet Protocol IP of the virtual machine belongs and the IP address of the centralized gateway.

获取单元45,还用于从第四路由表项中获取集中路由信息,集中路由信息用于表征虚拟机与集中式网关之间的路由关系。The obtaining unit 45 is further configured to obtain centralized routing information from the fourth routing table entry, where the centralized routing information is used to represent the routing relationship between the virtual machine and the centralized gateway.

第二发送单元46,用于向动态路由代理发送携带有集中路由信息的第二路由发布消息,第二路由发布消息用于指示动态路由代理向边界网关发布集中路由信息。The second sending unit 46 is configured to send a second route advertisement message carrying the centralized routing information to the dynamic routing agent, where the second route advertisement message is used to instruct the dynamic routing agent to publish the centralized routing information to the border gateway.

需要说明的是,本发明实施例提供的SDN控制器中部分功能模块的具体描述可以参考方法实施例中的对应内容,本实施例这里不再详细赘述。It should be noted that, for the specific description of some functional modules in the SDN controller provided in the embodiment of the present invention, reference may be made to the corresponding content in the method embodiment, which will not be described in detail here in this embodiment.

本发明实施例提供的SDN控制器,SDN控制器根据接收到的路由学习消息中携带的外部路由信息更新至少一个第一路由表项;SDN控制器在接收到虚拟机(SDN中包含的任意一个虚拟机)的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项,并向虚拟机的虚拟交换机发送第一流表项,以使得虚拟机的虚拟交换机根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发该来自虚拟机的数据包。其中,第二路由表项为至少一个第一路由表项中的一个路由表项,第二路由表项中包含的外部设备的地址与该来自虚拟机的数据包的目的地址相同。这样,当虚拟机需要向外部设备发送数据包时,虚拟机的虚拟交换机就可以根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发该数据包,而无需手动在分布式网关上配置边界网关和外部设备之间的路由,从而可以解决现有技术中采用分布式网关时手动配置路由工作量大的问题;此外,当网络拓扑发生变化时,采用本发明实施例中的SDN控制器,SDN控制器可以根据路由学习消息中携带的外部路由信息动态更新第一路由表项,从而可以动态调整边界网关和外部设备之间的路由,以解决现有技术中采用分布式网关时调整不方便的问题。In the SDN controller provided by the embodiment of the present invention, the SDN controller updates at least one first routing table entry according to the external routing information carried in the received routing learning message; When the data packet from the virtual machine is sent by the virtual switch of the virtual machine), the second routing table entry is converted into the first flow table entry, and the first flow table entry is sent to the virtual switch of the virtual machine, so that the virtual switch of the virtual machine is based on the first flow table entry. The first flow table entry forwards the data packet from the virtual machine through the distributed gateway deployed on the virtual switch of the virtual machine. The second routing table entry is one of the at least one first routing table entry, and the address of the external device included in the second routing table entry is the same as the destination address of the data packet from the virtual machine. In this way, when the virtual machine needs to send a data packet to an external device, the virtual switch of the virtual machine can forward the data packet through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry, without manually The route between the border gateway and the external device is configured on the gateway, so that the problem of large workload of manually configuring the route when the distributed gateway is adopted in the prior art can be solved; The SDN controller can dynamically update the first routing table entry according to the external routing information carried in the routing learning message, so that the routing between the border gateway and the external device can be dynamically adjusted, so as to solve the problem of using distributed gateways in the prior art. Time adjustment is not convenient.

本发明实施例还提供一种动态路由代理,应用于SDN中,SDN通过边界网关与外部网络相连,SDN中包含:SDN控制器、至少两个虚拟机、虚拟机的虚拟交换机和动态路由代理,虚拟机的虚拟交换机上部署有分布式网关,如图10所示,动态路由代理包括:接收单元51和发送单元52。An embodiment of the present invention further provides a dynamic routing agent, which is applied to an SDN. The SDN is connected to an external network through a border gateway, and the SDN includes: an SDN controller, at least two virtual machines, a virtual switch of the virtual machines, and a dynamic routing agent, A distributed gateway is deployed on the virtual switch of the virtual machine. As shown in FIG. 10 , the dynamic routing agent includes: a receiving unit 51 and a sending unit 52 .

接收单元51,用于接收边界网关发送的外部路由信息,外部路由信息用于表征外部设备与边界网关之间的路由关系。The receiving unit 51 is configured to receive external routing information sent by the border gateway, where the external routing information is used to represent the routing relationship between the external device and the border gateway.

发送单元52,用于向SDN控制器发送携带外部路由信息的路由学习消息,以使得SDN控制器根据外部路由信息更新至少一个第一路由表项,进而使得SDN控制器在接收到虚拟机的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项,并向虚拟机的虚拟交换机发送第一流表项。The sending unit 52 is configured to send a route learning message carrying external routing information to the SDN controller, so that the SDN controller updates at least one first routing table entry according to the external routing information, so that the SDN controller receives the virtual machine's virtual When the switch sends the data packet from the virtual machine, it converts the second routing table entry into the first flow table entry, and sends the first flow table entry to the virtual switch of the virtual machine.

其中,至少一个第一路由表项中的每个第一路由表项中包含一个外部设备的地址和向该外部设备发送数据包时所要经过的边界网关的地址;第二路由表项为至少一个第一路由表项中的一个路由表项,第二路由表项中包含的外部设备的地址与来自虚拟机的数据包的目的地址相同,虚拟机为至少两个虚拟机中的任意一个虚拟机。Wherein, each first routing table entry in the at least one first routing table entry contains the address of an external device and the address of the border gateway to be passed when sending data packets to the external device; the second routing table entry is at least one A routing table entry in the first routing table entry, the address of the external device contained in the second routing table entry is the same as the destination address of the data packet from the virtual machine, and the virtual machine is any one of at least two virtual machines. .

进一步的,接收单元51,还用于接收SDN控制器发送的第一路由发布消息,第一路由发布消息中携带有内部路由信息,内部路由信息用于表征虚拟机与虚拟机的虚拟交换机上部署的分布式网关之间的路由关系。Further, the receiving unit 51 is further configured to receive the first route advertisement message sent by the SDN controller, where the first route advertisement message carries internal routing information, and the internal routing information is used to represent the virtual machine and the deployment on the virtual switch of the virtual machine. The routing relationship between the distributed gateways.

发送单元52,还用于向边界网关发布内部路由信息。The sending unit 52 is further configured to publish internal routing information to the border gateway.

进一步的,如图11所示,动态路由代理还包括:控制单元53。Further, as shown in FIG. 11 , the dynamic routing agent further includes: a control unit 53 .

控制单元53,用于控制接收单元51基于动态路由协议,接收边界网关发送的外部路由信息。The control unit 53 is configured to control the receiving unit 51 to receive the external routing information sent by the border gateway based on the dynamic routing protocol.

控制单元53,还用于控制发送单元52基于动态路由协议,向边界网关发布内部路由信息。The control unit 53 is further configured to control the sending unit 52 to publish internal routing information to the border gateway based on the dynamic routing protocol.

进一步的,动态路由代理可以部署在虚拟机上,动态路由代理也可以部署在服务器上。Further, the dynamic routing agent can be deployed on the virtual machine, and the dynamic routing agent can also be deployed on the server.

可选的,SDN中还包含集中式网关。Optionally, a centralized gateway is also included in the SDN.

接收单元51,还用于接收SDN控制器发送的第二路由发布消息,第二路由发布消息中携带有集中路由信息,集中路由信息用于表征虚拟机与集中式网关之间的路由关系;The receiving unit 51 is further configured to receive a second route advertisement message sent by the SDN controller, where the second route advertisement message carries centralized routing information, and the centralized routing information is used to represent the routing relationship between the virtual machine and the centralized gateway;

发送单元52,还用于向边界网关发布集中路由信息。The sending unit 52 is further configured to publish the centralized routing information to the border gateway.

进一步的,控制单元53,还用于控制发送单元52基于动态路由协议,向边界网关发布集中路由信息。Further, the control unit 53 is further configured to control the sending unit 52 to publish the centralized routing information to the border gateway based on the dynamic routing protocol.

需要说明的是,本发明实施例提供的动态路由代理中部分功能模块的具体描述可以参考方法实施例中的对应内容,本实施例这里不再详细赘述。It should be noted that, for the specific description of some functional modules in the dynamic routing proxy provided in the embodiment of the present invention, reference may be made to the corresponding content in the method embodiment, which will not be described in detail in this embodiment.

本发明实施例提供的动态路由代理,动态路由代理向SDN控制器发送携带外部路由信息的路由学习消息,以使得SDN控制器根据外部路由信息更新至少一个第一路由表项,进而使得SDN控制器在接收到虚拟机的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项,并向虚拟机的虚拟交换机发送第一流表项。这样,虚拟机的虚拟交换机就可以根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发来自虚拟机的数据包,而无需手动在分布式网关上配置边界网关和外部设备之间的路由,从而可以解决现有技术中采用分布式网关时手动配置路由工作量大的问题;此外,当网络拓扑发生变化时,采用本发明实施例中的动态路由代理,动态路由代理可以通过外部路由信息获取网络拓扑变化后的外部设备与边界网关之间的路由关系,并通过向SDN控制器发送路由学习消息指示SDN控制器动态更新第一路由表项,从而可以动态调整边界网关和外部设备之间的路由,以解决现有技术中采用分布式网关时调整不方便的问题。In the dynamic routing agent provided by the embodiment of the present invention, the dynamic routing agent sends a routing learning message carrying external routing information to the SDN controller, so that the SDN controller updates at least one first routing table entry according to the external routing information, thereby enabling the SDN controller to update at least one first routing table entry. When receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the second routing table entry is converted into the first flow table entry, and the first flow table entry is sent to the virtual switch of the virtual machine. In this way, the virtual switch of the virtual machine can forward the data packets from the virtual machine through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry, without manually configuring the border gateway and the external device on the distributed gateway. Therefore, when the distributed gateway is used in the prior art, the problem of large workload of manual routing configuration can be solved; in addition, when the network topology changes, the dynamic routing agent in the embodiment of the present invention is used, and the dynamic routing agent can pass The external routing information obtains the routing relationship between the external device and the border gateway after the network topology has changed, and instructs the SDN controller to dynamically update the first routing table entry by sending a route learning message to the SDN controller, so that the border gateway and the external gateway can be dynamically adjusted. The routing between devices can solve the problem of inconvenient adjustment when using distributed gateways in the prior art.

本发明实施例还提供一种SDN控制器,应用于SDN中,SDN通过边界网关与外部网络相连,SDN中包含:SDN控制器、至少两个虚拟机、虚拟机的虚拟交换机和动态路由代理,虚拟机的虚拟交换机上部署有分布式网关,如图12所示,SDN控制器包括:接收器61、处理器62和发送器63。An embodiment of the present invention further provides an SDN controller, which is applied to an SDN. The SDN is connected to an external network through a border gateway, and the SDN includes: an SDN controller, at least two virtual machines, a virtual switch of the virtual machines, and a dynamic routing agent, A distributed gateway is deployed on the virtual switch of the virtual machine. As shown in FIG. 12 , the SDN controller includes: a receiver 61 , a processor 62 and a transmitter 63 .

接收器61,用于接收动态路由代理发送的路由学习消息,路由学习消息中携带有外部路由信息,外部路由信息用于表征外部设备与边界网关之间的路由关系。The receiver 61 is configured to receive a routing learning message sent by the dynamic routing agent, where the routing learning message carries external routing information, and the external routing information is used to represent the routing relationship between the external device and the border gateway.

处理器62,用于根据外部路由信息更新至少一个第一路由表项,至少一个第一路由表项中的每个第一路由表项中包含一个外部设备的地址和向该外部设备发送数据包时所要经过的边界网关的地址;在接收到虚拟机的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项,第二路由表项为至少一个第一路由表项中的一个路由表项,第二路由表项中包含的外部设备的地址与来自虚拟机的数据包的目的地址相同,虚拟机为至少两个虚拟机中的任意一个虚拟机。The processor 62 is configured to update at least one first routing table entry according to the external routing information, and each first routing table entry in the at least one first routing table entry contains an address of an external device and sends a data packet to the external device The address of the border gateway to pass through; when receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the second routing table entry is converted into the first flow table entry, and the second routing table entry is at least one first flow table entry. One routing table entry in the routing table entry, the address of the external device included in the second routing table entry is the same as the destination address of the data packet from the virtual machine, and the virtual machine is any one of the at least two virtual machines.

发送器63,用于向虚拟机的虚拟交换机发送第一流表项,以指示虚拟机的虚拟交换机根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发来自虚拟机的数据包。The transmitter 63 is configured to send the first flow entry to the virtual switch of the virtual machine to instruct the virtual switch of the virtual machine to forward the data packet from the virtual machine through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry .

进一步的,处理器62,还用于从至少一个第三路由表项中获取内部路由信息,至少一个第三路由表项中的每个第三路由表项中包含虚拟机的地址和向虚拟机发送数据包时所要经过的分布式网关的地址,向虚拟机发送数据包时所要经过的分布式网关为虚拟机的虚拟交换机上部署的分布式网关,内部路由信息用于表征虚拟机与虚拟机的虚拟交换机上部署的分布式网关之间的路由关系。Further, the processor 62 is further configured to obtain internal routing information from at least one third routing table entry, and each third routing table entry in the at least one third routing table entry contains the address of the virtual machine and the address to the virtual machine. The address of the distributed gateway to pass through when sending data packets. The distributed gateway to pass through when sending data packets to the virtual machine is the distributed gateway deployed on the virtual switch of the virtual machine. The internal routing information is used to characterize the virtual machine and the virtual machine. The routing relationship between the distributed gateways deployed on the virtual switches.

发送器63,还用于向动态路由代理发送携带有内部路由信息的第一路由发布消息,第一路由发布消息用于指示动态路由代理向边界网关发布内部路由信息。The transmitter 63 is further configured to send a first route advertisement message carrying internal routing information to the dynamic routing agent, where the first route advertisement message is used to instruct the dynamic routing agent to publish the internal routing information to the border gateway.

其中,SDN控制器中存储有路由表,路由表包含至少一个第一路由表项和至少一个第三路由表项。The SDN controller stores a routing table, and the routing table includes at least one first routing table entry and at least one third routing table entry.

进一步的,处理器62,还用于在从至少一个第三路由表项中获取内部路由信息之前,获取虚拟机的路由信息,虚拟机的路由信息包含虚拟机的地址和虚拟机的虚拟交换机上部署的分布式网关的地址;SDN控制器根据虚拟机的路由信息生成第三路由表项。Further, the processor 62 is further configured to obtain the routing information of the virtual machine before obtaining the internal routing information from at least one third routing table entry, and the routing information of the virtual machine includes the address of the virtual machine and the virtual switch of the virtual machine. The address of the deployed distributed gateway; the SDN controller generates a third routing table entry according to the routing information of the virtual machine.

进一步的,处理器62,还用于在根据虚拟机的路由信息生成第三路由表项之后,将第三路由表项转化为第二流表项。Further, the processor 62 is further configured to convert the third routing entry into the second flow entry after generating the third routing entry according to the routing information of the virtual machine.

发送器63,还用于向虚拟机的虚拟交换机发送第二流表项。The transmitter 63 is further configured to send the second flow entry to the virtual switch of the virtual machine.

进一步的,动态路由代理可以部署在虚拟机上,动态路由代理也可以部署在服务器上。Further, the dynamic routing agent can be deployed on the virtual machine, and the dynamic routing agent can also be deployed on the server.

可选的,SDN中还包含集中式网关;路由表还包含第四路由表项;第四路由表项中包含虚拟机的网际协议IP所属的网段的IP地址和集中式网关的IP地址。Optionally, the SDN further includes a centralized gateway; the routing table further includes a fourth routing table entry; the fourth routing table entry includes the IP address of the network segment to which the Internet Protocol IP of the virtual machine belongs and the IP address of the centralized gateway.

处理器62,还用于从第四路由表项中获取集中路由信息,集中路由信息用于表征虚拟机与集中式网关之间的路由关系。The processor 62 is further configured to obtain centralized routing information from the fourth routing table entry, where the centralized routing information is used to represent the routing relationship between the virtual machine and the centralized gateway.

发送器63,还用于向动态路由代理发送携带有集中路由信息的第二路由发布消息,第二路由发布消息用于指示动态路由代理向边界网关发布集中路由信息。The transmitter 63 is further configured to send a second route advertisement message carrying the centralized routing information to the dynamic routing agent, where the second route advertisement message is used to instruct the dynamic routing agent to publish the centralized routing information to the border gateway.

需要说明的是,本发明实施例提供的SDN控制器中部分功能模块的具体描述可以参考方法实施例中的对应内容,本实施例这里不再详细赘述。It should be noted that, for the specific description of some functional modules in the SDN controller provided in the embodiment of the present invention, reference may be made to the corresponding content in the method embodiment, which will not be described in detail here in this embodiment.

本发明实施例提供的SDN控制器,SDN控制器根据接收到的路由学习消息中携带的外部路由信息更新至少一个第一路由表项;SDN控制器在接收到虚拟机(SDN中包含的任意一个虚拟机)的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项,并向虚拟机的虚拟交换机发送第一流表项,以使得虚拟机的虚拟交换机根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发该来自虚拟机的数据包。其中,第二路由表项为至少一个第一路由表项中的一个第一路由表项,第二路由表项中包含的外部设备的地址与该来自虚拟机的数据包的目的地址相同。这样,当虚拟机需要向外部设备发送数据包时,虚拟机的虚拟交换机就可以根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发该数据包,而无需手动在分布式网关上配置边界网关和外部设备之间的路由,从而可以解决现有技术中采用分布式网关时手动配置路由工作量大的问题;此外,当网络拓扑发生变化时,采用本发明实施例中的SDN控制器,SDN控制器可以根据路由学习消息中携带的外部路由信息动态更新第一路由表项,从而可以动态调整边界网关和外部设备之间的路由,以解决现有技术中采用分布式网关时调整不方便的问题。In the SDN controller provided by the embodiment of the present invention, the SDN controller updates at least one first routing table entry according to the external routing information carried in the received routing learning message; When the data packet from the virtual machine is sent by the virtual switch of the virtual machine), the second routing table entry is converted into the first flow table entry, and the first flow table entry is sent to the virtual switch of the virtual machine, so that the virtual switch of the virtual machine is based on the first flow table entry. The first flow table entry forwards the data packet from the virtual machine through the distributed gateway deployed on the virtual switch of the virtual machine. The second routing table entry is one of the at least one first routing table entry, and the address of the external device included in the second routing table entry is the same as the destination address of the data packet from the virtual machine. In this way, when the virtual machine needs to send a data packet to an external device, the virtual switch of the virtual machine can forward the data packet through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry, without manually The route between the border gateway and the external device is configured on the gateway, so that the problem of large workload of manually configuring the route when the distributed gateway is adopted in the prior art can be solved; The SDN controller can dynamically update the first routing table entry according to the external routing information carried in the routing learning message, so that the routing between the border gateway and the external device can be dynamically adjusted, so as to solve the problem of using distributed gateways in the prior art. Time adjustment is not convenient.

本发明实施例还提供一种动态路由代理,应用于SDN中,SDN通过边界网关与外部网络相连,SDN中包含:SDN控制器、至少两个虚拟机、虚拟机的虚拟交换机和动态路由代理,虚拟机的虚拟交换机上部署有分布式网关,如图13所示,动态路由代理包括:接收器71和发送器72。An embodiment of the present invention further provides a dynamic routing agent, which is applied to an SDN. The SDN is connected to an external network through a border gateway, and the SDN includes: an SDN controller, at least two virtual machines, a virtual switch of the virtual machines, and a dynamic routing agent, A distributed gateway is deployed on the virtual switch of the virtual machine. As shown in FIG. 13 , the dynamic routing agent includes: a receiver 71 and a transmitter 72 .

接收器71,用于接收边界网关发送的外部路由信息,外部路由信息用于表征外部设备与边界网关之间的路由关系。The receiver 71 is configured to receive external routing information sent by the border gateway, where the external routing information is used to represent the routing relationship between the external device and the border gateway.

发送器72,用于向SDN控制器发送携带外部路由信息的路由学习消息,以使得SDN控制器根据外部路由信息更新至少一个第一路由表项,进而使得SDN控制器在接收到虚拟机的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项,并向虚拟机的虚拟交换机发送第一流表项。The transmitter 72 is configured to send a route learning message carrying external routing information to the SDN controller, so that the SDN controller updates at least one first routing table entry according to the external routing information, so that the SDN controller receives the virtual machine's virtual When the switch sends the data packet from the virtual machine, it converts the second routing table entry into the first flow table entry, and sends the first flow table entry to the virtual switch of the virtual machine.

其中,至少一个第一路由表项中的每个第一路由表项中包含一个外部设备的地址和向该外部设备发送数据包时所要经过的边界网关的地址;第二路由表项为至少一个第一路由表项中的一个路由表项,第二路由表项中包含的外部设备的地址与来自虚拟机的数据包的目的地址相同,虚拟机为至少两个虚拟机中的任意一个虚拟机。Wherein, each first routing table entry in the at least one first routing table entry contains the address of an external device and the address of the border gateway to be passed when sending data packets to the external device; the second routing table entry is at least one A routing table entry in the first routing table entry, the address of the external device contained in the second routing table entry is the same as the destination address of the data packet from the virtual machine, and the virtual machine is any one of at least two virtual machines. .

进一步的,接收器71,还用于接收SDN控制器发送的第一路由发布消息,第一路由发布消息中携带有内部路由信息,内部路由信息用于表征虚拟机与虚拟机的虚拟交换机上部署的分布式网关之间的路由关系。Further, the receiver 71 is further configured to receive the first route advertisement message sent by the SDN controller. The first route advertisement message carries internal routing information, and the internal routing information is used to represent the virtual machine and the virtual machine deployed on the virtual switch. The routing relationship between the distributed gateways.

发送器72,还用于向边界网关发布内部路由信息。The transmitter 72 is further configured to publish internal routing information to the border gateway.

进一步的,如图14所示,动态路由代理还包括:处理器73。Further, as shown in FIG. 14 , the dynamic routing agent further includes: a processor 73 .

处理器73,用于控制接收器71基于动态路由协议,接收边界网关发送的外部路由信息;控制发送器72基于动态路由协议,向边界网关发布内部路由信息。The processor 73 is configured to control the receiver 71 to receive the external routing information sent by the border gateway based on the dynamic routing protocol; control the transmitter 72 to publish the internal routing information to the border gateway based on the dynamic routing protocol.

进一步的,动态路由代理可以部署在虚拟机上,动态路由代理也可以部署在服务器上。Further, the dynamic routing agent can be deployed on the virtual machine, and the dynamic routing agent can also be deployed on the server.

可选的,SDN中还包含集中式网关。Optionally, a centralized gateway is also included in the SDN.

接收器71,还用于接收SDN控制器发送的第二路由发布消息,第二路由发布消息中携带有集中路由信息,集中路由信息用于表征虚拟机与集中式网关之间的路由关系。The receiver 71 is further configured to receive a second route advertisement message sent by the SDN controller, where the second route advertisement message carries centralized routing information, and the centralized routing information is used to represent the routing relationship between the virtual machine and the centralized gateway.

发送器72,还用于向边界网关发布集中路由信息。The transmitter 72 is also used for publishing centralized routing information to the border gateway.

进一步的,处理器73,还用于控制发送器72基于动态路由协议,向边界网关发布集中路由信息。Further, the processor 73 is further configured to control the transmitter 72 to publish the centralized routing information to the border gateway based on the dynamic routing protocol.

需要说明的是,本发明实施例提供的动态路由代理中部分功能模块的具体描述可以参考方法实施例中的对应内容,本实施例这里不再详细赘述。It should be noted that, for the specific description of some functional modules in the dynamic routing proxy provided in the embodiment of the present invention, reference may be made to the corresponding content in the method embodiment, which will not be described in detail in this embodiment.

本发明实施例提供的动态路由代理,动态路由代理向SDN控制器发送携带外部路由信息的路由学习消息,以使得SDN控制器根据外部路由信息更新至少一个第一路由表项,进而使得SDN控制器在接收到虚拟机的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项,并向虚拟机的虚拟交换机发送第一流表项。这样,虚拟机的虚拟交换机就可以根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发来自虚拟机的数据包,而无需手动在分布式网关上配置边界网关和外部设备之间的路由,从而可以解决现有技术中采用分布式网关时手动配置路由工作量大的问题;此外,当网络拓扑发生变化时,采用本发明实施例中的动态路由代理,动态路由代理可以通过外部路由信息获取网络拓扑变化后的外部设备与边界网关之间的路由关系,并通过向SDN控制器发送路由学习消息指示SDN控制器动态更新第一路由表项,从而可以动态调整边界网关和外部设备之间的路由,以解决现有技术中采用分布式网关时调整不方便的问题。In the dynamic routing agent provided by the embodiment of the present invention, the dynamic routing agent sends a routing learning message carrying external routing information to the SDN controller, so that the SDN controller updates at least one first routing table entry according to the external routing information, thereby enabling the SDN controller to update at least one first routing table entry. When receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the second routing table entry is converted into the first flow table entry, and the first flow table entry is sent to the virtual switch of the virtual machine. In this way, the virtual switch of the virtual machine can forward the data packets from the virtual machine through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry, without manually configuring the border gateway and the external device on the distributed gateway. Therefore, when the distributed gateway is used in the prior art, the problem of large workload of manual routing configuration can be solved; in addition, when the network topology changes, the dynamic routing agent in the embodiment of the present invention is used, and the dynamic routing agent can pass The external routing information obtains the routing relationship between the external device and the border gateway after the network topology has changed, and instructs the SDN controller to dynamically update the first routing table entry by sending a route learning message to the SDN controller, so that the border gateway and the external gateway can be dynamically adjusted. The routing between devices can solve the problem of inconvenient adjustment when using distributed gateways in the prior art.

本发明实施例还提供一种动态路由配置系统,如图15所示,动态路由配置系统包括:SDN控制器81、至少两个虚拟机82、虚拟机82的虚拟交换机83和动态路由代理84,虚拟交换机83上部署有分布式网关。An embodiment of the present invention further provides a dynamic routing configuration system. As shown in FIG. 15 , the dynamic routing configuration system includes: an SDN controller 81, at least two virtual machines 82, a virtual switch 83 of the virtual machines 82, and a dynamic routing agent 84, A distributed gateway is deployed on the virtual switch 83 .

SDN控制器81,用于接收动态路由代理84发送的路由学习消息,路由学习消息中携带有外部路由信息,外部路由信息用于表征外部设备与边界网关之间的路由关系;根据外部路由信息更新至少一个第一路由表项,至少一个第一路由表项中的每个第一路由表项中包含外部设备的地址和向外部设备发送数据包时所要经过的边界网关的地址;在接收到虚拟交换机83发送的来自虚拟机82的数据包时,将第二路由表项转化为第一流表项,第二路由表项为至少一个第一路由表项中的一个路由表项,第二路由表项中包含的外部设备的地址与来自该虚拟机82的数据包的目的地址相同,虚拟机82为至少两个虚拟机中的任意一个虚拟机;向虚拟交换机83发送第一流表项,以指示虚拟交换机83根据第一流表项,通过虚拟交换机83上部署的分布式网关转发来自虚拟机82的数据包。The SDN controller 81 is used to receive a route learning message sent by the dynamic routing agent 84, the route learning message carries external routing information, and the external routing information is used to represent the routing relationship between the external device and the border gateway; update according to the external routing information At least one first routing table entry, and each first routing table entry in the at least one first routing table entry contains the address of the external device and the address of the border gateway to be passed when sending data packets to the external device; When the switch 83 sends the data packet from the virtual machine 82, it converts the second routing table entry into the first flow table entry, the second routing table entry is one routing table entry in the at least one first routing table entry, and the second routing table entry is The address of the external device contained in the item is the same as the destination address of the data packet from the virtual machine 82, and the virtual machine 82 is any one of the at least two virtual machines; the first flow entry is sent to the virtual switch 83 to indicate The virtual switch 83 forwards the data packet from the virtual machine 82 through the distributed gateway deployed on the virtual switch 83 according to the first flow entry.

动态路由代理84,用于接收边界网关发送的外部路由信息;向SDN控制器81发送携带外部路由信息的路由学习消息,以使得SDN控制器81根据外部路由信息更新至少一个第一路由表项,进而使得SDN控制器81在接收到虚拟交换机83发送的来自虚拟机82的数据包时,将第二路由表项转化为第一流表项,并向虚拟交换机83发送第一流表项。The dynamic routing agent 84 is configured to receive the external routing information sent by the border gateway; send a routing learning message carrying the external routing information to the SDN controller 81, so that the SDN controller 81 updates at least one first routing table entry according to the external routing information, Furthermore, the SDN controller 81 converts the second routing table entry into the first flow table entry when receiving the data packet from the virtual machine 82 sent by the virtual switch 83 , and sends the first flow table entry to the virtual switch 83 .

本发明实施例提供的动态路由配置系统,SDN控制器根据接收到的路由学习消息中携带的外部路由信息更新至少一个第一路由表项;SDN控制器在接收到虚拟机(SDN中包含的任意一个虚拟机)的虚拟交换机发送的来自虚拟机的数据包时,将第二路由表项转化为第一流表项,并向虚拟机的虚拟交换机发送第一流表项,以使得虚拟机的虚拟交换机根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发该来自虚拟机的数据包。其中,第二路由表项为至少一个第一路由表项中的一个第一路由表项,第二路由表项中包含的外部设备的地址与该来自虚拟机的数据包的目的地址相同。这样,当虚拟机需要向外部设备发送数据包时,虚拟机的虚拟交换机就可以根据第一流表项,通过虚拟机的虚拟交换机上部署的分布式网关转发该数据包,而无需手动在分布式网关上配置边界网关和外部设备之间的路由,从而可以解决现有技术中采用分布式网关时手动配置路由工作量大的问题;此外,当网络拓扑发生变化时,采用本发明实施例中的动态路由配置系统,SDN控制器可以根据路由学习消息中携带的外部路由信息动态更新第一路由表项,从而可以动态调整边界网关和外部设备之间的路由,以解决现有技术中采用分布式网关时调整不方便的问题。In the dynamic routing configuration system provided by the embodiment of the present invention, the SDN controller updates at least one first routing table entry according to the external routing information carried in the received routing learning message; When a data packet from the virtual machine is sent by the virtual switch of a virtual machine, the second routing table entry is converted into the first flow table entry, and the first flow table entry is sent to the virtual switch of the virtual machine, so that the virtual switch of the virtual machine According to the first flow entry, the data packet from the virtual machine is forwarded through the distributed gateway deployed on the virtual switch of the virtual machine. The second routing table entry is one of the at least one first routing table entry, and the address of the external device included in the second routing table entry is the same as the destination address of the data packet from the virtual machine. In this way, when the virtual machine needs to send a data packet to an external device, the virtual switch of the virtual machine can forward the data packet through the distributed gateway deployed on the virtual switch of the virtual machine according to the first flow entry, without manually The route between the border gateway and the external device is configured on the gateway, so that the problem of large workload of manually configuring the route when the distributed gateway is adopted in the prior art can be solved; In the dynamic routing configuration system, the SDN controller can dynamically update the first routing table entry according to the external routing information carried in the routing learning message, so that the routing between the border gateway and the external device can be dynamically adjusted, so as to solve the problem of using distributed routing in the prior art. The problem of inconvenient adjustment during gateway.

通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。From the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and brevity of the description, only the division of the above functional modules is used as an example for illustration. In practical applications, the above functions can be allocated as required. It is completed by different functional modules, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. For the specific working process of the system, apparatus and unit described above, reference may be made to the corresponding process in the foregoing method embodiments, and details are not described herein again.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be Incorporation may either be integrated into another system, or some features may be omitted, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(英文:processor)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(英文:Read-Only Memory,缩写:ROM)、随机存取存储器(英文:Random AccessMemory,缩写:RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , which includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviation: ROM), random access memory (English: Random Access Memory, abbreviation: RAM), magnetic disk or optical disk, etc. A medium that can store program code.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention. should be included within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims (27)

1.一种动态路由配置方法,应用于软件定义网络SDN中,所述SDN通过边界网关与外部网络相连,其特征在于,所述SDN中包含:SDN控制器、至少两个虚拟机、所述虚拟机的虚拟交换机和动态路由代理,所述虚拟机的虚拟交换机上部署有分布式网关,所述方法包括:1. A dynamic routing configuration method, applied in a software-defined network SDN, the SDN is connected to an external network through a border gateway, wherein the SDN comprises: an SDN controller, at least two virtual machines, the A virtual switch and a dynamic routing agent of a virtual machine, where a distributed gateway is deployed on the virtual switch of the virtual machine, and the method includes: 所述SDN控制器接收所述动态路由代理发送的路由学习消息,所述路由学习消息中携带有外部路由信息,所述外部路由信息用于表征外部设备与边界网关之间的路由关系;The SDN controller receives a route learning message sent by the dynamic routing agent, where the route learning message carries external routing information, and the external routing information is used to represent the routing relationship between the external device and the border gateway; 所述SDN控制器根据所述外部路由信息更新至少一个第一路由表项,所述至少一个第一路由表项中的每个第一路由表项中包含所述外部设备的地址和向所述外部设备发送数据包时所要经过的边界网关的地址;The SDN controller updates at least one first routing table entry according to the external routing information, and each first routing table entry in the at least one first routing table entry includes the address of the external device and the address to the external device. The address of the border gateway through which the external device sends data packets; 所述SDN控制器在接收到虚拟机的虚拟交换机发送的来自所述虚拟机的数据包时,将第二路由表项转化为第一流表项,所述第二路由表项为所述至少一个第一路由表项中的一个路由表项,所述第二路由表项中包含的外部设备的地址与所述来自所述虚拟机的数据包的目的地址相同,所述虚拟机为所述至少两个虚拟机中的任意一个虚拟机;When receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the SDN controller converts a second routing table entry into a first flow table entry, and the second routing table entry is the at least one flow table entry. A routing table entry in the first routing table entry, the address of the external device included in the second routing table entry is the same as the destination address of the data packet from the virtual machine, and the virtual machine is the at least Any one of the two virtual machines; 所述SDN控制器向所述虚拟机的虚拟交换机发送所述第一流表项,以指示所述虚拟机的虚拟交换机根据所述第一流表项,通过所述虚拟机的虚拟交换机上部署的分布式网关转发所述来自所述虚拟机的数据包。The SDN controller sends the first flow entry to the virtual switch of the virtual machine to instruct the virtual switch of the virtual machine to pass the distribution deployed on the virtual switch of the virtual machine according to the first flow entry. A gateway forwards the data packets from the virtual machine. 2.根据权利要求1所述的方法,其特征在于,所述方法还包括:2. The method according to claim 1, wherein the method further comprises: 所述SDN控制器从至少一个第三路由表项中获取内部路由信息,所述至少一个第三路由表项中的每个第三路由表项中包含所述虚拟机的地址和向所述虚拟机发送数据包时所要经过的分布式网关的地址,所述向所述虚拟机发送数据包时所要经过的分布式网关为所述虚拟机的虚拟交换机上部署的分布式网关,所述内部路由信息用于表征所述虚拟机与所述虚拟机的虚拟交换机上部署的分布式网关之间的路由关系;The SDN controller obtains the internal routing information from at least one third routing table entry, and each third routing table entry in the at least one third routing table entry includes the address of the virtual machine and the address to the virtual machine. The address of the distributed gateway through which the machine sends data packets, the distributed gateway through which the data packet is sent to the virtual machine is the distributed gateway deployed on the virtual switch of the virtual machine, and the internal routing The information is used to represent the routing relationship between the virtual machine and the distributed gateway deployed on the virtual switch of the virtual machine; 所述SDN控制器向所述动态路由代理发送携带有所述内部路由信息的第一路由发布消息,所述第一路由发布消息用于指示所述动态路由代理向边界网关发布所述内部路由信息;The SDN controller sends a first route advertisement message carrying the internal routing information to the dynamic routing agent, where the first routing advertisement message is used to instruct the dynamic routing agent to publish the internal routing information to the border gateway ; 其中,所述SDN控制器中存储有路由表,所述路由表包含所述至少一个第一路由表项和所述至少一个第三路由表项。Wherein, a routing table is stored in the SDN controller, and the routing table includes the at least one first routing table entry and the at least one third routing table entry. 3.根据权利要求2所述的方法,其特征在于,在所述SDN控制器从至少一个第三路由表项中获取内部路由信息之前,所述方法还包括:3. The method according to claim 2, wherein before the SDN controller acquires internal routing information from at least one third routing table entry, the method further comprises: 所述SDN控制器获取所述虚拟机的路由信息,所述虚拟机的路由信息包含所述虚拟机的地址和所述虚拟机的虚拟交换机上部署的分布式网关的地址;The SDN controller acquires routing information of the virtual machine, where the routing information of the virtual machine includes the address of the virtual machine and the address of the distributed gateway deployed on the virtual switch of the virtual machine; 所述SDN控制器根据所述虚拟机的路由信息生成所述第三路由表项。The SDN controller generates the third routing table entry according to the routing information of the virtual machine. 4.根据权利要求3所述的方法,其特征在于,在所述SDN控制器根据所述虚拟机的路由信息生成所述第三路由表项之后,所述方法还包括:4. The method according to claim 3, wherein after the SDN controller generates the third routing table entry according to the routing information of the virtual machine, the method further comprises: 所述SDN控制器将所述第三路由表项转化为第二流表项,并向所述虚拟机的虚拟交换机发送所述第二流表项。The SDN controller converts the third routing entry into a second flow entry, and sends the second flow entry to the virtual switch of the virtual machine. 5.根据权利要求2-4中任一项所述的方法,其特征在于,所述动态路由代理部署在所述虚拟机上,或者,所述动态路由代理部署在所述虚拟机所属的服务器上。The method according to any one of claims 2-4, wherein the dynamic routing agent is deployed on the virtual machine, or the dynamic routing agent is deployed on a server to which the virtual machine belongs superior. 6.根据权利要求5所述的方法,其特征在于,所述SDN中还包含集中式网关;所述路由表还包含第四路由表项;所述第四路由表项中包含所述虚拟机的网际协议IP所属的网段的IP地址和所述集中式网关的IP地址;The method according to claim 5, wherein the SDN further includes a centralized gateway; the routing table further includes a fourth routing table entry; the fourth routing table entry includes the virtual machine The IP address of the network segment to which the Internet Protocol IP belongs and the IP address of the centralized gateway; 所述方法还包括:The method also includes: 所述SDN控制器从所述第四路由表项中获取集中路由信息,所述集中路由信息用于表征所述虚拟机与所述集中式网关之间的路由关系;obtaining, by the SDN controller, centralized routing information from the fourth routing table entry, where the centralized routing information is used to represent a routing relationship between the virtual machine and the centralized gateway; 所述SDN控制器向所述动态路由代理发送携带有所述集中路由信息的第二路由发布消息,所述第二路由发布消息用于指示所述动态路由代理向边界网关发布所述集中路由信息。The SDN controller sends a second route advertisement message carrying the centralized routing information to the dynamic routing agent, where the second routing advertisement message is used to instruct the dynamic routing agent to publish the centralized routing information to the border gateway . 7.一种动态路由配置方法,应用于软件定义网络SDN中,所述SDN通过边界网关与外部网络相连,其特征在于,所述SDN中包含:SDN控制器、至少两个虚拟机、所述虚拟机的虚拟交换机和动态路由代理,所述虚拟机的虚拟交换机上部署有分布式网关,所述方法包括:7. A dynamic routing configuration method, applied in a software-defined network SDN, wherein the SDN is connected to an external network through a border gateway, wherein the SDN includes: an SDN controller, at least two virtual machines, the A virtual switch and a dynamic routing agent of a virtual machine, where a distributed gateway is deployed on the virtual switch of the virtual machine, and the method includes: 所述动态路由代理接收边界网关发送的外部路由信息,所述外部路由信息用于表征外部设备与边界网关之间的路由关系;The dynamic routing agent receives external routing information sent by the border gateway, where the external routing information is used to represent the routing relationship between the external device and the border gateway; 所述动态路由代理向所述SDN控制器发送携带所述外部路由信息的路由学习消息,以使得所述SDN控制器根据所述外部路由信息更新至少一个第一路由表项,进而使得所述SDN控制器在接收到虚拟机的虚拟交换机发送的来自所述虚拟机的数据包时,将第二路由表项转化为第一流表项,并向所述虚拟机的虚拟交换机发送所述第一流表项;The dynamic routing agent sends a route learning message carrying the external routing information to the SDN controller, so that the SDN controller updates at least one first routing table entry according to the external routing information, thereby enabling the SDN controller to update at least one first routing table entry. When receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the controller converts the second routing table entry into the first flow table entry, and sends the first flow table to the virtual switch of the virtual machine item; 其中,所述至少一个第一路由表项中的每个第一路由表项中包含所述外部设备的地址和向所述外部设备发送数据包时所要经过的边界网关的地址;所述第二路由表项为所述至少一个第一路由表项中的一个路由表项,所述第二路由表项中包含的外部设备的地址与所述来自所述虚拟机的数据包的目的地址相同,所述虚拟机为所述至少两个虚拟机中的任意一个虚拟机。Wherein, each first routing table entry in the at least one first routing table entry contains the address of the external device and the address of the border gateway through which the data packet is sent to the external device; the second routing table entry The routing table entry is one of the at least one first routing table entry, and the address of the external device included in the second routing table entry is the same as the destination address of the data packet from the virtual machine, The virtual machine is any one of the at least two virtual machines. 8.根据权利要求7所述的方法,其特征在于,所述方法还包括:8. The method according to claim 7, wherein the method further comprises: 所述动态路由代理接收所述SDN控制器发送的第一路由发布消息,所述第一路由发布消息中携带有内部路由信息,所述内部路由信息用于表征所述虚拟机与所述虚拟机的虚拟交换机上部署的分布式网关之间的路由关系;The dynamic routing agent receives the first route advertisement message sent by the SDN controller, where the first route advertisement message carries internal routing information, and the internal routing information is used to represent the virtual machine and the virtual machine The routing relationship between the distributed gateways deployed on the virtual switches; 所述动态路由代理向边界网关发布所述内部路由信息。The dynamic routing agent publishes the internal routing information to the border gateway. 9.根据权利要求8所述的方法,其特征在于,所述动态路由代理接收边界网关发送的外部路由信息,包括:9. The method according to claim 8, wherein the dynamic routing agent receives the external routing information sent by the border gateway, comprising: 所述动态路由代理基于动态路由协议,接收边界网关发送的外部路由信息;The dynamic routing agent receives the external routing information sent by the border gateway based on the dynamic routing protocol; 所述动态路由代理向边界网关发布所述内部路由信息,包括:The dynamic routing agent publishes the internal routing information to the border gateway, including: 所述动态路由代理基于所述动态路由协议,向边界网关发布所述内部路由信息。The dynamic routing agent publishes the internal routing information to the border gateway based on the dynamic routing protocol. 10.根据权利要求7或8所述的方法,其特征在于,所述动态路由代理部署在所述虚拟机上,或者,所述动态路由代理部署在所述虚拟机所属的服务器上。The method according to claim 7 or 8, wherein the dynamic routing agent is deployed on the virtual machine, or the dynamic routing agent is deployed on a server to which the virtual machine belongs. 11.根据权利要求9所述的方法,其特征在于,所述动态路由代理部署在所述虚拟机上,或者,所述动态路由代理部署在所述虚拟机所属的服务器上。The method according to claim 9, wherein the dynamic routing agent is deployed on the virtual machine, or the dynamic routing agent is deployed on a server to which the virtual machine belongs. 12.根据权利要求10所述的方法,其特征在于,所述SDN中还包含集中式网关;所述方法还包括:12. The method according to claim 10, wherein the SDN further comprises a centralized gateway; the method further comprises: 所述动态路由代理接收所述SDN控制器发送的第二路由发布消息,所述第二路由发布消息中携带有集中路由信息,所述集中路由信息用于表征所述虚拟机与所述集中式网关之间的路由关系;The dynamic routing agent receives the second route advertisement message sent by the SDN controller, the second route advertisement message carries centralized routing information, and the centralized routing information is used to represent the virtual machine and the centralized routing information. The routing relationship between gateways; 所述动态路由代理向边界网关发布所述集中路由信息。The dynamic routing agent publishes the centralized routing information to the border gateway. 13.根据权利要求11所述的方法,其特征在于,所述SDN中还包含集中式网关;所述方法还包括:13. The method according to claim 11, wherein the SDN further comprises a centralized gateway; the method further comprises: 所述动态路由代理接收所述SDN控制器发送的第二路由发布消息,所述第二路由发布消息中携带有集中路由信息,所述集中路由信息用于表征所述虚拟机与所述集中式网关之间的路由关系;The dynamic routing agent receives the second route advertisement message sent by the SDN controller, the second route advertisement message carries centralized routing information, and the centralized routing information is used to represent the virtual machine and the centralized routing information. The routing relationship between gateways; 所述动态路由代理向边界网关发布所述集中路由信息。The dynamic routing agent publishes the centralized routing information to the border gateway. 14.根据权利要求13所述的方法,其特征在于,所述动态路由代理向边界网关发布所述集中路由信息,包括:14. The method according to claim 13, wherein the dynamic routing agent publishes the centralized routing information to the border gateway, comprising: 所述动态路由代理基于所述动态路由协议,向边界网关发布所述集中路由信息。The dynamic routing agent publishes the centralized routing information to the border gateway based on the dynamic routing protocol. 15.一种软件定义网络SDN控制器,应用于SDN中,所述SDN通过边界网关与外部网络相连,其特征在于,所述SDN中包含:所述SDN控制器、至少两个虚拟机、所述虚拟机的虚拟交换机和动态路由代理,所述虚拟机的虚拟交换机上部署有分布式网关,所述SDN控制器包括:15. A software-defined network SDN controller, applied in an SDN, the SDN is connected to an external network through a border gateway, wherein the SDN includes: the SDN controller, at least two virtual machines, all the The virtual switch and dynamic routing agent of the virtual machine, the distributed gateway is deployed on the virtual switch of the virtual machine, and the SDN controller includes: 接收单元,用于接收所述动态路由代理发送的路由学习消息,所述路由学习消息中携带有外部路由信息,所述外部路由信息用于表征外部设备与边界网关之间的路由关系;a receiving unit, configured to receive a routing learning message sent by the dynamic routing agent, where the routing learning message carries external routing information, and the external routing information is used to represent the routing relationship between the external device and the border gateway; 更新单元,用于根据所述外部路由信息更新至少一个第一路由表项,所述至少一个第一路由表项中的每个第一路由表项中包含所述外部设备的地址和向所述外部设备发送数据包时所要经过的边界网关的地址;An update unit, configured to update at least one first routing table entry according to the external routing information, where each first routing table entry in the at least one first routing table entry contains the address of the external device and the address to the external device. The address of the border gateway through which the external device sends data packets; 路由转换单元,用于在接收到虚拟机的虚拟交换机发送的来自所述虚拟机的数据包时,将第二路由表项转化为第一流表项,所述第二路由表项为所述至少一个第一路由表项中的一个路由表项,所述第二路由表项中包含的外部设备的地址与所述来自所述虚拟机的数据包的目的地址相同,所述虚拟机为所述至少两个虚拟机中的任意一个虚拟机;a route conversion unit, configured to convert a second routing table entry into a first flow table entry when receiving a data packet from the virtual machine sent by the virtual switch of the virtual machine, where the second routing table entry is the at least one A routing table entry in a first routing table entry, the address of the external device contained in the second routing table entry is the same as the destination address of the data packet from the virtual machine, and the virtual machine is the Any one of at least two virtual machines; 第一发送单元,用于向所述虚拟机的虚拟交换机发送所述第一流表项,以指示所述虚拟机的虚拟交换机根据所述第一流表项,通过所述虚拟机的虚拟交换机上部署的分布式网关转发所述来自所述虚拟机的数据包。a first sending unit, configured to send the first flow entry to the virtual switch of the virtual machine, to instruct the virtual switch of the virtual machine to deploy on the virtual switch of the virtual machine according to the first flow entry The distributed gateway forwards the packets from the virtual machine. 16.根据权利要求15所述的SDN控制器,其特征在于,所述SDN控制器还包括:16. The SDN controller according to claim 15, wherein the SDN controller further comprises: 获取单元,用于从至少一个第三路由表项中获取内部路由信息,所述至少一个第三路由表项中的每个第三路由表项中包含所述虚拟机的地址和向所述虚拟机发送数据包时所要经过的分布式网关的地址,所述向所述虚拟机发送数据包时所要经过的分布式网关为所述虚拟机的虚拟交换机上部署的分布式网关,所述内部路由信息用于表征所述虚拟机与所述虚拟机的虚拟交换机上部署的分布式网关之间的路由关系;The obtaining unit is configured to obtain internal routing information from at least one third routing table entry, where each third routing table entry in the at least one third routing table entry contains the address of the virtual machine and the address to the virtual machine. The address of the distributed gateway through which the machine sends data packets, the distributed gateway through which the data packet is sent to the virtual machine is the distributed gateway deployed on the virtual switch of the virtual machine, and the internal routing The information is used to represent the routing relationship between the virtual machine and the distributed gateway deployed on the virtual switch of the virtual machine; 第二发送单元,用于向所述动态路由代理发送携带有所述内部路由信息的第一路由发布消息,所述第一路由发布消息用于指示所述动态路由代理向边界网关发布所述内部路由信息;a second sending unit, configured to send a first route advertisement message carrying the internal routing information to the dynamic routing agent, where the first route advertisement message is used to instruct the dynamic routing agent to publish the internal routing information to the border gateway routing information; 其中,所述SDN控制器中存储有路由表,所述路由表包含所述至少一个第一路由表项和所述至少一个第三路由表项。Wherein, a routing table is stored in the SDN controller, and the routing table includes the at least one first routing table entry and the at least one third routing table entry. 17.根据权利要求16所述的SDN控制器,其特征在于,所述获取单元,还用于在从至少一个第三路由表项中获取内部路由信息之前,获取所述虚拟机的路由信息,所述虚拟机的路由信息包含所述虚拟机的地址和所述虚拟机的虚拟交换机上部署的分布式网关的地址;17. The SDN controller according to claim 16, wherein the obtaining unit is further configured to obtain the routing information of the virtual machine before obtaining the internal routing information from at least one third routing table entry, The routing information of the virtual machine includes the address of the virtual machine and the address of the distributed gateway deployed on the virtual switch of the virtual machine; 所述SDN控制器还包括:The SDN controller also includes: 生成单元,用于根据所述虚拟机的路由信息生成所述第三路由表项。A generating unit, configured to generate the third routing table entry according to the routing information of the virtual machine. 18.根据权利要求17所述的SDN控制器,其特征在于,所述路由转换单元,还用于在所述生成单元根据所述虚拟机的路由信息生成所述第三路由表项之后,将所述第三路由表项转化为第二流表项;18. The SDN controller according to claim 17, wherein the route conversion unit is further configured to, after the generating unit generates the third routing table entry according to the routing information of the virtual machine, convert the The third routing table entry is converted into a second flow table entry; 所述第一发送单元,还用于向所述虚拟机的虚拟交换机发送所述第二流表项。The first sending unit is further configured to send the second flow entry to the virtual switch of the virtual machine. 19.根据权利要求16-18中任一项所述的SDN控制器,其特征在于,所述动态路由代理部署在所述虚拟机上,或者,所述动态路由代理部署在所述虚拟机所属的服务器上。19. The SDN controller according to any one of claims 16-18, wherein the dynamic routing agent is deployed on the virtual machine, or the dynamic routing agent is deployed on the virtual machine to which the virtual machine belongs on the server. 20.根据权利要求19所述的SDN控制器,其特征在于,所述SDN中还包含集中式网关;所述路由表还包含第四路由表项;所述第四路由表项中包含所述虚拟机的网际协议IP所属的网段的IP地址和所述集中式网关的IP地址;20. The SDN controller according to claim 19, wherein the SDN further includes a centralized gateway; the routing table further includes a fourth routing table entry; the fourth routing table entry includes the The IP address of the network segment to which the Internet Protocol IP of the virtual machine belongs and the IP address of the centralized gateway; 所述获取单元,还用于从所述第四路由表项中获取集中路由信息,所述集中路由信息用于表征所述虚拟机与所述集中式网关之间的路由关系;The obtaining unit is further configured to obtain centralized routing information from the fourth routing table entry, where the centralized routing information is used to represent the routing relationship between the virtual machine and the centralized gateway; 所述第二发送单元,用于向所述动态路由代理发送携带有所述集中路由信息的第二路由发布消息,所述第二路由发布消息用于指示所述动态路由代理向边界网关发布所述集中路由信息。The second sending unit is configured to send a second route advertisement message carrying the centralized routing information to the dynamic routing agent, where the second route advertisement message is used to instruct the dynamic routing agent to publish the information to the border gateway. The centralized routing information is described. 21.一种动态路由代理,应用于软件定义网络SDN中,所述SDN通过边界网关与外部网络相连,其特征在于,所述SDN中包含:SDN控制器、至少两个虚拟机、所述虚拟机的虚拟交换机和所述动态路由代理,所述虚拟机的虚拟交换机上部署有分布式网关,所述动态路由代理包括:21. A dynamic routing agent, applied in a software-defined network SDN, wherein the SDN is connected to an external network through a border gateway, wherein the SDN comprises: an SDN controller, at least two virtual machines, the virtual The virtual switch of the virtual machine and the dynamic routing agent, a distributed gateway is deployed on the virtual switch of the virtual machine, and the dynamic routing agent includes: 接收单元,用于接收边界网关发送的外部路由信息,所述外部路由信息用于表征外部设备与边界网关之间的路由关系;a receiving unit, configured to receive external routing information sent by the border gateway, where the external routing information is used to represent the routing relationship between the external device and the border gateway; 发送单元,用于向所述SDN控制器发送携带所述外部路由信息的路由学习消息,以使得所述SDN控制器根据所述外部路由信息更新至少一个第一路由表项,进而使得所述SDN控制器在接收到虚拟机的虚拟交换机发送的来自所述虚拟机的数据包时,将第二路由表项转化为第一流表项,并向所述虚拟机的虚拟交换机发送所述第一流表项;A sending unit, configured to send a route learning message carrying the external routing information to the SDN controller, so that the SDN controller updates at least one first routing table entry according to the external routing information, thereby enabling the SDN controller to update at least one first routing table entry. When receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the controller converts the second routing table entry into the first flow table entry, and sends the first flow table to the virtual switch of the virtual machine item; 其中,所述至少一个第一路由表项中的每个第一路由表项中包含所述外部设备的地址和向所述外部设备发送数据包时所要经过的边界网关的地址;所述第二路由表项为所述至少一个第一路由表项中的一个路由表项,所述第二路由表项中包含的外部设备的地址与所述来自所述虚拟机的数据包的目的地址相同,所述虚拟机为所述至少两个虚拟机中的任意一个虚拟机。Wherein, each first routing table entry in the at least one first routing table entry contains the address of the external device and the address of the border gateway through which the data packet is sent to the external device; the second routing table entry The routing table entry is one of the at least one first routing table entry, and the address of the external device included in the second routing table entry is the same as the destination address of the data packet from the virtual machine, The virtual machine is any one of the at least two virtual machines. 22.根据权利要求21所述的动态路由代理,其特征在于,所述接收单元,还用于接收所述SDN控制器发送的第一路由发布消息,所述第一路由发布消息中携带有内部路由信息,所述内部路由信息用于表征所述虚拟机与所述虚拟机的虚拟交换机上部署的分布式网关之间的路由关系;22. The dynamic routing agent according to claim 21, wherein the receiving unit is further configured to receive a first routing advertisement message sent by the SDN controller, wherein the first routing advertisement message carries an internal routing information, where the internal routing information is used to represent the routing relationship between the virtual machine and the distributed gateway deployed on the virtual switch of the virtual machine; 所述发送单元,还用于向边界网关发布所述内部路由信息。The sending unit is further configured to publish the internal routing information to the border gateway. 23.根据权利要求22所述的动态路由代理,其特征在于,所述动态路由代理还包括:23. The dynamic routing proxy according to claim 22, wherein the dynamic routing proxy further comprises: 控制单元,用于控制所述接收单元基于动态路由协议,接收边界网关发送的外部路由信息;a control unit, configured to control the receiving unit to receive the external routing information sent by the border gateway based on the dynamic routing protocol; 所述控制单元,还用于控制所述发送单元基于所述动态路由协议,向边界网关发布所述内部路由信息。The control unit is further configured to control the sending unit to publish the internal routing information to the border gateway based on the dynamic routing protocol. 24.根据权利要求23所述的动态路由代理,其特征在于,所述动态路由代理部署在所述虚拟机上,或者,所述动态路由代理部署在所述虚拟机所属的服务器上。24. The dynamic routing proxy according to claim 23, wherein the dynamic routing proxy is deployed on the virtual machine, or the dynamic routing proxy is deployed on a server to which the virtual machine belongs. 25.根据权利要求24所述的动态路由代理,其特征在于,所述SDN中还包含集中式网关;25. The dynamic routing agent according to claim 24, wherein the SDN further comprises a centralized gateway; 所述接收单元,还用于接收所述SDN控制器发送的第二路由发布消息,所述第二路由发布消息中携带有集中路由信息,所述集中路由信息用于表征所述虚拟机与所述集中式网关之间的路由关系;The receiving unit is further configured to receive a second route advertisement message sent by the SDN controller, where the second route advertisement message carries centralized routing information, and the centralized routing information is used to represent the virtual machine and the Describe the routing relationship between centralized gateways; 所述发送单元,还用于向边界网关发布所述集中路由信息。The sending unit is further configured to publish the centralized routing information to the border gateway. 26.根据权利要求25所述的动态路由代理,其特征在于,所述控制单元,还用于控制所述发送单元基于所述动态路由协议,向边界网关发布所述集中路由信息。26. The dynamic routing agent according to claim 25, wherein the control unit is further configured to control the sending unit to publish the centralized routing information to the border gateway based on the dynamic routing protocol. 27.一种动态路由配置系统,其特征在于,所述系统包括:软件定义网络SDN控制器、至少两个虚拟机、所述虚拟机的虚拟交换机和动态路由代理,所述虚拟机的虚拟交换机上部署有分布式网关;27. A dynamic routing configuration system, characterized in that the system comprises: a software-defined network SDN controller, at least two virtual machines, a virtual switch of the virtual machine, and a dynamic routing agent, the virtual switch of the virtual machine A distributed gateway is deployed on the platform; 所述SDN控制器,用于接收所述动态路由代理发送的路由学习消息,所述路由学习消息中携带有外部路由信息,所述外部路由信息用于表征外部设备与边界网关之间的路由关系;根据所述外部路由信息更新至少一个第一路由表项,所述至少一个第一路由表项中的每个第一路由表项中包含所述外部设备的地址和向所述外部设备发送数据包时所要经过的边界网关的地址;在接收到虚拟机的虚拟交换机发送的来自所述虚拟机的数据包时,将第二路由表项转化为第一流表项,所述第二路由表项为所述至少一个第一路由表项中的一个路由表项,所述第二路由表项中包含的外部设备的地址与所述来自所述虚拟机的数据包的目的地址相同,所述虚拟机为所述至少两个虚拟机中的任意一个虚拟机;向所述虚拟机的虚拟交换机发送所述第一流表项,以指示所述虚拟机的虚拟交换机根据所述第一流表项,通过所述虚拟机的虚拟交换机上部署的分布式网关转发所述来自所述虚拟机的数据包;The SDN controller is configured to receive a route learning message sent by the dynamic routing agent, where the route learning message carries external routing information, and the external routing information is used to represent the routing relationship between the external device and the border gateway Update at least one first routing table entry according to the external routing information, and each first routing table entry in the at least one first routing table entry contains the address of the external device and sends data to the external device. The address of the border gateway to pass through when the packet is received; when receiving the data packet from the virtual machine sent by the virtual switch of the virtual machine, the second routing table entry is converted into the first flow table entry, the second routing table entry is a routing entry in the at least one first routing entry, the address of the external device contained in the second routing entry is the same as the destination address of the data packet from the virtual machine, the virtual The machine is any one of the at least two virtual machines; the first flow entry is sent to the virtual switch of the virtual machine to instruct the virtual switch of the virtual machine to pass the first flow entry according to the first flow entry. the distributed gateway deployed on the virtual switch of the virtual machine forwards the data packet from the virtual machine; 所述动态路由代理,用于接收所述边界网关发送的所述外部路由信息;向所述SDN控制器发送携带所述外部路由信息的所述路由学习消息,以使得所述SDN控制器根据所述外部路由信息更新所述至少一个第一路由表项,进而使得所述SDN控制器在接收到所述虚拟机的虚拟交换机发送的来自所述虚拟机的数据包时,将所述第二路由表项转化为所述第一流表项,并向所述虚拟机的虚拟交换机发送所述第一流表项。The dynamic routing agent is configured to receive the external routing information sent by the border gateway; and send the routing learning message carrying the external routing information to the SDN controller, so that the SDN controller can The external routing information updates the at least one first routing table entry, so that when the SDN controller receives the data packet from the virtual machine sent by the virtual switch of the virtual machine, the second routing table is The entry is converted into the first flow entry, and the first flow entry is sent to the virtual switch of the virtual machine.
CN201510119094.9A 2015-03-18 2015-03-18 A kind of dynamic route collocating method, apparatus and system Active CN106034077B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201510119094.9A CN106034077B (en) 2015-03-18 2015-03-18 A kind of dynamic route collocating method, apparatus and system
PCT/CN2016/076633 WO2016146077A1 (en) 2015-03-18 2016-03-17 Dynamic route configuration method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510119094.9A CN106034077B (en) 2015-03-18 2015-03-18 A kind of dynamic route collocating method, apparatus and system

Publications (2)

Publication Number Publication Date
CN106034077A CN106034077A (en) 2016-10-19
CN106034077B true CN106034077B (en) 2019-06-28

Family

ID=56918277

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510119094.9A Active CN106034077B (en) 2015-03-18 2015-03-18 A kind of dynamic route collocating method, apparatus and system

Country Status (2)

Country Link
CN (1) CN106034077B (en)
WO (1) WO2016146077A1 (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107888438B (en) * 2016-09-29 2021-06-08 上海天旦网络科技发展有限公司 Flow table technology-based system for automatically sensing and adapting to cloud environment change
CN106550159B (en) * 2017-01-23 2019-09-06 广州海格通信集团股份有限公司 VoIP communication system
CN106911506B (en) * 2017-02-27 2020-07-10 苏州浪潮智能科技有限公司 Method and device for avoiding management network disconnection during network service restart
CN108574635B (en) 2017-03-09 2021-06-22 华为技术有限公司 Routing priority configuration method, device and controller
US20190028409A1 (en) * 2017-07-19 2019-01-24 Alibaba Group Holding Limited Virtual switch device and method
CN109688062B (en) * 2017-10-19 2021-07-13 中兴通讯股份有限公司 Routing method and routing equipment
CN108616386A (en) * 2018-03-29 2018-10-02 西安交通大学 A kind of construction method and SDN virtual network environments of SDN virtual network environments
CN109617804B (en) * 2018-12-11 2020-10-13 广东省新一代通信与网络创新研究院 Method, device, computer readable storage medium and system for defining routing protocol
CN111404705B (en) * 2019-01-02 2023-05-09 中国移动通信有限公司研究院 SDN optimization method and device and computer readable storage medium
CN110086676B (en) * 2019-05-08 2022-11-22 深信服科技股份有限公司 Configuration method of distributed router and related equipment
CN110430076B (en) * 2019-07-31 2022-05-31 新华三技术有限公司合肥分公司 Route management method and device
CN112751766B (en) * 2019-10-30 2023-07-11 华为技术有限公司 Message forwarding method and system, related equipment and chip
CN111181860A (en) * 2020-01-07 2020-05-19 苏宁云计算有限公司 Route forwarding method, device and system based on zuul gateway
CN114244810A (en) * 2020-09-07 2022-03-25 中兴通讯股份有限公司 Virtual IP management method, device, electronic equipment and storage medium
US11528213B2 (en) * 2020-12-30 2022-12-13 Juniper Networks, Inc. Sharing routes using an in-memory data store in a distributed network system
CN113014426B (en) * 2021-02-10 2023-04-07 优刻得科技股份有限公司 Method and device for establishing communication between cloud server and client server
CN113938379B (en) * 2021-09-29 2024-06-04 浪潮云信息技术股份公司 Method for dynamically loading cloud platform log acquisition configuration
CN115277550B (en) * 2022-06-21 2023-11-28 阿里巴巴(中国)有限公司 Routing system, routing method and routing device of virtual network

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103152264A (en) * 2013-02-25 2013-06-12 北京百度网讯科技有限公司 Openflow network and IP (Internet Protocol) network interconnection communication method and openflow subnet edge switch
CN104022960A (en) * 2013-02-28 2014-09-03 杭州华三通信技术有限公司 Method and device realizing PVLAN through OpenFlow protocol
CN104243317A (en) * 2014-09-26 2014-12-24 杭州华三通信技术有限公司 Method and device for forwarding IP (internet protocol) routes
CN104283756A (en) * 2013-07-02 2015-01-14 杭州华三通信技术有限公司 A method and device for implementing a distributed multi-tenant virtual network

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA3081255C (en) * 2009-04-01 2023-08-22 Nicira, Inc. Method and apparatus for implementing and managing virtual switches
US9167501B2 (en) * 2011-08-29 2015-10-20 Telefonaktiebolaget L M Ericsson (Publ) Implementing a 3G packet core in a cloud computer with openflow data and control planes
WO2013047705A1 (en) * 2011-09-27 2013-04-04 日本電気株式会社 Network system, front-end device, and control message transmission rate minimizing method
US9392050B2 (en) * 2013-03-15 2016-07-12 Cisco Technology, Inc. Automatic configuration of external services based upon network activity
CN104394083B (en) * 2014-09-22 2017-12-15 华为技术有限公司 Method, the method and its device and system of message forwarding of forwarding-table item processing

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103152264A (en) * 2013-02-25 2013-06-12 北京百度网讯科技有限公司 Openflow network and IP (Internet Protocol) network interconnection communication method and openflow subnet edge switch
CN104022960A (en) * 2013-02-28 2014-09-03 杭州华三通信技术有限公司 Method and device realizing PVLAN through OpenFlow protocol
CN104283756A (en) * 2013-07-02 2015-01-14 杭州华三通信技术有限公司 A method and device for implementing a distributed multi-tenant virtual network
CN104243317A (en) * 2014-09-26 2014-12-24 杭州华三通信技术有限公司 Method and device for forwarding IP (internet protocol) routes

Also Published As

Publication number Publication date
WO2016146077A1 (en) 2016-09-22
CN106034077A (en) 2016-10-19

Similar Documents

Publication Publication Date Title
CN106034077B (en) A kind of dynamic route collocating method, apparatus and system
US9374270B2 (en) Multicast service in virtual networks
US20210243108A1 (en) Method for implementing network virtualization and related apparatus and communications system
US8755377B2 (en) Facilitating operation of one or more virtual networks
US9906407B1 (en) Methods and apparatus for scalable resilient networks
CN105264493B (en) Dynamic virtual machine migration on information centre's network
CN110896371B (en) Virtual network equipment and related method
WO2014118938A1 (en) Communication path management method
US9419940B2 (en) IPv4 data center support for IPv4 and IPv6 visitors
US20160065503A1 (en) Methods, systems, and computer readable media for virtual fabric routing
JP2020508022A (en) Scalable advanced packet core
CN108293022A (en) A kind of methods, devices and systems of message transmissions
RU2005141461A (en) VIRTUAL MULTI-ADDRESS ROUTING FOR A CLUSTER HAVING A SYNCHRONIZATION OF A STATE
US10924372B2 (en) Computing system providing enhanced point of presence (PoP) server selection based upon network health metrics and related methods
WO2014194753A1 (en) Method, device and system for generating service path
JP2017526309A (en) Forwarding table synchronization method, network device and system
CN111314196A (en) Data center network hybrid overlay communication method
WO2014075216A1 (en) Method and network device for establishing virtual cluster
EP3902207B1 (en) Packet forwarding method and network device
CN105391636A (en) Interconnection mechanism between software defined network (SDN) subnet and IP subnet in autonomous system
CN104135446A (en) System and method of implementing transition from IPv4 (Internet Protocol Version4) to IPv6 (Internet Protocol Version6) based on SDN (Software Defined Network)
JP2019519146A (en) Routing establishment, packet transmission
WO2012022169A1 (en) Management method and apparatus for network address translation
WO2023165137A1 (en) Cross-cluster network communication system and method
US11070395B2 (en) Customer premises LAN expansion

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220224

Address after: 550025 Huawei cloud data center, jiaoxinggong Road, Qianzhong Avenue, Gui'an New District, Guiyang City, Guizhou Province

Patentee after: Huawei Cloud Computing Technologies Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.

TR01 Transfer of patent right