Movatterモバイル変換


[0]ホーム

URL:


CN110545230B - Method and device for forwarding VXLAN message - Google Patents

Method and device for forwarding VXLAN message
Download PDF

Info

Publication number
CN110545230B
CN110545230BCN201910839835.9ACN201910839835ACN110545230BCN 110545230 BCN110545230 BCN 110545230BCN 201910839835 ACN201910839835 ACN 201910839835ACN 110545230 BCN110545230 BCN 110545230B
Authority
CN
China
Prior art keywords
real
address
port
client
vxlan message
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
CN201910839835.9A
Other languages
Chinese (zh)
Other versions
CN110545230A (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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology 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 Beijing Baidu Netcom Science and Technology Co LtdfiledCriticalBeijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910839835.9ApriorityCriticalpatent/CN110545230B/en
Publication of CN110545230ApublicationCriticalpatent/CN110545230A/en
Application grantedgrantedCritical
Publication of CN110545230BpublicationCriticalpatent/CN110545230B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本公开的实施例公开了用于转发VXLAN报文的方法和装置。该方法的一具体实施方式包括:负载均衡设备响应于接收到来自客户端的VXLAN报文,从VXLAN报文中解析出客户端的真实IP地址和端口;使用指定的IP地址和端口替换掉VXLAN报文中的客户端的真实IP地址和端口;从至少一个真实服务器中选择出目标真实服务器;使用解析出的客户端的真实IP地址和端口替换掉VXLAN报文中的特定字段;将修改后的VXLAN报文转发给目标真实服务器。真实服务器响应于接收到负载均衡设备转发的VXLAN报文,根据真实服务器的解析模式从VXLAN报文的特定字段中解析出客户端的真实IP地址和端口后进行业务处理。该实施方式能够提高云计算服务的可靠性。

Embodiments of the present disclosure disclose methods and devices for forwarding VXLAN messages. A specific implementation of the method includes: the load balancing device responds to receiving the VXLAN message from the client, parses the client's real IP address and port from the VXLAN message, and replaces the VXLAN message with the specified IP address and port. The real IP address and port of the client in Forwarded to the target real server. In response to receiving the VXLAN message forwarded by the load balancing device, the real server parses the client's real IP address and port from the specific fields of the VXLAN message according to the real server's parsing mode and then performs business processing. This implementation can improve the reliability of cloud computing services.

Description

Translated fromChinese
用于转发VXLAN报文的方法和装置Method and device for forwarding VXLAN messages

技术领域Technical field

本公开的实施例涉及计算机技术领域,具体涉及用于转发VXLAN报文的方法和装置。Embodiments of the present disclosure relate to the field of computer technology, and specifically to methods and devices for forwarding VXLAN messages.

背景技术Background technique

随着当前互联网流量和带宽出现的爆炸性增长,负载均衡产品得到了越来越多的应用:对外能够提供单一的IP+Port,作为访问服务的统一入口;对内能够将流量均衡地分发到多个真实服务器中,使得每个真实服务器不会处理超过其能力范围的请求,并且当单个真实服务器无法提供服务时,流量能够被其它存活的真实服务器所分担,实现了服务的高可靠性。With the current explosive growth of Internet traffic and bandwidth, load balancing products have been increasingly used: externally, they can provide a single IP+Port as a unified entrance to access services; internally, they can evenly distribute traffic to multiple servers. In a real server, each real server will not handle requests that exceed its capabilities, and when a single real server cannot provide services, the traffic can be shared by other surviving real servers, achieving high reliability of the service.

云计算领域广泛采用Overlay技术,在两个物理设备之上构建逻辑上的网络通信链路,相对于Underlay网络,Overlay技术可以非常灵活的构建多个虚拟子网以支持多租户、虚拟机迁移等服务。目前最流行的Overlay技术方案应该就是VXLAN(VirtualExtensibleLocalAreaNetwork,虚拟扩展局域网)协议。Overlay technology is widely used in the cloud computing field to build logical network communication links on two physical devices. Compared with Underlay networks, Overlay technology can very flexibly build multiple virtual subnets to support multi-tenancy, virtual machine migration, etc. Serve. At present, the most popular Overlay technology solution should be the VXLAN (Virtual Extensible Local Area Network) protocol.

从客户端来的入向流量,经过负载均衡设备时,普遍会进行从VIP+Vport(虚拟服务IP地址+端口)到RSIP+RSPort(真实服务器IP地址+端口)的DNAT(DestinationNetworkAddress,目的地址转换),有时为了隔离内外网的流量也会进行SNAT(SourceNetworkAddressTranslation,源地址转换),使用其它IP+Port来替换CIP+Cport(客户端IP地址+端口)。将CIP+CPort透传给后端的服务器,有时确实是业务的实际需要,譬如ACL(AccessControlList,访问控制列表)、QoS(QualityofService,服务质量)、计费等。When the incoming traffic from the client passes through the load balancing device, DNAT (Destination Network Address) is generally performed from VIP+Vport (virtual service IP address + port) to RSIP+RSPort (real server IP address + port). ), sometimes in order to isolate the traffic of the internal and external networks, SNAT (SourceNetworkAddressTranslation, source address translation) is also performed, and other IP+Ports are used to replace CIP+Cport (client IP address+port). Transparently transmitting CIP+CPort to the back-end server is sometimes an actual need of the business, such as ACL (AccessControlList, access control list), QoS (Quality of Service, quality of service), billing, etc.

发明内容Contents of the invention

本公开的实施例提出了用于转发VXLAN报文的方法和装置。Embodiments of the present disclosure provide methods and devices for forwarding VXLAN messages.

第一方面,本公开的实施例提供了一种用于转发VXLAN报文的方法,应用于负载均衡设备,包括:响应于接收到来自客户端的VXLAN报文,从VXLAN报文中解析出客户端的真实IP地址和端口;使用指定的IP地址和端口替换掉VXLAN报文中的客户端的真实IP地址和端口;从至少一个真实服务器中选择出目标真实服务器;使用解析出的客户端的真实IP地址和端口替换掉VXLAN报文中的特定字段;将修改后的VXLAN报文转发给目标真实服务器。In a first aspect, embodiments of the present disclosure provide a method for forwarding VXLAN messages, applied to a load balancing device, including: in response to receiving a VXLAN message from a client, parsing out the client's address from the VXLAN message. Real IP address and port; use the specified IP address and port to replace the real IP address and port of the client in the VXLAN message; select the target real server from at least one real server; use the parsed real IP address and port of the client The port replaces specific fields in the VXLAN message and forwards the modified VXLAN message to the target real server.

在一些实施例中,特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption。In some embodiments, the specific fields include at least one of the following: source MAC address, TCPoption, IPoption in the inner ether header.

在一些实施例中,在使用解析出的客户端的真实IP地址和端口替换掉VXLAN报文中的特定字段之前,该方法还包括:获取目标真实服务器的解析模式;根据解析模式确定待替换的特定字段。In some embodiments, before using the parsed real IP address and port of the client to replace the specific field in the VXLAN message, the method further includes: obtaining the parsing mode of the target real server; determining the specific field to be replaced according to the parsing mode. field.

在一些实施例中,从至少一个真实服务器中选择出目标真实服务器,包括:获取至少一个真实服务器的解析模式;从至少一个真实服务器选择解析模式与负载均衡设备的组包模式匹配的目标真实服务器。In some embodiments, selecting a target real server from at least one real server includes: obtaining a parsing mode of at least one real server; selecting a target real server whose parsing mode matches the group package mode of the load balancing device from at least one real server. .

第二方面,本公开的实施例提供了一种用于转发VXLAN报文的方法,应用于真实服务器,包括:响应于接收到负载均衡设备转发的VXLAN报文,根据真实服务器的解析模式从VXLAN报文的特定字段中解析出客户端的真实IP地址和端口,其中,特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption;基于解析出的客户端的真实IP地址和端口进行业务处理。In the second aspect, embodiments of the present disclosure provide a method for forwarding VXLAN messages, applied to a real server, including: in response to receiving a VXLAN message forwarded by a load balancing device, from the VXLAN message to the real server according to the parsing mode of the real server. The real IP address and port of the client are parsed from the specific fields of the message. The specific fields include at least one of the following: the source MAC address, TCPoption, and IPoption in the inner ether header; based on the parsed real IP address and port of the client. Port for business processing.

在一些实施例中,该方法还包括:响应于接收到解析模式的配置命令,根据配置命令切换解析模式。In some embodiments, the method further includes: in response to receiving a configuration command of the parsing mode, switching the parsing mode according to the configuration command.

在一些实施例中,该方法还包括:对解析出的客户端的真实IP地址和端口进行校验;若校验失败,则切换解析模式后重新从VXLAN报文的特定字段中解析出客户端的真实IP地址和端口。In some embodiments, the method also includes: verifying the parsed real IP address and port of the client; if the verification fails, switching the parsing mode and re-parsing the real IP address and port of the client from the specific field of the VXLAN message. IP address and port.

第三方面,本公开的实施例提供了一种用于转发VXLAN报文的系统,包括负载均衡设备和至少一个真实服务器:负载均衡设备,被配置成:响应于接收到来自客户端的VXLAN报文,从VXLAN报文中解析出客户端的真实IP地址和端口;使用指定的IP地址和端口替换掉VXLAN报文中的客户端的真实IP地址和端口;从至少一个真实服务器中选择出目标真实服务器;使用解析出的客户端的真实IP地址和端口替换掉VXLAN报文中的特定字段;将修改后的VXLAN报文转发给目标真实服务器;真实服务器,被配置成:响应于接收到负载均衡设备转发的VXLAN报文,根据真实服务器的解析模式从VXLAN报文的特定字段中解析出客户端的真实IP地址和端口,其中,特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption;基于解析出的客户端的真实IP地址和端口进行业务处理。In a third aspect, embodiments of the present disclosure provide a system for forwarding VXLAN messages, including a load balancing device and at least one real server: the load balancing device is configured to: respond to receiving a VXLAN message from a client , parse the client's real IP address and port from the VXLAN message; use the specified IP address and port to replace the client's real IP address and port in the VXLAN message; select the target real server from at least one real server; Use the parsed real IP address and port of the client to replace specific fields in the VXLAN message; forward the modified VXLAN message to the target real server; the real server is configured to: respond to receiving the message forwarded by the load balancing device For VXLAN messages, the real IP address and port of the client are parsed from specific fields in the VXLAN message according to the parsing mode of the real server. The specific fields include at least one of the following: source MAC address in the inner ether header, TCPoption, IPoption; perform business processing based on the resolved real IP address and port of the client.

第四方面,本公开的实施例提供了一种用于转发VXLAN报文的装置,应用于负载均衡设备,包括:第一解析单元,被配置成响应于接收到来自客户端的VXLAN报文,从VXLAN报文中解析出客户端的真实IP地址和端口;第一替换单元,被配置成使用指定的IP地址和端口替换掉VXLAN报文中的客户端的真实IP地址和端口;调度单元,被配置成从至少一个真实服务器中选择出目标真实服务器;第二替换单元,被配置成使用解析出的客户端的真实IP地址和端口替换掉VXLAN报文中的特定字段;发送单元,被配置成将修改后的VXLAN报文转发给目标真实服务器。In a fourth aspect, embodiments of the present disclosure provide a device for forwarding VXLAN messages, applied to a load balancing device, including: a first parsing unit configured to respond to receiving a VXLAN message from a client, from The real IP address and port of the client are parsed from the VXLAN message; the first replacement unit is configured to replace the real IP address and port of the client in the VXLAN message with the specified IP address and port; the scheduling unit is configured to Select a target real server from at least one real server; the second replacement unit is configured to replace specific fields in the VXLAN message with the parsed real IP address and port of the client; the sending unit is configured to replace the modified The VXLAN packet is forwarded to the target real server.

在一些实施例中,特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption。In some embodiments, the specific fields include at least one of the following: source MAC address, TCPoption, IPoption in the inner ether header.

在一些实施例中,该装置还包括确定单元,被配置成:在使用解析出的客户端的真实IP地址和端口替换掉VXLAN报文中的特定字段之前,获取目标真实服务器的解析模式;根据解析模式确定待替换的特定字段。In some embodiments, the device further includes a determining unit configured to: obtain the parsing mode of the target real server before using the parsed real IP address and port of the client to replace a specific field in the VXLAN message; according to the parsing The schema determines the specific fields to be replaced.

在一些实施例中,调度单元进一步被配置成:获取至少一个真实服务器的解析模式;从至少一个真实服务器选择解析模式与负载均衡设备的组包模式匹配的目标真实服务器。In some embodiments, the scheduling unit is further configured to: obtain a parsing mode of at least one real server; and select a target real server whose parsing mode matches the grouping mode of the load balancing device from the at least one real server.

第五方面,本公开的实施例提供了一种用于转发VXLAN报文的装置,应用于真实服务器,包括:第二解析单元,被配置成响应于接收到负载均衡设备转发的VXLAN报文,根据真实服务器的解析模式从VXLAN报文的特定字段中解析出客户端的真实IP地址和端口,其中,特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption;业务单元,被配置成基于解析出的客户端的真实IP地址和端口进行业务处理。In a fifth aspect, embodiments of the present disclosure provide a device for forwarding VXLAN messages, applied to a real server, including: a second parsing unit configured to respond to receiving a VXLAN message forwarded by a load balancing device, The real IP address and port of the client are parsed from specific fields of the VXLAN message according to the parsing mode of the real server. The specific fields include at least one of the following: source MAC address, TCPoption, and IPoption in the inner ether header; business unit , is configured to perform business processing based on the resolved real IP address and port of the client.

在一些实施例中,该装置还包括切换单元,被配置成:响应于接收到解析模式的配置命令,根据配置命令切换解析模式。In some embodiments, the device further includes a switching unit configured to: in response to receiving a configuration command of the parsing mode, switch the parsing mode according to the configuration command.

在一些实施例中,该装置还包括校验单元,被配置成:对解析出的客户端的真实IP地址和端口进行校验;若校验失败,则切换解析模式后重新从VXLAN报文的特定字段中解析出客户端的真实IP地址和端口。In some embodiments, the device further includes a verification unit configured to: verify the parsed real IP address and port of the client; if the verification fails, switch the parsing mode and re-select the specific IP address and port of the VXLAN message. The real IP address and port of the client are parsed in the field.

第六方面,本公开的实施例提供了一种用于转发VXLAN报文的电子设备,包括:一个或多个处理器;存储装置,其上存储有一个或多个程序,当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现如第一方面中任一的方法。In the sixth aspect, embodiments of the present disclosure provide an electronic device for forwarding VXLAN messages, including: one or more processors; a storage device on which one or more programs are stored. When one or more The program is executed by one or more processors, so that the one or more processors implement any method as in the first aspect.

第七方面,本公开的实施例提供了一种计算机可读介质,其上存储有计算机程序,其中,程序被处理器执行时实现如第一方面中任一的方法。In a seventh aspect, embodiments of the present disclosure provide a computer-readable medium on which a computer program is stored, wherein when the program is executed by a processor, any method as in the first aspect is implemented.

本公开的实施例提供的用于转发VXLAN报文的方法和装置,在将真实IP+Port信息透传给真实服务器时,即可采用在报文中附加自定义数据的方式,又可采用复用报文中内层ether头中的源MAC地址的字段。可自适应识别报文中的字段,避免中间转发设备可能会由于无法识别而将其丢弃。复用内层ether头中的源MAC地址的字段,不会使报文变长,不会产生超过设备的MTU(MaximumTransmissionUnit,最大传输单元)而导致被分片或者被丢弃等情况的出现。The method and device for forwarding VXLAN messages provided by the embodiments of the present disclosure can transparently transmit the real IP+Port information to the real server by appending custom data to the message, or by using complex methods. Use the source MAC address field in the inner ether header of the packet. It can adaptively identify fields in packets to prevent intermediate forwarding devices from discarding them due to unrecognizability. Multiplexing the source MAC address field in the inner ether header will not make the message longer, nor will it exceed the MTU (Maximum Transmission Unit) of the device, causing it to be fragmented or discarded.

附图说明Description of the drawings

通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本公开的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present disclosure will become more apparent upon reading the detailed description of the non-limiting embodiments with reference to the following drawings:

图1是本公开的一个实施例可以应用于其中的示例性系统架构图;Figure 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied;

图2是根据本公开的用于转发VXLAN报文的方法的一个实施例的流程图;Figure 2 is a flow chart of one embodiment of a method for forwarding VXLAN messages according to the present disclosure;

图3是根据本公开的用于转发VXLAN报文的方法的又一个实施例的流程图;Figure 3 is a flow chart of yet another embodiment of a method for forwarding VXLAN messages according to the present disclosure;

图4a-4c是根据本公开的用于转发VXLAN报文的方法的应用场景的示意图;Figures 4a-4c are schematic diagrams of application scenarios of the method for forwarding VXLAN messages according to the present disclosure;

图5是根据本公开的用于转发VXLAN报文的装置的一个实施例的结构示意图;Figure 5 is a schematic structural diagram of an embodiment of a device for forwarding VXLAN messages according to the present disclosure;

图6是根据本公开的用于转发VXLAN报文的装置的又一个实施例的结构示意图;Figure 6 is a schematic structural diagram of another embodiment of a device for forwarding VXLAN messages according to the present disclosure;

图7是适于用来实现本公开的实施例的电子设备的计算机系统的结构示意图。FIG. 7 is a schematic structural diagram of a computer system suitable for implementing an electronic device according to an embodiment of the present disclosure.

具体实施方式Detailed ways

下面结合附图和实施例对本公开作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。The present disclosure will be further described in detail below in conjunction with the accompanying drawings and examples. It can be understood that the specific embodiments described here are only used to explain the relevant invention, but not to limit the invention. It should also be noted that, for convenience of description, only the parts related to the invention are shown in the drawings.

需要说明的是,在不冲突的情况下,本公开中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本公开。It should be noted that, as long as there is no conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other. The present disclosure will be described in detail below in conjunction with embodiments with reference to the accompanying drawings.

图1示出了可以应用本公开的用于转发VXLAN报文的方法或用于转发VXLAN报文的装置的实施例的示例性系统架构100。FIG. 1 shows an exemplary system architecture 100 in which embodiments of the method for forwarding VXLAN messages or the apparatus for forwarding VXLAN messages of the present disclosure may be applied.

如图1所示,系统架构100可以包括客户端(client)101、负载均衡设备(loadbalancer)102、真实服务器(real server)103。网络用以在客户端101、负载均衡设备102、真实服务器103之间提供通信链路的介质。网络可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in Figure 1, the system architecture 100 may include a client 101, a load balancer 102, and a real server 103. The network is a medium used to provide communication links between the client 101, the load balancing device 102, and the real server 103. Networks can include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.

用户可以使用客户端101通过网络与负载均衡设备102交互,以接收或发送消息等。客户端101上可以安装有各种通讯客户端应用,例如网页浏览器应用、购物类应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等。Users can use the client 101 to interact with the load balancing device 102 over the network to receive or send messages, etc. Various communication client applications can be installed on the client 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

客户端101可以是硬件,也可以是软件。当客户端101为硬件时,可以是具有显示屏并且支持网页浏览的各种电子设备,包括但不限于智能手机、平板电脑、电子书阅读器、MP3播放器(MovingPictureExpertsGroupAudioLayerIII,动态影像专家压缩标准音频层面3)、MP4(MovingPictureExpertsGroupAudioLayerIV,动态影像专家压缩标准音频层面4)播放器、膝上型便携计算机和台式计算机等等。当客户端101为软件时,可以安装在上述所列举的电子设备中。其可以实现成多个软件或软件模块(例如用来提供分布式服务),也可以实现成单个软件或软件模块。在此不做具体限定。The client 101 may be hardware or software. When the client 101 is hardware, it can be a variety of electronic devices with a display screen and supporting web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, Moving Picture Experts compressed standard audio Layer 3), MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Compression Standard Audio Layer 4) players, laptops and desktop computers, etc. When the client 101 is software, it can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, used to provide distributed services), or as a single software or software module. There are no specific limitations here.

负载均衡设备102,可用于在云中快速、简便地构建高性能的服务器集群,让新服务或企业已有服务上云。为了解决Overlay流量识别问题,通常使用单实例或多实例的方式为租户提供负载均衡服务。即对于用户创建的每个负载均衡实例,云服务提供商在后台为用户启动一个或多个反向代理实例(即负载均衡实例),前端统一使用不同的身份<IP,Port>接入,后端通过固定的配置回源;这些反向代理实例通常会根据每个用户的不同的业务需求,使用一份定制化的配置。从此以后,这些反向代理实例便专属于某个用户,只要位于前端的4层网络设备能够把特定流量转发到特定的一组反向代理实例,流经这些实例的流量也会根据既定配置转发到用户指定的真实服务器103。The load balancing device 102 can be used to quickly and easily build a high-performance server cluster in the cloud to bring new services or existing enterprise services to the cloud. In order to solve the overlay traffic identification problem, a single instance or multiple instances are usually used to provide load balancing services for tenants. That is, for each load balancing instance created by the user, the cloud service provider starts one or more reverse proxy instances (i.e. load balancing instances) for the user in the background. The front end uses different identities <IP, Port> to access, and the backend The client returns to the origin through a fixed configuration; these reverse proxy instances usually use a customized configuration based on the different business needs of each user. From then on, these reverse proxy instances are dedicated to a specific user, and as long as the layer 4 network equipment at the front end can forward specific traffic to a specific set of reverse proxy instances, the traffic flowing through these instances will also be forwarded according to the established configuration to the real server 103 specified by the user.

需要说明的是,本公开的实施例所提供的用于转发VXLAN报文的方法一般由负载均衡设备102和真实服务器103执行,相应地,用于转发VXLAN报文的装置一般设置于负载均衡设备102和真实服务器103中。It should be noted that the method for forwarding VXLAN packets provided in the embodiments of the present disclosure is generally executed by the load balancing device 102 and the real server 103. Correspondingly, the device for forwarding VXLAN packets is generally provided on the load balancing device. 102 and real server 103.

应该理解,图1中的客户端101、负载均衡设备102、真实服务器103的数目仅仅是示意性的。根据实现需要,可以具有任意数目的客户端101、负载均衡设备102、真实服务器103。It should be understood that the numbers of clients 101, load balancing devices 102, and real servers 103 in Figure 1 are only illustrative. According to implementation needs, there can be any number of clients 101, load balancing devices 102, and real servers 103.

继续参考图2,示出了根据本公开的用于转发VXLAN报文的方法的一个实施例的流程200。该用于转发VXLAN报文的方法,包括以下步骤:Continuing to refer to FIG. 2 , a process 200 of one embodiment of a method for forwarding VXLAN messages according to the present disclosure is shown. The method for forwarding VXLAN packets includes the following steps:

步骤201,响应于接收到来自客户端的VXLAN报文,从VXLAN报文中解析出客户端的真实IP地址和端口。Step 201: In response to receiving the VXLAN message from the client, parse the client's real IP address and port from the VXLAN message.

在本实施例中,用于转发VXLAN报文的方法的执行主体(例如图1所示的负载均衡设备)可以通过有线连接方式或者无线连接方式从用户利用其进行云计算的客户端接收VXLAN报文。然后从VXLAN报文中解析出客户端的真实IP地址和端口。报文结构可如图4a所示。In this embodiment, the execution subject of the method for forwarding VXLAN packets (such as the load balancing device shown in Figure 1) can receive VXLAN packets from the client that the user uses for cloud computing through a wired connection or a wireless connection. arts. Then parse the client's real IP address and port from the VXLAN message. The message structure can be shown in Figure 4a.

从这个报文中可以看到三个部分:Three parts can be seen from this message:

1、最外层的IP/UDP协议报文用来在底层网络上传输,也就是vtep之间互相通信的基础。1. The outermost IP/UDP protocol message is used for transmission on the underlying network, which is the basis for mutual communication between vteps.

2、中间是VXLAN头部,vtep接收到报文之后,去除前面的IP/UDP协议部分,根据这部分来处理VXLAN的逻辑,主要是根据VNI发送到最终的虚拟机。2. The middle is the VXLAN header. After vtep receives the message, it removes the previous IP/UDP protocol part and processes the VXLAN logic based on this part, mainly sending it to the final virtual machine based on the VNI.

3、最里面是原始的报文,也就是虚拟机看到的报文内容。3. The innermost part is the original message, which is the content of the message seen by the virtual machine.

报文各个部分的意义如下:The meaning of each part of the message is as follows:

VXLANheader:VXLAN协议相关的部分,一共8个字节VXLANheader: The part related to the VXLAN protocol, a total of 8 bytes

VXLANflags:标志位VXLANflags: flag bit

Reserved:保留位Reserved: reserved bit

VNID:24位的VNI字段,这也是VXLAN能支持千万租户的地方VNID: 24-bit VNI field, this is where VXLAN can support tens of millions of tenants

Reserved:保留字段Reserved: reserved fields

UDP头部,8个字节UDP header, 8 bytes

UDP应用通信双方是vtep应用,其中目的端口就是接收方vtep使用的端口,IANA分配的端口是4789The two parties of UDP application communication are vtep applications. The destination port is the port used by the receiving vtep. The port assigned by IANA is 4789.

IP头部:20字节IP header: 20 bytes

主机之间通信的地址,可能是主机的网卡IP地址,也可能是多播IP地址The address for communication between hosts may be the host's network card IP address or a multicast IP address.

MAC头部:14字节MAC header: 14 bytes

主机之间通信的MAC地址,源MAC地址为主机MAC地址,目的MAC地址为下一跳设备的MAC地址。The MAC address used for communication between hosts. The source MAC address is the host MAC address, and the destination MAC address is the MAC address of the next hop device.

通过报文可以看出VXLAN协议比原始报文多50字节的内容,这会降低网络链路传输有效数据的比例。VXLAN头部最重要的是VNID字段,其他的保留字段主要是为了未来的扩展,目前留给不同的厂商用这些字段添加自己的功能。It can be seen from the packet that the VXLAN protocol contains 50 bytes more content than the original packet, which will reduce the proportion of valid data transmitted by the network link. The most important VNID field in the VXLAN header is the VNID field. The other reserved fields are mainly for future expansion. Currently, it is left to different manufacturers to use these fields to add their own functions.

步骤202,使用指定的IP地址和端口替换掉VXLAN报文中的客户端的真实IP地址和端口。Step 202: Use the specified IP address and port to replace the real IP address and port of the client in the VXLAN message.

在本实施例中,从client来的入向流量,经过负载均衡设备时,普遍会进行从VIP+VPort到RS IP+RS Port的DNAT,有时为了隔离内外网的流量也会进行SNAT,使用其它IP+Port来替换CIP+CPort。即,将Inner IP header中的源IP和源Port进行替换。In this embodiment, when the incoming traffic from the client passes through the load balancing device, DNAT is generally performed from VIP+VPort to RS IP+RS Port. Sometimes, in order to isolate the traffic of the internal and external networks, SNAT is also performed, using other IP+Port to replace CIP+CPort. That is, replace the source IP and source Port in the Inner IP header.

步骤203,从至少一个真实服务器中选择出目标真实服务器。Step 203: Select a target real server from at least one real server.

在本实施例中,可通过预设的调度算法从至少一个真实服务器中选择出目标真实服务器。例如,轮询、源地址hash之类。也可根据真实服务器的负载情况选择资源占有率最低的真实服务器作为目标真实服务器。In this embodiment, the target real server can be selected from at least one real server through a preset scheduling algorithm. For example, polling, source address hashing, etc. You can also select the real server with the lowest resource occupancy as the target real server based on the load of the real server.

在本实施例的一些可选的实现方式中,从至少一个真实服务器中选择出目标真实服务器,包括:获取至少一个真实服务器的解析模式;从至少一个真实服务器选择解析模式与负载均衡设备的组包模式匹配的目标真实服务器。例如,负载均衡设备被配置成替换内层ether头中的源MAC地址,则需要从至少一个真实服务器选择支持内层ether头中的源MAC地址解析为CIP+CPort的真实服务器。In some optional implementations of this embodiment, selecting a target real server from at least one real server includes: obtaining the parsing mode of at least one real server; selecting a combination of parsing mode and load balancing device from at least one real server. The target real server for packet pattern matching. For example, if the load balancing device is configured to replace the source MAC address in the inner ether header, you need to select a real server from at least one real server that supports the resolution of the source MAC address in the inner ether header to CIP+CPort.

步骤204,使用解析出的客户端的真实IP地址和端口替换掉VXLAN报文中的特定字段。Step 204: Use the parsed real IP address and port of the client to replace specific fields in the VXLAN message.

在本实施例中,特定字段可包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption。In this embodiment, the specific field may include at least one of the following: source MAC address, TCPoption, and IPoption in the inner ether header.

如图4b所示为使用解析出的客户端的真实IP地址和端口替换掉VXLAN报文中的TCPoption的过程。负载均衡设备将CIP+CPort填充到VXLAN报文中的TCPoption所在位置。Figure 4b shows the process of replacing TCPoption in the VXLAN message with the parsed real IP address and port of the client. The load balancing device fills CIP+CPort into the TCPoption position in the VXLAN packet.

如图4c所示为使用解析出的客户端的真实IP地址和端口替换掉VXLAN报文中的内层ether头中的源MAC地址的过程。负载均衡设备将CIP+CPort填充到VXLAN报文中的内层ether头中的源MAC地址所在位置。一般情况下,这个源MAC地址是租户虚拟网络的上一条网关地址,在后续数据转发的过程中并没有太多作用,可以被重用来携带所需要的IP+Port信息。48bits的源MAC地址,刚好可以携带32bits的IP和16bits的端口信息。使用非标准的TCPoption、IP option或者自定义协议,不存在由于无法识别而被丢弃的风险,并且报文长度在转换前后未发生改变,也不存在由于超过MTU而被分片或者被丢弃的可能。Figure 4c shows the process of replacing the source MAC address in the inner ether header in the VXLAN message with the resolved real IP address and port of the client. The load balancing device fills CIP+CPort into the source MAC address in the inner ether header of the VXLAN packet. Under normal circumstances, this source MAC address is the previous gateway address of the tenant's virtual network. It does not play much role in the subsequent data forwarding process and can be reused to carry the required IP+Port information. A 48-bit source MAC address can just carry 32-bit IP and 16-bit port information. When using non-standard TCP option, IP option or custom protocol, there is no risk of being discarded due to unrecognizability, and the length of the message does not change before and after conversion, and there is no possibility of being fragmented or discarded due to exceeding the MTU. .

在本实施例的一些可选的实现方式中,在使用解析出的客户端的真实IP地址和端口替换掉VXLAN报文中的特定字段之前,该方法还包括:获取目标真实服务器的解析模式;根据解析模式确定待替换的特定字段。负载均衡设备可使用指定的特定字段进行替换,然后由真实服务器进行自适应的解析。负载均衡设备还可根据所选择的目标服务器的解析模式来自适应组包。解析模式包括以下至少一项:内层ether头中的源MAC地址解析模式、TCPoption解析模式、IPoption解析模式。In some optional implementations of this embodiment, before using the parsed real IP address and port of the client to replace specific fields in the VXLAN message, the method further includes: obtaining the parsing mode of the target real server; The parsing pattern determines the specific fields to be replaced. The load balancing device can be replaced with specified specific fields, which are then adaptively parsed by the real server. The load balancing device can also automatically adapt group packets based on the resolution mode of the selected target server. The parsing mode includes at least one of the following: source MAC address parsing mode in the inner ether header, TCPoption parsing mode, and IPoption parsing mode.

步骤205,将修改后的VXLAN报文转发给目标真实服务器。Step 205: Forward the modified VXLAN message to the target real server.

在本实施例中,将修改后的VXLAN报文转发给步骤步骤203确定出的目标真实服务器。由目标真实服务器从中提取出CIP+CPort用于业务处理。In this embodiment, the modified VXLAN message is forwarded to the target real server determined in step 203. The CIP+CPort is extracted from the target real server for business processing.

继续参考图3,示出了根据本公开的用于转发VXLAN报文的方法的又一个实施例的流程300。该用于转发VXLAN报文的方法,包括以下步骤:Continuing to refer to FIG. 3 , a process 300 of yet another embodiment of a method for forwarding VXLAN messages according to the present disclosure is shown. The method for forwarding VXLAN packets includes the following steps:

步骤301,响应于接收到负载均衡设备转发的VXLAN报文,根据真实服务器的解析模式从VXLAN报文的特定字段中解析出客户端的真实IP地址和端口。Step 301: In response to receiving the VXLAN message forwarded by the load balancing device, parse the client's real IP address and port from the specific fields of the VXLAN message according to the parsing mode of the real server.

在本实施例中,用于转发VXLAN报文的方法的执行主体(例如图1所示的真实服务器)可以通过有线连接方式或者无线连接方式从用于真实服务器调度的负载均衡设备接收VXLAN报文。然后根据真实服务器的解析模式从VXLAN报文的特定字段中解析出客户端的真实IP地址和端口。该VXLAN报文是负载均衡器根据步骤201-204生成的。其中,特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption。In this embodiment, the execution subject of the method for forwarding VXLAN messages (such as the real server shown in Figure 1) can receive VXLAN messages from the load balancing device used for real server scheduling through a wired connection or a wireless connection. . Then the real IP address and port of the client are parsed from specific fields of the VXLAN message according to the parsing mode of the real server. The VXLAN packet is generated by the load balancer according to steps 201-204. Among them, the specific fields include at least one of the following: source MAC address, TCPoption, and IPoption in the inner ether header.

解析模式可以通过命令设置。当真实服务器被设置了解析模式后后,即按要所设置的解析模式来解析VXLAN报文。The parsing mode can be set via commands. When the real server is set to the parsing mode, it parses VXLAN messages according to the set parsing mode.

在本实施例的一些可选的实现方式中,该方法还包括:对解析出的客户端的真实IP地址和端口进行校验;若校验失败,则切换解析模式后重新从VXLAN报文的特定字段中解析出客户端的真实IP地址和端口。从而可以自适应的调整解析模式。例如,原本的解析模式是从报文中内层ether头中的源MAC地址所在位置解析出客户端的真实IP地址和端口。但如果解析出的值不符合IP地址和端口的规则,则认为负载均衡器不是对内层ether头中的源MAC地址进行替换。真实服务器可切换到到TCPoption模式继续解析。In some optional implementations of this embodiment, the method also includes: verifying the parsed real IP address and port of the client; if the verification fails, switching the parsing mode and then re-selecting the specific IP address and port of the VXLAN message. The real IP address and port of the client are parsed in the field. This allows the analysis mode to be adjusted adaptively. For example, the original parsing mode is to parse the client's real IP address and port from the location of the source MAC address in the inner ether header of the message. However, if the parsed value does not comply with the rules of IP address and port, it is considered that the load balancer is not replacing the source MAC address in the inner ether header. The real server can switch to TCPoption mode to continue parsing.

步骤302,基于解析出的客户端的真实IP地址和端口进行业务处理。Step 302: Perform business processing based on the resolved real IP address and port of the client.

在本实施例中,通过特定的内核模块,将封装在内层ether源MAC或其它特定字段中的数据取出来,再借由自定义的系统调用最终传递给应用程序。真实IP地址和端口可用于标识个体身份。In this embodiment, a specific kernel module is used to extract the data encapsulated in the inner ether source MAC or other specific fields, and then finally pass it to the application program through a customized system call. The real IP address and port can be used to identify an individual.

进一步参考图5,作为对上述各图所示方法的实现,本公开提供了一种用于转发VXLAN报文的装置(应用于负载均衡设备)的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。With further reference to Figure 5, as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for forwarding VXLAN messages (applied to load balancing equipment). The device embodiment is the same as that shown in Figure 2 Corresponding to the method embodiment shown, the device can be applied to various electronic devices.

如图5所示,本实施例的用于转发VXLAN报文的装置(应用于负载均衡设备)500包括:第一解析单元501、第一替换单元502、调度单元503、第二替换单元504和发送单元505。其中,第一解析单元501,被配置成响应于接收到来自客户端的VXLAN报文,从所述VXLAN报文中解析出所述客户端的真实IP地址和端口;第一替换单元502,被配置成使用指定的IP地址和端口替换掉所述VXLAN报文中的所述客户端的真实IP地址和端口;调度单元503,被配置成从至少一个真实服务器中选择出目标真实服务器;第二替换单元504,被配置成使用解析出的所述客户端的真实IP地址和端口替换掉所述VXLAN报文中的特定字段;发送单元505,被配置成将修改后的VXLAN报文转发给所述目标真实服务器。As shown in Figure 5, the device (applied to load balancing equipment) 500 for forwarding VXLAN messages in this embodiment includes: a first parsing unit 501, a first replacement unit 502, a scheduling unit 503, a second replacement unit 504 and Sending unit 505. Among them, the first parsing unit 501 is configured to respond to receiving a VXLAN message from the client and parse the real IP address and port of the client from the VXLAN message; the first replacement unit 502 is configured to Use the specified IP address and port to replace the real IP address and port of the client in the VXLAN message; the scheduling unit 503 is configured to select the target real server from at least one real server; the second replacement unit 504 , is configured to use the parsed real IP address and port of the client to replace specific fields in the VXLAN message; the sending unit 505 is configured to forward the modified VXLAN message to the target real server .

在本实施例中用于转发VXLAN报文的装置500的第一解析单元501、第一替换单元502、调度单元503、第二替换单元504和发送单元505的具体处理可以参考图2对应实施例中的步骤201、步骤202、步骤203、步骤204和步骤205。In this embodiment, the specific processing of the first parsing unit 501, the first replacement unit 502, the scheduling unit 503, the second replacement unit 504 and the sending unit 505 of the device 500 for forwarding VXLAN messages can refer to the corresponding embodiment of Figure 2 Step 201, Step 202, Step 203, Step 204 and Step 205 in .

在本实施例的一些可选的实现方式中,特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption。In some optional implementations of this embodiment, the specific field includes at least one of the following: source MAC address, TCPoption, and IPoption in the inner ether header.

在本实施例的一些可选的实现方式中,装置500还包括确定单元(附图中未示出),被配置成:在使用解析出的客户端的真实IP地址和端口替换掉VXLAN报文中的特定字段之前,获取目标真实服务器的解析模式;根据解析模式确定待替换的特定字段。In some optional implementations of this embodiment, the device 500 further includes a determining unit (not shown in the drawing) configured to: replace the VXLAN message with the parsed real IP address and port of the client. Before the specific fields, obtain the parsing mode of the target real server; determine the specific fields to be replaced based on the parsing mode.

在本实施例的一些可选的实现方式中,调度单元503进一步被配置成:获取至少一个真实服务器的解析模式;从至少一个真实服务器选择解析模式与负载均衡设备的组包模式匹配的目标真实服务器。In some optional implementations of this embodiment, the scheduling unit 503 is further configured to: obtain the parsing mode of at least one real server; select the target real server whose parsing mode matches the grouping mode of the load balancing device from at least one real server. server.

进一步参考图6,作为对上述各图所示方法的实现,本公开提供了一种用于转发VXLAN报文的装置(应用于真实服务器)的一个实施例,该装置实施例与图3所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。With further reference to Figure 6, as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device (applied to a real server) for forwarding VXLAN messages. The device embodiment is the same as that shown in Figure 3 Corresponding to the method embodiments, the device can be applied to various electronic devices.

如图6所示,本实施例的用于转发VXLAN报文的装置(应用于真实服务器)600包括:第二解析单元601和业务单元602。其中,第二解析单元601,被配置成响应于接收到负载均衡设备转发的VXLAN报文,根据真实服务器的解析模式从VXLAN报文的特定字段中解析出客户端的真实IP地址和端口,其中,特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption;业务单元602,被配置成基于解析出的客户端的真实IP地址和端口进行业务处理。As shown in Figure 6, the device (applied to a real server) 600 for forwarding VXLAN messages in this embodiment includes: a second parsing unit 601 and a service unit 602. Among them, the second parsing unit 601 is configured to respond to receiving the VXLAN message forwarded by the load balancing device and parse the real IP address and port of the client from the specific field of the VXLAN message according to the parsing mode of the real server, where, The specific fields include at least one of the following: source MAC address, TCPoption, and IPoption in the inner ether header; the business unit 602 is configured to perform business processing based on the parsed real IP address and port of the client.

在本实施例的一些可选的实现方式中,装置600还包括切换单元(附图中未示出),被配置成:响应于接收到解析模式的配置命令,根据配置命令切换解析模式。In some optional implementations of this embodiment, the device 600 further includes a switching unit (not shown in the drawing) configured to: in response to receiving a configuration command of the parsing mode, switch the parsing mode according to the configuration command.

在本实施例的一些可选的实现方式中,装置600还包括校验单元(附图中未示出),被配置成:对解析出的客户端的真实IP地址和端口进行校验;若校验失败,则切换解析模式后重新从VXLAN报文的特定字段中解析出客户端的真实IP地址和端口。In some optional implementations of this embodiment, the device 600 also includes a verification unit (not shown in the drawing) configured to: verify the parsed real IP address and port of the client; if the verification If the verification fails, switch the parsing mode and re-parse the client's real IP address and port from the specific fields of the VXLAN message.

下面参考图7,其示出了适于用来实现本公开的实施例的电子设备(例如图1中的负载均衡设备或真实服务器)700的结构示意图。图7示出的负载均衡设备或真实服务器仅仅是一个示例,不应对本公开的实施例的功能和使用范围带来任何限制。Referring now to FIG. 7 , a schematic structural diagram of an electronic device (such as the load balancing device or a real server in FIG. 1 ) 700 suitable for implementing embodiments of the present disclosure is shown. The load balancing device or real server shown in Figure 7 is only an example, and should not bring any limitations to the functions and usage scope of the embodiments of the present disclosure.

如图7所示,电子设备700可以包括处理装置(例如中央处理器、图形处理器等)701,其可以根据存储在只读存储器(ROM)702中的程序或者从存储装置708加载到随机访问存储器(RAM)703中的程序而执行各种适当的动作和处理。在RAM703中,还存储有电子设备700操作所需的各种程序和数据。处理装置701、ROM702以及RAM703通过总线704彼此相连。输入/输出(I/O)接口705也连接至总线704。As shown in FIG. 7 , the electronic device 700 may include a processing device (eg, central processing unit, graphics processor, etc.) 701 that may be loaded into a random access device according to a program stored in a read-only memory (ROM) 702 or from a storage device 708 . The program in the memory (RAM) 703 executes various appropriate actions and processes. In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702 and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.

通常,以下装置可以连接至I/O接口705:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置706;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置707;包括例如磁带、硬盘等的存储装置708;以及通信装置709。通信装置709可以允许电子设备700与其他设备进行无线或有线通信以交换数据。虽然图7示出了具有各种装置的电子设备700,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。图7中示出的每个方框可以代表一个装置,也可以根据需要代表多个装置。Generally, the following devices may be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speakers, vibration An output device 707 such as a computer; a storage device 708 including a magnetic tape, a hard disk, etc.; and a communication device 709. Communication device 709 may allow electronic device 700 to communicate wirelessly or wiredly with other devices to exchange data. Although FIG. 7 illustrates an electronic device 700 having various means, it should be understood that implementation or availability of all illustrated means is not required. More or fewer means may alternatively be implemented or provided. Each block shown in Figure 7 may represent one device, or may represent multiple devices as needed.

特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置709从网络上被下载和安装,或者从存储装置708被安装,或者从ROM702被安装。在该计算机程序被处理装置701执行时,执行本公开的实施例的方法中限定的上述功能。需要说明的是,本公开的实施例所述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开的实施例中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开的实施例中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product including a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart. In such embodiments, the computer program may be downloaded and installed from the network via communication device 709, or from storage device 708, or from ROM 702. When the computer program is executed by the processing device 701, the above-described functions defined in the method of the embodiment of the present disclosure are performed. It should be noted that the computer-readable medium described in the embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of computer readable storage media may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard drive, random access memory (RAM), read only memory (ROM), removable Programmed read-only memory (EPROM or flash memory), fiber optics, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, in which computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device . Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wire, optical cable, RF (radio frequency), etc., or any suitable combination of the above.

上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:响应于接收到来自客户端的VXLAN报文,从VXLAN报文中解析出客户端的真实IP地址和端口;使用指定的IP地址和端口替换掉VXLAN报文中的客户端的真实IP地址和端口;从至少一个真实服务器中选择出目标真实服务器;使用解析出的客户端的真实IP地址和端口替换掉VXLAN报文中的特定字段;将修改后的VXLAN报文转发给目标真实服务器。或者,使得该电子设备:响应于接收到负载均衡设备转发的VXLAN报文,根据真实服务器的解析模式从VXLAN报文的特定字段中解析出客户端的真实IP地址和端口,其中,特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption;基于解析出的客户端的真实IP地址和端口进行业务处理。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; it may also exist independently without being assembled into the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: in response to receiving the VXLAN message from the client, parses the VXLAN message from the VXLAN message. The real IP address and port of the client; replace the real IP address and port of the client in the VXLAN message with the specified IP address and port; select the target real server from at least one real server; use the resolved real IP of the client The address and port replace specific fields in the VXLAN message; the modified VXLAN message is forwarded to the target real server. Or, causing the electronic device to: in response to receiving the VXLAN message forwarded by the load balancing device, parse the real IP address and port of the client from specific fields of the VXLAN message according to the parsing mode of the real server, where the specific fields include the following At least one item: the source MAC address, TCPoption, and IPoption in the inner ether header; business processing is performed based on the parsed real IP address and port of the client.

可以以一种或多种程序设计语言或其组合来编写用于执行本公开的实施例的操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing operations of embodiments of the present disclosure may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, or a combination thereof, Also included are conventional procedural programming languages—such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In situations involving remote computers, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as an Internet service provider through Internet connection).

附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, segment, or portion of code that contains one or more logic functions that implement the specified executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown one after another may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved. It will also be noted that each block of the block diagram and/or flowchart illustration, and combinations of blocks in the block diagram and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or operations. , or can be implemented using a combination of specialized hardware and computer instructions.

描述于本公开的实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括第一解析单元、第一替换单元、调度单元、第二替换单元和发送单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,第一解析单元还可以被描述为“响应于接收到来自客户端的VXLAN报文,从所述VXLAN报文中解析出所述客户端的真实IP地址和端口的单元”。The units involved in the embodiments of the present disclosure may be implemented in software or hardware. The described unit may also be provided in a processor. For example, it may be described as follows: a processor includes a first parsing unit, a first replacement unit, a scheduling unit, a second replacement unit and a sending unit. Among them, the names of these units do not constitute a limitation on the unit itself under certain circumstances. For example, the first parsing unit can also be described as "in response to receiving a VXLAN message from the client, from the VXLAN message The unit that parses out the real IP address and port of the client."

以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离所述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is only a description of the preferred embodiments of the present disclosure and the technical principles applied. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to technical solutions formed by a specific combination of the above technical features, but should also cover any combination of the above technical features without departing from the concept of the invention. or other technical solutions formed by any combination of equivalent features. For example, a technical solution is formed by replacing the above features with technical features with similar functions disclosed in this disclosure (but not limited to).

Claims (13)

Translated fromChinese
1.一种用于转发VXLAN报文的方法,应用于负载均衡设备,包括:1. A method for forwarding VXLAN messages, applied to load balancing equipment, including:响应于接收到来自客户端的VXLAN报文,从所述VXLAN报文中解析出所述客户端的真实IP地址和端口;In response to receiving the VXLAN message from the client, parse the real IP address and port of the client from the VXLAN message;使用指定的IP地址和端口替换掉所述VXLAN报文中的所述客户端的真实IP地址和端口;Use the specified IP address and port to replace the real IP address and port of the client in the VXLAN message;从至少一个真实服务器中选择出目标真实服务器;Select a target real server from at least one real server;使用解析出的所述客户端的真实IP地址和端口替换掉所述VXLAN报文中的特定字段,其中,所述特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption;Use the parsed real IP address and port of the client to replace specific fields in the VXLAN message, where the specific fields include at least one of the following: source MAC address, TCPoption, IPoption in the inner ether header ;将修改后的VXLAN报文转发给所述目标真实服务器,以使得所述真实服务器根据解析模式从所述VXLAN报文的特定字段中解析出客户端的真实IP地址和端口,对解析出的客户端的真实IP地址和端口进行校验;若校验失败,则切换解析模式后重新从所述VXLAN报文的特定字段中解析出客户端的真实IP地址和端口;基于解析出的客户端的真实IP地址和端口进行业务处理。Forward the modified VXLAN message to the target real server, so that the real server parses the client's real IP address and port from the specific field of the VXLAN message according to the parsing mode, and analyzes the parsed client's real IP address and port. The real IP address and port are verified; if the verification fails, the parsing mode is switched and the client's real IP address and port are parsed again from the specific fields of the VXLAN message; based on the parsed real IP address and port of the client Port for business processing.2.根据权利要求1所述的方法,其中,在使用解析出的所述客户端的真实IP地址和端口替换掉所述VXLAN报文中的特定字段之前,所述方法还包括:2. The method according to claim 1, wherein before using the parsed real IP address and port of the client to replace specific fields in the VXLAN message, the method further includes:获取所述目标真实服务器的解析模式;Obtain the parsing mode of the target real server;根据所述解析模式确定待替换的特定字段。Specific fields to be replaced are determined based on the parsing pattern.3.根据权利要求1所述的方法,其中,所述从至少一个真实服务器中选择出目标真实服务器,包括:3. The method according to claim 1, wherein selecting the target real server from at least one real server includes:获取所述至少一个真实服务器的解析模式;Obtain the parsing mode of the at least one real server;从所述至少一个真实服务器选择解析模式与所述负载均衡设备的组包模式匹配的目标真实服务器。Select a target real server whose parsing mode matches the grouping mode of the load balancing device from the at least one real server.4.一种用于转发VXLAN报文的方法,应用于真实服务器,包括:4. A method for forwarding VXLAN messages, applied to real servers, including:响应于接收到负载均衡设备转发的VXLAN报文,根据所述真实服务器的解析模式从所述VXLAN报文的特定字段中解析出客户端的真实IP地址和端口,其中,所述特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption;In response to receiving the VXLAN message forwarded by the load balancing device, the real IP address and port of the client are parsed from specific fields of the VXLAN message according to the parsing mode of the real server, wherein the specific fields include at least the following: One item: source MAC address, TCPoption, IPoption in the inner ether header;对解析出的客户端的真实IP地址和端口进行校验;Verify the resolved real IP address and port of the client;若校验失败,则切换解析模式后重新从所述VXLAN报文的特定字段中解析出客户端的真实IP地址和端口;If the verification fails, the client's real IP address and port are parsed again from the specific fields of the VXLAN message after switching to the parsing mode;基于解析出的客户端的真实IP地址和端口进行业务处理。Business processing is performed based on the resolved real IP address and port of the client.5.根据权利要求4所述的方法,其中,所述方法还包括:5. The method of claim 4, wherein the method further comprises:响应于接收到解析模式的配置命令,根据所述配置命令切换解析模式。In response to receiving a configuration command of the parsing mode, switching the parsing mode according to the configuration command.6.一种用于转发VXLAN报文的系统,包括负载均衡设备和至少一个真实服务器:6. A system for forwarding VXLAN messages, including a load balancing device and at least one real server:负载均衡设备,被配置成:响应于接收到来自客户端的VXLAN报文,从所述VXLAN报文中解析出所述客户端的真实IP地址和端口;使用指定的IP地址和端口替换掉所述VXLAN报文中的所述客户端的真实IP地址和端口;从至少一个真实服务器中选择出目标真实服务器;使用解析出的所述客户端的真实IP地址和端口替换掉所述VXLAN报文中的特定字段;将修改后的VXLAN报文转发给所述目标真实服务器;The load balancing device is configured to: in response to receiving a VXLAN message from the client, parse the real IP address and port of the client from the VXLAN message; and replace the VXLAN with the specified IP address and port. The real IP address and port of the client in the message; selecting a target real server from at least one real server; using the parsed real IP address and port of the client to replace specific fields in the VXLAN message ;Forward the modified VXLAN message to the target real server;真实服务器,被配置成:响应于接收到负载均衡设备转发的VXLAN报文,根据所述真实服务器的解析模式从所述VXLAN报文的特定字段中解析出客户端的真实IP地址和端口,其中,所述特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption;对解析出的客户端的真实IP地址和端口进行校验;若校验失败,则切换解析模式后重新从所述VXLAN报文的特定字段中解析出客户端的真实IP地址和端口;基于解析出的客户端的真实IP地址和端口进行业务处理。The real server is configured to: in response to receiving the VXLAN message forwarded by the load balancing device, parse the real IP address and port of the client from the specific field of the VXLAN message according to the parsing mode of the real server, wherein, The specific fields include at least one of the following: the source MAC address, TCPoption, and IPoption in the inner ether header; verify the parsed real IP address and port of the client; if the verification fails, switch the parsing mode and try again. The real IP address and port of the client are parsed from the specific fields of the VXLAN message; business processing is performed based on the parsed real IP address and port of the client.7.一种用于转发VXLAN报文的装置,应用于负载均衡设备,包括:7. A device for forwarding VXLAN messages, applied to load balancing equipment, including:第一解析单元,被配置成响应于接收到来自客户端的VXLAN报文,从所述VXLAN报文中解析出所述客户端的真实IP地址和端口;The first parsing unit is configured to parse the real IP address and port of the client from the VXLAN message in response to receiving the VXLAN message from the client;第一替换单元,被配置成使用指定的IP地址和端口替换掉所述VXLAN报文中的所述客户端的真实IP地址和端口;The first replacement unit is configured to replace the real IP address and port of the client in the VXLAN message with the specified IP address and port;调度单元,被配置成从至少一个真实服务器中选择出目标真实服务器;a scheduling unit configured to select a target real server from at least one real server;第二替换单元,被配置成使用解析出的所述客户端的真实IP地址和端口替换掉所述VXLAN报文中的特定字段,其中,所述特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption;The second replacement unit is configured to use the parsed real IP address and port of the client to replace specific fields in the VXLAN message, wherein the specific fields include at least one of the following: in the inner ether header Source MAC address, TCPoption, IPoption;发送单元,被配置成将修改后的VXLAN报文转发给所述目标真实服务器,以使得所述真实服务器根据解析模式从所述VXLAN报文的特定字段中解析出客户端的真实IP地址和端口,对解析出的客户端的真实IP地址和端口进行校验;若校验失败,则切换解析模式后重新从所述VXLAN报文的特定字段中解析出客户端的真实IP地址和端口;基于解析出的客户端的真实IP地址和端口进行业务处理。a sending unit configured to forward the modified VXLAN message to the target real server, so that the real server parses the real IP address and port of the client from a specific field of the VXLAN message according to the parsing mode, Verify the parsed real IP address and port of the client; if the verification fails, switch the parsing mode and then parse the real IP address and port of the client from the specific field of the VXLAN message again; based on the parsed The real IP address and port of the client are used for business processing.8.根据权利要求7所述的装置,其中,所述装置还包括确定单元,被配置成:8. The device according to claim 7, wherein the device further comprises a determining unit configured to:在使用解析出的所述客户端的真实IP地址和端口替换掉所述VXLAN报文中的特定字段之前,获取所述目标真实服务器的解析模式;Obtain the parsing mode of the target real server before replacing specific fields in the VXLAN message with the parsed real IP address and port of the client;根据所述解析模式确定待替换的特定字段。Specific fields to be replaced are determined based on the parsing pattern.9.根据权利要求7所述的装置,其中,所述调度单元进一步被配置成:9. The apparatus of claim 7, wherein the scheduling unit is further configured to:获取所述至少一个真实服务器的解析模式;Obtain the parsing mode of the at least one real server;从所述至少一个真实服务器选择解析模式与所述负载均衡设备的组包模式匹配的目标真实服务器。Select a target real server whose parsing mode matches the grouping mode of the load balancing device from the at least one real server.10.一种用于转发VXLAN报文的装置,应用于真实服务器,包括:10. A device for forwarding VXLAN messages, applied to real servers, including:第二解析单元,被配置成响应于接收到负载均衡设备转发的VXLAN报文,根据所述真实服务器的解析模式从所述VXLAN报文的特定字段中解析出客户端的真实IP地址和端口,其中,所述特定字段包括以下至少一项:内层ether头中的源MAC地址、TCPoption、IPoption;The second parsing unit is configured to, in response to receiving the VXLAN message forwarded by the load balancing device, parse the real IP address and port of the client from the specific field of the VXLAN message according to the parsing mode of the real server, wherein , the specific field includes at least one of the following: source MAC address, TCPoption, and IPoption in the inner ether header;校验单元,被配置成:对解析出的客户端的真实IP地址和端口进行校验;若校验失败,则切换解析模式后重新从所述VXLAN报文的特定字段中解析出客户端的真实IP地址和端口;The verification unit is configured to: verify the parsed real IP address and port of the client; if the verification fails, switch the parsing mode and re-parse the real IP of the client from the specific field of the VXLAN message address and port;业务单元,被配置成基于解析出的客户端的真实IP地址和端口进行业务处理。The business unit is configured to perform business processing based on the resolved real IP address and port of the client.11.根据权利要求10所述的装置,其中,所述装置还包括切换单元,被配置成:11. The device of claim 10, wherein the device further comprises a switching unit configured to:响应于接收到解析模式的配置命令,根据所述配置命令切换解析模式。In response to receiving a configuration command of the parsing mode, switching the parsing mode according to the configuration command.12.一种用于转发VXLAN报文的电子设备,包括:12. An electronic device for forwarding VXLAN messages, including:一个或多个处理器;one or more processors;存储装置,其上存储有一个或多个程序,a storage device on which one or more programs are stored,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-5中任一所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method as described in any one of claims 1-5.13.一种计算机可读介质,其上存储有计算机程序,其中,所述程序被处理器执行时实现如权利要求1-5中任一所述的方法。13. A computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method of any one of claims 1-5 is implemented.
CN201910839835.9A2019-09-062019-09-06Method and device for forwarding VXLAN messageActiveCN110545230B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201910839835.9ACN110545230B (en)2019-09-062019-09-06Method and device for forwarding VXLAN message

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201910839835.9ACN110545230B (en)2019-09-062019-09-06Method and device for forwarding VXLAN message

Publications (2)

Publication NumberPublication Date
CN110545230A CN110545230A (en)2019-12-06
CN110545230Btrue CN110545230B (en)2023-09-26

Family

ID=68712794

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201910839835.9AActiveCN110545230B (en)2019-09-062019-09-06Method and device for forwarding VXLAN message

Country Status (1)

CountryLink
CN (1)CN110545230B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111800423A (en)*2020-07-062020-10-20中国工商银行股份有限公司Method, system, computing device and medium for processing IP address
CN112636997B (en)*2020-11-172022-08-30新华三技术有限公司Path detection method and device
CN114157632B (en)*2021-10-122023-11-21北京华耀科技有限公司Network isolation method, device, equipment and storage medium
CN118041859B (en)*2023-12-122025-02-11天翼云科技有限公司 A vxlan forwarding table self-learning method
CN119544718A (en)*2024-11-282025-02-28中国农业银行股份有限公司 Load balancing method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN105554065A (en)*2015-12-032016-05-04华为技术有限公司Method, conversion unit and application unit for message processing
CN106878194A (en)*2016-12-302017-06-20新华三技术有限公司A kind of message processing method and device
CN107026890A (en)*2016-02-022017-08-08华为技术有限公司A kind of message forming method and load equalizer based on server cluster
WO2018014874A1 (en)*2016-07-212018-01-25深圳奇迹智慧网络有限公司Mobile terminal mac data acquisition method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111800423A (en)*2020-07-062020-10-20中国工商银行股份有限公司Method, system, computing device and medium for processing IP address

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN105554065A (en)*2015-12-032016-05-04华为技术有限公司Method, conversion unit and application unit for message processing
CN107026890A (en)*2016-02-022017-08-08华为技术有限公司A kind of message forming method and load equalizer based on server cluster
WO2018014874A1 (en)*2016-07-212018-01-25深圳奇迹智慧网络有限公司Mobile terminal mac data acquisition method
CN106878194A (en)*2016-12-302017-06-20新华三技术有限公司A kind of message processing method and device

Also Published As

Publication numberPublication date
CN110545230A (en)2019-12-06

Similar Documents

PublicationPublication DateTitle
CN110545230B (en)Method and device for forwarding VXLAN message
CN110708393B (en)Method, device and system for transmitting data
US12147318B2 (en)Techniques for replicating state information for high availability
US11777897B2 (en)Cloud infrastructure resources for connecting a service provider private network to a customer private network
CN110313163B (en) Load Balancing in Distributed Computing Systems
US9246819B1 (en)System and method for performing message-based load balancing
US12010195B2 (en)Efficient flow management utilizing control packets
JP6087922B2 (en) Communication control method and gateway
CN201518488U (en)Server load equalizer and system thereof
CA2968964C (en)Source ip address transparency systems and methods
US20230041806A1 (en)Location-independent programming data plane for packet processing
US20230370421A1 (en)Scaling ip addresses in overlay networks
US12015557B2 (en)Efficient flow management utilizing unified logging
CN103581062A (en)Method and system for handling unknown unicast data packets
CN108200018B (en)Flow forwarding method and equipment, computer equipment and readable medium in cloud computing
US20210329531A1 (en)Dynamic mapping of nodes responsible for monitoring traffic of an evolved packet core
US12289284B2 (en)Cloud infrastructure resources for connecting a service provider private network to a customer private network
US20230013110A1 (en)Techniques for processing network flows
US20200196135A1 (en)Enhanced connectivity in dual-mode networks for single-mode nodes
JP2025514772A (en) Network device level optimization for latency sensitive RDMA traffic
WO2023169202A1 (en)Video stream data acquisition method and apparatus, and electronic device and computer-readable medium
CN115834487A (en)Cross-private cloud service access method, load balancing system and computing equipment
CN116208544A (en)Message sending method, system, device, equipment and storage medium
CN115460213A (en) A business processing method, device, electronic device, and computer-readable medium
JP2013126219A (en)Transfer server and transfer program

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp