CN109150745B - Message processing method and device - Google Patents

Message processing method and device Download PDF

Info

Publication number
CN109150745B
CN109150745B CN201811260255.6A CN201811260255A CN109150745B CN 109150745 B CN109150745 B CN 109150745B CN 201811260255 A CN201811260255 A CN 201811260255A CN 109150745 B CN109150745 B CN 109150745B
Authority
CN
China
Prior art keywords
client
dhcp
message
address
target server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811260255.6A
Other languages
Chinese (zh)
Other versions
CN109150745A (en
Inventor
董瑶
王国利
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Security Technologies Co Ltd
Original Assignee
New H3C Security Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New H3C Security Technologies Co Ltd filed Critical New H3C Security Technologies Co Ltd
Priority to CN201811260255.6A priority Critical patent/CN109150745B/en
Publication of CN109150745A publication Critical patent/CN109150745A/en
Application granted granted Critical
Publication of CN109150745B publication Critical patent/CN109150745B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • H04L47/125Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the application provides a message processing method and a message processing device, relates to the technical field of communication, and is used for solving the problem that a DHCP client side fails to apply for an address due to session maintenance. The scheme of the embodiment of the application comprises the following steps: receiving a Dynamic Host Configuration Protocol (DHCP) message sent by a client, if the DHCP message is determined to be an IP address request message, determining a target server for allocating an IP address to the client according to a preset load balancing rule, generating a temporary session holding table item containing an identifier of the client and an identifier of the target server, then forwarding the IP address request message to the target server, receiving a response message returned by the target server according to the IP address request message, and if the response message does not carry the IP address allocated to the client, deleting the temporary session holding table item.

Description

Message processing method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for processing a packet.
Background
In order to implement Load Balance (LB) of a Dynamic Host Configuration Protocol (DHCP) server, after receiving a DHCP discover (discover) message from a DHCP client, a Load balancing device may select the DHCP server for the DHCP client according to a scheduling algorithm, and then forward the DHCP discover message to the selected DHCP server.
In order to ensure that a session with certain correlation can be processed by the same DHCP server, after the load balancing equipment selects the DHCP server for the DHCP client, a session holding method can be adopted to generate a session holding list item containing the identification of the DHCP client and the identification of the DHCP server, and after subsequent load balancing equipment receives a message from the DHCP client, the message is forwarded to the same DHCP server for processing according to the session holding list item.
However, if the DHCP server selected by the load balancing device does not have an address that can be allocated to the DHCP client, the DHCP client may fail to apply for the address. When the subsequent DHCP client applies for an address again, the load balancing device still sends the DHCP discover message from the DHCP client to the server corresponding to the identifier of the DHCP server in the session holding entry, and if there is no assignable address in the DHCP server, the DHCP client still fails to apply for the address.
Disclosure of Invention
An object of the embodiments of the present application is to provide a message processing method and apparatus, so as to solve a problem that a DHCP client fails to apply for an address due to session maintenance. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a packet processing method, where the method is applied to a load balancing device, and the method includes:
receiving a Dynamic Host Configuration Protocol (DHCP) message sent by a client;
if the DHCP message is determined to be an IP address request message, determining a target server for allocating an IP address to the client according to a preset load balancing rule, and generating a temporary session holding list item comprising the identification of the client and the identification of the target server;
forwarding the IP address request message to the target server, and receiving a response message returned by the target server according to the IP address request message;
and if the response message does not carry the IP address distributed for the client, deleting the temporary session holding list item.
In a possible implementation manner, if the response packet carries an IP address allocated to the client, the temporary session holding entry is updated to a formal session holding entry, and the aging time of the formal session holding entry is greater than or equal to the lease time of the IP address.
In a possible implementation manner, if the DHCP message is another DHCP message except an IP address request message, the method further includes:
searching a formal session holding list item containing the identification of the client;
and forwarding the DHCP message to a server corresponding to the identifier of the server according to the identifier of the server contained in the formal session holding list item.
In one possible implementation, after the deleting the temporary session holding entry, the method further includes:
adding 1 to the counting number of times of deleting the temporary session maintaining table item containing the identification of the target server;
if the counting times reach preset times, not sending an IP address request message to a target server corresponding to the identification of the target server within a preset time period, and resetting the counting times;
and clearing the counting times if the temporary session maintaining table item containing the identification of the target server is updated to a formal session maintaining table item before the counting times reach the preset times.
In one possible implementation manner, the updating the temporary session holding entry to the formal session holding entry includes:
and updating a first flag bit in the temporary session holding table entry into a second flag bit, wherein the first flag bit is used for identifying the temporary session holding table entry, and the second flag bit is used for identifying a formal session holding table entry.
In a second aspect, an embodiment of the present application provides a packet processing apparatus, where the apparatus is applied to a load balancing device, and the apparatus includes:
the communication module is used for receiving a Dynamic Host Configuration Protocol (DHCP) message sent by the client;
a generating module, configured to determine, according to a preset load balancing rule, a target server that allocates an IP address to the client if it is determined that the DHCP message received by the communication module is an IP address request message, and generate a temporary session holding entry that includes an identifier of the client and an identifier of the target server;
the communication module is further configured to forward the IP address request packet to the target server, and receive a response packet returned by the target server according to the IP address request packet;
and the deleting module is used for deleting the temporary session holding list item if the response message received by the communication module does not carry the IP address distributed to the client.
In one possible implementation, the apparatus further includes: an update module;
and the updating module is used for updating the temporary session holding list item into a formal session holding list item if the response message carries the IP address allocated to the client, wherein the aging time of the formal session holding list item is more than or equal to the lease time of the IP address.
In one possible implementation, the apparatus further includes: a searching module;
the searching module is used for searching a formal session holding table item containing the identification of the client if the DHCP message is other DHCP messages except the IP address request message;
and the communication module is further configured to forward the DHCP message to a server corresponding to the identifier of the server according to the identifier of the server included in the formal session holding entry.
In one possible implementation, the apparatus further includes: a counting module;
the counting module is configured to add 1 to the count number of times of deleting the temporary session holding entry including the identifier of the target server after the deleting module deletes the temporary session holding entry; if the counting times reach preset times, not sending an IP address request message to a target server corresponding to the identification of the target server within a preset time period, and resetting the counting times; and clearing the counting times if the temporary session maintaining table item containing the identification of the target server is updated to a formal session maintaining table item before the counting times reach the preset times.
In a possible implementation manner, the updating module is specifically configured to update a first flag bit in the temporary session holding entry to a second flag bit, where the first flag bit is used to identify the temporary session holding entry, and the second flag bit is used to identify a formal session holding entry.
In a third aspect, an embodiment of the present application provides a load balancing device, where the load balancing device includes: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: the message processing method described in the first aspect is implemented.
In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the message processing method in the first aspect is implemented.
In a fifth aspect, an embodiment of the present application further provides a computer program product containing instructions, which when run on a computer, causes the computer to execute any of the message processing methods described above.
By adopting the message processing method and the device provided by the embodiment of the application, after the load balancing equipment receives the IP address request message, a target server that assigns an IP address to the client may be determined based on load balancing rules, and a temporary session holding entry comprising an identification of the client and an identification of the target server may be generated, then, the IP address request message is forwarded to the target server, and the response message is received, if the response message does not carry the IP address allocated to the client, it indicates that the target server does not have the allocable IP address, the temporary session holding table entry is deleted, so that after the load balancing device receives the IP address request message from the client next time, the IP address request packet is not forwarded to the same server according to the session holding entry, and the server for distributing the IP address for the client is reselected, so that the problem of address application failure caused by the fact that the DHCP client is always accessed into the same DHCP server is solved.
Of course, it is not necessary for any product or method of the present application to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a communication system according to an embodiment of the present application;
fig. 2 is a flowchart of a message processing method according to an embodiment of the present application;
fig. 3 is a flowchart of another message processing method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a message processing apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a load balancing device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The message processing method provided by the embodiment of the present application may be applied to the communication system shown in fig. 1, where the system includes a DHCP client, a switch, a load balancing device, and at least two DHCP servers, and optionally, the system may further include a DHCP relay device.
Under the condition that the DHCP relay equipment is not deployed in the system, the DHCP client side is connected to the switch, the switch is connected to the load balancing equipment, and the switch is connected to at least two DHCP servers.
Optionally, the DHCP client may also be connected to the load balancing device, that is, the DHCP client may communicate with the load balancing device through the switch, or may directly communicate with the load balancing device.
Optionally, the load balancing device may also be connected to at least two DHCP servers, that is, the load balancing device may communicate with the DHCP servers through a switch, or may communicate with the DHCP servers directly.
In the case that the DHCP relay device is deployed in the system, the DHCP client is connected to the DHCP relay device, and the DHCP relay device is connected to the switch, that is, the DHCP client can communicate with the switch through the DHCP relay device. The switch is connected to the load balancing device, and the switch is connected to at least two DHCP servers, optionally, the load balancing device may be connected to at least two DHCP servers, so that the load balancing device may communicate with the DHCP servers through the switch, and may also communicate with the DHCP servers directly.
Wherein, the DHCP client may send an IP address request message, which may be forwarded to the load balancing device, and then the load balancing device selects a DHCP server serving the DHCP client, and then the IP address request message is forwarded to the DHCP server.
In a first implementation manner, the DHCP client may send an IP address request packet to the switch through the DHCP relay device, and then the switch forwards the IP address request packet to the load balancing device, and after the load balancing device selects a DHCP server for the IP address request packet, the switch forwards the IP address request packet to the selected DHCP server.
In a second implementation manner, after receiving the IP address request packet sent by the DHCP client, the DHCP relay device may directly send the IP address request packet to the load balancing device without passing through the switch, and after selecting a DHCP server for the IP address request packet, the load balancing device forwards the IP address request packet to the selected DHCP server through the switch.
In a third implementation manner, after the switch forwards the IP address request packet to the load balancing device, the load balancing device selects a DHCP server for the IP address request packet, and then the IP address request packet may be directly forwarded to the selected DHCP server without passing through the switch.
In the fourth implementation manner, the DHCP client may also directly send an IP address request packet to the switch without deploying the DHCP relay device, and the switch performs a subsequent packet forwarding process.
The method for processing the message provided by the embodiment of the application can be applied to any one of the implementation manners. For example, in the description of the subsequent embodiment, the load balancing device receives an IP address request message sent by the DHCP client, which may refer to the load balancing device directly receiving the IP address request message sent by the DHCP client, or refer to the load balancing device receiving the IP address request message sent by the DHCP client through the DHCP relay device. In addition, the load balancing device forwards the IP address request message to the DHCP server, which may refer to the load balancing device forwarding the IP address request message to the DHCP server through the switch, or may refer to the load balancing device directly forwarding the IP address request message to the DHCP server.
In combination with the communication system shown in fig. 1, to solve the problem of failure of address application by a DHCP client due to session maintenance, an embodiment of the present application provides a message processing method, where the method is applied to a load balancing device, and as shown in fig. 2, the method includes:
s201, receiving a DHCP message sent by a client.
Wherein the client may be a DHCP client.
S202, if the DHCP message is determined to be the IP address request message, determining a target server for allocating the IP address to the client according to a preset load balancing rule, and generating a temporary session holding list item comprising the identification of the client and the identification of the target server.
Optionally, the IP address request packet is a packet for requesting to acquire an IP address, and may be, for example, a DHCP discover packet. The target server may be a DHCP server.
The load balancing rule is to adopt a random distribution algorithm, a polling scheduling algorithm and a weighted round robin scheduling algorithm, or to select a target server according to information dynamically fed back by the server. Of course, the embodiments of the present application are not limited thereto, and other rules for implementing load balancing may also be applied to the embodiments of the present application.
For example, through a polling scheduling algorithm, that is, a DHCP server serving a DHCP client is selected according to a certain sequence, when the load balancing device receives a DHCP discover message, if it is determined that the DHCP discover message was received last time, the DHCP server 1 is selected, the DHCP server 2 is selected this time, and similarly, when the DHCP discover message is received next time, the DHCP server 3 is selected. Or, a minimum connection scheduling algorithm may also be adopted, that is, after the load balancing device receives the DHCP discover message, the DHCP server with the minimum number of the served DHCP clients is selected. Of course, the scheduling algorithms that can be used in the embodiments of the present application are not limited to the two illustrated above, and the rest of the scheduling algorithms for load balancing are also applicable to this.
S203, forwarding the IP address request message to the target server, and receiving a response message returned by the target server according to the IP address request message.
Optionally, if the IP address request packet is a DHCP discover packet, the response packet may be a DHCP offer packet.
And S204, if the response message does not carry the IP address distributed for the client, deleting the temporary session holding list item.
After receiving the response message, the load balancing device may analyze the response message, and if the response message does not carry the IP address allocated to the client, it indicates that there is no allocatable IP address in the target server, or that the allocation of the IP address to the client fails this time, so the temporary session holding table entry may be deleted, so that the client may be matched to other servers when sending the IP address request message again.
Optionally, after the load balancing device receives the response packet, the load balancing device may forward the response packet to the client.
By adopting the message processing method provided by the embodiment of the application, after the load balancing equipment receives the IP address request message, a target server that assigns an IP address to the client may be determined based on load balancing rules, and a temporary session holding entry comprising an identification of the client and an identification of the target server may be generated, then, the IP address request message is forwarded to the target server, and the response message is received, if the response message does not carry the IP address allocated to the client, it indicates that the target server does not have the allocable IP address, the temporary session holding table entry is deleted, so that after the load balancing device receives the IP address request message from the client next time, the IP address request packet is not forwarded to the same server according to the session holding entry, and the server for distributing the IP address for the client is reselected, so that the problem of address application failure caused by the fact that the DHCP client is always accessed into the same DHCP server is solved.
Optionally, on the basis of the embodiment in fig. 2, if the response packet carries an IP address allocated to the client, as shown in fig. 3, the method specifically includes: S301-S305.
Wherein S301-S304 are the same as S201-S204 described above.
S305, if the response message carries the IP address distributed for the client, updating the temporary session holding list item into a formal session holding list item.
The aging time of the formal session holding table entry is greater than or equal to the lease of the IP address, that is, when the IP address allocated to the client expires, the load balancing device may delete the formal session holding table entry.
In addition, if the client sends a release message of the IP address before the IP address expires, the load balancing device deletes the formal session holding entry after the IP address is released.
If the client renews the lease on the IP address before the IP address expires and the lease is successful, the load balancing device may refresh the formal session holding entry and update the aging time of the formal session holding entry to the lease period of the IP address after the lease is renewed.
The method for updating the temporary session holding table entry to the formal session holding table entry may be: and updating the first flag bit in the temporary session holding table entry into the second flag bit. The first flag bit is used for identifying a temporary session holding table item, and the second flag bit is used for identifying a formal session holding table item.
For example, if the first flag bit may be T (temporary), it represents that the session holding table entry is a temporary session holding table entry; the second flag bit is O (official), which represents that the session holding table entry is an official session holding table entry.
In a possible implementation manner, if the message received by the load balancing device in S201 is another DHCP message except the IP address request message, the method further includes S306-S307.
S306, if the DHCP message is determined to be other DHCP messages except the IP address request message, searching a formal session holding list item containing the identification of the client.
The client in this step is a client that sends a DHCP message. Illustratively, other DHCP messages besides the IP address request message may be DHCP info messages.
S307, forwarding the DHCP message to the server corresponding to the server identifier according to the server identifier contained in the formal session holding list item.
By adopting the method of the embodiment of the application, the temporary session holding list item is updated to the formal session holding list item under the condition of receiving the response message carrying the IP address, and if other DHCP messages except the IP address request message sent by the client are subsequently received and the client is matched with the formal session holding performance, the DHCP message can be forwarded to the server corresponding to the server identifier contained in the formal session holding list item, so that the processing efficiency of the DHCP message can be improved.
In this embodiment of the present application, after the load balancing device deletes the temporary session holding entry each time, 1 may be added to the count number of times of continuously deleting the temporary session holding entry that includes the identifier of the target server. In particular, the load balancing device may count through a counter.
And if the counting times reach the preset times, not sending an IP address request message to the target server corresponding to the identification of the target server within a preset time period, and clearing the counting times of the target server.
If the temporary session holding table entry containing the identifier of the target server is continuously deleted for a preset number of times, it indicates that there is no assignable IP address in the target server, and in order to avoid application failure caused by application of an IP address from the target server by the client again, an IP address request message may not be sent to the target server within a preset time period.
And if the temporary session maintaining table item containing the identification of the target server is updated to be a formal session maintaining table item before the counting number reaches the preset number, clearing the counting number of the target server.
If the temporary session holding table entry containing the identifier of the target server is updated to a formal session holding table entry, it indicates that there may be an IP address released in the target server, so that the client can still be served.
By adopting the method of the embodiment of the application, the temporary session holding list item containing the target server is continuously deleted for the preset times, which shows that the target server does not have an IP address which can be distributed, and the target server is not required to send an IP address request message in the preset time period, so that the success rate of the client for applying for the IP address can be improved.
Corresponding to the foregoing method embodiment, an embodiment of the present application further provides a message processing apparatus, and as shown in fig. 4, the apparatus includes: a communication module 401, a generation module 402, and a deletion module 403.
The communication module 401 is configured to receive a dynamic host configuration protocol DHCP message sent by a client.
A generating module 402, configured to determine, according to a preset load balancing rule, a target server that allocates an IP address to the client if it is determined that the DHCP message received by the communication module 401 is an IP address request message, and generate a temporary session holding entry that includes an identifier of the client and an identifier of the target server.
The communication module 401 is further configured to forward the IP address request packet to the target server, and receive a response packet returned by the target server according to the IP address request packet.
A deleting module 403, configured to delete the temporary session holding entry if the response packet received by the communication module 401 does not carry the IP address allocated to the client.
Optionally, the apparatus further comprises: updating the module;
and the updating module is used for updating the temporary session holding list item into a formal session holding list item if the response message carries the IP address distributed to the client, wherein the aging time of the formal session holding list item is more than or equal to the lease time of the IP address.
Optionally, the apparatus further comprises: a search module;
the searching module is used for searching a formal session holding table item containing the identification of the client if the DHCP message is other DHCP messages except the IP address request message;
the communication module 401 is further configured to forward, according to the identifier of the server included in the formal session holding entry, the DHCP message to the server corresponding to the identifier of the server.
Optionally, the apparatus further comprises: a counting module;
the counting module is used for adding 1 to the counting number of times of deleting the temporary session maintaining table item containing the identifier of the target server after the deleting module deletes the temporary session maintaining table item; if the counting times reach the preset times, the IP address request message is not sent to the target server corresponding to the identification of the target server within the preset time period, and the counting times are reset; and if the temporary session maintaining table item containing the identification of the target server is updated to be the formal session maintaining table item before the counting number reaches the preset number, clearing the counting number.
Optionally, the updating module is specifically configured to update a first flag bit in the temporary session holding entry to a second flag bit, where the first flag bit is used to identify the temporary session holding entry, and the second flag bit is used to identify the formal session holding entry.
The embodiment of the present application further provides a load balancing apparatus, as shown in fig. 5, which includes a processor 501, a communication interface 502, a memory 503, and a communication bus 504, where the processor 501, the communication interface 502, and the memory 503 complete mutual communication through the communication bus 504,
a memory 503 for storing a computer program;
the processor 501 is configured to implement the steps executed by the load balancing apparatus in the foregoing method embodiments when executing the program stored in the memory 503.
The communication bus mentioned in the above load balancing device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the load balancing device and other devices.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In another embodiment provided by the present application, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any of the message processing methods described above.
In yet another embodiment provided by the present application, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the message processing methods of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (12)

1. A message processing method is applied to load balancing equipment, and is characterized in that the method comprises the following steps:
receiving a Dynamic Host Configuration Protocol (DHCP) message sent by a client;
if the DHCP message is determined to be an IP address request message, determining a target server for allocating an IP address to the client according to a preset load balancing rule, and generating a temporary session holding list item comprising the identification of the client and the identification of the target server;
forwarding the IP address request message to the target server, and receiving a response message returned by the target server according to the IP address request message;
and if the response message does not carry the IP address distributed for the client, deleting the temporary session holding list item.
2. The method of claim 1, further comprising:
if the response message carries the IP address distributed to the client, the temporary session maintaining table item is updated to a formal session maintaining table item, and the aging time of the formal session maintaining table item is more than or equal to the lease time of the IP address.
3. The method of claim 2, wherein if the DHCP message is another DHCP message other than an IP address request message, the method further comprises:
searching a formal session holding list item containing the identification of the client;
and forwarding the DHCP message to a server corresponding to the identifier of the server according to the identifier of the server contained in the formal session holding list item.
4. The method of any of claims 1-3, wherein after said deleting said temporary session hold entry, said method further comprises:
adding 1 to the counting number of times of deleting the temporary session maintaining table item containing the identification of the target server;
if the counting times reach preset times, not sending an IP address request message to a target server corresponding to the identification of the target server within a preset time period, and resetting the counting times;
and clearing the counting times if the temporary session maintaining table item containing the identification of the target server is updated to a formal session maintaining table item before the counting times reach the preset times.
5. The method according to claim 2 or 3, wherein the updating the temporary session holding table entry to a formal session holding table entry comprises:
and updating a first flag bit in the temporary session holding table entry into a second flag bit, wherein the first flag bit is used for identifying the temporary session holding table entry, and the second flag bit is used for identifying a formal session holding table entry.
6. A message processing apparatus, wherein the apparatus is applied to a load balancing device, and the apparatus comprises:
the communication module is used for receiving a Dynamic Host Configuration Protocol (DHCP) message sent by the client;
a generating module, configured to determine, according to a preset load balancing rule, a target server that allocates an IP address to the client if it is determined that the DHCP message received by the communication module is an IP address request message, and generate a temporary session holding entry that includes an identifier of the client and an identifier of the target server;
the communication module is further configured to forward the IP address request packet to the target server, and receive a response packet returned by the target server according to the IP address request packet;
and the deleting module is used for deleting the temporary session holding list item if the response message received by the communication module does not carry the IP address distributed to the client.
7. The apparatus of claim 6, further comprising: an update module;
and the updating module is used for updating the temporary session holding list item into a formal session holding list item if the response message carries the IP address allocated to the client, wherein the aging time of the formal session holding list item is more than or equal to the lease time of the IP address.
8. The apparatus of claim 7, further comprising: a searching module;
the searching module is used for searching a formal session holding table item containing the identification of the client if the DHCP message is other DHCP messages except the IP address request message;
the communication module is further configured to forward the DHCP message to a server corresponding to the identifier of the server according to the identifier of the server included in the formal session holding entry.
9. The apparatus according to any one of claims 6-8, further comprising: a counting module;
the counting module is configured to add 1 to the count number of times of deleting the temporary session holding entry including the identifier of the target server after the deleting module deletes the temporary session holding entry; if the counting times reach preset times, not sending an IP address request message to a target server corresponding to the identification of the target server within a preset time period, and resetting the counting times; and clearing the counting times if the temporary session maintaining table item containing the identification of the target server is updated to a formal session maintaining table item before the counting times reach the preset times.
10. The apparatus according to claim 7 or 8,
the updating module is specifically configured to update a first flag bit in the temporary session holding table entry to a second flag bit, where the first flag bit is used to identify the temporary session holding table entry, and the second flag bit is used to identify a formal session holding table entry.
11. A load balancing device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: the steps of implementing the method of any one of claims 1 to 5.
12. A machine-readable storage medium having stored thereon machine-executable instructions that, when invoked and executed by a processor, cause the processor to: the steps of implementing the method of any one of claims 1 to 5.
CN201811260255.6A 2018-10-26 2018-10-26 Message processing method and device Active CN109150745B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811260255.6A CN109150745B (en) 2018-10-26 2018-10-26 Message processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811260255.6A CN109150745B (en) 2018-10-26 2018-10-26 Message processing method and device

Publications (2)

Publication Number Publication Date
CN109150745A CN109150745A (en) 2019-01-04
CN109150745B true CN109150745B (en) 2022-06-21

Family

ID=64809914

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811260255.6A Active CN109150745B (en) 2018-10-26 2018-10-26 Message processing method and device

Country Status (1)

Country Link
CN (1) CN109150745B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110730254B (en) * 2019-10-14 2022-06-21 新华三信息安全技术有限公司 Address allocation method, device, relay equipment and medium
CN111147617B (en) * 2019-12-20 2022-08-12 互联网域名***北京市工程研究中心有限公司 Method and system for distributing addresses based on DHCP server cluster load
CN111212134A (en) * 2019-12-31 2020-05-29 北京金山云网络技术有限公司 Request message processing method and device, edge computing system and electronic equipment
CN111245913A (en) * 2020-01-06 2020-06-05 深圳壹账通智能科技有限公司 Message sending method and device based on gateway, computer equipment and storage medium
CN113612851A (en) * 2021-08-11 2021-11-05 山石网科通信技术股份有限公司 Remote connection method and device, storage medium and processor

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009082978A1 (en) * 2007-12-28 2009-07-09 Huawei Technologies Co., Ltd. Access network protecting method, system and access edge node
CN102299932A (en) * 2011-09-22 2011-12-28 杭州华三通信技术有限公司 Backup method for DHCP (Dynamic Host Configuration Protocol) server and DHCP server
CN103457869A (en) * 2013-08-28 2013-12-18 北京星网锐捷网络技术有限公司 Conversation maintaining method and device
CN103795581A (en) * 2012-10-29 2014-05-14 杭州华三通信技术有限公司 Address processing method and address processing device
CN106357838A (en) * 2016-09-26 2017-01-25 杭州昆海信息技术有限公司 Method and device for distributing IP (Internet protocol) address
CN107733995A (en) * 2017-09-21 2018-02-23 北京信安世纪科技股份有限公司 A kind of session keeping method, device and electronic equipment
CN107864101A (en) * 2017-12-26 2018-03-30 杭州迪普科技股份有限公司 Load-balancing method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9253144B2 (en) * 2011-12-22 2016-02-02 International Business Machines Corporation Client-driven load balancing of dynamic IP address allocation

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009082978A1 (en) * 2007-12-28 2009-07-09 Huawei Technologies Co., Ltd. Access network protecting method, system and access edge node
CN102299932A (en) * 2011-09-22 2011-12-28 杭州华三通信技术有限公司 Backup method for DHCP (Dynamic Host Configuration Protocol) server and DHCP server
CN103795581A (en) * 2012-10-29 2014-05-14 杭州华三通信技术有限公司 Address processing method and address processing device
CN103457869A (en) * 2013-08-28 2013-12-18 北京星网锐捷网络技术有限公司 Conversation maintaining method and device
CN106357838A (en) * 2016-09-26 2017-01-25 杭州昆海信息技术有限公司 Method and device for distributing IP (Internet protocol) address
CN107733995A (en) * 2017-09-21 2018-02-23 北京信安世纪科技股份有限公司 A kind of session keeping method, device and electronic equipment
CN107864101A (en) * 2017-12-26 2018-03-30 杭州迪普科技股份有限公司 Load-balancing method and device

Also Published As

Publication number Publication date
CN109150745A (en) 2019-01-04

Similar Documents

Publication Publication Date Title
CN109150745B (en) Message processing method and device
CN111460460B (en) Task access method, device, proxy server and machine-readable storage medium
CN110677405B (en) Data processing method and device, electronic equipment and storage medium
CN106878045B (en) Service calling method and device
CN111212134A (en) Request message processing method and device, edge computing system and electronic equipment
CN110730254B (en) Address allocation method, device, relay equipment and medium
CN108494755B (en) Method and device for transmitting Application Programming Interface (API) request
CN108933829A (en) A kind of load-balancing method and device
US10425475B2 (en) Distributed data management
US20180295062A1 (en) System and method for efficient traffic shaping and quota enforcement in a cluster environment
CN110719221A (en) Instant messaging method, device, equipment and storage medium
US10070408B2 (en) Application registration methods and apparatuses
CN110691042A (en) Resource allocation method and device
US11070614B2 (en) Load balancing method and related apparatus
CN116566984A (en) Routing information creation method and device of k8s container cluster and electronic equipment
US20190372825A1 (en) Communication apparatus, communication method, and recording medium
CN106921557B (en) Mail sending method and equipment
CN109391658B (en) Account data synchronization method and equipment, storage medium and terminal thereof
CN108737493B (en) Address allocation method and device and electronic equipment
US10951732B2 (en) Service processing method and device
US20180331934A1 (en) State synchronization for global control in a distributed security system
CN111093281B (en) Method and device for allocating resources
US20140047014A1 (en) Network access system
CN115065664A (en) Internet protocol address recovery method, electronic equipment and storage medium
CN114448932A (en) Address allocation method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant