DHCP message response method and device based on OpenFlow protocol
By using the OpenFlow protocol to design flow table matching and modifying DHCP request packets in the virtual switch of the compute node, the problem that the virtual server cannot obtain IP addresses when communicating with the compute node and network node is solved, and high availability and scalability are achieved DHCP response.
Patent Information
- Application Number
- CN202211698220.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2042-12-28
AI Technical Summary
In the prior art, when there is a problem with the communication between the computing node and the network node or the DHCP service is unavailable, the virtual server cannot obtain the IP address or renew the contract, which affects the normal use of the service.
The DHCP message response method based on the OpenFlow protocol is adopted. The virtual switch in the computing node receives the DHCP request message from the virtual server, performs predefined OpenFlow protocol design flow table matching and modification, and directly completes the DHCP request response in the computing node. Avoid DHCP servers that rely on network nodes.
It realizes that without the need for a DHCP server in the computing node, the virtual server can obtain an IP address or renew the IP address, which improves the availability and scalability of the system and meets distributed needs.
Smart Images

Figure CN116260766B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a method and device for responding to a DHCP message based on an OpenFlow protocol. Background Art
[0002] The virtual server is on the computing node, and the DHCP Server of the virtual server on the cloud computing management platform OpenStack is on the network node.
[0003] In the prior art, when a virtual server is created to obtain an IP address or renew an IP, the request is forwarded to a DHCP server on a network node through a computing node, and the DHCP server responds to the DHCP request of the virtual server to obtain an IP address or renew an IP.
[0004] The problem with the prior art is that when a problem occurs in the communication between the computing node and the network node, or the DHCP service is unavailable, the virtual server cannot obtain an IP address or renew the lease through the DHCP server, thereby affecting the normal use of the service. Summary of the invention
[0005] The embodiments of the present application provide a DHCP message response method and device based on the OpenFlow protocol to solve the problem in the prior art that when there is a problem in the communication between the computing node and the network node, or the DHCP service is unavailable, the virtual server cannot obtain an IP address or renew the lease through the DHCP server, thereby affecting the normal use of the business.
[0006] The present application provides a DHCP message response method based on the OpenFlow protocol, the method comprising:
[0007] The virtual switch in the computing node receives the DHCP request message broadcast by the virtual server;
[0008] Matching the DHCP request message with a predefined OpenFlow protocol design flow table, modifying the DHCP request message according to the matching result, obtaining a modified first message and sending it to the virtual server;
[0009] Receiving a response message corresponding to the first message broadcast by the virtual server;
[0010] The response message is matched with a predefined OpenFlow protocol design flow table, the response message is modified according to the matching result, and the modified second message is sent to the virtual server, so that the virtual server obtains an IP address or renews an IP address.
[0011] Further, including:
[0012] Matching the DHCP request message with a predefined OpenFlow protocol design flow table, if it is determined that the DHCP request message is an IPv4 type request message, modifying the DHCPDiscover request message broadcast by the virtual server according to the matching result, obtaining a DHCP Offer message and sending it to the virtual server;
[0013] Receiving a DHCP Request message broadcasted by the virtual server;
[0014] The DHCP Request message is matched with a predefined OpenFlow protocol design flow table, the DHCP Request message is modified according to the matching result, and a DHCP ACK message is obtained and sent to the virtual server, so that the virtual server obtains an IPv4 address or renews an IPv4 address.
[0015] Further, including:
[0016] Matching the DHCP request message with a predefined OpenFlow protocol design flow table, if it is determined that the DHCP request message is an IPv6 type request message, modifying the DHCPSolicit request message broadcast by the virtual server according to the matching result, obtaining a DHCP Advertise message and sending it to the virtual server;
[0017] Receiving a DHCP Request message broadcasted by the virtual server;
[0018] The DHCP Request message is matched with a predefined OpenFlow protocol design flow table, the DHCP Request message is modified according to the matching result, and a DHCP Reply message is obtained and sent to the virtual server, so that the virtual server obtains an IPv6 address.
[0019] Furthermore, the method further comprises:
[0020] Receive a DHCP Renew request message broadcast by the virtual server, match the DHCP Renew request message with a predefined OpenFlow protocol design flow table, modify the DHCP Renew request message according to the matching result, obtain a DHCP Reply message and send it to the virtual server, so that the virtual server renews the IPv6 address.
[0021] Further, the modifying the DHCP Discover request message broadcast by the virtual server according to the matching result includes:
[0022] For the received DHCP Discover request message, construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server, replace the content of the DHCP Discover request message part, modify the source mac address, source IPv4 address, and source port port of the DHCP Discover request message, complete the transformation of the DHCP Offer message and send it to the virtual server.
[0023] Further, the modifying the DHCP Request message according to the matching result includes:
[0024] For the received DHCP Request message, construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server, replace the content of the DHCP Request message part, modify the source mac address, source IPv4 address, and source port port of the DHCP Request message, complete the transformation of the DHCP ACK message and send it to the virtual server.
[0025] Further, the modifying the DHCP Solicit request message broadcast by the virtual server according to the matching result includes:
[0026] For the received DHCP Solicit request message, construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server, replace the content of the DHCP Solicit request message part, modify the source mac address, source IPv6 address, and source port port of the DHCP Solicit request message, complete the transformation of the DHCP Advertise message and send it to the virtual server.
[0027] Furthermore, the method further comprises:
[0028] Define the numbers corresponding to IPv4 DHCP Message Type and IPv6 DHCP Message Type respectively;
[0029] For IPv4 type request message modification, modify the number corresponding to the DHCP Message Type of the request message and the Message Type value of the request message;
[0030] For IPv6 type request message modification, the Message Type value of the request message is modified.
[0031] On the other hand, the present application provides a DHCP message response device based on the OpenFlow protocol, the device comprising:
[0032] A receiving module, used for receiving a DHCP request message broadcast by a virtual server;
[0033] A response module, used for matching the DHCP request message with a predefined OpenFlow protocol design flow table, modifying the DHCP request message according to the matching result, obtaining a modified first message and sending it to the virtual server;
[0034] The receiving module is further used to receive a response message corresponding to the first message broadcast by the virtual server;
[0035] The response module is also used to match the response message with a predefined OpenFlow protocol design flow table, modify the response message according to the matching result, and send the modified second message to the virtual server so that the virtual server obtains an IP address or renews the IP address.
[0036] Further, the response module is specifically used to match the DHCP request message with a predefined OpenFlow protocol design flow table, and if it is determined that the DHCP request message is an IPv4 type request message, modify the DHCP Discover request message broadcast by the virtual server according to the matching result, obtain a DHCP Offer message and send it to the virtual server;
[0037] The receiving module is specifically used to receive the DHCP Request message broadcast by the virtual server;
[0038] The response module is specifically used to match the DHCP Request message with a predefined OpenFlow protocol design flow table, modify the DHCP Request message according to the matching result, obtain a DHCPACK message and send it to the virtual server, so that the virtual server obtains an IPv4 address or renews an IPv4 address.
[0039] Further, the response module is specifically used to match the DHCP request message with a predefined OpenFlow protocol design flow table, and if it is determined that the DHCP request message is an IPv6 type request message, modify the DHCP Solicit request message broadcast by the virtual server according to the matching result, and obtain a DHCP Advertise message and send it to the virtual server;
[0040] The receiving module is specifically used to receive the DHCP Request message broadcast by the virtual server;
[0041] The response module is specifically used to match the DHCP Request message with a predefined OpenFlow protocol design flow table, modify the DHCP Request message according to the matching result, obtain a DHCPReply message and send it to the virtual server, so that the virtual server obtains an IPv6 address.
[0042] Furthermore, the receiving module is further used to receive a DHCP Renew request message broadcast by the virtual server;
[0043] The response module is further used to match the DHCP Renew request message with a predefined OpenFlow protocol design flow table, modify the DHCP Renew request message according to the matching result, obtain a DHCP Reply message and send it to the virtual server, so that the virtual server renews the IPv6 address.
[0044] Furthermore, the response module is specifically used to construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server for the received DHCP Discover request message, replace the content of the DHCP Discover request message part, modify the source mac address, source IPv4 address, and source port port of the DHCP Discover request message, complete the transformation of the DHCP Offer message and send it to the virtual server.
[0045] Furthermore, the response module is specifically used to construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server for the received DHCP Request message, replace the content of the DHCPRequest message part, modify the source mac address, source IPv4 address, and source port port of the DHCP Request message, complete the transformation of the DHCP ACK message and send it to the virtual server.
[0046] Furthermore, the response module is specifically used to construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server for the received DHCP Solicit request message, replace the content of the DHCP Solicit request message part, modify the source mac address, source IPv6 address, and source port port of the DHCP Solicit request message, complete the transformation of the DHCP Advertise message and send it to the virtual server.
[0047] Furthermore, the response module is also used to define numbers corresponding to IPv4 DHCP Message Type and IPv6 DHCP Message Type respectively; for modification of an IPv4 type request message, modify the number corresponding to the DHCP Message Type of the request message and the Message Type value of the request message; for modification of an IPv6 type request message, modify the Message Type value of the request message.
[0048] On the other hand, the present application provides a virtual switch, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus;
[0049] Memory, used to store computer programs;
[0050] The processor is used to implement any of the method steps described above when executing the program stored in the memory.
[0051] On the other hand, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of the above are implemented.
[0052] The present application provides a method and device for responding to a DHCP message based on the OpenFlow protocol. The method includes: a virtual switch in a computing node receives a DHCP request message broadcast by a virtual server; matches the DHCP request message with a predefined OpenFlow protocol designed flow table, modifies the DHCP request message according to the matching result, obtains a modified first message and sends it to the virtual server; receives a response message corresponding to the first message broadcast by the virtual server; matches the response message with a predefined OpenFlow protocol designed flow table, modifies the response message according to the matching result, obtains a modified second message and sends it to the virtual server, so that the virtual server obtains an IP address or renews an IP address.
[0053] The above technical solution has the following advantages or beneficial effects:
[0054] This application does not require the DHCP server of the network node to provide DHCP service. In the virtual switch of the computing node, the flow table is designed through the OpenFlow protocol to match the DHCP request message and complete the modification to achieve the response to the DHCP request message. It solves the problem in the prior art that when there is a problem in the communication between the computing node and the network node or the DHCP service is unavailable, the virtual server cannot obtain an IP address or renew the contract through the DHCP Server, thereby affecting the normal use of the business. In addition, the virtual switch in each computing node implements the DHCP request response of the virtual server on it, which has strong scalability and meets the distributed requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0056] Figure 1 A schematic diagram of the DHCP message response process based on the OpenFlow protocol provided for this application;
[0057] Figure 2 DHCP message response architecture diagram based on OpenFlow protocol provided for this application;
[0058] Figure 3 Schematic diagram of the process of requesting an IPv4 address for a virtual server provided in this application;
[0059] Figure 4 Schematic diagram of the process of requesting an IPv6 address for a virtual server provided in this application;
[0060] Figure 5 A schematic diagram of the structure of a DHCP message response device based on the OpenFlow protocol provided in this application;
[0061] Figure 6 A schematic diagram of the virtual switch structure provided in this application. DETAILED DESCRIPTION
[0062] In order to make the purpose and implementation method of the present application clearer, the exemplary implementation method of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0063] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.
[0064] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.
[0065] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0066] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0067] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0068] For the convenience of explanation, the above description has been made in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.
[0069] Figure 1 The schematic diagram of the DHCP message response process based on the OpenFlow protocol provided in this application includes the following steps:
[0070] S101: A virtual switch in a computing node receives a DHCP request message broadcast by a virtual server.
[0071] S102: Match the DHCP request message with a predefined OpenFlow protocol design flow table, modify the DHCP request message according to the matching result, obtain a modified first message, and send it to the virtual server.
[0072] S103: Receive a response message corresponding to the first message broadcast by the virtual server.
[0073] S104: Match the response message with a predefined OpenFlow protocol design flow table, modify the response message according to the matching result, obtain a modified second message and send it to the virtual server, so that the virtual server obtains an IP address or renews an IP address.
[0074] The DHCP message response method based on the OpenFlow protocol provided in the present application is applied to a virtual switch in a computing node.
[0075] In this application, the virtual switch in the computing node adds custom classifications and actions in the OpenFlow protocol to support the matching and operation of DHCP request messages; there is no need for a DHCP Server to provide DHCP services, and the flow table is designed and the data packet is transformed (modified) through the OpenFlow protocol to achieve the response to the DHCP request; the DHCP request response of the virtual server on it is implemented on each computing node, which has strong scalability and meets the distributed requirements; the response to the DHCP request is implemented directly through the original data plane path of the virtual server, without relying on other additional services, thereby improving availability.
[0076] The virtual server broadcasts a DHCP request message. After the virtual switch receives the DHCP request message broadcast by the virtual server, it matches the DHCP request message with the pre-defined OpenFlow protocol design flow table, modifies the DHCP request message according to the matching result, obtains the modified first message and sends it back to the virtual server. The virtual server then broadcasts a response message corresponding to the first message. After receiving the response message broadcast by the virtual server, the virtual switch matches the response message with the pre-defined OpenFlow protocol design flow table, modifies the response message according to the matching result, obtains the modified second message and sends it back to the virtual server. At this time, the virtual server successfully obtains the IP address.
[0077] This application does not require the DHCP server of the network node to provide DHCP services. In the virtual switch of the computing node, the flow table is designed through the OpenFlow protocol to match the DHCP request message and complete the modification to achieve the response to the DHCP request message. It solves the problem in the prior art that when there is a problem in the communication between the computing node and the network node, the virtual server cannot obtain an IP address or renew the contract through the DHCP Server, thereby affecting the normal use of the business. In addition, the virtual switch in each computing node realizes the DHCP request response of the virtual server on it, which has strong scalability and meets the distributed requirements.
[0078] Specifically, the process of the virtual server requesting an IPv4 address in this application is as follows:
[0079] The DHCP request message is matched with the pre-defined OpenFlow protocol design flow table. If it is determined that the DHCP request message is an IPv4 type request message, the DHCP Discover request message broadcast by the virtual server is modified according to the matching result, and a DHCP Offer message is obtained and sent to the virtual server.
[0080] Receive the DHCP Request message broadcast by the virtual server;
[0081] The DHCP Request message is matched with a predefined OpenFlow protocol design flow table, the DHCP Request message is modified according to the matching result, and a DHCP ACK message is obtained and sent to the virtual server, so that the virtual server successfully obtains an IPv4 address.
[0082] The process of renewing the IPv4 address of a virtual server is as follows:
[0083] Receive the DHCP Request message broadcast by the virtual server;
[0084] The DHCP Request message is matched with the pre-defined OpenFlow protocol design flow table, and the DHCP Request message is modified according to the matching result to obtain a DHCP ACK message and send it to the virtual server, so that the virtual server can successfully renew the IPv4 address.
[0085] The process of a virtual server requesting an IPv6 address is as follows:
[0086] Match the DHCP request message with a predefined OpenFlow protocol design flow table, and if it is determined that the DHCP request message is an IPv6 type request message, modify the DHCPSolicit request message broadcast by the virtual server according to the matching result to obtain a DHCP Advertise message and send it to the virtual server;
[0087] Receive the DHCP Request message broadcast by the virtual server;
[0088] The DHCP Request message is matched with the pre-defined OpenFlow protocol design flow table, and the DHCP Request message is modified according to the matching result to obtain a DHCP Reply message and send it to the virtual server so that the virtual server obtains an IPv6 address.
[0089] The process of renewing the IPv6 address of a virtual server is as follows:
[0090] Receive the DHCP Renew request message broadcast by the virtual server, match the DHCP Renew request message with the pre-defined OpenFlow protocol design flow table, modify the DHCP Renew request message according to the matching result, obtain the DHCP Reply message and send it to the virtual server to renew the IPv6 address of the virtual server.
[0091] In the present application, the modifying of the DHCP Discover request message broadcast by the virtual server according to the matching result includes:
[0092] For the received DHCP Discover request message, construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server, replace the content of the DHCP Discover request message, modify the source mac address, source IPv4 address, and source port of the DHCP Discover request message, complete the transformation of the DHCP Offer message and send it to the virtual server.
[0093] The modifying the DHCP Request message according to the matching result includes:
[0094] For the received DHCP Request message, build the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server, replace the content of the DHCP Request message, modify the source MAC address, source IPv4 address, and source port of the DHCP Request message, complete the transformation of the DHCP ACK message and send it to the virtual server.
[0095] The modifying of the DHCP Solicit request message broadcast by the virtual server according to the matching result includes:
[0096] For the received DHCP Solicit request message, construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server, replace the content of the DHCP Solicit request message, modify the source mac address, source IPv6 address, and source port of the DHCP Solicit request message, complete the transformation of the DHCP Advertise message and send it to the virtual server.
[0097] For the received Request request, the Request part is replaced in the same way as above, the DHCP Reply packet is transformed, and finally sent back to the virtual server port; for the received Renew request, the Renew part is replaced in the same way as above, the DHCP Reply packet is transformed, and finally sent back to the virtual server port.
[0098] The method further comprises:
[0099] Define the numbers corresponding to IPv4 DHCP Message Type and IPv6 DHCP Message Type respectively;
[0100] For IPv4 type request message modification, modify the number corresponding to the DHCP Message Type of the request message and the Message Type value of the request message;
[0101] For IPv6 type request message modification, the Message Type value of the request message is modified.
[0102] The DHCP message response process based on the OpenFlow protocol provided by the present application is described in detail below with reference to the accompanying drawings.
[0103] Figure 2 The DHCP message response architecture diagram based on the OpenFlow protocol provided for this application is as follows: Figure 2The computing node includes a virtual switch vSwitch and multiple virtual server VMs. Each VM sends a DHCP request to the vSwitch, and the vSwitch sends a DHCP response to the VM.
[0104] In the OpenFlow protocol, the matching and action rules for DHCP request messages are designed.
[0105] 1. The DHCP request message sent by the virtual machine port matches:
[0106] ①table=0,priority=100,udp,tp_src=68,tp_dst=67,actions=(resubmit,1)
[0107] ②table=0, priority=100, udp6, tp_src=546, tp_dst=547, actions=(resubmit,1)
[0108] The above two flow tables match the IPv4 and IPv6 DHCP requests sent by the virtual machine respectively, and forward them to table1 after matching.
[0109] 2. Customize the design of different actions for different DHCP requests.
[0110] A. First, in OpenFlow, according to the DHCP Message type of Options in the DHCP message, add custom classification numbers for different DHCP requests, and identify them in the flow table through the custom dhcp_type keyword:
[0111]
[0112] B. Add a new custom action mod_dhcp_type in OpenFlow to modify the Message type of DHCP messages.
[0113] IPv4: In addition to modifying the DHCP Message Type value in Options, the mod_dhcp_type action also modifies the Message type value of the message according to the DHCP message type. Since the bridge functions as a DHCP server, it is uniformly modified to 2. The Message type of the message includes Boot Reply and Boot Request. The Boot Request value is 1 and the Boot Reply value is 2.
[0114] IPv6: The mod_dhcp_type action only modifies the Message type value of the message.
[0115] C. Add custom actions for modifying DHCP message content in OpenFlow, including: load:dhcp_options(IPv4), load:dhcp_advertise(IPv6), load:dhcp_reply(IPv6).
[0116] load:dhcp_options(IPv4):
[0117] Complete the DHCP Offer or DHCP ACK message content according to the DHCP configuration of each virtual machine, and replace the DHCPDiscover or DHCP Request message content;
[0118] load:dhcp_advertise(IPv6):
[0119] Complete the DHCP Advertise message content according to the DHCP configuration of each virtual machine and replace the DHCP Solicit request message content;
[0120] load:dhcp_reply(IPv6):
[0121] Complete the DHCP Reply message content according to the DHCP configuration of each virtual machine and replace the DHCP Request message content.
[0122] D. Finally, in table 1, a flow table is created to match different DHCP requests sent by each virtual server port according to the configuration.
[0123] Table 1 The flow table is as follows:
[0124] ①
[0125] table=1,priority=1,in_port={vm_port},udp,dhcp_type=1,actions=load:dhcp_options,mod_dl_src:{bridge_mac},mod_dl_dst:{ vm_port_mac},mod_nw_src:{bridge_ip},mod_nw_dst:{vm_ip},mod_tp_src:67,mod_tp_dst:68,mod_dhcp_type:2,output:{vm_port}.
[0126] For the received Discover request, first build the DHCP-related configuration content to be returned to the virtual server according to the issued virtual server DHCP configuration, replace the content of the Discover part, then modify the source and destination mac address, source and destination IPv4 address, and source and destination port of the data packet to complete the transformation of the DHCP Offer packet, and finally send it back to the virtual server port.
[0127] ②
[0128] table=1,priority=1,in_port={vm_port},udp,dhcp_type=3,actions=load:dhcp_options,mod_dl_src:{bridge_mac},mod_dl_dst:{ vm_port_mac},mod_nw_src:{bridge_ip},mod_nw_dst:{vm_ip},mod_tp_src:67,mod_tp_dst:68,mod_dhcp_type:5,output:{vm_port}.
[0129] The received Request request is the same as above, the Request part is replaced, the DHCP ACK packet is transformed, and finally sent back to the virtual server port.
[0130] ③
[0131] table=1,priority=1,in_port={vm_port},udp6,dhcp_type=1,actions=load:dhcp_advertise,mod_dl_src:{bridge_mac},mod_dl_dst:{ vm_port_mac},mod_nw_src:{bridge_ip},mod_nw_dst:{vm_ip},mod_tp_src:547,mod_tp_dst:546,mod_dhcp_type:2,output:{vm_port}.
[0132] For the received Solicit request, first build the DHCP-related configuration content to be returned to the virtual server based on the virtual server DHCP configuration sent down, replace the content of the Solicit part, then modify the source and destination mac address, source and destination IPv6 address, and source and destination port of the data packet to complete the transformation of the DHCP Advertise packet, and finally send it back to the virtual server port.
[0133] ④
[0134] table=1,priority=1,in_port={vm_port},udp6,dhcp_type=3,actions=load:dhcp_reply,mod_dl_src:{bridge_mac},mod_dl_dst:{vm _port_mac},mod_nw_src:{bridge_ip},mod_nw_dst:{vm_ip},mod_tp_src:547,mod_tp_dst:546,mod_dhcp_type:7,output:{vm_port}.
[0135] The received Request request is the same as above, the Request part is replaced, the DHCP Reply packet is transformed, and finally sent back to the virtual server port.
[0136] ⑤
[0137] table=1,priority=1,in_port={vm_port},udp6,dhcp_type=5,actions=load:dhcp_reply,mod_dl_src:{bridge_mac},mod_dl_dst:{vm _port_mac},mod_nw_src:{bridge_ip},mod_nw_dst:{vm_ip},mod_tp_src:547,mod_tp_dst:546,mod_dhcp_type:7,output:{vm_port}.
[0138] The received Renew request is the same as above, the Renew part is replaced, the DHCP Reply packet is transformed, and finally sent back to the virtual server port.
[0139] Figure 3 Schematic diagram of the process of requesting an IPv4 address for a virtual server provided in this application. Figure 3As shown, the process of the virtual server requesting an IPv4 address is as follows: steps 1-2-3-4-5-1-2-6-4-5. Specifically, the virtual machine broadcasts a DHCP Discover request (step 1)--> the vSwitch flow table matches the DHCP request and processes it (steps 2 and 3)--> the vSwitch sends the DHCP Offer packet back to the virtual machine (steps 4 and 5)--> the virtual machine broadcasts a DHCP Request request (step 1)--> the vSwitch flow table matches the DHCP request and processes it (steps 2 and 6)--> the vSwitch sends the DHCP ACK packet back to the virtual machine (steps 4 and 5)--> the virtual machine successfully obtains an IPv4 address.
[0140] The process of renewing the IPv4 address of the virtual machine: steps 1-2-6-4-5.
[0141] The virtual machine broadcasts a DHCP Request (step 1) --> the vSwitch flow table matches the DHCP request and processes it (steps 2 and 6) --> the vSwitch sends a DHCP ACK packet back to the virtual machine (steps 4 and 5) --> the virtual machine successfully renews its IPv4 address. In this application, a virtual server is also referred to as a virtual machine.
[0142] Figure 4 Schematic diagram of the process of requesting an IPv6 address for a virtual server provided in this application. Figure 4 As shown in the figure, the process of a virtual machine requesting an IPv6 address is as follows: Steps 1-2-3-4-5-1-2-6-4-5. Specifically: the virtual machine broadcasts a DHCP Solicit request (Step 1) --> the vSwitch flow table matches the DHCP request and processes it (Steps 2 and 3) --> the vSwitch sends a DHCP Advertise packet back to the virtual machine (Steps 4 and 5) --> the virtual machine broadcasts a DHCP Request request (Step 1) --> the vSwitch flow table matches the DHCP request and processes it (Steps 2 and 4) --> the vSwitch sends a DHCP Reply packet back to the virtual machine (Steps 4 and 5) --> the virtual machine successfully obtains an IPv6 address.
[0143] The process of renewing the IPv6 address of the virtual machine: steps 1-2-7-4-5.
[0144] The VM broadcasts a DHCP Renew request (step 1) --> the vSwitch flow table matches the DHCP request and processes it (steps 2 and 4) --> the vSwitch sends a DHCP Reply packet back to the VM (steps 4 and 5) --> the VM successfully renews its IPv6 address.
[0145] In this application, DHCP is translated as Dynamic Host Configuration Protocol, OpenFlow is translated as Virtual Switch Protocol, and vSwitch is translated as Virtual Machine Switch on Compute Node.
[0146] Figure 5 The schematic diagram of the structure of the DHCP message response device based on the OpenFlow protocol provided in this application includes:
[0147] The receiving module 51 is used to receive the DHCP request message broadcast by the virtual server;
[0148] A response module 52 is used to match the DHCP request message with a predefined OpenFlow protocol design flow table, modify the DHCP request message according to the matching result, obtain a modified first message and send it to the virtual server;
[0149] The receiving module 51 is further configured to receive a response message corresponding to the first message broadcast by the virtual server;
[0150] The response module 52 is also used to match the response message with a predefined OpenFlow protocol design flow table, modify the response message according to the matching result, and send the modified second message to the virtual server so that the virtual server obtains an IP address or renews the IP address.
[0151] The response module 52 is specifically configured to match the DHCP request message with a predefined OpenFlow protocol design flow table, and if it is determined that the DHCP request message is an IPv4 type request message, modify the DHCP Discover request message broadcast by the virtual server according to the matching result, obtain a DHCP Offer message and send it to the virtual server;
[0152] The receiving module 51 is specifically configured to receive a DHCP Request message broadcast by the virtual server;
[0153] The response module 52 is specifically used to match the DHCP Request message with a predefined OpenFlow protocol design flow table, modify the DHCP Request message according to the matching result, obtain a DHCPACK message and send it to the virtual server, so that the virtual server obtains an IPv4 address or renews an IPv4 address.
[0154] The response module 52 is specifically used to match the DHCP request message with a predefined OpenFlow protocol design flow table, and if it is determined that the DHCP request message is an IPv6 type request message, modify the DHCP Solicit request message broadcast by the virtual server according to the matching result to obtain a DHCP Advertise message and send it to the virtual server;
[0155] The receiving module 51 is specifically configured to receive a DHCP Request message broadcast by the virtual server;
[0156] The response module 52 is specifically configured to match the DHCP Request message with a predefined OpenFlow protocol design flow table, modify the DHCP Request message according to the matching result, obtain a DHCPReply message and send it to the virtual server, so that the virtual server obtains an IPv6 address.
[0157] The receiving module 51 is further configured to receive a DHCP Renew request message broadcast by the virtual server;
[0158] The response module 52 is further configured to match the DHCP Renew request message with a predefined OpenFlow protocol design flow table, modify the DHCP Renew request message according to the matching result, obtain a DHCP Reply message and send it to the virtual server, so that the virtual server renews the IPv6 address.
[0159] The response module 52 is specifically used to construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server for the received DHCP Discover request message, replace the content of the DHCP Discover request message part, modify the source mac address, source IPv4 address, and source port port of the DHCP Discover request message, complete the transformation of the DHCP Offer message and send it to the virtual server.
[0160] The response module 52 is specifically used to construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server for the received DHCP Request message, replace the content of the DHCP Request message part, modify the source mac address, source IPv4 address, and source port port of the DHCP Request message, complete the transformation of the DHCP ACK message and send it to the virtual server.
[0161] The response module 52 is specifically used to construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server for the received DHCP Solicit request message, replace the content of the DHCP Solicit request message part, modify the source mac address, source IPv6 address, and source port port of the DHCP Solicit request message, complete the transformation of the DHCP Advertise message and send it to the virtual server.
[0162] The response module 52 is further used to define numbers corresponding to IPv4 DHCP Message Type and IPv6 DHCP Message Type respectively; for modification of an IPv4 type request message, modify the number corresponding to the DHCP Message Type of the request message and the Message Type value of the request message; for modification of an IPv6 type request message, modify the Message Type value of the request message.
[0163] The present application also provides a virtual switch, such as Figure 6 As shown, it includes: a processor 301, a communication interface 302, a memory 303 and a communication bus 304, wherein the processor 301, the communication interface 302, and the memory 303 communicate with each other through the communication bus 304;
[0164] The memory 303 stores a computer program, and when the program is executed by the processor 301, the processor 301 executes any one of the above method steps.
[0165] The communication bus mentioned in the above virtual switch can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0166] The communication interface 302 is used for communication between the virtual switch and other devices.
[0167] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0168] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.
[0169] The present application also provides a computer storage readable storage medium, wherein the computer readable storage medium stores a computer program executable by a virtual switch, and when the program runs on the virtual switch, the virtual switch implements any of the above method steps when executed.
[0170] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0171] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A DHCP message response method based on OpenFlow protocol, characterized in that: The method comprises: The virtual switch in the computing node receives the DHCP request message broadcast by the virtual server; Match the DHCP request message with a predefined flow table designed for the OpenFlow protocol; if it is determined that the DHCP request message is an IPv4 type request message, modify the DHCP Discover request message broadcast by the virtual server according to the matching result, obtain a DHCP Offer message and send it to the virtual server; receive the DHCP Request message broadcast by the virtual server; match the DHCP Request message with a predefined flow table designed for the OpenFlow protocol, modify the DHCP Request message according to the matching result, obtain a DHCP ACK message and send it to the virtual server, so that the virtual server obtains an IPv4 address or renews an IPv4 address; If it is determined that the DHCP request message is an IPv6 type request message, modify the DHCP Solicit request message broadcast by the virtual server according to the matching result to obtain a DHCP Advertise message and send it to the virtual server; receive the DHCP Request request message broadcast by the virtual server; match the DHCP Request request message with a predefined OpenFlow protocol design flow table, modify the DHCP Request request message according to the matching result, obtain a DHCP Reply message and send it to the virtual server, so that the virtual server obtains an IPv6 address; The method further comprises: Define numbers corresponding to IPv4 DHCP Message Type and IPv6 DHCP Message Type respectively; for modification of an IPv4 type request message, modify the number corresponding to the DHCP Message Type of the request message and the Message Type value of the request message; for modification of an IPv6 type request message, modify the MessageType value of the request message.
2. The method according to claim 1, characterized in that The method further comprises: Receive a DHCP Renew request message broadcast by the virtual server, match the DHCP Renew request message with a predefined OpenFlow protocol design flow table, modify the DHCP Renew request message according to the matching result, obtain a DHCP Reply message and send it to the virtual server, so that the virtual server renews the IPv6 address.
3. The method according to claim 1, characterized in that The modifying of the DHCP Discover request message broadcast by the virtual server according to the matching result includes: For the received DHCP Discover request message, construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server, replace the content of the DHCP Discover request message part, modify the source mac address, source IPv4 address, and source port port of the DHCP Discover request message, complete the transformation of the DHCP Offer message and send it to the virtual server.
4. The method according to claim 1, characterized in that The modifying the DHCP Request message according to the matching result includes: For the received DHCP Request message, construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server, replace the content of the DHCP Request message part, modify the source mac address, source IPv4 address, and source port port of the DHCPRequest message, complete the transformation of the DHCP ACK message and send it to the virtual server.
5. The method according to claim 1, characterized in that The modifying of the DHCP Solicit request message broadcast by the virtual server according to the matching result includes: For the received DHCP Solicit request message, construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server, replace the content of the DHCP Solicit request message part, modify the source mac address, source IPv6 address, and source port port of the DHCP Solicit request message, complete the transformation of the DHCP Advertise message and send it to the virtual server.
6. A DHCP message response device based on OpenFlow protocol, characterized in that: A virtual switch applied to a computing node, the device comprising: A receiving module, used for receiving a DHCP request message broadcast by a virtual server; The response module is used to match the DHCP request message with a predefined flow table designed for the OpenFlow protocol. If it is determined that the DHCP request message is an IPv4 type request message, the DHCP Discover request message broadcast by the virtual server is modified according to the matching result to obtain a DHCP Offer message and send it to the virtual server. The receiving module is also used to receive the DHCP Request message broadcast by the virtual server. The response module is also used to match the DHCP Request message with a predefined flow table designed for the OpenFlow protocol, modify the DHCP Request message according to the matching result, obtain a DHCP ACK message and send it to the virtual server, so that the virtual server obtains an IPv4 address or renews an IPv4 address. The responding module is further configured to, if it is determined that the DHCP request message is an IPv6 type request message, modify the DHCP Solicit request message broadcast by the virtual server according to the matching result, obtain a DHCP Advertise message and send it to the virtual server; the receiving module is further configured to receive the DHCP Request request message broadcast by the virtual server; the responding module is further configured to match the DHCP Request request message with a predefined OpenFlow protocol design flow table, modify the DHCP Request request message according to the matching result, obtain a DHCP Reply message and send it to the virtual server, so that the virtual server obtains an IPv6 address; The response module is further used to define numbers corresponding to IPv4 DHCP Message Type and IPv6 DHCP Message Type respectively; for modification of an IPv4 type request message, modify the number corresponding to the DHCP Message Type of the request message and the Message Type value of the request message; for modification of an IPv6 type request message, modify the Message Type value of the request message.
7. The device according to claim 6, characterized in that The receiving module is further used to receive the DHCP Renew request message broadcast by the virtual server; The response module is further used to match the DHCP Renew request message with a predefined OpenFlow protocol design flow table, modify the DHCP Renew request message according to the matching result, obtain a DHCP Reply message and send it to the virtual server, so that the virtual server renews the IPv6 address.
8. The device according to claim 6, characterized in that The response module is specifically used to construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server for the received DHCPDiscover request message, replace the content of the DHCP Discover request message part, modify the source mac address, source IPv4 address, and source port port of the DHCP Discover request message, complete the transformation of the DHCP Offer message and send it to the virtual server.
9. The device according to claim 6, characterized in that The response module is specifically used to construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server for the received DHCPRequest message, replace the content of the DHCPRequest message part, modify the source mac address, source IPv4 address, and source port port of the DHCPRequest message, complete the transformation of the DHCP ACK message and send it to the virtual server.
10. The device according to claim 6, characterized in that The response module is specifically used to construct the DHCP configuration content to be returned to the virtual server according to the DHCP configuration of the virtual server for the received DHCP Solicit request message, replace the content of the DHCP Solicit request message part, modify the source mac address, source IPv6 address, and source port port of the DHCP Solicit request message, complete the transformation of the DHCP Advertise message and send it to the virtual server.
11. A virtual switch, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 5 when executing a program stored in a memory.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method and device for allocating IP addresses to virtual machines in software defined network
CN104283983A
Method and equipment for providing DHCP service
CN108933844A
Method and device for configuring ipv6 transition technique on cpe
WO2014056441A1