An improved method for creating external network ports when creating a virtual router

The method of checking IP availability, pre-allocating resources, and broadcasting notifications for virtual router creation addresses IP resource insufficiencies, ensuring smooth network connectivity and user-friendly operation.

CN116846825BActive Publication Date: 2025-04-18XIAN LEIFENG ELECTRONIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310902342.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-21
Publication Date
2025-04-18
Estimated Expiration
2043-07-21

AI Technical Summary

Technical Problem

Existing distributed virtual routers in OpenStack platforms inefficiently manage external network port creation during initial setup, leading to potential IP resource shortages and failures, which can prevent virtual machines from connecting to external networks without proper failure notifications.

Method used

Implement a method that includes checking available IP resources, pre-allocating needed IP addresses, broadcasting creation notifications, and creating ports using pre-allocated IPs to ensure sufficient IP resources are available before initiating virtual router creation.

Benefits of technology

Ensures adequate IP resources are allocated, preventing port creation failures and providing seamless network connectivity for virtual machines, enhancing user experience by avoiding IP conflicts and ensuring timely failure notifications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116846825B_ABST
    Figure CN116846825B_ABST
Patent Text Reader

Abstract

The invention discloses an improved method for creating an external network port when creating a virtual router, and specifically relates to the technical field of virtual routers. The method comprises the following steps: a user initiates a request for creating a distributed virtual router; an IP sufficient module is established to query whether the number of currently idle IPs in the external network is sufficient; an IP pre-occupancy module is established to pre-occupy the external network IP resources according to the number of IP resources required for this creation; a virtual router is created by using a native external network of a cloud computing platform; a broadcast notification module is established to send a notification of creating a distributed virtual router to native three-layer network agents of all nodes by using a message queue; and the four technical improvements can solve the problem that insufficient or occupied external network IP resources cause some computing nodes to fail to create FIP ports and SNAT ports and there is no failure notification, thereby causing other node virtual machines to be unable to connect to the external network through the virtual router, thereby providing a more friendly user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of virtual routers, and in particular to an improved method for creating an external network port when creating a virtual router. Background Art

[0002] As a mainstream open source cloud computing management platform, openstack provides users with good basic services in network virtualization. The three-layer network based on distributed virtual routers provides users with a safe and flexible network experience.

[0003] However, the native distributed virtual router follows the principle of "saving as much as possible" when creating ports for the external network when it is newly created. That is, it only creates FIP ports and SNAT ports on one computing node, and does not create them on other computing nodes first. They are implicitly created in the background after the internal network is added and the virtual machines exist.

[0004] The above method places higher demands on the user's network planning capabilities. It is very easy for the external network IP resources to be insufficient or occupied, resulting in the failure of some computing nodes to create FIP ports or SNAT ports without failure notification, which in turn causes the virtual machines on these computing nodes to be unable to connect to the external network through the virtual router, which is extremely unfriendly to users.

[0005] Therefore, it is necessary for the present application to provide an improved method for creating an external network port when creating a virtual router to solve the above problems. Summary of the invention

[0006] The purpose of the present invention is to provide an improved method for creating an external network port when creating a virtual router, so as to solve the above-mentioned shortcomings in the technology.

[0007] In order to achieve the above object, the present invention provides the following technical solution: an improved method for creating an external network port when creating a virtual router, comprising the following steps:

[0008] S1. The user initiates a request to create a distributed virtual router;

[0009] S2. Establish an IP sufficient module to query whether the number of idle IPs in the external network is sufficient;

[0010] S3, establish an IP pre-occupancy module to pre-occupy external network IP resources according to the number of IP resources required for this creation;

[0011] S4. Create a virtual router using the native external network of the cloud computing platform;

[0012] S5. Establish a broadcast notification module, and use the message queue to send a notification of creating a distributed virtual router to the native three-layer network agent of all nodes;

[0013] S6. Establish a routing port creation module, and call the routing port creation module according to the notification of creating a distributed virtual router received by the native three-layer network agent;

[0014] S7. The routing port creation module creates all ports required by the virtual router according to the pre-occupied IP addresses.

[0015] Preferably, in S2, the IP sufficiency module determines whether the external network IP resources are sufficient by calculating the number of nodes; if not, failure is returned.

[0016] Preferably, when the number of nodes is calculated to determine whether the number of external network IP resources is sufficient, the specific steps are as follows:

[0017] S21, initiate a request to query the number of computing nodes to the external network, and obtain the number of computing nodes host_num;

[0018] S22, initiate a request to query the number of available network IPs to the external network, and obtain the number of free IPs in the external network network_free_i p_num and the number of free IPs in the subnet subnet_free_ip_num;

[0019] S23, determine whether the number of free IP addresses in the external network, network_free_ip_num, is less than or equal to 0. If so, return that the number of external network IP resources is insufficient; otherwise, proceed to step S24;

[0020] S24, initiating a query to the external network for the existing fip ports in the current external network, and obtaining the number of fip_agent_gw_ports_num, wherein the fip port refers to the network port associated with the floating ip;

[0021] S25, determine whether the number of free IP addresses in the external network network_free_ip_num is less than the number of external network IP resources required for this creation, the number of external network IP resources required for this creation = host_num-fip_agent_gw_ports_num+X, where X represents the number of SNAT external gateways. If yes, return that the number of external network IP resources is insufficient, where the number of SNAT external gateways represents the external network interface of the SNAT function configured on the virtual router; otherwise, continue to step S26;

[0022] S26. Determine whether the number of free subnet IP addresses, subnet_free_ip_num, is less than the number of computing nodes, host_num. If so, return that the number of external network IP resources is insufficient; otherwise, return that the number of external network IP resources is sufficient.

[0023] Preferably, in S3, the external network IP resources are pre-occupied according to the number of IP resources required for this creation, and the specific steps are as follows:

[0024] S31, initiate a request to query the number of computing nodes to the external network, and obtain the number of computing nodes host_num;

[0025] S32, initiating a query to the external network about the existing fip ports in the current external network, and obtaining the number of fip_agent_gw_ports_num;

[0026] S33, calculate host_num-fip_agent_gw_ports_num+X to get the number of external network IP resources needed for this creation, need_ip_num;

[0027] S34, cyclically initiate an IP allocation request to the external network, the number of cycles is need_ip_num;

[0028] S35. Mark the allocated IP resources as pre-occupied in the database.

[0029] Preferably, in S5, the broadcast notification module uses a message queue to send a notification of creating a distributed virtual router to the native three-layer network agent of all nodes, and the specific steps are as follows:

[0030] S51, configure message queue broadcast parameters;

[0031] S52: Call the message queue to send a message.

[0032] Preferably, in S7, the routing port creation module creates all ports required by the virtual router according to the pre-occupied IP address, and the specific steps are as follows:

[0033] S71, check whether the SNAT port already exists, if yes, jump to step S74, otherwise, continue to step S72;

[0034] S72, setting the port attribute to the SNAT port, initiating a routing port creation request to the external network, the external network determining whether the received request is a routing port creation request, if the received request is a routing port creation request, querying an IP address marked as a pre-occupied state in the database, and creating an outbound port;

[0035] S73. Create a local SNAT network namespace and configure related routing tables and network rules;

[0036] S74, check whether the fip port already exists, if yes, exit, otherwise continue to step S75;

[0037] S75, setting the port attribute to a fip port, initiating a routing port creation request to the external network, the external network determining whether the received request is a routing port creation request, if the received request is a routing port creation request, querying an IP address marked as a pre-occupied state in the database, and creating an outbound port;

[0038] S76. Create a local fip port network namespace and configure related routing tables and network rules.

[0039] In the above technical solution, the technical effects and advantages provided by the present invention are:

[0040] The module for judging whether there are enough IPs can determine whether the external network IP resources are sufficient based on the number of computing nodes. If the IP resources are insufficient, it will directly return failure, which has better interactivity.

[0041] The IP pre-occupancy module can be used to pre-occupy external network IP resources to avoid IP resource pre-occupancy and conflicts during the period of creating routes.

[0042] Through the broadcast notification module, the notification of creating a distributed virtual router can be sent to all nodes in a broadcast form based on the existing message queue mechanism, so that all nodes can take further actions to create a distributed virtual router;

[0043] By adding a routing port creation module to the computing node, all external network ports required for routing can be created using the IP resources pre-occupied in the above IP pre-occupancy module;

[0044] In summary, the problem that some computing nodes fail to create FIP ports and SNAT ports due to insufficient or occupied external network IP resources and there is no failure notification, which in turn causes other node virtual machines to be unable to connect to the external network through the virtual router can be solved, providing a more user-friendly experience.

[0045] In this application, SNAT refers to source address translation technology, which is a mature network technology for realizing multiple internal IPs sharing the same external IP to connect to the external network.

[0046] The fip port is an additional port created in openstack to connect the internal and external networks using a floating IP address. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0048] Figure 1 is a system block diagram of the present invention;

[0049] Figure 2 It is a flow chart of the scheme of the present invention;

[0050] Figure 3 Is the module flow chart of whether the IP of the present invention is sufficient?

[0051] Figure 4 It is the flow chart of the IP pre-occupancy module of the present invention;

[0052] Figure 5 A module flow chart is created for the routing port of the present invention. DETAILED DESCRIPTION

[0053] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings.

[0054] The present invention provides Figure 1-5 The improved method for creating an external network port when creating a virtual router includes the following steps:

[0055] S1. The user initiates a request to create a distributed virtual router;

[0056] S2. Establish an IP sufficient module to query whether the number of idle IPs in the external network is sufficient;

[0057] S3, establish an IP pre-occupancy module to pre-occupy external network IP resources according to the number of IP resources required for this creation;

[0058] S4, using the native external network of the cloud computing platform (i.e., openstack) to create a virtual router;

[0059] S5. Establish a broadcast notification module, and use the message queue to send a notification of creating a distributed virtual router to the native three-layer network agent of all nodes;

[0060] S6. Establish a routing port creation module, and call the routing port creation module according to the notification of creating a distributed virtual router received by the native three-layer network agent;

[0061] S7. The routing port creation module creates all ports required by the virtual router according to the pre-occupied IP addresses.

[0062] Specifically, in S2, the IP sufficiency module determines whether the external network IP resources are sufficient by calculating the number of nodes; if not, it returns failure.

[0063] Reference Figure 3 , when calculating the number of nodes to determine whether the number of external network IP resources is sufficient, the specific steps are as follows:

[0064] S21, initiate a request to query the number of computing nodes to the external network, and obtain the number of computing nodes host_num;

[0065] S22, initiate a request to query the number of available network IPs to the external network, and obtain the number of free IPs in the external network network_free_i p_num and the number of free IPs in the subnet subnet_free_ip_num;

[0066] S23, determine whether the number of free IP addresses in the external network, network_free_ip_num, is less than or equal to 0. If so, return that the number of external network IP resources is insufficient; otherwise, proceed to step S24;

[0067] S24, initiating a query to the external network for the existing fip ports in the current external network, and obtaining the number of fip_agent_gw_ports_num, wherein the fip port refers to the network port associated with the floating ip;

[0068] S25, determine whether the number of free IP addresses of the external network network_free_ip_num is less than the number of external network IP resources required for this creation, the number of external network IP resources required for this creation = host_num-fip_agent_gw_ports_num+X, where X represents the number of SNAT external gateways. If yes, return that the number of external network IP resources is insufficient, where the number of SNAT external gateways represents the external network interface or port of the SNAT function configured on the virtual router. This gateway is responsible for performing source address translation on the traffic from the internal network and then sending it to the external network; otherwise, continue to step S26;

[0069] S26. Determine whether the number of free subnet IP addresses, subnet_free_ip_num, is less than the number of computing nodes, host_num. If so, return that the number of external network IP resources is insufficient; otherwise, return that the number of external network IP resources is sufficient.

[0070] Reference Figure 4 In S3, the external network IP resources are pre-occupied according to the number of IP resources required for this creation. The specific steps are as follows:

[0071] S31, initiate a request to query the number of computing nodes to the external network, and obtain the number of computing nodes host_num;

[0072] S32, initiating a query to the external network about the existing fip ports in the current external network, and obtaining the number of fip_agent_gw_ports_num;

[0073] S33, calculate host_num-fip_agent_gw_ports_num+X to get the number of external network IP resources needed for this creation, need_ip_num;

[0074] S34, cyclically initiate an IP allocation request to the external network, the number of cycles is need_ip_num;

[0075] S35. Mark the allocated IP resources as being in pre-occupied state in the database.

[0076] Preferably, in S5, the broadcast notification module uses a message queue to send a notification of creating a distributed virtual router to the native three-layer network agent of all nodes, and the specific steps are as follows:

[0077] S51, configure message queue broadcast parameters;

[0078] S52: Call the message queue to send a message.

[0079] Reference Figure 5 In S7, the routing port creation module creates all the ports required by the virtual router according to the pre-occupied IP address. The specific steps are as follows:

[0080] S71, check whether the SNAT port already exists, if yes, jump to step S74, otherwise, continue to step S72;

[0081] S72, setting the port attribute to the SNAT port, initiating a routing port creation request to the external network, the external network determining whether the received request is a routing port creation request, if the received request is a routing port creation request, querying an IP address marked as a pre-occupied state in the database, and creating an outbound port;

[0082] S73. Create a local SNAT network namespace and configure related routing tables and network rules;

[0083] S74, check whether the fip port already exists, if yes, exit, otherwise continue to step S75;

[0084] S75, setting the port attribute to a fip port, initiating a routing port creation request to the external network, the external network determining whether the received request is a routing port creation request, if the received request is a routing port creation request, querying an IP address marked as a pre-occupied state in the database, and creating an outbound port;

[0085] S76. Create a local fip port network namespace and configure related routing tables and network rules.

[0086] Through the above technical solution:

[0087] When in use, the module for judging whether there are enough IP resources can determine whether there are enough external network IP resources according to the number of computing nodes. If there are insufficient IP resources, it will directly return failure, which has better interactivity.

[0088] The IP pre-occupancy module can be used to pre-occupy external network IP resources to avoid IP resource pre-occupancy and conflicts during the period of creating routes.

[0089] Through the broadcast notification module, the notification of creating a distributed virtual router can be sent to all nodes in a broadcast form based on the existing message queue mechanism, so that all nodes can take further actions to create a distributed virtual router;

[0090] By adding a routing port creation module to the computing node, all external network ports required for routing can be created using the IP resources pre-occupied in the above IP pre-occupancy module;

[0091] In summary, through the four technical improvements of the present invention, the problem that some computing nodes fail to create FIP ports and SNAT ports due to insufficient or occupied external network IP resources and there is no failure notification, which in turn causes other node virtual machines to be unable to connect to the external network through the virtual router can be solved, providing a more user-friendly experience.

[0092] The above description is only by way of illustration of certain exemplary embodiments of the present invention. It is undoubted that those skilled in the art can modify the described embodiments in various ways without departing from the spirit and scope of the present invention. Therefore, the above drawings and descriptions are illustrative in nature and should not be construed as limiting the scope of protection of the claims of the present invention.

Claims

1. An improved method for creating an external network port when creating a virtual router, characterized in that: The following steps are involved: S1. The user initiates a request to create a distributed virtual router; S2. Establish an IP sufficient module to query whether the number of idle IPs in the external network is sufficient; S3, establish an IP pre-occupancy module to pre-occupy external network IP resources according to the number of IP resources required for this creation; S4. Create a virtual router using the native external network of the cloud computing platform; S5. Establish a broadcast notification module, and use the message queue to send a notification of creating a distributed virtual router to the native three-layer network agent of all nodes; S6. Establish a routing port creation module, and call the routing port creation module according to the notification of creating a distributed virtual router received by the native three-layer network agent; S7. The routing port creation module creates all ports required by the virtual router according to the pre-occupied IP addresses.

2. The improved method for creating an external network port when creating a virtual router according to claim 1, characterized in that: In S2, the IP Sufficient Module determines whether the external network IP resources are sufficient by calculating the number of nodes; if not, it returns failure.

3. The improved method for creating an external network port when creating a virtual router according to claim 2, characterized in that: When calculating the number of nodes to determine whether the number of external network IP resources is sufficient, the specific steps are as follows: S21, initiate a request to query the number of computing nodes to the external network, and obtain the number of computing nodes host_num; S22, initiate a request to query the number of available network IPs to the external network, and obtain the number of free IPs in the external network network_free_i p_num and the number of free IPs in the subnet subnet_free_ip_num; S23, determine whether the number of free IP addresses in the external network, network_free_ip_num, is less than or equal to 0. If so, return that the number of external network IP resources is insufficient; Otherwise, continue to step S24; S24, initiating a query to the external network for the existing fip ports in the current external network, and obtaining the number of fip_agent_gw_ports_num, wherein the fip port refers to the network port associated with the floating ip; S25, determine whether the number of free IP addresses in the external network network_free_ip_num is less than the number of external network IP resources required for this creation, the number of external network IP resources required for this creation = host_num-fip_agent_gw_ports_num+X, where X represents the number of SNAT external gateways. If yes, return that the number of external network IP resources is insufficient, where the number of SNAT external gateways represents the external network interface of the SNAT function configured on the virtual router; otherwise, continue to step S26; S26. Determine whether the number of free subnet IP addresses, subnet_free_ip_num, is less than the number of computing nodes, host_num. If so, return that the number of external network IP resources is insufficient; otherwise, return that the number of external network IP resources is sufficient.

4. The improved method for creating an external network port when creating a virtual router according to claim 1, characterized in that: In S3, the external network IP resources are pre-occupied according to the number of IP resources required for this creation. The specific steps are as follows: S31, initiate a request to query the number of computing nodes to the external network, and obtain the number of computing nodes host_num; S32, initiating a query to the external network for the existing fip ports in the current external network, and obtaining the number of fip_agent_gw_ports_num; S33, calculate host_num-fip_agent_gw_ports_num+X to get the number of external network IP resources needed for this creation, need_ip_num; S34, cyclically initiate an IP allocation request to the external network, the number of cycles is need_ip_num; S35. Mark the allocated IP resources as being in pre-occupied state in the database.

5. The improved method for creating an external network port when creating a virtual router according to claim 1, characterized in that: In S5, the broadcast notification module uses the message queue to send a notification of creating a distributed virtual router to the native three-layer network agent of all nodes. The specific steps are as follows: S51, configure message queue broadcast parameters; S52: Call the message queue to send a message.

6. The improved method for creating an external network port when creating a virtual router according to claim 4, characterized in that: In S7, the routing port creation module creates all the ports required by the virtual router according to the pre-occupied IP address. The specific steps are as follows: S71, check whether the SNAT port already exists, if yes, jump to step S74, otherwise, continue to step S72; S72, setting the port attribute to the SNAT port, initiating a routing port creation request to the external network, the external network determining whether the received request is a routing port creation request, if the received request is a routing port creation request, querying an IP address marked as a pre-occupied state in the database, and creating an outbound port; S73. Create a local SNAT network namespace and configure related routing tables and network rules; S74, check whether the fip port already exists, if yes, exit, otherwise continue to step S75; S75, setting the port attribute to a fip port, initiating a routing port creation request to the external network, the external network determining whether the received request is a routing port creation request, if the received request is a routing port creation request, querying an IP address marked as a pre-occupied state in the database, and creating an outbound port; S76. Create a local fip port network namespace and configure related routing tables and network rules.

Citation Information

Patent Citations

  • Port forwarding function test method and system based on cloud platform

    CN111371636A

  • Public cloud container instance creation method

    CN114422350A