A gateway configuration method and apparatus

By receiving and maintaining the virtual machine's custom gateway information through OVS, the problem of virtual machines being unable to configure custom gateways under controller failure or distributed DHCP function is solved, and the custom gateway renewal of virtual machines when the controller is not in place is realized, ensuring business continuity.

CN116208481BActive Publication Date: 2026-05-05NEW H3C TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NEW H3C TECH CO LTD
Filing Date
2023-02-10
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

When the controller fails or the distributed DHCP function is enabled, OVS cannot specify a custom gateway for the virtual machine, resulting in the lack of flexible gateway functionality and affecting service availability.

Method used

OVS receives the virtual machine MAC address and custom gateway information from the controller, maintains the custom gateway configuration through DHCP message interaction, including creating a DHCP agent service, and sending the custom gateway information to the virtual machine in the DHCP response message to ensure that the virtual machine can be configured based on the custom gateway information.

Benefits of technology

Even when the controller is not in place, OVS can still renew the custom gateway for virtual machines, avoiding the unavailability of the custom gateway function for virtual machines and ensuring business continuity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116208481B_ABST
    Figure CN116208481B_ABST
Patent Text Reader

Abstract

This application relates to the field of network communication technology, and in particular to a gateway configuration method and apparatus. The method is applied to an OVS virtual switch, and includes: receiving the MAC address of a newly created virtual machine and custom gateway information specified for the virtual machine from the controller; receiving a DHCP request message sent by a target virtual machine, and obtaining the MAC address information of the target virtual machine carried in a specified field of the DHCP request message; if it is determined that target custom gateway information corresponding to the MAC address of the target virtual machine is maintained locally, then sending the target custom gateway information in a DHCP response message to the target virtual machine, so that the target virtual machine performs gateway configuration based on the target custom gateway information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network communication technology, and in particular to a gateway configuration method and apparatus. Background Technology

[0002] In the current host overlay scenario, when the controller (with embedded DHCP server function) is in place or the distributed DHCP function is disabled, flexible gateway configuration function based on virtual machine granularity can be achieved by leveraging the DHCP message interaction between the controller and the virtual machine.

[0003] A flexible gateway refers to a system where, when a virtual machine needs to access multiple layers (Layer 3), traffic is first directed to a user-defined gateway (e.g., a Virtual Service Router). The VSR performs necessary business processing (e.g., billing processing) before subsequent nodes forward the traffic. This approach allows users to customize their business deployments.

[0004] However, when the controller is out of service due to a fault, or when distributed DHCP is enabled (i.e., DHCP interaction is offloaded to OVS (Open vSwitch), OVS can only complete basic DHCP message interaction with the virtual machine. When OVS receives a DHCP renewal message from the virtual machine, it cannot specify / configure a flexible gateway for the virtual machine, resulting in the lack of flexible gateway functionality. This will cause services deployed on the flexible gateway to become unavailable. Summary of the Invention

[0005] This application provides a gateway configuration method and apparatus to solve the problem that the custom gateway function is unavailable in the prior art.

[0006] Firstly, this application provides a gateway configuration method applied to an OVS virtual switch, the method comprising:

[0007] Receive the MAC address of the newly created virtual machine and the custom gateway information specified for that virtual machine from the controller;

[0008] Receive a DHCP request message sent by the target virtual machine, and obtain the MAC address information of the target virtual machine carried in a specified field of the DHCP request message;

[0009] If it is determined that the target custom gateway information corresponding to the MAC address of the target virtual machine is maintained locally, the target custom gateway information is carried in the DHCP response message and sent to the target virtual machine so that the target virtual machine can configure the gateway based on the target custom gateway information.

[0010] Optionally, the steps of receiving the MAC address of the newly created virtual machine and the custom gateway information specified for that virtual machine from the controller include:

[0011] Receive the MAC address of the newly created virtual machine from the controller, the custom gateway information specified for the virtual machine, and the IP address assigned to the virtual machine.

[0012] Optionally, after receiving the MAC address of the newly created virtual machine and the custom gateway information specified for the virtual machine from the controller, the method further includes:

[0013] Determine if a DHCP agent service exists for the subnet of the virtual machine, where one DHCP agent service corresponds to one or more subnets;

[0014] If it does not exist, a DHCP proxy service corresponding to the subnet is created, and the MAC address of the virtual machine and the custom gateway information specified for the virtual machine are maintained in the DHCP proxy service. The DHCP proxy service is added to the OVS bridge through the interface.

[0015] If it exists, the MAC address of the virtual machine and the custom gateway information specified for the virtual machine will be maintained in the DHCP proxy service.

[0016] Optionally, if the DHCP request message is a DHCP Discovery message, then the DHCP response message is a DHCP Offer message; if the DHCP request message is a DHCP Request message, then the DHCP response message is a DHCPReply message. Based on the interaction of the DHCP messages, the target virtual machine requests / renews an IP address and configures a custom gateway.

[0017] Optionally, after receiving the DHCP Discovery message sent by the target virtual machine, the DHCP Discovery message is forwarded to the DHCP agent service, so that the DHCP agent service can perform the step of obtaining the MAC address information of the target virtual machine carried in the specified field of the DHCP Discovery message;

[0018] If the DHCP agent service determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally, it sends the target custom gateway information to the target virtual machine in the specified option field of the DHCP Offer message;

[0019] Upon receiving a DHCP Request message from the target virtual machine, the DHCP Request message is forwarded to the DHCP agent service, so that the DHCP agent service can perform the step of obtaining the MAC address information of the target virtual machine carried in the specified field of the DHCP Request message;

[0020] If the DHCP proxy service determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally, it sends the target custom gateway information to the target virtual machine in the specified option field of the DHCP Reply message; after receiving the DHCP Reply message carrying the target custom gateway information, the target virtual machine performs gateway configuration based on the target custom gateway information.

[0021] Optionally, if it is determined that the target virtual machine has migrated from the first source host to the second source host, the gateway configuration corresponding to the target virtual machine on the first source host is revoked, and the gateway configuration corresponding to the target virtual machine is reissued on the second source host.

[0022] Optionally, if it is determined that the target virtual machine is deleted from the source host, the gateway configuration corresponding to the target virtual machine on the first source host is revoked.

[0023] Secondly, this application provides a gateway configuration device for use in an OVS virtual switch, the device comprising:

[0024] The first receiving unit is used to receive the MAC address of the newly created virtual machine and the custom gateway information specified for the virtual machine from the controller;

[0025] The second receiving unit is used to receive the DHCP request message sent by the target virtual machine and obtain the MAC address information of the target virtual machine carried in the specified field of the DHCP request message.

[0026] If the sending unit determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally, the sending unit is used to send the target custom gateway information in a DHCP response message to the target virtual machine so that the target virtual machine can configure the gateway based on the target custom gateway information.

[0027] Optionally, when receiving the MAC address of the newly created virtual machine and the custom gateway information specified for the virtual machine from the controller, the first receiving unit is specifically used for:

[0028] Receive the MAC address of the newly created virtual machine from the controller, the custom gateway information specified for the virtual machine, and the IP address assigned to the virtual machine.

[0029] Optionally, the device further includes:

[0030] The determining unit is used to determine whether a DHCP proxy service corresponding to the subnet of the virtual machine exists, wherein one DHCP proxy service corresponds to one or more subnets;

[0031] If the determining unit determines that it does not exist, the creating unit is used to create a DHCP proxy service corresponding to the subnet, and the maintaining unit is used to maintain the MAC address of the virtual machine and the custom gateway information specified for the virtual machine in the DHCP proxy service. The DHCP proxy service is added to the OVS bridge through the interface.

[0032] If the determining unit is determined to exist, the maintenance unit is used to maintain the MAC address of the virtual machine and the custom gateway information specified for the virtual machine in the DHCP proxy service.

[0033] Optionally, if the DHCP request message is a DHCP Discovery message, then the DHCP response message is a DHCP Offer message; if the DHCP request message is a DHCP Request message, then the DHCP response message is a DHCPReply message. Based on the interaction of the DHCP messages, the target virtual machine requests / renews an IP address and configures a custom gateway.

[0034] Optionally, the second receiving unit is specifically configured to, after receiving the DHCP Discovery message sent by the target virtual machine, forward the DHCP Discovery message to the DHCP agent service, so that the DHCP agent service can perform the step of obtaining the MAC address information of the target virtual machine carried in the specified field of the DHCP Discovery message;

[0035] The sending unit is specifically used to send the target custom gateway information, which is carried in the specified option field of the DHCP Offer message, to the target virtual machine if the DHCP proxy service determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally.

[0036] The second receiving unit is specifically used to forward the DHCP Request message to the DHCP proxy service after receiving the DHCP Request message sent by the target virtual machine, so that the DHCP proxy service can perform the step of obtaining the MAC address information of the target virtual machine carried in the specified field of the DHCP Request message;

[0037] The sending unit is specifically used to, if the DHCP proxy service determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally, send the target custom gateway information in the specified option field of the DHCP Reply message to the target virtual machine; after receiving the DHCP Reply message carrying the target custom gateway information, the target virtual machine performs gateway configuration based on the target custom gateway information.

[0038] Optionally, the device further includes a revocation unit and a distribution unit. If it is determined that the target virtual machine has migrated from the first source host to the second source host, the revocation unit is used to revoke the gateway configuration corresponding to the target virtual machine on the first source host, and the distribution unit is used to re-distribute the gateway configuration corresponding to the target virtual machine on the second source host.

[0039] Optionally, if it is determined that the target virtual machine is deleted from the source host, the revocation unit is used to revoke the gateway configuration corresponding to the target virtual machine on the first source host.

[0040] Thirdly, embodiments of this application provide a gateway configuration device, which includes:

[0041] Memory, used to store program instructions;

[0042] A processor is configured to invoke program instructions stored in the memory and execute the steps of the method as described in any one of the first aspects above, according to the obtained program instructions.

[0043] Fourthly, embodiments of this application also provide a computer-readable storage medium storing computer-executable instructions for causing a computer to perform the steps of the method as described in any of the first aspects above.

[0044] In summary, the gateway configuration method provided in this application is applied to an OVS virtual switch. The method includes: receiving the MAC address of a newly created virtual machine and custom gateway information specified for the virtual machine from the controller; receiving a DHCP request message sent by a target virtual machine and obtaining the MAC address information of the target virtual machine carried in a specified field of the DHCP request message; if it is determined that target custom gateway information corresponding to the MAC address of the target virtual machine is maintained locally, then sending the target custom gateway information in a DHCP response message to the target virtual machine, so that the target virtual machine performs gateway configuration based on the target custom gateway information.

[0045] Using the gateway configuration method provided in this application embodiment, when creating a new virtual machine, if the controller determines that the virtual machine is configured with a corresponding custom gateway, it will send the relevant information of the custom gateway to the OVS side corresponding to the virtual machine. The OVS will maintain the custom gateway information of the virtual machine, and the virtual machine will interact with the OVS through DHCP to complete the custom gateway configuration of the virtual machine. In this way, when the controller fails and is not available, if the virtual machine needs to renew its IP address, the OVS can still reconfigure the custom gateway information of the virtual machine during the renewal process, avoiding the problem of the custom gateway function of the virtual machine being unavailable. Attached Figure Description

[0046] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments of this application or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings of the embodiments of this application.

[0047] Figure 1 A detailed flowchart illustrating a gateway configuration method provided in an embodiment of this application;

[0048] Figure 2 This is a schematic diagram of the structure of a gateway configuration device provided in an embodiment of this application;

[0049] Figure 3 This is a schematic diagram of the hardware architecture of a gateway configuration device provided in an embodiment of this application. Detailed Implementation

[0050] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. The singular forms “a,” “the,” and “the” as used in this application and claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to any and all possible combinations comprising one or more of the associated listed items.

[0051] It should be understood that although the terms first, second, third, etc., may be used to describe various information in embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" may also be interpreted as "when," "when," or "in response to a determination."

[0052] For example, see Figure 1 The diagram shown is a detailed flowchart of a network configuration method provided in an embodiment of this application. This method is applied to an OVS virtual switch and includes the following steps:

[0053] Step 100: Receive the MAC address of the newly created virtual machine and the custom gateway information specified for the virtual machine from the controller.

[0054] Specifically, in this embodiment of the application, when receiving the MAC address of a newly created virtual machine and the custom gateway information specified for the virtual machine from the controller, a preferred implementation is to receive the MAC address of the newly created virtual machine, the custom gateway information specified for the virtual machine, and the IP address assigned to the virtual machine from the controller.

[0055] In practical applications, the controller (SDN controller) can communicate with its managed devices (communication devices / servers) via the Openflow / ovsdb protocol. Users can create virtual machines (VMs) on the servers managed by the controller through the interface provided by the controller to host various services, and can determine whether to specify a custom gateway (flexible gateway) for the VM based on actual business needs. It should be noted that in this embodiment, the controller integrates DHCP server functionality, and the controller can enable distributed DHCP. In this embodiment, the controller can allocate an available IP address from the IP pool for a VM when a user creates it, and can also normally enable the DHCP server function and perform IP address allocation operations when it receives a DHCP request message from a VM.

[0056] In this embodiment of the application, after the controller determines that a user has created a virtual machine, it obtains the MAC address of the virtual machine, allocates an available IP address for the virtual machine from the IP address pool, and, if it determines that a custom gateway needs to be specified for the virtual machine (the user-defined information of the flexible gateway specified for the virtual machine), sends the MAC address of the virtual machine, the IP address allocated to the virtual machine, and the information of the flexible gateway specified for the virtual machine to the OVS corresponding to the virtual machine on the server.

[0057] It should be noted that if the user does not specify a custom gateway when creating the virtual machine, the virtual machine can be brought online using the existing DHCP process. Alternatively, the controller can assign an available IP address to the virtual machine from the IP address pool and send the virtual machine's MAC address and the assigned IP address to the corresponding OVS on the server. The virtual machine then exchanges DHCP messages with the OVS to obtain the IP address and perform subsequent virtual machine online operations.

[0058] In this embodiment of the application, after the controller sends the relevant information of the newly created virtual machine to OVS, OVS determines whether there is a DHCP proxy service (e.g., DNSMasq service) corresponding to the subnet of the virtual machine. Here, a DHCP proxy service corresponds to one or more subnets.

[0059] If it does not exist, a DHCP proxy service corresponding to the subnet is created, and the MAC address of the virtual machine and the custom gateway information specified for the virtual machine are maintained in the DHCP proxy service. The DHCP proxy service is added to the OVS bridge through the interface.

[0060] If it exists, the MAC address of the virtual machine and the custom gateway information specified for the virtual machine are maintained in the DHCP proxy service. Specifically, a configuration file related to the DHCP lease is also generated and written to DNSMasq.

[0061] In other words, both OVS and the DHCP agent service are virtualized and reside on the same server. The DHCP agent service accesses OVS through an interface, that is, the DHCP agent service establishes a communication connection with OVS.

[0062] Step 110: Receive the DHCP request message sent by the target virtual machine, and obtain the MAC address information of the target virtual machine carried in the specified field of the DHCP request message.

[0063] Step 120: If it is determined that the target custom gateway information corresponding to the MAC address of the target virtual machine is maintained locally, the target custom gateway information is carried in the DHCP response message and sent to the target virtual machine so that the target virtual machine can configure the gateway based on the target custom gateway information.

[0064] In this embodiment, if the DHCP request message is a DHCP Discovery message, then the DHCP response message is a DHCP Offer message; if the DHCP request message is a DHCP Request message, then the DHCP response message is a DHCP Reply message. The target virtual machine, based on the interaction of the DHCP messages, requests / renews an IP address and configures a custom gateway. That is, when an IP address requested by a virtual machine is about to expire, it can send a renewal request to OVS. OVS, based on the information maintained in the DHCP proxy service regarding whether the virtual machine is configured with a flexible gateway, configures the flexible gateway for the virtual machine. Even if the controller is not present, the virtual machine can still continue to be configured with the flexible gateway function.

[0065] Therefore, upon receiving a DHCP Discovery message from the target virtual machine, the DHCP Discovery message is forwarded to the DHCP agent service, so that the DHCP agent service can perform the step of obtaining the MAC address information of the target virtual machine carried in the specified field of the DHCP Discovery message.

[0066] If the DHCP agent service determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally, it will send the target custom gateway information to the target virtual machine in the specified option field of the DHCP Offer message.

[0067] Specifically, the virtual machine sends a DHCP Discovery message. OVS redirects this DHCP Discovery message to the DNSmasq service. When DNSmasq receives the DHCP Discovery message, it parses the chaddr field (the field carrying the virtual machine's MAC address). If it determines that the virtual machine corresponding to the MAC address has enabled Flexible Gateway functionality, it removes the option3 field from the DHCP offer response message; simultaneously, it carries the classless default static route (Flexible Gateway related information) via option 121. Of course, it also carries the IP address corresponding to the MAC address in the DHCP offer response message.

[0068] Upon receiving a DHCP Request message from the target virtual machine, the DHCP Request message is forwarded to the DHCP agent service, so that the DHCP agent service can perform the step of obtaining the MAC address information of the target virtual machine carried in the specified field of the DHCP Request message.

[0069] If the DHCP proxy service determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally, it sends the target custom gateway information to the target virtual machine in the specified option field of the DHCP Reply message; after receiving the DHCP Reply message carrying the target custom gateway information, the target virtual machine performs gateway configuration based on the target custom gateway information.

[0070] Specifically, if a virtual machine receives a DHCP offer message, it sends a DHCP request message. OVS redirects this DHCP request message to the DNSmasq service. When DNSmasq receives the DHCP request message, it parses the chaddr field. If the virtual machine corresponding to the MAC address has the Flexible Gateway feature enabled, it removes the option3 field from the DHCP REPLY response message; simultaneously, it carries the classless default static route corresponding to the Flexible Gateway via option 121. Of course, it also carries the IP address corresponding to the MAC address in the DHCP offer response message. When the virtual machine receives the DHCP REPLY message, it generates a route for the Flexible Gateway locally based on the configuration in the DHCP option (option 121).

[0071] In practical applications, when a virtual machine initiates a Layer 3 (cross-segment forwarding) access to a specified destination device, it finds a default route matching the flexible gateway locally and initiates an ARP request to the flexible gateway (based on the MAC-IP mapping of the flexible gateway). This request is answered by the local OVS flow table. Essentially, this is to obtain the MAC address of the flexible gateway.

[0072] Service traffic initiated by the virtual machine is sent to the designated flexible gateway via the MAC forwarding flow table on OVS. That is, through Layer 2 forwarding, the service packet can be forwarded to the flexible gateway. The flexible gateway can then process the service packet (e.g., if a billing service is deployed on the flexible gateway, the service packet can be processed for billing), and then forward the service packet to the destination device.

[0073] Furthermore, in this embodiment of the application, if it is determined that the target virtual machine has migrated from the first source host to the second source host, the gateway configuration corresponding to the target virtual machine on the first source host is revoked, and the gateway configuration corresponding to the target virtual machine is reissued on the second source host.

[0074] In other words, when a virtual machine is migrated, the controller reclaims the flexible gateway configuration related to the virtual machine on the source host and redistributes the relevant flexible gateway configuration on the destination host.

[0075] Alternatively, if it is determined that the target virtual machine has been deleted from the source host, the gateway configuration corresponding to the target virtual machine on the first source host is revoked.

[0076] In other words, when a virtual machine goes offline, the controller reclaims the flexible gateway configuration associated with the virtual machine on the corresponding host.

[0077] For example, see Figure 2The diagram shown is a schematic representation of a gateway configuration device provided in an embodiment of this application. This device is applied to an OVS virtual switch and includes:

[0078] The first receiving unit 20 is used to receive the MAC address of the newly created virtual machine and the custom gateway information specified for the virtual machine from the controller;

[0079] The second receiving unit 21 is used to receive a DHCP request message sent by the target virtual machine and obtain the MAC address information of the target virtual machine carried in a specified field of the DHCP request message.

[0080] If the sending unit 22 determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally, the sending unit 22 is used to send the target custom gateway information in a DHCP response message to the target virtual machine so that the target virtual machine can perform gateway configuration based on the target custom gateway information.

[0081] Optionally, when receiving the MAC address of the newly created virtual machine and the custom gateway information specified for the virtual machine from the controller, the first receiving unit 20 is specifically used for:

[0082] Receive the MAC address of the newly created virtual machine from the controller, the custom gateway information specified for the virtual machine, and the IP address assigned to the virtual machine.

[0083] Optionally, the device further includes:

[0084] The determining unit is used to determine whether a DHCP proxy service corresponding to the subnet of the virtual machine exists, wherein one DHCP proxy service corresponds to one or more subnets;

[0085] If the determining unit determines that it does not exist, the creating unit is used to create a DHCP proxy service corresponding to the subnet, and the maintaining unit is used to maintain the MAC address of the virtual machine and the custom gateway information specified for the virtual machine in the DHCP proxy service. The DHCP proxy service is added to the OVS bridge through the interface.

[0086] If the determining unit is determined to exist, the maintenance unit is used to maintain the MAC address of the virtual machine and the custom gateway information specified for the virtual machine in the DHCP proxy service.

[0087] Optionally, if the DHCP request message is a DHCP Discovery message, then the DHCP response message is a DHCP Offer message; if the DHCP request message is a DHCP Request message, then the DHCP response message is a DHCPReply message. Based on the interaction of the DHCP messages, the target virtual machine requests / renews an IP address and configures a custom gateway.

[0088] Optionally, the second receiving unit 21 is specifically configured to, after receiving the DHCP Discovery message sent by the target virtual machine, forward the DHCP Discovery message to the DHCP agent service, so that the DHCP agent service can perform the step of obtaining the MAC address information of the target virtual machine carried in the specified field of the DHCP Discovery message;

[0089] The sending unit 22 is specifically used to send the target custom gateway information, which is carried in the specified option field of the DHCP Offer message, to the target virtual machine if the DHCP proxy service determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally.

[0090] The second receiving unit 21 is specifically used to forward the DHCP Request message to the DHCP proxy service after receiving the DHCP Request message sent by the target virtual machine, so that the DHCP proxy service can perform the step of obtaining the MAC address information of the target virtual machine carried in the specified field of the DHCP Request message;

[0091] The sending unit 22 is specifically used to, if the DHCP proxy service determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally, send the target custom gateway information in the specified option field of the DHCP Reply message to the target virtual machine; after receiving the DHCP Reply message carrying the target custom gateway information, the target virtual machine performs gateway configuration based on the target custom gateway information.

[0092] Optionally, the device further includes a revocation unit and a distribution unit. If it is determined that the target virtual machine has migrated from the first source host to the second source host, the revocation unit is used to revoke the gateway configuration corresponding to the target virtual machine on the first source host, and the distribution unit is used to re-distribute the gateway configuration corresponding to the target virtual machine on the second source host.

[0093] Optionally, if it is determined that the target virtual machine is deleted from the source host, the revocation unit is used to revoke the gateway configuration corresponding to the target virtual machine on the first source host.

[0094] These units can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more digital signal processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when one of these units is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these units can be integrated together to form a system-on-a-chip (SOC).

[0095] Furthermore, regarding the gateway configuration device provided in this application embodiment, from a hardware perspective, the hardware architecture diagram of the gateway configuration device can be found in [reference needed]. Figure 3 As shown, the gateway configuration device may include: a memory 30 and a processor 31.

[0096] The memory 30 is used to store program instructions; the processor 31 calls the program instructions stored in the memory 30 and executes the above method embodiment according to the obtained program instructions. The specific implementation method and technical effect are similar, and will not be described again here.

[0097] Optionally, this application also provides a gateway configuration device, including at least one processing element (or chip) for performing the above method embodiments.

[0098] Optionally, this application also provides a program product, such as a computer-readable storage medium storing computer-executable instructions for causing the computer to perform the above-described method embodiments.

[0099] Here, a machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, a machine-readable storage medium can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.

[0100] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which can take the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, game console, tablet computer, wearable device, or any combination of these devices.

[0101] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.

[0102] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0103] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0104] Furthermore, these computer program instructions can also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in the process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0105] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0106] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A gateway configuration method, characterized in that, Applied to OVS virtual switches, the method includes: Receive the MAC address of the newly created virtual machine and the custom gateway information specified for that virtual machine from the controller; Determine if a DHCP agent service exists for the subnet of the virtual machine, where one DHCP agent service corresponds to one or more subnets; If it does not exist, a DHCP proxy service corresponding to the subnet is created, and the MAC address of the virtual machine and the custom gateway information specified for the virtual machine are maintained in the DHCP proxy service. The DHCP proxy service is added to the OVS bridge through the interface. If it exists, the MAC address of the virtual machine and the custom gateway information specified for the virtual machine will be maintained in the DHCP proxy service; Receive a DHCP request message sent by the target virtual machine, and forward the DHCP request message to the corresponding DHCP proxy service, so that the DHCP proxy service can obtain the MAC address information of the target virtual machine carried in the specified field of the DHCP request message; If the DHCP proxy service determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally, it sends the target custom gateway information to the target virtual machine in the specified option field of the DHCP response message, so that the target virtual machine can configure the gateway based on the target custom gateway information.

2. The method as described in claim 1, characterized in that, The steps for receiving the MAC address of the newly created virtual machine and the custom gateway information specified for that virtual machine from the controller include: Receive the MAC address of the newly created virtual machine from the controller, the custom gateway information specified for the virtual machine, and the IP address assigned to the virtual machine.

3. The method as described in claim 1, characterized in that, If the DHCP request message is a DHCP Discovery message, then the DHCP response message is a DHCP Offer message; if the DHCP request message is a DHCP Request message, then the DHCP response message is a DHCP Reply message. Based on the interaction of the DHCP messages, the target virtual machine requests / renews an IP address and configures a custom gateway.

4. The method as described in claim 3, characterized in that, Upon receiving a DHCP Discovery message from the target virtual machine, the DHCP Discovery message is forwarded to the DHCP agent service, so that the DHCP agent service can perform the step of obtaining the MAC address information of the target virtual machine carried in the specified field of the DHCP Discovery message; If the DHCP agent service determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally, it sends the target custom gateway information to the target virtual machine in the specified option field of the DHCP Offer message; Upon receiving a DHCP Request message from the target virtual machine, the DHCP Request message is forwarded to the DHCP agent service, so that the DHCP agent service can perform the step of obtaining the MAC address information of the target virtual machine carried in the specified field of the DHCP Request message; If the DHCP proxy service determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally, it sends the target custom gateway information to the target virtual machine in the specified option field of the DHCP Reply message; after receiving the DHCP Reply message carrying the target custom gateway information, the target virtual machine performs gateway configuration based on the target custom gateway information.

5. The method as described in claim 1 or 2, characterized in that, If it is determined that the target virtual machine has migrated from the first source host to the second source host, then the gateway configuration corresponding to the target virtual machine on the first source host is revoked, and the gateway configuration corresponding to the target virtual machine is reissued on the second source host.

6. The method as described in claim 1 or 2, characterized in that, If it is determined that the target virtual machine has been deleted from the source host, then the gateway configuration corresponding to the target virtual machine on the source host is revoked.

7. A gateway configuration device, characterized in that, The device, applied to OVS virtual switches, includes: The first receiving unit is used to receive the MAC address of the newly created virtual machine and the custom gateway information specified for the virtual machine from the controller; The determining unit is used to determine whether a DHCP proxy service corresponding to the subnet of the virtual machine exists, wherein one DHCP proxy service corresponds to one or more subnets; If the determining unit determines that it does not exist, the creating unit is used to create a DHCP proxy service corresponding to the subnet, and the maintaining unit is used to maintain the MAC address of the virtual machine and the custom gateway information specified for the virtual machine in the DHCP proxy service. The DHCP proxy service is added to the OVS bridge through the interface. If the determining unit is determined to exist, the maintaining unit is used to maintain the MAC address of the virtual machine and the custom gateway information specified for the virtual machine in the DHCP proxy service; The second receiving unit is used to receive the DHCP request message sent by the target virtual machine and forward the DHCP request message to the corresponding DHCP proxy service, so that the DHCP proxy service can obtain the MAC address information of the target virtual machine carried in the specified field of the DHCP request message; If the DHCP proxy service determines that it maintains target custom gateway information corresponding to the MAC address of the target virtual machine locally, the sending unit is used to send the target custom gateway information in a specified option field of the DHCP response message to the target virtual machine, so that the target virtual machine can perform gateway configuration based on the target custom gateway information.

8. A gateway configuration device, characterized in that, The gateway configuration device includes: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the steps of the method as described in any one of claims 1-6 according to the obtained program instructions.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing the computer to perform the steps of the method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Virtual switch distributed escape method and device and storage medium

    CN113132155A