DHCP relay function implementation method, device, program product and medium
By obtaining and optimizing the routing status of multiple groups of server Internet protocol addresses, and selecting the priority order for forwarding DHCP packets, it solves the network redundancy and inefficiency problems of the DHCP relay agent when the server address route is unreachable, and improves the reliability of the network. sex and efficiency.
Patent Information
- Application Number
- CN202410760975.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-06-13
AI Technical Summary
With existing DHCP relay agents, when the DHCP server address route is unreachable, the client needs to wait for timeout before selecting a backup server, resulting in network redundancy and inefficient DHCP packet processing.
By obtaining multiple groups of server Internet protocol addresses, use the preset trace route monitoring component to query the routing status and determine the type of relay forwarding scenario. If any route is unreachable, obtain the priority order and select the target server for unicast forwarding; if all routes If it is unreachable, it will not be relayed and forwarded to avoid redundant packets.
It reduces the impact of network failures on users, improves network reliability and stability, avoids unnecessary DHCP packet broadcasts, and improves network efficiency.
Smart Images

Figure CN118337688B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network communication technology, and in particular to a method, device, program product and medium for realizing a DHCP relay function. Background Art
[0002] The DHCP (Dynamic Host Configuration Protocol) relay function is to realize the message exchange between the client and the DHCP server. Figure 1 The following is a basic flow chart of DHCP relay. In the discovery phase (DHCP Discover), the DHCP relay switch converts the DHCP discovery message sent by the client in broadcast form into unicast and sends it to the DHCP server; in the offer phase (DHCP Offer), the DHCP server responds to the DHCP offer message and forwards it to the client through the DHCP relay switch; in the selection phase (DHCP Request), when the client receives the DHCP offer message sent by DHCP, it broadcasts the DHCP request message and forwards it to the DHCP server in unicast; in the confirmation phase (DHCP ACK), the DHCP server returns the DHCP confirmation response message to the client.
[0003] The basic function of the DHCP relay agent in the existing solution is to change the gateway address (GIADDR, Gateway IP Address) in the DHCP client discovery message to the primary address of the relay agent, and then forward it to the DHCP server. If the DHCP server address is unreachable, the client needs to wait for the DHCP relay (Relay) forwarding timeout before selecting the backup DHCP server address. Figure 2 The following is a schematic diagram of possible problems that may occur in DHCP relay. If multiple groups of DHCP server addresses are unreachable, it is necessary to wait for all the timeout times. In addition to wasting DHCP access efficiency, redundant DHCP unicasts are also sent to the network. Therefore, how to provide a solution to the above technical problems is a problem that technicians in this field need to solve. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a method, device, program product and medium for implementing the DHCP relay function, which can reduce network redundant DHCP packets and inefficient DHCP packet processing. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a method for implementing a dynamic host configuration protocol relay function, which is applied to a relay agent, comprising:
[0006] obtaining multiple sets of server Internet Protocol addresses configured for a Dynamic Host Configuration Protocol server;
[0007] Receiving a dynamic host configuration protocol discovery message broadcasted by a client device, and using a preset tracking route monitoring component to query the routing status corresponding to each of the plurality of groups of server Internet Protocol addresses;
[0008] Determine the relay forwarding scenario type currently corresponding to the relay agent according to the routing state;
[0009] If the relay forwarding scenario type is the first scenario type characterizing that any of the multiple groups of server Internet Protocol addresses are unreachable by any route, obtaining a priority order of the multiple groups of server Internet Protocol addresses, and determining a target server Internet Protocol address that meets a preset condition from the multiple groups of server Internet Protocol addresses based on the priority order, and then unicast forwarding the dynamic host configuration protocol discovery message to a target dynamic host configuration protocol server corresponding to the target server Internet Protocol address;
[0010] If the relay forwarding scenario type is the second scenario type indicating that all routes in the multiple groups of server Internet Protocol addresses are unreachable, relay forwarding is not performed.
[0011] Optionally, the process of obtaining multiple groups of server Internet Protocol addresses configured for the dynamic host configuration protocol server further includes:
[0012] A first gateway address is configured for the relay agent, and a priority configuration interface is constructed for the multiple groups of server Internet Protocol addresses.
[0013] Optionally, the unicast forwarding of the dynamic host configuration protocol discovery message to a target dynamic host configuration protocol server corresponding to the Internet Protocol address of the target server includes:
[0014] The second gateway address of the client device is obtained according to the dynamic host configuration protocol discovery message, and the second gateway address is replaced with the first gateway address, so as to unicast forward the dynamic host configuration protocol discovery message to a target dynamic host configuration protocol server corresponding to the target server Internet Protocol address according to the first gateway address.
[0015] Optionally, the obtaining the priority order of the multiple groups of server Internet Protocol addresses includes:
[0016] Obtaining configuration parameters input through the priority configuration interface, and determining the priority order of the plurality of groups of server Internet Protocol addresses according to the configuration parameters;
[0017] Or, the priority configuration interface detects a route tracking command sent based on a preset tracking route monitoring component, and determines the lifetime values corresponding to the multiple groups of server Internet Protocol addresses based on the route tracking command, so as to determine the priority order of the multiple groups of server Internet Protocol addresses based on the lifetime value.
[0018] Optionally, determining the survival time values corresponding to the multiple groups of server Internet Protocol addresses according to the route tracking command, so as to determine the priority order of the multiple groups of server Internet Protocol addresses according to the survival time values, includes:
[0019] Determining the survival time values corresponding to the plurality of groups of server Internet Protocol addresses according to the route tracking command, and sorting the survival time values to obtain a sorting result;
[0020] Based on the ranking result, the plurality of groups of server Internet Protocol addresses are assigned corresponding priorities from high to low in the order of the survival time values from small to large.
[0021] Optionally, after receiving the dynamic host configuration protocol discovery message broadcasted by the client device, the method further includes:
[0022] Determining a configuration method for configuring the priority order for the plurality of groups of server Internet Protocol addresses;
[0023] When the priority order is configured for the multiple groups of server Internet Protocol addresses using the first configuration method, determine whether the multiple groups of server Internet Protocol addresses can be obtained; if so, trigger the step of using the preset tracking route monitoring component to query the routing status corresponding to each of the multiple groups of server Internet Protocol addresses; if not, discard the dynamic host configuration protocol discovery message; wherein the first configuration method is a configuration method for inputting the configuration parameters through the priority configuration interface to configure the priority order;
[0024] When the priority order is configured for the multiple groups of server Internet Protocol addresses using the second configuration method, the size order of the lifetime values is queried, and then the step of using the preset tracking route monitoring component to query the routing status corresponding to each of the multiple groups of server Internet Protocol addresses is triggered based on the size order; wherein the second configuration method is a configuration method for determining the lifetime value according to the detected route tracking command through the priority configuration interface to configure the priority order.
[0025] Optionally, after receiving the dynamic host configuration protocol discovery message broadcasted by the client device, the method further includes:
[0026] Using a preset tracking route monitoring component, issuing a network control message protocol to the dynamic host configuration protocol server according to a first preset time period, and determining whether a network control message protocol response message returned by the dynamic host configuration protocol server is received;
[0027] If the network control message protocol response message returned by the dynamic host configuration protocol server is received, determining that the routing state corresponding to the current server Internet Protocol address is a reachable state;
[0028] If the network control message protocol response message returned by the dynamic host configuration protocol server is not received, it is determined that the routing state corresponding to the current server Internet Protocol address is an unreachable state.
[0029] Optionally, the method for implementing the dynamic host configuration protocol relay function further includes:
[0030] According to a second preset time period, the server Internet Protocol addresses corresponding to the reachable state and the unreachable state are respectively recorded in a preset database.
[0031] Optionally, the using a preset tracking route monitoring component to query the routing status corresponding to each of the plurality of groups of server Internet Protocol addresses includes:
[0032] The preset tracking route monitoring component is used to query the reachable status of the multiple groups of server Internet Protocol addresses and / or the unreachable status of the multiple groups of server Internet Protocol addresses from the preset database.
[0033] Optionally, the method for implementing the dynamic host configuration protocol relay function further includes:
[0034] The priorities corresponding to the plurality of groups of server Internet Protocol addresses are recorded in the preset database, and the priorities are matched with the routing states to obtain a matching result list.
[0035] Optionally, the using a preset tracking route monitoring component to query the routing status corresponding to each of the plurality of groups of server Internet Protocol addresses includes:
[0036] According to a third preset time period, using the matching result list to synchronize the status updates of the multiple groups of server Internet Protocol addresses to obtain current routing statuses corresponding to the multiple groups of server Internet Protocol addresses;
[0037] The preset tracking route monitoring component is used to query the current routing status corresponding to each of the multiple groups of server Internet Protocol addresses.
[0038] Optionally, after determining the relay forwarding scenario type currently corresponding to the relay agent according to the routing state, the method further includes:
[0039] If the relay forwarding scenario type is the first scenario type characterizing that any of the multiple groups of server Internet Protocol addresses are unreachable, obtaining a priority order of the multiple groups of server Internet Protocol addresses, and determining in sequence based on the priority order whether the routing states corresponding to the multiple groups of server Internet Protocol addresses are reachable states;
[0040] If the routing state corresponding to the current server Internet Protocol address is a reachable state, the current server Internet Protocol address is determined as the target server Internet Protocol address, and then the step of unicast forwarding the dynamic host configuration protocol discovery message to the target dynamic host configuration protocol server corresponding to the target server Internet Protocol address is triggered;
[0041] If the routing status corresponding to the current server Internet Protocol address is unreachable, jump to the step of querying the size order of the survival time values.
[0042] Optionally, determining the relay forwarding scenario type currently corresponding to the relay agent according to the routing state includes:
[0043] Obtain a first number of all the configured groups of server Internet Protocol addresses, obtain a second number of the groups of server Internet Protocol addresses corresponding to when the routing state is the reachable state, and obtain a third number of the groups of server Internet Protocol addresses corresponding to when the routing state is the unreachable state;
[0044] If the second number is not zero and the second number is less than the first number, determining that the relay forwarding scenario type is a first scenario type characterizing that any of the multiple groups of server Internet Protocol addresses are unreachable by any route;
[0045] If the third number is equal to the first number, it is determined that the relay forwarding scenario type is a second scenario type that indicates that all routes in the multiple groups of server Internet Protocol addresses are unreachable.
[0046] Optionally, if the relay forwarding scenario type is a second scenario type characterizing that all routes in the multiple groups of server Internet Protocol addresses are unreachable, then relay forwarding is not performed, including:
[0047] If the relay forwarding scenario type is the second scenario type indicating that all routes in the multiple groups of server Internet Protocol addresses are unreachable, no relay forwarding is performed and the dynamic host configuration protocol discovery message is discarded.
[0048] Optionally, the method for implementing the dynamic host configuration protocol relay function further includes:
[0049] If the relay forwarding scenario type is a third scenario type characterizing that there is no route unreachable in the multiple groups of server Internet Protocol addresses, obtain the priority order of the multiple groups of server Internet Protocol addresses, and determine the target server Internet Protocol address that meets the preset conditions from the multiple groups of server Internet Protocol addresses based on the priority order, and then unicast forward the dynamic host configuration protocol discovery message to the target dynamic host configuration protocol server corresponding to the target server Internet Protocol address.
[0050] Optionally, determining a target server Internet Protocol address that meets a preset condition from the multiple groups of server Internet Protocol addresses based on the priority order includes:
[0051] A server Internet Protocol address with the highest priority is selected from the multiple groups of server Internet Protocol addresses based on the priority order, and the server Internet Protocol address with the highest priority is determined as the target server Internet Protocol address.
[0052] Optionally, the method for implementing the dynamic host configuration protocol relay function further includes:
[0053] According to a fourth preset time period, monitoring the target server Internet Protocol address using the preset traceroute monitoring component;
[0054] When the monitored target server Internet Protocol address does not satisfy the preset condition, excluding the target server Internet Protocol address from the multiple groups of server Internet Protocol addresses to obtain an excluded server Internet Protocol address;
[0055] The server Internet Protocol address with the highest priority is re-determined from the excluded server Internet Protocol addresses based on the priority order, and the current server Internet Protocol address with the highest priority is determined as the new target server Internet Protocol address.
[0056] In a second aspect, the present application discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the method for implementing the aforementioned dynamic host configuration protocol relay function.
[0057] In a third aspect, the present application discloses an electronic device, comprising:
[0058] Memory for storing computer programs;
[0059] The processor is used to load and execute the computer program to implement the aforementioned method for implementing the dynamic host configuration protocol relay function.
[0060] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements a method for implementing the aforementioned dynamic host configuration protocol relay function.
[0061] The present application provides a method for implementing a dynamic host configuration protocol relay function, which is applied to a relay agent, including: obtaining multiple groups of server Internet Protocol addresses configured for a dynamic host configuration protocol server; receiving a dynamic host configuration protocol discovery message broadcasted by a client device, and using a preset tracking route monitoring component to query the routing status corresponding to each of the multiple groups of server Internet Protocol addresses; determining the relay forwarding scenario type currently corresponding to the relay agent according to the routing status; if the relay forwarding scenario type is a first scenario type characterizing that any route in the multiple groups of server Internet Protocol addresses is unreachable, obtaining the priority order of the multiple groups of server Internet Protocol addresses, and determining a target server Internet Protocol address that meets a preset condition from the multiple groups of server Internet Protocol addresses based on the priority order, and then unicasting the dynamic host configuration protocol discovery message to a target dynamic host configuration protocol server corresponding to the target server Internet Protocol address; if the relay forwarding scenario type is a second scenario type characterizing that all routes in the multiple groups of server Internet Protocol addresses are unreachable, no relay forwarding is performed.
[0062] The beneficial technical effect of the present application is: using a relay agent to pre-configure multiple groups of server Internet Protocol addresses for a dynamic host configuration protocol server, combined with a preset tracking route monitoring component, the availability of the dynamic host configuration protocol server can be quickly detected. On the one hand, when there is a first scenario type in which any route is unreachable in the multiple groups of server Internet Protocol addresses, in order to reduce the impact of network failures, other available servers will be selected as soon as possible according to the priority order of the multiple groups of server Internet Protocol addresses for unicast forwarding of the dynamic host configuration protocol discovery message, reducing the impact of network failures on users, allowing users to obtain the target server Internet Protocol address more quickly, thereby improving the reliability and stability of the network. On the other hand, when there is a second scenario type in which all routes are unreachable in the multiple groups of server Internet Protocol addresses, the dynamic host configuration protocol discovery message will not be processed, and relay forwarding will not be performed, thereby avoiding unnecessary broadcasts of dynamic host configuration protocol discovery messages, thereby reducing the release of redundant dynamic host configuration protocol packets to the network, thereby reducing the network burden and improving the efficiency of the network.
[0063] In addition, the present application provides a device, a computer program product, and a medium for implementing the dynamic host configuration protocol relay function, which correspond to the above-mentioned method for implementing the dynamic host configuration protocol relay function, and have the same effect as above. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0065] Figure 1 This is a basic flow chart of DHCP relay;
[0066] Figure 2 A schematic diagram of a possible problem that may occur in a DHCP relay disclosed in this application;
[0067] Figure 3 A flow chart of a method for implementing a dynamic host configuration protocol relay function disclosed in this application;
[0068] Figure 4 A schematic diagram of the relationship between modules related to a relay agent disclosed in this application;
[0069] Figure 5 A schematic diagram of a relay agent function in a first scenario type disclosed in this application;
[0070] Figure 6 A schematic diagram of a relay agent function in a second scenario type disclosed in this application;
[0071] Figure 7 A flowchart of a specific method for implementing the dynamic host configuration protocol relay function disclosed in this application;
[0072] Figure 8 A data flow chart for realizing a specific relay function disclosed in this application;
[0073] Fig. 9 A data flow chart for realizing a specific relay function disclosed in this application;
[0074] Fig.10 A schematic diagram of the structure of a device for implementing a dynamic host configuration protocol relay function disclosed in this application;
[0075] Fig.11 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0076] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0077] For ease of understanding, the following is a brief description of the terms used in this article.
[0078] 1. DHCP: It is a network protocol used to automatically configure the IP address and other related network configuration information of host devices on TCP (Transmission Control Protocol) / IP (Internet Protocol) networks. The main function of DHCP is to provide dynamically assigned IP addresses for computers, mobile devices, and other network devices without manually configuring the network parameters of each device. The following are some key features and functions of DHCP:
[0079] 1) IP address allocation: DHCP allows network administrators to configure a DHCP server to automatically assign IP addresses to devices connected to the network. When a device joins the network, it requests an IP address from the DHCP server, and the server assigns an available IP address to the device, thus avoiding IP address conflicts;
[0080] 2) Automatic configuration: DHCP can also assign other network configuration information, such as subnet mask, default gateway, DNS (Domain Name System) server and NTP (Network Time Protocol) server. This configuration information can be automatically applied to the device so that it can communicate and access the Internet correctly;
[0081] 3) Address pool management: A DHCP server usually manages a pool of IP addresses from which it assigns addresses to devices. The server keeps track of which addresses have been assigned to ensure that no address conflicts occur;
[0082] 4) Lease mechanism: IP addresses assigned by DHCP usually have a lease period. Before the lease period expires, the device will regularly request renewal from the DHCP server, effectively helping network administrators manage IP address resources;
[0083] 5) Reduce configuration work: DHCP greatly reduces the workload of network administrators to manually configure each device, especially in large networks, it makes network expansion and device addition easier;
[0084] 6) Support for mobile devices: DHCP supports mobile devices, such as laptops and smartphones, to automatically obtain appropriate IP addresses and configuration information when they are connected to different networks.
[0085] 2. DHCP Relay Agent: The main function is to forward DHCP messages between different network subnets to support client devices located in different subnets to obtain IP addresses and other network configuration information. DHCP RelayAgent is usually used in large networks where there are multiple subnets, and the DHCP server is usually located in a central location instead of one in each subnet. The following are the main roles and functions of DHCP Relay Agent:
[0086] 1) Message forwarding: When client devices are located in a different subnet from the DHCP server, they usually cannot communicate directly with the DHCP server because DHCP messages are sent in a broadcast form and cannot be propagated across subnets. DHCP RelayAgent acts as an intermediary, receiving DHCP request messages from client devices and forwarding these messages to DHCP servers located in different subnets;
[0087] 2) Maintain relay information: The DHCP Relay Agent adds information related to the source subnet to the forwarded DHCP message so that the DHCP server knows which subnet the client requested the address. This helps the server select the appropriate IP address pool and configuration information for the client;
[0088] 3) Broadcast to Unicast Conversion: DHCP messages are usually sent in broadcast form, but when crossing different subnets, they are converted by the DHCP Relay Agent into unicast messages to ensure that they only reach the DHCP server and do not flood the entire network;
[0089] 4) Simplify network configuration: DHCP Relay Agent simplifies network management because it allows a single DHCP server to be used on multiple subnets in the network, thus reducing the work of configuring and managing multiple DHCP servers;
[0090] 5) Support for mobile devices: When mobile devices roam from one subnet to another, DHCP RelayAgent can ensure that they can still obtain the appropriate IP address and configuration information without the need for reconfiguration.
[0091] 3. DHCP-Discovery packet: used to find available DHCP servers to obtain IP addresses and other network configuration information when a computer or other network device starts up. When a computer or device is first connected to the network or restarted, it usually does not know the location of available DHCP servers. By sending a DHCP Discovery broadcast request packet, it searches for any available DHCP server. The DHCP server will respond to the Discovery request on the network, so that the device can learn about at least one available server.
[0092] 4. DHCP-Offer packet: used to respond to DHCP Discovery request, provide available IP address and other network configuration information to DHCP client. The following is the main explanation and function of DHCP Offer packet:
[0093] 1) Respond to client requests: When the DHCP client sends a Discovery request, the DHCP server receives the request and generates a DHCP Offer packet as a response. This Offer packet contains the IP address assigned to the client and other related network configuration information;
[0094] 2) Provide IP address: The most important information in the DHCP Offer packet is an available IP address, which is assigned to the client by the DHCP server. This IP address is necessary for the client to communicate on the network;
[0095] 3) Provide other configuration information: In addition to the IP address, the DHCP Offer packet can also contain other network configuration information, such as subnet mask, gateway address, DNS server address, NTP server address, etc. This information enables the client to correctly configure its own network parameters;
[0096] 4) Lease time: DHCP Offer packets usually include a lease time, which indicates the period of time during which the IP address assigned to the client is valid. The client can use the assigned IP address during this period. Once the lease expires, the client must renew or release the IP address;
[0097] 5) Broadcast: DHCP Offer packets are usually sent in broadcast mode, because the client does not have a specific IP address at this time, and only broadcast messages can ensure that the client receives a response;
[0098] 6) Option fields: The DHCP Offer packet also contains various option fields, which can include other detailed information, such as DHCP server identification, lease time, router information, etc. The client can use these fields to better configure its own network environment.
[0099] 5. Traceroute: is a network diagnostic tool used to determine the path that a data packet takes from source to destination on a network and measure the delay of each hop. It tracks the routing path of a data packet by gradually increasing the TTL (Time To Live) value of the data packet and identifies the location of network delays and interruptions. It is designed to provide a fast, lightweight method so that network devices can quickly detect link interruptions or failures and immediately take appropriate measures, such as switching to an alternate path or disabling a faulty link, thereby reducing the impact of network failures on service availability. The following are the main features and explanations of the Traceroute tool:
[0100] 1) Sending packets hop by hop: Traceroute works by sending a series of packets to the target host, with the IP TTL value of each packet increasing from 1. TTL is one of the header fields of the IP packet, indicating the maximum number of routing hops that the packet is allowed to pass through in the network. The TTL value decreases by 1 for each router it passes through;
[0101] 2) Data packet arrives at the router: When a data packet passes through a router, if the TTL value is 0, the router will discard the data packet and send an ICMP (Internet Control Message Protocol) time exceeded message (Time Exceeded) to the source address of the data packet, so that the source host knows the IP address and hop count of the router where the data packet arrives;
[0102] 3) Recording packet transmission information: Traceroute records the IP address of the router that each packet arrives at, the response time, and the round-trip time of the packet. By gradually increasing the TTL value, Traceroute can record all delays and hops along the entire path from source to destination;
[0103] 4) Continue until the target host: Traceroute continues to increment the TTL value until the data packet reaches the target host and receives an ICMP response message from the target host, or reaches the predetermined maximum number of hops;
[0104] 5) Display results: Traceroute outputs each recorded hop and the corresponding router IP address, response time, and packet round-trip time to the user. This information can help users understand the delays and interruption locations on the network path.
[0105] Currently, for the DHCP Relay gateway address and DHCP server address pool of the DHCP Discover request message from the client, if the remote DHCP server address is unreachable, it will cause network interruption, resulting in redundant DHCP Discover forwarding and inefficient processing.
[0106] To this end, the present application provides an implementation solution for the Dynamic Host Configuration Protocol relay function, which can reduce network redundant DHCP packets and inefficient DHCP packet processing, and help administrators better manage network resources and services.
[0107] The embodiment of the present invention discloses a method for implementing a dynamic host configuration protocol relay function, which is applied to a relay agent, see Figure 3 As shown, the method includes:
[0108] Step S11: Acquire multiple groups of server Internet Protocol addresses configured for the Dynamic Host Configuration Protocol server.
[0109] In the embodiment of the present application, the relay agent (DHCP Relay) device will configure multiple groups of server Internet Protocol addresses (DHCP Server IP) for the Dynamic Host Configuration Protocol server (DHCP Server). One DHCP Server corresponds to one group of DHCP Server IPs, which is used to manage multiple groups of DHCP Server IPs through the relay agent. When a DHCP server is unavailable, it can immediately switch to other available DHCP servers, thereby improving the reliability and stability of the network.
[0110] It is understandable that the DHCP relay function will change the gateway address (GIADDR) in the DHCP client discovery message into the primary address of the relay agent and then forward it to the DHCP server during implementation. Therefore, the process of obtaining multiple groups of server Internet Protocol addresses configured for the Dynamic Host Configuration Protocol server also includes: configuring a first gateway address for the relay agent, and building a priority configuration interface for the multiple groups of server Internet Protocol addresses.
[0111] That is, after the process starts, the user configures the first gateway address of the DHCP relay agent and the IP address of the DHCP server. It should be pointed out that the IP address of the DHCP server has a certain priority, and its priority is operational. According to the priority order of the IP address of the DHCP server, the forwarding path of the discovery message (DHCP Discover) sent by the client can be determined in the subsequent execution process. Therefore, in the embodiment of the present application, a priority configuration interface is constructed for multiple groups of server Internet Protocol addresses. The operability of the priorities of multiple groups of server Internet Protocol addresses is achieved through the priority configuration interface.
[0112] Step S12: receiving the dynamic host configuration protocol discovery message broadcasted by the client device, and using the preset tracking route monitoring component to query the routing status corresponding to each of the plurality of groups of server Internet Protocol addresses.
[0113] In the discovery phase, that is, the phase when the DHCP client searches for a DHCP server, the DHCP client sends a DHCP Discover message in a broadcast mode because the client does not know the IP address of the server. Since the relay agent manages multiple groups of DHCP server IPs, after receiving the DHCP Discover packet broadcasted by the client device, it determines the target server Internet Protocol address from the multiple groups of DHCP Server IPs it manages, and then unicasts the DHCP Discover message to the corresponding target Dynamic Host Configuration Protocol server.
[0114] In the embodiment of the present application, a service is started on the relay device to check the routing status of each group of DHCP Server IP, that is, to judge the routing reachability of the DHCP Server IP. Specifically, a tracking route monitoring component Traceroute is set on the relay device, and each group of DHCP Server IP is checked through Traceroute. It can be understood that the Traceroute command can traverse all routers on the data packet transmission path by manipulating the TTL value of the independent Internet Control Message Protocol (ICMP) call message and observing the return information of the discarded message. Therefore, by presetting the tracking route monitoring component, it is possible to query the routing status corresponding to each of the multiple groups of server Internet Protocol addresses.
[0115] Step S13: Determine the relay forwarding scenario type currently corresponding to the relay agent according to the routing state.
[0116] In the embodiment of the present application, the current relay forwarding scenario is judged according to the routing status. It is understandable that by judging the routing status corresponding to each of the multiple groups of server Internet Protocol addresses, it is possible to determine whether there is a DHCP server address route unreachable in the multiple groups of server Internet Protocol addresses, and then determine the relay forwarding scenario currently corresponding to the relay agent according to whether there is a DHCP server address route unreachable.
[0117] Step S14: If the relay forwarding scenario type is the first scenario type that characterizes that any route in the multiple groups of server Internet Protocol addresses is unreachable, obtain the priority order of the multiple groups of server Internet Protocol addresses, and determine the target server Internet Protocol address that meets the preset conditions from the multiple groups of server Internet Protocol addresses based on the priority order, and then unicast forward the dynamic host configuration protocol discovery message to the target dynamic host configuration protocol server corresponding to the target server Internet Protocol address.
[0118] In a specific implementation manner, in order to avoid processing an unreachable DHCP Server IP, a first scenario type in which any of the multiple groups of server Internet Protocol addresses are unreachable by any route is described.
[0119] According to the above steps, since a priority configuration interface is constructed for multiple groups of server Internet Protocol addresses, the priority order of the multiple groups of server Internet Protocol addresses can be obtained through the priority configuration interface. Specifically, the configuration parameters input through the priority configuration interface are obtained, and the priority order of the multiple groups of server Internet Protocol addresses is determined according to the configuration parameters; or, the route tracking command sent by the preset tracking route monitoring component is detected through the priority configuration interface, and the survival time values corresponding to the multiple groups of server Internet Protocol addresses are determined according to the route tracking command, so as to determine the priority order of the multiple groups of server Internet Protocol addresses according to the survival time value.
[0120] It is understandable that the user can manually configure the priority through the priority configuration interface, or the priority can be passively determined by the Traceroute TTL (time to live value). When the user does not configure the priority order of multiple groups of server Internet Protocol addresses, the priority order of the multiple groups of server Internet Protocol addresses can be determined according to the TTL values corresponding to the multiple groups of server Internet Protocol addresses. In this way, flexibility can be provided according to the user's configuration to adapt to different network requirements, which allows network administrators to more flexibly manage and configure DHCP servers to meet the requirements of specific scenarios.
[0121] It should be pointed out that when the priority is passively determined based on the Traceroute TTL, the IP corresponding to the smallest TTL value is given the highest priority. Therefore, the priority order of multiple groups of server Internet Protocol addresses is determined by sorting according to the TTL value of each group of IP detected. Specifically, the survival time values corresponding to the multiple groups of server Internet Protocol addresses are determined according to the routing trace command, and the survival time values are sorted to obtain the sorting result; based on the sorting result, the multiple groups of server Internet Protocol addresses are assigned corresponding priorities from high to low in the order of the survival time values from small to large. Furthermore, the priority sorting results corresponding to the TTL values are recorded in the database for subsequent reference to the packet forwarding of the DHCP Client.
[0122] In an embodiment of the present application, after determining the priority order of multiple groups of server Internet Protocol addresses, a target server Internet Protocol address that meets a preset condition is determined from the multiple groups of server Internet Protocol addresses based on the priority order. In a feasible implementation, the preset condition may be that the route is reachable. That is, a server IP address that is reachable by a route is selected as the target server IP address on the basis of following the priority order. Then, a DHCPDiscover message is unicast forwarded to the target DHCP server corresponding to the target server IP address.
[0123] In addition, according to the aforementioned steps, it can be known that the DHCP relay function will change the gateway address in the DHCP client discovery message to the primary address of the relay agent and then forward it to the DHCP server during the implementation process. Therefore, in an embodiment of the present application, after receiving the DHCP Discover message broadcasted by the client device, the DHCP relay agent will replace the gateway address of each DHCP Discover message sent. The gateway address of the client device is obtained through the DHCP Discover message, and then the gateway address of the client device is replaced with the primary address of the relay agent to perform unicast forwarding of the DHCP Discover message. Specifically, the second gateway address of the client device is obtained according to the Dynamic Host Configuration Protocol discovery message, and the second gateway address is replaced with the first gateway address, so that the Dynamic Host Configuration Protocol discovery message is unicast forwarded to the target Dynamic Host Configuration Protocol server corresponding to the Internet Protocol address of the target server according to the first gateway address.
[0124] Step S15: If the relay forwarding scenario type is the second scenario type indicating that all routes in the multiple groups of server Internet Protocol addresses are unreachable, then relay forwarding is not performed.
[0125] In another specific implementation manner, in order to avoid redundant DHCP Discover being published in the network, a second scenario type in which all routes in multiple groups of server Internet Protocol addresses are unreachable is described.
[0126] In an embodiment of the present application, if the relay forwarding scenario type is the second scenario type indicating that all routes in the multiple groups of server Internet Protocol addresses are unreachable, relay forwarding is not performed and the dynamic host configuration protocol discovery message is discarded.
[0127] The present application provides a method for implementing a dynamic host configuration protocol relay function, which is applied to a relay agent, including: obtaining multiple groups of server Internet Protocol addresses configured for a dynamic host configuration protocol server; receiving a dynamic host configuration protocol discovery message broadcasted by a client device, and using a preset tracking route monitoring component to query the routing status corresponding to each of the multiple groups of server Internet Protocol addresses; determining the relay forwarding scenario type currently corresponding to the relay agent according to the routing status; if the relay forwarding scenario type is a first scenario type characterizing that any route in the multiple groups of server Internet Protocol addresses is unreachable, obtaining the priority order of the multiple groups of server Internet Protocol addresses, and determining a target server Internet Protocol address that meets a preset condition from the multiple groups of server Internet Protocol addresses based on the priority order, and then unicasting the dynamic host configuration protocol discovery message to a target dynamic host configuration protocol server corresponding to the target server Internet Protocol address; if the relay forwarding scenario type is a second scenario type characterizing that all routes in the multiple groups of server Internet Protocol addresses are unreachable, no relay forwarding is performed.
[0128] The beneficial technical effect of the present application is: using a relay agent to pre-configure multiple groups of server Internet Protocol addresses for a dynamic host configuration protocol server, combined with a preset tracking route monitoring component, the availability of the dynamic host configuration protocol server can be quickly detected. On the one hand, when there is a first scenario type in which any route is unreachable in the multiple groups of server Internet Protocol addresses, in order to reduce the impact of network failures, other available servers will be selected as soon as possible according to the priority order of the multiple groups of server Internet Protocol addresses for unicast forwarding of the dynamic host configuration protocol discovery message, reducing the impact of network failures on users, allowing users to obtain the target server Internet Protocol address more quickly, thereby improving the reliability and stability of the network. On the other hand, when there is a second scenario type in which all routes are unreachable in the multiple groups of server Internet Protocol addresses, the dynamic host configuration protocol discovery message will not be processed, and relay forwarding will not be performed, thereby avoiding unnecessary broadcasts of dynamic host configuration protocol discovery messages, thereby reducing the release of redundant dynamic host configuration protocol packets to the network, thereby reducing the network burden and improving the efficiency of the network.
[0129] like Figure 4 The figure shows a schematic diagram of the relationship between the modules related to a relay agent. The data of each application is stored in the database, and each application can realize or complete one or more specific tasks. The relay agent can be used to configure multiple groups of DHCP server IP addresses. The combination of auxiliary addresses and Traceroute monitor components can quickly detect the availability of the DHCP server. This solution can currently be applied to the SONIC (Software for Open Networking in the Cloud) architecture, and can also be extended to other application network devices to realize the corresponding relay functions. Figure 5 The figure shows that when the relay agent is relaying, the relay forwarding scenario type is the first scenario type. That is, there are any unreachable routes in the multiple groups of server Internet Protocol addresses. If the DHCP Server IP of some groups is unreachable, the DHCP Relay module will skip the DHCP Server IP of these groups for forwarding. For example, Figure 5 There are two groups of DHCP server IPs in the figure. The oper_status of one group is down (i.e., unreachable), and the other group is up (i.e., reachable). The DHCP Relay module will select the group of DHCPServer IPs with oper_status up for forwarding. Figure 6 The figure shows that when the relay agent is relaying, the relay forwarding scenario type is the second scenario type. That is, all routes in multiple groups of server Internet Protocol addresses are unreachable. If the oper_status of all DHCP ServerIPs is down, the DHCP Relay module will not perform any processing to avoid redundant DHCPDiscover being published to the network.
[0130] With respect to step S13 of the previous embodiment, the method of determining the relay forwarding scenario type currently corresponding to the relay agent according to the routing state may also be implemented by executing the following steps:
[0131] Step 1: Obtain a first number of all the configured groups of server Internet Protocol addresses, obtain a second number of the groups of server Internet Protocol addresses corresponding to the reachable state when the routing state is the reachable state, and obtain a third number of the groups of server Internet Protocol addresses corresponding to the unreachable state when the routing state is the unreachable state;
[0132] Step 2: If the second number is not zero and the second number is less than the first number, determining that the relay forwarding scenario type is a first scenario type that indicates that any of the multiple groups of server Internet Protocol addresses are unreachable by any route;
[0133] Step three: If the third number is equal to the first number, determine that the relay forwarding scenario type is a second scenario type that indicates that all routes in the multiple groups of server Internet Protocol addresses are unreachable.
[0134] For the convenience of description, the above steps are combined for explanation.
[0135] In the embodiment of the present application, since multiple groups of DHCP server IPs are managed by a relay agent, and the routing status corresponding to each of the multiple groups of server Internet Protocol addresses is determined by using a preset tracking route monitoring component in the relay agent, therefore, in a feasible implementation, the current relay forwarding scenario is determined according to the number of routing statuses of the multiple groups of DHCP server IPs managed.
[0136] It can be understood that if the number of all configured groups of server Internet Protocol addresses is the first number, when the second number of reachable states of the routes is less than the first number, it means that there are unreachable routes in the groups of server Internet Protocol addresses, that is, not all server IP addresses are reachable, and the corresponding relay forwarding scenario type is the first scenario type in which any route is unreachable. When the third number of unreachable states of the routes is equal to the first number, it means that all routes in the groups of server Internet Protocol addresses are unreachable, that is, there are no server IP addresses that are reachable by routes in the groups of server Internet Protocol addresses, and the corresponding relay forwarding scenario type is the second scenario type.
[0137] The present application embodiment discloses a specific method for implementing the dynamic host configuration protocol relay function, see Figure 7 As shown, the method includes:
[0138] Step S21: Acquire multiple groups of server Internet Protocol addresses configured for the Dynamic Host Configuration Protocol server.
[0139] For a more specific processing procedure of the above step S21, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.
[0140] Step S22: receiving a dynamic host configuration protocol discovery message broadcasted by a client device, and determining a configuration method for configuring the priority order for the plurality of groups of server Internet Protocol addresses.
[0141] In the embodiment of the present application, the priorities of multiple groups of server Internet Protocol addresses can be manually configured or the priorities of multiple groups of server Internet Protocol addresses can be passively determined by Traceroute TTL to adapt to different network requirements. Therefore, after receiving the dynamic host configuration protocol discovery message broadcasted by the client device, the configuration method of the priority order is determined. In a feasible implementation method, the configuration method of the priority order is determined by judging whether there is a configuration parameter for user-configured priority. If there is a configuration parameter for user-configured priority, it means that the configuration method of the priority order is manually configured by the user; if there is no configuration parameter for user-configured priority, it means that the current configuration method is to determine the priority order according to the Traceroute TTL value.
[0142] Step S23: When the priority order is configured for the multiple groups of server Internet Protocol addresses using the first configuration method, determine whether the multiple groups of server Internet Protocol addresses can be obtained, and based on the determination result, trigger the step of using a preset tracking route monitoring component to query the routing status corresponding to each of the multiple groups of server Internet Protocol addresses.
[0143] In the embodiment of the present application, the first configuration method is a configuration method for configuring the priority order by inputting the configuration parameters through the priority configuration interface. That is, it is manually configured by the user. When the priority order is configured for the multiple groups of server Internet Protocol addresses using the first configuration method, it is further determined whether the multiple groups of server Internet Protocol addresses can be obtained based on the corresponding priority order.
[0144] If the multiple groups of server Internet Protocol addresses can be obtained, then further determine whether the corresponding routing status is reachable, that is, trigger the step of using the preset tracking route monitoring component to query the routing status corresponding to each of the multiple groups of server Internet Protocol addresses; if the multiple groups of server Internet Protocol addresses cannot be obtained, then discard the dynamic host configuration protocol discovery message. Figure 8 As shown, a branch with priority configuration corresponds to the above specific process.
[0145] Step S24: When the priority order is configured for the multiple groups of server Internet Protocol addresses using the second configuration method, the size order of the lifetime values is queried, and then based on the size order, the step of using the preset tracking route monitoring component to query the routing status corresponding to each of the multiple groups of server Internet Protocol addresses is triggered.
[0146] In the embodiment of the present application, the second configuration method is a configuration method for configuring the priority order by determining the lifetime value according to the detected route tracking command through the priority configuration interface, that is, determining the priority order of the IP address according to the sorting result of the TTL value. When the priority order is configured for the multiple groups of server Internet Protocol addresses using the second configuration method, it is further determined whether the corresponding routing status is reachable based on the corresponding priority order, that is, the step of using the preset tracking route monitoring component to query the routing status corresponding to each of the multiple groups of server Internet Protocol addresses is triggered based on the size order of the lifetime value. Figure 8 As shown, a branch without priority configuration corresponds to the above specific process.
[0147] Step S25: Determine the relay forwarding scenario type currently corresponding to the relay agent according to the routing state.
[0148] For a more specific processing procedure of the above step S25, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.
[0149] Step S26: If the relay forwarding scenario type is the first scenario type that characterizes that any route in the multiple groups of server Internet Protocol addresses is unreachable, obtain the priority order of the multiple groups of server Internet Protocol addresses, and based on the priority order, determine in turn whether the routing status corresponding to the multiple groups of server Internet Protocol addresses is a reachable status.
[0150] In the embodiment of the present application, for the first scenario type in which the relay forwarding scenario type is characterized by the presence of any unreachable route in the multiple groups of server Internet Protocol addresses, when determining the target server Internet Protocol address for unicast forwarding, it is determined by judging whether the route status corresponding to the multiple groups of server Internet Protocol addresses is a reachable state. According to the priority order, it is judged in turn whether the route status is a reachable state, and the server IP address in the unreachable state will be skipped and not forwarded.
[0151] Step S27: If the routing state corresponding to the current server Internet Protocol address is a reachable state, the current server Internet Protocol address is determined as the target server Internet Protocol address, and then the dynamic host configuration protocol discovery message is unicast forwarded to the target dynamic host configuration protocol server corresponding to the target server Internet Protocol address.
[0152] In the embodiment of the present application, it is determined in turn whether the routing state is a reachable state according to the priority order. If the routing state corresponding to the current server Internet Protocol address currently detected is a reachable state, it means that the current server Internet Protocol address can forward the DHCP Discover message. Therefore, the current server Internet Protocol address is determined as the target server Internet Protocol address, and then the DHCP Discover message is unicast forwarded to the target Dynamic Host Configuration Protocol server corresponding to the target server Internet Protocol address.
[0153] Step S28: If the routing status corresponding to the current server Internet Protocol address is unreachable, jump to the step of querying the size order of the lifetime value.
[0154] It is understandable that if the routing status corresponding to the current server Internet Protocol address is unreachable, the server IP will be skipped, and the TTL value order will be queried again, and the server Internet Protocol address with a reachable routing status will be queried according to the TTL value order.
[0155] Step S29: If the relay forwarding scenario type is the second scenario type indicating that all routes in the multiple groups of server Internet Protocol addresses are unreachable, then relay forwarding is not performed.
[0156] Among them, for the more specific processing process of the above step S29, reference can be made to the corresponding content disclosed in the above embodiment, which will not be repeated here.
[0157] The beneficial technical effect of this embodiment is: since the DHCP relay agent will replace the gateway address of each DHCP Discover message sent, the priority order can be determined according to the address order configured by the user or according to the Traceroute TTL. According to the priority order, the routing status of each group of DHCP server IPs corresponding to the query is selected, and the DHCP server IP with an operation status of up is selected as the target DHCP server for relay forwarding; if the status of all Traceroute DHCP servers is down, DHCP Relay forwarding is not performed and the DHCP Discover message from the client is directly discarded. It can be seen that the use of a relay agent to pre-configure multiple groups of server Internet Protocol addresses for the Dynamic Host Configuration Protocol server, combined with the preset traceroute monitoring component, can achieve rapid detection of the availability of the Dynamic Host Configuration Protocol server. On the one hand, when there is a first scenario type where any route is unreachable in multiple sets of server Internet Protocol addresses, in order to reduce the impact of network failures, other available servers will be selected as soon as possible according to the priority order of multiple sets of server Internet Protocol addresses for unicast forwarding of Dynamic Host Configuration Protocol discovery messages, reducing the impact of network failures on users and enabling users to obtain the target server Internet Protocol address more quickly, thereby improving network reliability and stability. On the other hand, when there is a second scenario type where all routes are unreachable in multiple sets of server Internet Protocol addresses, the Dynamic Host Configuration Protocol discovery message will not be processed and will not be relayed, thereby avoiding unnecessary broadcasts of Dynamic Host Configuration Protocol discovery messages and reducing the release of redundant Dynamic Host Configuration Protocol packets to the network, thereby reducing the network burden and improving network efficiency.
[0158] Based on the above embodiment, in a feasible implementation, in order to enable a DHCP server to be immediately switched to another available DHCP server when it is unavailable, the target server Internet Protocol address is monitored in the embodiment of the present application. Specifically, the following steps may be included:
[0159] Step 1: monitoring the target server Internet Protocol address using the preset traceroute monitoring component according to a fourth preset time period;
[0160] Step 2: When the monitored target server Internet Protocol address does not meet the preset condition, the target server Internet Protocol address is excluded from the multiple groups of server Internet Protocol addresses to obtain an excluded server Internet Protocol address;
[0161] Step three: re-determine the highest priority server Internet Protocol address from the excluded server Internet Protocol addresses based on the priority order, and determine the current highest priority server Internet Protocol address as the new target server Internet Protocol address.
[0162] In the embodiment of the present application, in order to reduce the impact of network failures, if a certain DHCP server is unavailable, the DHCP Relay module service will select other available servers for DHCP Discover unicast forwarding as soon as possible. A timer can be set to monitor the target server Internet Protocol address according to a certain time period. Once it is detected that the target server Internet Protocol address does not meet the preset conditions, the server Internet Protocol address that does not currently meet the preset conditions is excluded, and then a new target server Internet Protocol address for unicast forwarding is selected based on the priority order. In this way, when a certain DHCP server is unavailable, it can be immediately switched to other available DHCP servers, thereby improving the reliability and stability of the network, reducing the impact of network failures on users, and enabling users to obtain IP addresses more quickly.
[0163] Based on the above embodiment, in a feasible implementation manner, specifically, after receiving the dynamic host configuration protocol discovery message broadcasted by the client device, specifically, the following steps can be performed: Fig. 9 The process shown is implemented as follows Fig. 9 The method for implementing the dynamic host configuration protocol relay function may further include the following steps:
[0164] Step 1: using a preset tracking route monitoring component, publishing a network control message protocol to the dynamic host configuration protocol server according to a first preset time period, and determining whether a network control message protocol response message returned by the dynamic host configuration protocol server is received;
[0165] Step 2: If the network control message protocol response message returned by the dynamic host configuration protocol server is received, determining that the routing state corresponding to the current server Internet Protocol address is a reachable state;
[0166] Step 3: If the network control message protocol response message returned by the dynamic host configuration protocol server is not received, it is determined that the routing state corresponding to the current server Internet Protocol address is unreachable.
[0167] In the embodiment of the present application, at the beginning of the process, the user configures the gateway address of the DHCP relay agent and the IP address of the DHCP server; when the relay agent receives the broadcast packet sent by the client, it sets the tracking route component according to the gateway address configuration instruction therein, and uses the tracking route component to determine the target server IP address from multiple groups of server IP addresses.
[0168] Specifically, by setting a timer, ICMP is regularly issued according to the first preset time period to detect whether the routing status is reachable. It can be understood that when detecting the routing status through Traceroute, the Traceroute command will first send an ICMP echo request message with a TTL of 1. After this message leaves the source host, its TTL value will be reduced by 1 and become 0. When the first router receives this data packet, since TTL=0, the router will discard it and send a "TTLexceeded" message to the source host, so that the Traceroute command knows the existence of the router. Secondly, the TTL value is incremented, and the Traceroute command continues to send the next ICMP echo request message with a TTL of 2. When this message reaches the second-hop router, since TTL=2, the router will forward the message. If the message times out or is discarded during transmission, the Traceroute command will receive an ICMP timeout (TIME_EXCEEDED) response, thereby knowing the address of the second-hop router. The Traceroute command continues to increase the TTL value step by step until it reaches the target computer.
[0169] It can be seen that the routing state corresponding to the current server Internet Protocol address can be determined by whether the network control message protocol response message is obtained. If the network control message protocol response message returned by the dynamic host configuration protocol server is received, the routing state corresponding to the current server Internet Protocol address is set to a reachable state, and the corresponding TTL value is obtained. The current server Internet Protocol address with a reachable routing state and the corresponding TTL value are periodically written into the database for subsequent use by the relay agent.
[0170] Specifically, according to the second preset time period, the server Internet Protocol addresses corresponding to the reachable state and the unreachable state are recorded in a preset database respectively. Accordingly, the priorities corresponding to the multiple groups of server Internet Protocol addresses are recorded in the preset database, and the priorities are matched with the routing states to obtain a matching result list.
[0171] It should be noted that the status of Traceroute monitoring will be regularly updated to the DHCP Relay module through database synchronization. When a DHCP Discover broadcast packet is sent from the client, the DHCP Relay module will perform unicast forwarding of the DHCP Discover according to the priority order of the DHCP Server IP in the database.
[0172] Specifically, according to the third preset time period, the matching result list is used to synchronize the status updates of the multiple groups of server Internet Protocol addresses to obtain the current routing status corresponding to each of the multiple groups of server Internet Protocol addresses; and the preset tracking route monitoring component is used to query the current routing status corresponding to each of the multiple groups of server Internet Protocol addresses. The preset tracking route monitoring component is used to query the reachable status of the multiple groups of server Internet Protocol addresses and / or the unreachable status of the multiple groups of server Internet Protocol addresses from the preset database.
[0173] The beneficial technical effect of the present application is: using a relay agent to pre-configure multiple groups of server Internet Protocol addresses for a dynamic host configuration protocol server, combined with a preset tracking route monitoring component, the availability of the dynamic host configuration protocol server can be quickly detected. On the one hand, when there is a first scenario type in which any route is unreachable in the multiple groups of server Internet Protocol addresses, in order to reduce the impact of network failures, other available servers will be selected as soon as possible according to the priority order of the multiple groups of server Internet Protocol addresses for unicast forwarding of the dynamic host configuration protocol discovery message, reducing the impact of network failures on users, allowing users to obtain the target server Internet Protocol address more quickly, thereby improving the reliability and stability of the network. On the other hand, when there is a second scenario type in which all routes are unreachable in the multiple groups of server Internet Protocol addresses, the dynamic host configuration protocol discovery message will not be processed, and relay forwarding will not be performed, thereby avoiding unnecessary broadcasts of dynamic host configuration protocol discovery messages, thereby reducing the release of redundant dynamic host configuration protocol packets to the network, thereby reducing the network burden and improving the efficiency of the network.
[0174] Based on the above embodiment, in a feasible implementation manner, the embodiment of the present application is described for a scenario where there is no unreachable route. Specifically, the following steps may also be included:
[0175] If the relay forwarding scenario type is a third scenario type characterizing that there is no route unreachable in the multiple groups of server Internet Protocol addresses, obtain the priority order of the multiple groups of server Internet Protocol addresses, and determine the target server Internet Protocol address that meets the preset conditions from the multiple groups of server Internet Protocol addresses based on the priority order, and then unicast forward the dynamic host configuration protocol discovery message to the target dynamic host configuration protocol server corresponding to the target server Internet Protocol address.
[0176] It should be pointed out that if there is no IP address that is unreachable by routing in the relay forwarding scenario, then the DHCP Server IP with the highest priority will be selected according to the priority order for unicast forwarding of DHCP Discover. Specifically, the server Internet Protocol address with the highest priority is selected from the multiple groups of server Internet Protocol addresses based on the priority order, and the server Internet Protocol address with the highest priority is determined as the target server Internet Protocol address. Then, the Dynamic Host Configuration Protocol discovery message is unicast forwarded to the target Dynamic Host Configuration Protocol server corresponding to the target server Internet Protocol address.
[0177] The beneficial technical effect of this embodiment is that for the third scenario type where there is no route unreachable in multiple groups of server Internet Protocol addresses, unicast forwarding of messages can also be performed based on the priority order of multiple groups of server Internet Protocol addresses, which can improve the access efficiency of DHCP Relay Agent.
[0178] Correspondingly, the embodiment of the present application also discloses a device for implementing the dynamic host configuration protocol relay function, which is applied to the relay agent, see Fig.10 As shown, the device comprises:
[0179] An address acquisition module 11, used to acquire multiple groups of server Internet Protocol addresses configured for a dynamic host configuration protocol server;
[0180] The message receiving module 12 is used to receive the dynamic host configuration protocol discovery message broadcasted by the client device;
[0181] A routing status query module 13, used to query the routing status corresponding to each of the plurality of groups of server Internet Protocol addresses using a preset tracking routing monitoring component;
[0182] A scenario type determination module 14, configured to determine the relay forwarding scenario type currently corresponding to the relay agent according to the routing state;
[0183] The first processing module 15 is configured to obtain a priority order of the multiple groups of server Internet Protocol addresses if the relay forwarding scenario type is a first scenario type that indicates that any of the multiple groups of server Internet Protocol addresses are unreachable by any route, and determine a target server Internet Protocol address that meets a preset condition from the multiple groups of server Internet Protocol addresses based on the priority order, and then unicast forward the dynamic host configuration protocol discovery message to a target dynamic host configuration protocol server corresponding to the target server Internet Protocol address;
[0184] The second processing module 16 is configured to not perform relay forwarding if the relay forwarding scenario type is a second scenario type indicating that all routes in the multiple groups of server Internet Protocol addresses are unreachable.
[0185] Among them, for more specific working processes of the above-mentioned modules, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.
[0186] It can be seen that the above scheme of this embodiment is applied to the relay agent, including: obtaining multiple groups of server Internet Protocol addresses configured for the dynamic host configuration protocol server; receiving the dynamic host configuration protocol discovery message broadcasted by the client device, and using the preset tracking route monitoring component to query the routing status corresponding to each of the multiple groups of server Internet Protocol addresses; determining the relay forwarding scenario type currently corresponding to the relay agent according to the routing status; if the relay forwarding scenario type is the first scenario type characterizing that any route in the multiple groups of server Internet Protocol addresses is unreachable, then obtaining the priority order of the multiple groups of server Internet Protocol addresses, and determining the target server Internet Protocol address that meets the preset conditions from the multiple groups of server Internet Protocol addresses based on the priority order, and then unicast forwarding the dynamic host configuration protocol discovery message to the target dynamic host configuration protocol server corresponding to the target server Internet Protocol address; if the relay forwarding scenario type is the second scenario type characterizing that all routes in the multiple groups of server Internet Protocol addresses are unreachable, then no relay forwarding is performed.
[0187] The beneficial technical effect of the present application is: using a relay agent to pre-configure multiple groups of server Internet Protocol addresses for a dynamic host configuration protocol server, combined with a preset tracking route monitoring component, the availability of the dynamic host configuration protocol server can be quickly detected. On the one hand, when there is a first scenario type in which any route is unreachable in the multiple groups of server Internet Protocol addresses, in order to reduce the impact of network failures, other available servers will be selected as soon as possible according to the priority order of the multiple groups of server Internet Protocol addresses for unicast forwarding of the dynamic host configuration protocol discovery message, reducing the impact of network failures on users, allowing users to obtain the target server Internet Protocol address more quickly, thereby improving the reliability and stability of the network. On the other hand, when there is a second scenario type in which all routes are unreachable in the multiple groups of server Internet Protocol addresses, the dynamic host configuration protocol discovery message will not be processed, and relay forwarding will not be performed, thereby avoiding unnecessary broadcasts of dynamic host configuration protocol discovery messages, thereby reducing the release of redundant dynamic host configuration protocol packets to the network, thereby reducing the network burden and improving the efficiency of the network.
[0188] In a feasible implementation manner, the address acquisition module 11 further includes:
[0189] An address configuration module, used to configure a first gateway address for the relay agent;
[0190] The interface construction module is used to construct a priority configuration interface for the multiple groups of server Internet Protocol addresses.
[0191] In a feasible implementation manner, the first processing module 15 includes:
[0192] an address replacement module, configured to obtain a second gateway address of the client device according to the dynamic host configuration protocol discovery message, and replace the second gateway address with the first gateway address, so as to unicast forward the dynamic host configuration protocol discovery message to a target dynamic host configuration protocol server corresponding to the target server Internet Protocol address according to the first gateway address.
[0193] a first priority order determination module, configured to obtain configuration parameters input through the priority configuration interface, and determine the priority order of the plurality of groups of server Internet Protocol addresses according to the configuration parameters;
[0194] Or, a second priority order determination module is used to detect a route tracking command sent based on a preset tracking route monitoring component through the priority configuration interface, and determine the lifetime values corresponding to the multiple groups of server Internet Protocol addresses according to the route tracking command, so as to determine the priority order of the multiple groups of server Internet Protocol addresses according to the lifetime value.
[0195] In a feasible implementation manner, the second priority order determination module includes:
[0196] a sorting module, configured to determine the survival time values corresponding to the plurality of groups of server Internet Protocol addresses according to the route tracking command, and sort the survival time values to obtain a sorting result;
[0197] The priority assigning module is used to assign corresponding priorities from high to low to the multiple groups of server Internet Protocol addresses in order from small to large according to the survival time values based on the sorting result.
[0198] In a feasible implementation manner, the routing status query module 13 further includes:
[0199] A configuration mode determination module, used to determine a configuration mode for configuring the priority order for the plurality of groups of server Internet Protocol addresses;
[0200] The third processing module is used to determine whether the plurality of groups of server Internet Protocol addresses can be obtained when the priority order is configured for the plurality of groups of server Internet Protocol addresses using the first configuration method; if so, trigger the step of querying the routing status corresponding to each of the plurality of groups of server Internet Protocol addresses using the preset tracking route monitoring component; if not, discard the dynamic host configuration protocol discovery message; wherein the first configuration method is a configuration method of inputting the configuration parameters through the priority configuration interface to configure the priority order;
[0201] The fourth processing module is used to query the size order of the lifetime values when the priority order is configured for the multiple groups of server Internet Protocol addresses using the second configuration method, and then trigger the step of querying the routing status corresponding to each of the multiple groups of server Internet Protocol addresses using the preset tracking route monitoring component based on the size order; wherein the second configuration method is a configuration method for determining the lifetime value according to the detected route tracking command through the priority configuration interface to configure the priority order.
[0202] In a feasible implementation manner, the message receiving module 12 further includes:
[0203] a response message monitoring module, configured to use a preset tracking route monitoring component to publish a network control message protocol to the dynamic host configuration protocol server according to a first preset time period, and determine whether a network control message protocol response message returned by the dynamic host configuration protocol server is received;
[0204] The routing status determination module is used to determine that the routing status corresponding to the Internet Protocol address of the current server is a reachable status if the network control message protocol response message returned by the dynamic host configuration protocol server is received; and to determine that the routing status corresponding to the Internet Protocol address of the current server is an unreachable status if the network control message protocol response message returned by the dynamic host configuration protocol server is not received.
[0205] In a feasible implementation manner, the device for implementing the dynamic host configuration protocol relay function further includes:
[0206] The first recording module is used to record the server Internet Protocol addresses corresponding to the reachable state and the unreachable state into a preset database according to a second preset time period.
[0207] The second recording module is used to record the priorities corresponding to the multiple groups of server Internet Protocol addresses into the preset database, and match the priorities with the routing status to obtain a matching result list.
[0208] In a feasible implementation manner, the routing status query module 13 is specifically used to:
[0209] The preset tracking route monitoring component is used to query the reachable status of the multiple groups of server Internet Protocol addresses and / or the unreachable status of the multiple groups of server Internet Protocol addresses from the preset database.
[0210] In a feasible implementation manner, the routing status query module 13 includes:
[0211] An update synchronization module, configured to perform status update synchronization on the plurality of groups of server Internet Protocol addresses using the matching result list according to a third preset time period, so as to obtain current routing states corresponding to the plurality of groups of server Internet Protocol addresses respectively;
[0212] The current routing status query module is used to query the current routing status corresponding to each of the multiple groups of server Internet Protocol addresses using the preset tracking routing monitoring component.
[0213] In a feasible implementation manner, the first processing module 15 is specifically used to:
[0214] If the relay forwarding scenario type is the first scenario type characterizing that any of the multiple groups of server Internet Protocol addresses are unreachable, obtaining a priority order of the multiple groups of server Internet Protocol addresses, and determining in sequence based on the priority order whether the routing states corresponding to the multiple groups of server Internet Protocol addresses are reachable states;
[0215] If the routing state corresponding to the current server Internet Protocol address is a reachable state, the current server Internet Protocol address is determined as the target server Internet Protocol address, and then the step of unicast forwarding the dynamic host configuration protocol discovery message to the target dynamic host configuration protocol server corresponding to the target server Internet Protocol address is triggered;
[0216] If the routing status corresponding to the current server Internet Protocol address is unreachable, jump to the step of querying the size order of the survival time values.
[0217] In a feasible implementation manner, the scene type determination module 14 is specifically configured to:
[0218] Obtain a first number of all the configured groups of server Internet Protocol addresses, obtain a second number of the groups of server Internet Protocol addresses corresponding to when the routing state is the reachable state, and obtain a third number of the groups of server Internet Protocol addresses corresponding to when the routing state is the unreachable state;
[0219] If the second number is not zero and the second number is less than the first number, determining that the relay forwarding scenario type is a first scenario type characterizing that any of the multiple groups of server Internet Protocol addresses are unreachable by any route;
[0220] If the third number is equal to the first number, it is determined that the relay forwarding scenario type is a second scenario type that indicates that all routes in the multiple groups of server Internet Protocol addresses are unreachable.
[0221] In a feasible implementation manner, the second processing module 16 is specifically used to:
[0222] If the relay forwarding scenario type is the second scenario type indicating that all routes in the multiple groups of server Internet Protocol addresses are unreachable, no relay forwarding is performed and the dynamic host configuration protocol discovery message is discarded.
[0223] In a feasible implementation manner, the device for implementing the dynamic host configuration protocol relay function further includes:
[0224] a fifth processing module, for obtaining a priority order of the multiple groups of server Internet Protocol addresses if the relay forwarding scenario type is a third scenario type characterizing that there is no route unreachable in the multiple groups of server Internet Protocol addresses, and determining a target server Internet Protocol address that meets a preset condition from the multiple groups of server Internet Protocol addresses based on the priority order, and then unicast-forwarding the dynamic host configuration protocol discovery message to a target dynamic host configuration protocol server corresponding to the target server Internet Protocol address.
[0225] In a feasible implementation manner, the first processing module 15 is specifically used to:
[0226] A server Internet Protocol address with the highest priority is selected from the multiple groups of server Internet Protocol addresses based on the priority order, and the server Internet Protocol address with the highest priority is determined as the target server Internet Protocol address.
[0227] In a feasible implementation manner, the device for implementing the dynamic host configuration protocol relay function further includes:
[0228] An address monitoring module, configured to monitor the target server Internet Protocol address using the preset trace route monitoring component according to a fourth preset time period;
[0229] An exclusion module, configured to exclude the target server Internet Protocol address from the plurality of groups of server Internet Protocol addresses when the monitored target server Internet Protocol address does not satisfy the preset condition, so as to obtain an excluded server Internet Protocol address;
[0230] The switching module is used to re-determine the server Internet Protocol address with the highest priority from the excluded server Internet Protocol addresses based on the priority order, and determine the current server Internet Protocol address with the highest priority as the new target server Internet Protocol address.
[0231] Furthermore, the present application also discloses an electronic device. Fig.11 This is a structural diagram of an electronic device 20 according to an exemplary embodiment, and the content in the diagram cannot be considered as any limitation on the scope of use of the present application.
[0232] Fig.11 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the method for implementing the dynamic host configuration protocol relay function disclosed in any of the aforementioned embodiments.
[0233] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0234] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222 and data 223, etc. The data 223 may include various data. The storage method may be temporary storage or permanent storage.
[0235] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the implementation method of the dynamic host configuration protocol relay function performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0236] Furthermore, the embodiment of the present application also discloses a computer-readable storage medium, wherein the computer-readable storage medium mentioned here includes a random access memory (Random Access Memory, RAM), a memory, a read-only memory (Read-Only Memory, ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a magnetic disk or an optical disk, or any other form of storage medium known in the technical field. Among them, the implementation method of the aforementioned dynamic host configuration protocol relay function when the computer program is executed by the processor. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the aforementioned embodiment, and no further description will be given here.
[0237] Furthermore, an embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements any one of the above-mentioned methods for implementing the dynamic host configuration protocol relay function.
[0238] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0239] The steps of the implementation method or algorithm of the dynamic host configuration protocol relay function described in conjunction with the embodiments disclosed herein can be directly implemented by hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0240] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0241] The above describes in detail a method, device, program product and medium for implementing a DHCP relay function provided by the present invention. Specific examples are used herein to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there may be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for implementing a dynamic host configuration protocol relay function, It is characterized in that Applicable to relay agents, including: obtaining multiple sets of server Internet Protocol addresses configured for a Dynamic Host Configuration Protocol server; Receiving a dynamic host configuration protocol discovery message broadcasted by a client device, and using a preset tracking route monitoring component to query the routing status corresponding to each of the plurality of groups of server Internet Protocol addresses; the preset tracking route monitoring component is used to determine the routing reachability of the Internet Protocol address of the dynamic host configuration protocol server; Determine the relay forwarding scenario type currently corresponding to the relay agent according to the routing state; If the relay forwarding scenario type is the first scenario type characterizing that any of the multiple groups of server Internet Protocol addresses are unreachable by any route, obtaining a priority order of the multiple groups of server Internet Protocol addresses, and determining a target server Internet Protocol address that meets a preset condition from the multiple groups of server Internet Protocol addresses based on the priority order, and then unicast forwarding the dynamic host configuration protocol discovery message to a target dynamic host configuration protocol server corresponding to the target server Internet Protocol address; If the relay forwarding scenario type is the second scenario type indicating that all routes in the multiple groups of server Internet Protocol addresses are unreachable, relay forwarding is not performed.
2. The method for implementing the dynamic host configuration protocol relay function according to claim 1, It is characterized in that The process of obtaining multiple groups of server Internet Protocol addresses configured for the dynamic host configuration protocol server also includes: A first gateway address is configured for the relay agent, and a priority configuration interface is constructed for the multiple groups of server Internet Protocol addresses.
3. The method for implementing the dynamic host configuration protocol relay function according to claim 2, It is characterized in that The unicast forwarding of the dynamic host configuration protocol discovery message to a target dynamic host configuration protocol server corresponding to the Internet Protocol address of the target server includes: The second gateway address of the client device is obtained according to the dynamic host configuration protocol discovery message, and the second gateway address is replaced with the first gateway address, so as to unicast forward the dynamic host configuration protocol discovery message to a target dynamic host configuration protocol server corresponding to the target server Internet Protocol address according to the first gateway address.
4. The method for implementing the dynamic host configuration protocol relay function according to claim 2, It is characterized in that The obtaining of the priority order of the plurality of groups of server Internet Protocol addresses comprises: Obtaining configuration parameters input through the priority configuration interface, and determining the priority order of the plurality of groups of server Internet Protocol addresses according to the configuration parameters; Or, the priority configuration interface detects a route tracking command sent based on a preset tracking route monitoring component, and determines the lifetime values corresponding to the multiple groups of server Internet Protocol addresses based on the route tracking command, so as to determine the priority order of the multiple groups of server Internet Protocol addresses based on the lifetime value.
5. The method for implementing the dynamic host configuration protocol relay function according to claim 4, It is characterized in that Determining the survival time values corresponding to the plurality of groups of server Internet Protocol addresses according to the route tracking command, so as to determine the priority order of the plurality of groups of server Internet Protocol addresses according to the survival time values, comprises: Determining the survival time values corresponding to the plurality of groups of server Internet Protocol addresses according to the route tracking command, and sorting the survival time values to obtain a sorting result; Based on the ranking result, the plurality of groups of server Internet Protocol addresses are assigned corresponding priorities from high to low in the order of the survival time values from small to large.
6. The method for implementing the dynamic host configuration protocol relay function according to claim 4, It is characterized in that After receiving the dynamic host configuration protocol discovery message broadcasted by the client device, the method further includes: Determining a configuration method for configuring the priority order for the plurality of groups of server Internet Protocol addresses; When the priority order is configured for the multiple groups of server Internet Protocol addresses using the first configuration method, determine whether the multiple groups of server Internet Protocol addresses can be obtained; if so, trigger the step of using the preset tracking route monitoring component to query the routing status corresponding to each of the multiple groups of server Internet Protocol addresses; if not, discard the dynamic host configuration protocol discovery message; wherein the first configuration method is a configuration method for inputting the configuration parameters through the priority configuration interface to configure the priority order; When the priority order is configured for the multiple groups of server Internet Protocol addresses using the second configuration method, the size order of the lifetime values is queried, and then the step of using the preset tracking route monitoring component to query the routing status corresponding to each of the multiple groups of server Internet Protocol addresses is triggered based on the size order; wherein the second configuration method is a configuration method for determining the lifetime value according to the detected route tracking command through the priority configuration interface to configure the priority order.
7. The method for implementing the dynamic host configuration protocol relay function according to claim 6, It is characterized in that After receiving the dynamic host configuration protocol discovery message broadcasted by the client device, the method further includes: Using a preset tracking route monitoring component, issuing a network control message protocol to the dynamic host configuration protocol server according to a first preset time period, and determining whether a network control message protocol response message returned by the dynamic host configuration protocol server is received; If the network control message protocol response message returned by the dynamic host configuration protocol server is received, determining that the routing state corresponding to the current server Internet Protocol address is a reachable state; If the network control message protocol response message returned by the dynamic host configuration protocol server is not received, it is determined that the routing state corresponding to the current server Internet Protocol address is an unreachable state.
8. The method for implementing the dynamic host configuration protocol relay function according to claim 7, It is characterized in that Also includes: According to a second preset time period, the server Internet Protocol addresses corresponding to the reachable state and the unreachable state are respectively recorded in a preset database.
9. The method for implementing the dynamic host configuration protocol relay function according to claim 8, It is characterized in that The method of using a preset tracking route monitoring component to query the routing status corresponding to each of the plurality of groups of server Internet Protocol addresses includes: The preset tracking route monitoring component is used to query the reachable status of the multiple groups of server Internet Protocol addresses and / or the unreachable status of the multiple groups of server Internet Protocol addresses from the preset database.
10. The method for implementing the dynamic host configuration protocol relay function according to claim 8, It is characterized in that Also includes: The priorities corresponding to the plurality of groups of server Internet Protocol addresses are recorded in the preset database, and the priorities are matched with the routing states to obtain a matching result list.
11. The method for implementing the dynamic host configuration protocol relay function according to claim 10, It is characterized in that The method of using a preset tracking route monitoring component to query the routing status corresponding to each of the plurality of groups of server Internet Protocol addresses includes: According to a third preset time period, using the matching result list to synchronize the status updates of the multiple groups of server Internet Protocol addresses to obtain current routing statuses corresponding to the multiple groups of server Internet Protocol addresses; The preset tracking route monitoring component is used to query the current routing status corresponding to each of the multiple groups of server Internet Protocol addresses.
12. The method for implementing the dynamic host configuration protocol relay function according to claim 7, It is characterized in that After determining the relay forwarding scenario type currently corresponding to the relay agent according to the routing state, the method further includes: If the relay forwarding scenario type is the first scenario type characterizing that any of the multiple groups of server Internet Protocol addresses are unreachable, obtaining a priority order of the multiple groups of server Internet Protocol addresses, and determining in sequence based on the priority order whether the routing states corresponding to the multiple groups of server Internet Protocol addresses are reachable states; If the routing state corresponding to the current server Internet Protocol address is a reachable state, the current server Internet Protocol address is determined as the target server Internet Protocol address, and then the step of unicast forwarding the dynamic host configuration protocol discovery message to the target dynamic host configuration protocol server corresponding to the target server Internet Protocol address is triggered; If the routing status corresponding to the current server Internet Protocol address is unreachable, jump to the step of querying the size order of the survival time values.
13. The method for implementing the dynamic host configuration protocol relay function according to claim 7, It is characterized in that The determining, according to the routing state, the relay forwarding scenario type currently corresponding to the relay agent includes: Obtain a first number of all the configured groups of server Internet Protocol addresses, obtain a second number of the groups of server Internet Protocol addresses corresponding to when the routing state is the reachable state, and obtain a third number of the groups of server Internet Protocol addresses corresponding to when the routing state is the unreachable state; If the second number is not zero and the second number is less than the first number, determining that the relay forwarding scenario type is a first scenario type characterizing that any of the multiple groups of server Internet Protocol addresses are unreachable by any route; If the third number is equal to the first number, it is determined that the relay forwarding scenario type is a second scenario type that indicates that all routes in the multiple groups of server Internet Protocol addresses are unreachable.
14. The method for implementing the dynamic host configuration protocol relay function according to claim 1, It is characterized in that If the relay forwarding scenario type is a second scenario type indicating that all routes in the multiple groups of server Internet Protocol addresses are unreachable, then relay forwarding is not performed, including: If the relay forwarding scenario type is the second scenario type indicating that all routes in the multiple groups of server Internet Protocol addresses are unreachable, no relay forwarding is performed and the dynamic host configuration protocol discovery message is discarded.
15. The method for implementing the dynamic host configuration protocol relay function according to any one of claims 1 to 14, It is characterized in that Also includes: If the relay forwarding scenario type is a third scenario type characterizing that there is no route unreachable in the multiple groups of server Internet Protocol addresses, obtain the priority order of the multiple groups of server Internet Protocol addresses, and determine the target server Internet Protocol address that meets the preset conditions from the multiple groups of server Internet Protocol addresses based on the priority order, and then unicast forward the dynamic host configuration protocol discovery message to the target dynamic host configuration protocol server corresponding to the target server Internet Protocol address.
16. The method for implementing the dynamic host configuration protocol relay function according to claim 1, It is characterized in that The determining of a target server Internet Protocol address that meets a preset condition from the plurality of groups of server Internet Protocol addresses based on the priority order includes: A server Internet Protocol address with the highest priority is selected from the multiple groups of server Internet Protocol addresses based on the priority order, and the server Internet Protocol address with the highest priority is determined as the target server Internet Protocol address.
17. The method for implementing the dynamic host configuration protocol relay function according to claim 16, It is characterized in that Also includes: According to a fourth preset time period, monitoring the target server Internet Protocol address using the preset traceroute monitoring component; When the monitored target server Internet Protocol address does not satisfy the preset condition, excluding the target server Internet Protocol address from the multiple groups of server Internet Protocol addresses to obtain an excluded server Internet Protocol address; The server Internet Protocol address with the highest priority is re-determined from the excluded server Internet Protocol addresses based on the priority order, and the current server Internet Protocol address with the highest priority is determined as the new target server Internet Protocol address.
18. A computer program product comprising a computer program / instructions, It is characterized in that When the computer program / instructions are executed by a processor, the steps of the method for implementing the dynamic host configuration protocol relay function as described in any one of claims 1 to 17 are implemented.
19. An electronic device, It is characterized in that include: Memory for storing computer programs; A processor, configured to load and execute the computer program to implement the method for implementing the dynamic host configuration protocol relay function as described in any one of claims 1 to 17.
20. A computer-readable storage medium, It is characterized in that Used to store computer programs; wherein the computer program, when executed by a processor, implements the method for implementing the dynamic host configuration protocol relay function as described in any one of claims 1 to 17.
