CN107786682B - Method and device for processing DHCP REQUEST message - Google Patents

Method and device for processing DHCP REQUEST message Download PDF

Info

Publication number
CN107786682B
CN107786682B CN201611008408.9A CN201611008408A CN107786682B CN 107786682 B CN107786682 B CN 107786682B CN 201611008408 A CN201611008408 A CN 201611008408A CN 107786682 B CN107786682 B CN 107786682B
Authority
CN
China
Prior art keywords
dhcp
request message
dhcp server
server
target
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
CN201611008408.9A
Other languages
Chinese (zh)
Other versions
CN107786682A (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201611008408.9A priority Critical patent/CN107786682B/en
Publication of CN107786682A publication Critical patent/CN107786682A/en
Application granted granted Critical
Publication of CN107786682B publication Critical patent/CN107786682B/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
    • 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]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

The embodiment of the invention discloses a method and a device for processing a DHCP REQUEST message, wherein the method comprises the following steps: if a DHCP protocol message sent by a DHCP client side is received, identifying whether the DHCP protocol message is a DHCP REQUEST message or not, wherein the DHCP REQUEST message at least comprises a message type, a source address and a destination address, the source address is an MAC address of the DHCP client side, and the destination address is FF-FF-FF-FF-FF-FF; if yes, determining a target DHCP server and an MAC address of the target DHCP server according to a preset mapping relation and a source address of the DHCP client, wherein the preset mapping relation comprises an association relation between the DHCP client and the DHCP server; modifying the destination address in the DHCP REQUEST message into the MAC address of the target DHCP server; and sending the modified DHCP REQUEST message to a target DHCP server. The embodiment of the invention also discloses a device. The embodiment of the invention can realize that the DHCP REQUEST message is sent to the target DHCP server in a unicast mode, thereby reducing the occupied network bandwidth and reducing the network pressure.

Description

Method and device for processing DHCP REQUEST message
Technical Field
The invention relates to the technical field of communication, in particular to a method and a device for processing a DHCP REQUEST message.
Background
Because of limited IP address (internet protocol address) resources, each host connected to the internet cannot be configured with a fixed IP address. In order to implement the Configuration operation of the IP address, a temporary IP address is generally configured for a Host connected to a network using a dynamic Host Configuration protocol (dhcp). In the prior art, a broadcast message such as a DHCP REQUEST message exists in the interaction information between the DHCP client and the DHCP server. The DHCP REQUEST message is used for a broadcast message sent by the DHCP client selecting one of the DHCP servers as a target DHCP server after receiving the DHCP Offer messages responded by the plurality of DHCP servers. However, the DHCPREQUEST message sent in the form of a broadcast message may occupy network bandwidth, causing network stress.
Disclosure of Invention
A first embodiment of the present invention provides a method and an apparatus for processing a DHCP REQUEST message, which can send the DHCP REQUEST message in a unicast manner, thereby reducing occupied network bandwidth and alleviating network pressure.
In a first aspect, a first embodiment of the present invention provides a method for processing a DHCP REQUEST message, where the method includes: if a DHCP protocol message sent by a DHCP client side is received, identifying whether the DHCP protocol message is a DHCP REQUEST message or not, wherein the DHCP REQUEST message at least comprises a message type, a source address and a destination address, the source address is an MAC address of the DHCP client side, and the destination address is FF-FF-FF-FF-FF-FF; if yes, determining a target DHCP server and an MAC address of the target DHCP server according to a preset mapping relation and a source address of the DHCP client, wherein the preset mapping relation comprises an association relation between the DHCP client and the DHCP server; modifying the destination address in the DHCP REQUEST message into the MAC address of the target DHCP server; and sending the modified DHCP REQUEST message to the target DHCP server.
On the other hand, a first embodiment of the present invention provides an apparatus, including an identifying unit, configured to identify whether a DHCP protocol message sent by a DHCP client is a DHCP REQUEST message, where the DHCP REQUEST message at least includes a message type, a source address, and a destination address, the source address is a MAC address of the DHCP client, and the destination address is FF-FF; a first determining unit, configured to determine, if yes, a target DHCP server and an MAC address of the target DHCP server according to a preset mapping relationship and a source address of the DHCP client, where the preset mapping relationship includes an association relationship between the DHCP client and the DHCP server; a first modifying unit, configured to modify a destination address in the DHCP REQUEST message to an MAC address of the target DHCP server; and the first sending unit is used for sending the modified DHCP REQUEST message to the target DHCP server.
The embodiment of the invention identifies the received DHCP protocol message, if the DHCP protocol message is a DHCP REQUEST message, the MAC addresses of the target DHCP server and the target DHCP server are determined according to the preset mapping relation and the source address of the DHCP client, the target address in the DHCP REQUEST message is modified into the MAC address of the target DHCP server, and the modified DHCP REQUEST message is sent to the target DHCP server, so that the DHCPREQUEST REQUEST message is sent to the target DHCP server in a unicast mode, the occupied network bandwidth is reduced, and the network pressure is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a processing method of a DHCP REQUEST message according to a first embodiment of the present invention;
fig. 2 is a schematic flowchart of a processing method of a DHCP REQUEST message according to a second embodiment of the present invention;
fig. 3 is a schematic flowchart of a processing method of a DHCP REQUEST message according to a third embodiment of the present invention;
FIG. 4 is a schematic block diagram of an apparatus provided in a first embodiment of the invention;
FIG. 5 is a schematic block diagram of an apparatus provided in a second embodiment of the invention;
fig. 6 is a schematic block diagram of an apparatus provided by a third embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. 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 invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Fig. 1 is a schematic flowchart of a processing method of a DHCP REQUEST message according to a first embodiment of the present invention. The device corresponding to the processing method of the DHCP REQUEST message is applied between the DHCP client and the DHCP server, and realizes that the DHCP REQUEST message is sent to the target DHCP server in a unicast mode. As shown in the figure, the processing method of the DHCP REQUEST message includes steps S101 to S104.
S101, if a DHCP protocol message sent by a DHCP client is received, identifying whether the DHCP protocol message is a DHCP REQUEST message or not, wherein the DHCP REQUEST message at least comprises a message type, a source address and a destination address, the source address is an MAC address of the DHCP client, and the destination address is FF-FF-FF-FF-FF-FF.
Specifically, in the process of communicating between the DHCP client and the DHCP server through a DHCP protocol message, various types of messages are usually involved, such as a DHCP DISCOVER message, a DHCP OFFER message, a DHCP REQUEST message, an DHCP DECLINE message, and a DHCP cpack message, and these DHCP protocol messages may be transmitted in a broadcast, unicast, or multicast manner. The DHCP protocol message is encapsulated according to a specified message format, for example, in the embodiment of the present invention, the DHCP REQUEST message sent by the DHCP client at least includes a message type, a source address, a destination address, and the like. The message types are used for distinguishing different types of messages. In the embodiment of the present invention, whether a DHCP protocol message sent by a DHCP client is a DHCP REQUEST message is identified by a message type, if yes, step S102 is executed, and if not, the process is ended.
The source address and the destination address correspond to each other in the ethernet link layer and the network protocol layer, that is, the source address in the ethernet link layer is the MAC address of the DHCP client, the destination address is FF-FF, and the source address in the network protocol layer corresponding to the ethernet link layer is 0.0.0.0 and the destination address is 255.255.255.255. The destination address is 255.255.255.255, which means that all DHCP servers supporting the TCP/IP protocol on the network receive the DHCP REQUEST message, i.e. the DHCP REQUEST message sent from the DHCP client is a broadcast message; and after receiving the DHCP REQUEST message, the DHCP server responds to the DHCP client according to the MAC address of the DHCP client, such as sending a DHCPACK message to the DHCP client.
S102, if yes, determining a target DHCP server and an MAC address of the target DHCP server according to a preset mapping relation and the source address of the DHCP client, wherein the preset mapping relation comprises an association relation between the DHCP client and the DHCP server.
Specifically, the preset mapping relationship is usually configured according to the requirement of load balancing, and is used for determining which DHCP servers provide IP services for which DHCP clients, so as to ensure that hosts connected to the network can be configured with available IP addresses. It is to be understood that the preset mapping relationship is not limited, and the preset mapping relationship may also be determined by autonomously selecting the DHCP client according to the response speed of the DHCP server, for example, comparing the response speeds of a plurality of DHCP servers and selecting the DHCP server with the highest response speed as the target DHCP server, and the like, which is not limited herein. In the embodiment of the invention, the preset mapping relationship comprises an association relationship between the DHCP client and the DHCP server. The preset mapping relationship can be embodied in a form of a list, and the corresponding relationship between the DHCP client and the DHCP server is marked by recording the name of the DHCP client, the MAC address of the DHCP client, the name of the DHCP server corresponding to the DHCP client, the MAC address of the DHCP server and the like in the list, so that the target DHCP server and the MAC address of the target DHCP server can be conveniently determined in the list of the preset mapping relationship according to the source address of the DHCP client, and the target DHCP server can provide IP address service for the DHCP client.
S103, modifying the destination address in the DHCP REQUEST message into the MAC address of the target DHCP server.
Specifically, in order to reduce the network bandwidth occupied by the DHCP REQUEST message during transmission and reduce the network pressure, it is necessary to modify broadcast transmission into unicast transmission during the transmission of the DHCP REQUEST message. In the embodiment of the invention, the destination address in the DHCP REQUEST message is modified into the MAC address of the target DHCP server, namely, the destination address is FF-FF-FF-FF-FF, the destination address is the MAC address of the target DHCP server, so that the DHCP REQUEST message is converted into the message in a unicast form from a broadcast form.
S104, sending the modified DHCP REQUEST message to the target DHCP server.
Specifically, after modifying the destination address in the DHCP REQUEST message to the MAC address of the target DHCP server according to step S103, the modified DHCP REQUEST message is sent to the target DHCP server, so that the target DHCP server responds to the DHCP REQUEST message. By sending the DHCP REQUEST message to the target DHCP server in a unicast mode, compared with the method of sending the DHCP REQUEST message to a plurality of DHCP servers in a broadcast mode, the occupied network bandwidth is reduced, and the network pressure is reduced.
The embodiment of the invention identifies the received DHCP protocol message, if the DHCP protocol message is a DHCP REQUEST message, the MAC addresses of the target DHCP server and the target DHCP server are determined according to the preset mapping relation and the source address of the DHCP client, the target address in the DHCP REQUEST message is modified into the MAC address of the target DHCP server, and the modified DHCP REQUEST message is sent to the target DHCP server, so that the DHCPREQUEST REQUEST message is sent to the target DHCP server in a unicast mode, the occupied network bandwidth is reduced, and the network pressure is reduced.
Fig. 2 is a schematic flowchart of a method for processing a DHCP REQUEST message according to a second embodiment of the present invention. As shown, the method includes steps S201 to S207.
S201, if a DHCP protocol message sent by a DHCP client is received, identifying whether the DHCP protocol message is a DHCP REQUEST message, wherein the DHCP REQUEST message at least comprises a message type, a source address and a destination address, the source address is an MAC address of the DHCP client, and the destination address is FF-FF-FF-FF-FF-FF.
S202, if yes, determining a target DHCP server and an MAC address of the target DHCP server according to a preset mapping relation and the source address of the DHCP client, wherein the preset mapping relation comprises an association relation between the DHCP client and the DHCP server.
S203, modifying the destination address in the DHCP REQUEST message into the MAC address of the target DHCP server.
S204, sending the modified DHCP REQUEST message to the target DHCP server.
Steps S201 to S204 are the same as above, and are not described herein again.
S205, determining the MAC address of each standby DHCP server according to a preset mapping relation and the MAC address of the target DHCP server, wherein the preset mapping relation also comprises an association relation between the DHCP server and the standby DHCP server.
Specifically, in the embodiment of the present invention, in order to achieve high availability of the DHCP servers and prevent that a DHCP client cannot respond to a DHCP server after a failure occurs in one of the DHCP servers, in the embodiment of the present invention, at least one standby DHCP server is configured for a target DHCP server, and the standby DHCP server and the target DHCP server form a DHCP server cluster to provide a redundant backup function for the target DHCP server. The preset mapping relationship not only includes an association relationship between the DHCP client and the DHCP server, but also includes an association relationship between the DHCP server and the standby DHCP server in the embodiment of the present invention, that is, which standby DHCP servers are configured for the target DHCP server corresponding to one DHCP client. The preset mapping relationship can also be embodied in a form of a list, and the corresponding relationship between the DHCP server and the standby DHCP server is marked by recording the name of the DHCP server, the MAC address of the DHCP server, the name of the standby DHCP server corresponding to the DHCP server, the MAC address of the standby DHCP server, and the like in the list, so that the MAC addresses of the standby DHCP server and the standby DHCP server can be determined in the list of the preset mapping relationship according to the MAC address of the target DHCP server, and the standby DHCP server can provide a redundant standby function for the target DHCP server.
It is understood that, in step S202, the target DHCP server and the MAC address of the target DHCP server are determined according to the preset mapping relationship and the source address of the DHCP client, and in step S205, the MAC address of each backup DHCP server is determined according to the preset mapping relationship and the MAC address of the target DHCP server. In some possible embodiments, it is preferable that step S205 is performed simultaneously with step S202, that is, the MAC of the target DHCP server, the MAC of the standby server, and the MAC address of the standby server are determined simultaneously according to the preset mapping relationship and the source address of the DHCP client.
S206, modifying the destination address in the DHCP REQUEST message into the MAC address of the standby DHCP server to obtain the DHCP REQUEST message matched with the number of the standby DHCP server.
Specifically, in the embodiment of the present invention, after the number of the standby DHCP servers of the target DHCP server and the MAC address of each of the standby DHCP servers are determined in step S205, the destination address in the DHCP REQUEST message is modified to the MAC address of the standby DHCP server, so as to obtain the DHCP REQUEST message matching the number of the standby DHCP servers. In some possible embodiments, it is preferable that step S206 is performed simultaneously with step S203.
Preferably, in some possible embodiments, the destination address in the DHCP REQUEST message is sequentially modified into the MAC address of the standby DHCP server according to a preset order to obtain the DHCP REQUEST message matching the number of the standby DHCP servers. The preset sequence may be modified in sequence according to the sequence of the DHCP servers in the list, and if the number of the standby DHCP servers is 3, the destination address in the DHCPREQUEST REQUEST message is modified in sequence according to the sequence of the 3 standby DHCP servers in the list to the MAC address of the standby DHCP server to obtain 3 DHCP REQUEST messages. It is to be understood that, in other possible embodiments, in order to improve the transmission speed of the DHCP REQUEST message, the destination address in the DHCP REQUEST message may also be simultaneously modified to the MAC address of the standby DHCP server to obtain a DHCP REQUEST message matching the number of the standby DHCP servers.
S207, sending each modified DHCP REQUEST message to the corresponding standby DHCP server.
Specifically, in the embodiment of the present invention, each modified DHCP REQUEST message is sent to the corresponding backup DHCP server, so as to provide a redundant backup function for the target DHCP server, and when the target DHCP server fails and cannot respond to the DHCP client, the backup DHCP server will replace the target DHCP server to respond to the DHCP client, thereby achieving high availability of the DHCP server. In some possible embodiments, it is preferable that step S207 is performed simultaneously with step S204.
The embodiment of the invention identifies the received DHCP protocol message, if the DHCP protocol message is a DHCP REQUEST message, the MAC addresses of a target DHCP server and the target DHCP server are determined according to a preset mapping relation and a source address of a DHCP client, the destination address in the DHCP REQUEST message is modified into the MAC address of the target DHCP server, the modified DHCP REQUEST message is sent to the target DHCP server, the MAC address of each standby DHCP server is determined according to the preset mapping relation and the MAC address of the target DHCP server, the destination address in the DHCP REQUEST message is modified into the MAC address of the standby DHCP server to obtain the DHCP REQUEST message matched with the number of the standby DHCP servers, and each modified DHCP REQUEST message is sent to the corresponding standby DHCP server, thereby realizing that the DHCP REQUEST message is sent to the target DHCP server and the standby DHCP server in a unicast mode, the high availability of the DHCP is realized, the occupied network bandwidth is reduced, and the network pressure is reduced.
Fig. 3 is a schematic flowchart of a method for processing a DHCP REQUEST message according to a third embodiment of the present invention. As shown, the method includes steps S301-S305.
S301, a preset mapping relation is obtained from a controller, and the controller is used for managing a DHCP client and a DHCP server and distributing the DHCP server for providing the IP service for the DHCP client.
Specifically, in the embodiment of the present invention, the controller is configured to integrally manage the DHCP client and the DHCP server, and allocate the DHCP server for providing the IP service to the DHCP client. The preset mapping relationship may be configured to allocate, to the controller, a DHCP server corresponding to each DHCP client according to an average allocation principle after the number of the DHCP clients and the number of the DHCP servers are obtained, or the controller dynamically allocates, to the DHCP client, a DHCP server corresponding to each DHCP server according to a working state of each DHCP server, which is not limited herein.
S302, if a DHCP protocol message sent by a DHCP client is received, identifying whether the DHCP protocol message is a DHCP REQUEST message, wherein the DHCP REQUEST message at least comprises a message type, a source address and a destination address, the source address is an MAC address of the DHCP client, and the destination address is FF-FF-FF-FF-FF-FF.
And S303, if yes, determining a target DHCP server and an MAC address of the target DHCP server according to the preset mapping relationship and the source address of the DHCP client, wherein the preset mapping relationship comprises an association relationship between the DHCP client and the DHCP server.
Specifically, the target DHCP server and the MAC address of the target DHCP server are determined according to the preset mapping relationship obtained from the controller in step S301 and the source address of the DHCP client.
S304, modifying the destination address in the DHCP REQUEST message into the MAC address of the target DHCP server.
S305, sending the modified DHCP REQUEST message to the target DHCP server.
Steps S303 to S305 are the same as above, and are not described herein again.
The embodiment of the invention acquires the preset mapping relation from the controller, identifies the received DHCP protocol message, determines the MAC address of the target DHCP server and the target DHCP server according to the preset mapping relation and the source address of the DHCP client if the DHCP protocol message is the DHCP REQUEST message, modifies the target address in the DHCP REQUEST message into the MAC address of the target DHCP server, and sends the modified DHCP REQUEST message to the target DHCP server, thereby realizing that the DHCP REQUEST message is sent to the target DHCP server in a unicast mode according to the preset mapping relation, reducing the occupied network bandwidth and reducing the network pressure.
Referring to fig. 4, a schematic block diagram of an apparatus according to a first embodiment of the present invention is shown. The apparatus 40 in the present embodiment as shown in the figure comprises a recognition unit 41, a first determination unit 42, a first modification unit 43, and a first sending unit 44.
The identifying unit 41 is configured to identify whether a DHCP protocol message sent by a DHCP client is a DHCP REQUEST message, where the DHCP REQUEST message at least includes a message type, a source address, and a destination address, the source address is an MAC address of the DHCP client, and the destination address is FF-FF.
Specifically, in the process of communicating between the DHCP client and the DHCP server through a DHCP protocol message, various types of messages are usually involved, such as a DHCP DISCOVER message, a DHCP OFFER message, a DHCP REQUEST message, an DHCP DECLINE message, and a DHCP cpack message, and these DHCP protocol messages may be transmitted in a broadcast, unicast, or multicast manner. The DHCP protocol message is encapsulated according to a specified message format, for example, in the embodiment of the present invention, the DHCP REQUEST message sent by the DHCP client at least includes a message type, a source address, a destination address, and the like. The message types are used for distinguishing different types of messages. The source address and the destination address correspond to each other in an Ethernet link layer and a network protocol layer, namely the source address in the Ethernet link layer is the MAC address of the DHCP client, the destination address is FF-FF-FF-FF-FF, and the source address in the network protocol layer corresponding to the Ethernet link layer is 0.0.0.0.0 and the destination address is 255.255.255.255. The destination address is 255.255.255.255, which means that all DHCP servers supporting the TCP/IP protocol on the network receive the DHCP REQUEST message, i.e. the DHCP REQUEST message sent from the DHCP client is a broadcast message; and after receiving the DHCP REQUEST message, the DHCP server responds to the DHCP client according to the MAC address of the DHCP client, such as sending a DHCPACK message to the DHCP client.
A first determining unit 42, configured to determine, if yes, a target DHCP server and an MAC address of the target DHCP server according to a preset mapping relationship and a source address of the DHCP client, where the preset mapping relationship includes an association relationship between the DHCP client and the DHCP server.
Specifically, the preset mapping relationship is usually configured according to the requirement of load balancing, and is used for determining which DHCP servers provide IP services for which DHCP clients, so as to ensure that hosts connected to the network can be configured with available IP addresses. It is to be understood that the preset mapping relationship is not limited, and the preset mapping relationship may also be determined by autonomously selecting the DHCP client according to the response speed of the DHCP server, for example, comparing the response speeds of a plurality of DHCP servers and selecting the DHCP server with the highest response speed as the target DHCP server, and the like, which is not limited herein. In the embodiment of the invention, the preset mapping relationship comprises an association relationship between the DHCP client and the DHCP server. The preset mapping relationship can be embodied in a form of a list, and the corresponding relationship between the DHCP client and the DHCP server is marked by recording the name of the DHCP client, the MAC address of the DHCP client, the name of the DHCP server corresponding to the DHCP client, the MAC address of the DHCP server and the like in the list, so that the target DHCP server and the MAC address of the target DHCP server can be conveniently determined in the list of the preset mapping relationship according to the source address of the DHCP client, and the target DHCP server can provide IP address service for the DHCP client.
A first modifying unit 43, configured to modify the destination address in the DHCP REQUEST message to the MAC address of the target DHCP server.
Specifically, in order to reduce the network bandwidth occupied by the DHCP REQUEST message during transmission and reduce the network pressure, the broadcast form needs to be modified into the unicast form during the transmission of the DHCP REQUEST message. In the embodiment of the invention, the destination address in the DHCP REQUEST message is modified into the MAC address of the target DHCP server, namely, the destination address is FF-FF-FF-FF-FF, the destination address is the MAC address of the target DHCP server, so that the DHCP REQUEST message is converted into the message in a unicast form from a broadcast form.
A first sending unit 44, configured to send the modified DHCP REQUEST message to the target DHCP server.
Specifically, after modifying the destination address in the DHCP REQUEST message to the MAC address of the target DHCP server, the first modifying unit 43 sends the modified DHCP REQUEST message to the target DHCP server, so that the target DHCP server responds to the DHCP REQUEST message. By sending the DHCP REQUEST message to the target DHCP server in a unicast mode, compared with the mode that the DHCP REQUEST message is sent to a plurality of DHCP servers in a broadcast mode, the occupied network bandwidth is reduced, and the network pressure is reduced.
In the embodiment of the present invention, the received DHCP protocol message is identified by the identifying unit 41, if the DHCP protocol message is a DHCP REQUEST message, the first determining unit 42 determines the target DHCP server and the MAC address of the target DHCP server according to the preset mapping relationship and the source address of the DHCP client, modifies the destination address in the DHCP REQUEST message to the MAC address of the target DHCP server by the first modifying unit 43, and sends the modified DHCP REQUEST message to the target DHCP server by the first sending unit 44, thereby implementing sending the DHCP REQUEST message to the target DHCP server in a unicast manner, so as to reduce the occupied network bandwidth and reduce the network pressure.
Referring to fig. 5, there is shown a schematic block diagram of an apparatus according to a second embodiment of the present invention. The apparatus 50 in the present embodiment as shown in the figure includes a recognition unit 51, a first determination unit 52, a first modification unit 53, a first transmission unit 54, a second determination unit 55, a second modification unit 56, and a second transmission unit 57.
The identification unit 51 is configured to identify whether a DHCP protocol message sent by a DHCP client is a DHCP REQUEST message, where the DHCP REQUEST message at least includes a message type, a source address, and a destination address, the source address is an MAC address of the DHCP client, and the destination address is FF-FF.
A first determining unit 52, configured to determine, if yes, a target DHCP server and an MAC address of the target DHCP server according to a preset mapping relationship and a source address of the DHCP client, where the preset mapping relationship includes an association relationship between the DHCP client and the DHCP server.
A first modifying unit 53, configured to modify the destination address in the DHCP REQUEST message to the MAC address of the target DHCP server.
A first sending unit 54, configured to send the modified DHCP REQUEST message to the target DHCP server.
A second determining unit 55, configured to determine the MAC address of each of the standby DHCP servers according to a preset mapping relationship and the MAC address of the target DHCP server, where the preset mapping relationship further includes an association relationship between the DHCP server and the standby DHCP server.
Specifically, in the embodiment of the present invention, in order to achieve high availability of the DHCP servers and prevent that a DHCP client cannot respond to a DHCP server after a failure occurs in one of the DHCP servers, in the embodiment of the present invention, at least one standby DHCP server is configured for a target DHCP server, and the standby DHCP server and the target DHCP server form a DHCP server cluster to provide a redundant backup function for the target DHCP server. The preset mapping relationship not only includes an association relationship between the DHCP client and the DHCP server, but also includes an association relationship between the DHCP server and the standby DHCP server in the embodiment of the present invention, that is, which standby DHCP servers are configured for the target DHCP server corresponding to one DHCP client. The preset mapping relationship can also be embodied in a form of a list, and the corresponding relationship between the DHCP server and the standby DHCP server is marked by recording the name of the DHCP server, the MAC address of the DHCP server, the name of the standby DHCP server corresponding to the DHCP server, the MAC address of the standby DHCP server, and the like in the list, so that the MAC addresses of the standby DHCP server and the standby DHCP server can be determined in the list of the preset mapping relationship according to the MAC address of the target DHCP server, and the standby DHCP server can provide a redundant standby function for the target DHCP server.
It is understood that, at the first determining unit 53, the target DHCP server and the MAC address of the target DHCP server are determined according to the preset mapping relationship and the source address of the DHCP client, and the second determining unit 55 determines the MAC address of each backup DHCP server according to the preset mapping relationship and the MAC address of the target DHCP server. In some possible embodiments, it is preferable that the first determining unit 53 and the second determining unit 55 are executed simultaneously, that is, the MAC of the target DHCP server, the MAC of the standby server, and the MAC address of the standby server are determined simultaneously according to the preset mapping relationship and the source address of the DHCP client.
A second modifying unit 56, configured to modify the destination address in the DHCP REQUEST message into the MAC address of the standby DHCP server to obtain a DHCP REQUEST message matching the number of the standby DHCP servers.
Specifically, in the embodiment of the present invention, after the number of the standby DHCP servers of the target DHCP server and the MAC address of each of the standby DHCP servers are determined in step S205, the destination address in the DHCP REQUEST message is modified to the MAC address of the standby DHCP server, so as to obtain the DHCP REQUEST message matching the number of the standby DHCP servers. In some possible embodiments, it is preferred that the first modification unit 53 is performed simultaneously with the second modification unit 56.
Preferably, in some possible embodiments, the destination address in the DHCP REQUEST message is sequentially modified into the MAC address of the standby DHCP server according to a preset order to obtain the DHCP REQUEST message matching the number of the standby DHCP servers. The preset sequence may be modified in sequence according to the sequence of the DHCP servers in the list, and if the number of the standby DHCP servers is 3, the destination address in the DHCPREQUEST REQUEST message is modified in sequence according to the sequence of the 3 standby DHCP servers in the list to the MAC address of the standby DHCP server to obtain 3 DHCP REQUEST messages. It is to be understood that, in other possible embodiments, in order to improve the transmission speed of the DHCP REQUEST message, the destination address in the DHCP REQUEST message may also be simultaneously modified to the MAC address of the standby DHCP server to obtain a DHCP REQUEST message matching the number of the standby DHCP servers.
A second sending unit 57, configured to send each modified DHCP REQUEST message to the corresponding standby DHCP server.
Specifically, in the embodiment of the present invention, each modified DHCP REQUEST message is sent to the corresponding backup DHCP server, so as to provide a redundant backup function for the target DHCP server, and when the target DHCP server fails and cannot respond to the DHCP client, the backup DHCP server will replace the target DHCP server to respond to the DHCP client, thereby achieving high availability of the DHCP server. In some possible embodiments, it is preferred that the second sending unit 57 is executed simultaneously with the first sending unit 54.
The embodiment of the invention identifies the received DHCP protocol message by an identification unit 51, if the DHCP protocol message is a DHCP REQUEST message, a target DHCP server and the MAC address of the target DHCP server are determined by a first determination unit 52 according to a preset mapping relation and the source address of a DHCP client, the destination address in the DHCP REQUEST message is modified into the MAC address of the target DHCP server by a first modification unit 53, the modified DHCP REQUEST message is sent to the target DHCP server by a first sending unit 54, the MAC address of each standby DHCP server is determined by a second determination unit 55 according to the preset mapping relation and the MAC address of the target DHCP server, the destination address in the DHCP REQUEST message is modified into the MAC address of the standby DHCP server by a second modification unit 56 to obtain the DHCP REQUEST message matched with the number of the standby DHCP servers, and each modified DHCP REQUEST message is sent to the corresponding standby DHCP server through the second sending unit 57, so that the DHCP REQUEST message is sent to the target DHCP server and the standby DHCP server in a unicast manner, high availability of DHCP is realized, occupied network bandwidth is reduced, and network pressure is reduced. And sending the modified DHCP REQUEST message to each standby DHCP server, thereby realizing that the DHCP REQUEST message is sent to the target DHCP server and the standby DHCP server in a unicast mode, not only realizing the high availability of the DHCP, but also reducing the occupied network bandwidth and reducing the network pressure.
Referring to fig. 6, a schematic block diagram of an apparatus according to a third embodiment of the present invention is shown. The apparatus 60 in the present embodiment as shown in the figure includes an acquisition unit 61, a recognition unit 62, a first determination unit 63, a first modification unit 64, and a first transmission unit 65.
And an obtaining unit 61, configured to obtain the preset mapping relationship from a controller, where the controller is configured to manage the DHCP client and the DHCP server, and allocate the DHCP server that provides the IP service for the DHCP client.
Specifically, in the embodiment of the present invention, the controller is configured to integrally manage the DHCP client and the DHCP server, and allocate the DHCP server for providing the IP service to the DHCP client. The preset mapping relationship table may allocate, to the controller, a DHCP server corresponding to each DHCP client according to an average allocation principle after the obtained number of the DHCP clients and the number of the DHCP servers, or the controller dynamically allocates, to the DHCP client, a DHCP server corresponding to each DHCP server according to a working state of each DHCP server, which is not limited herein.
The identification unit 62 is configured to identify whether a DHCP protocol message sent by a DHCP client is a DHCP REQUEST message, where the DHCP REQUEST message at least includes a message type, a source address, and a destination address, the source address is an MAC address of the DHCP client, and the destination address is FF-FF.
A first determining unit 63, configured to determine, if yes, a target DHCP server and an MAC address of the target DHCP server according to a preset mapping relationship and a source address of the DHCP client, where the preset mapping relationship includes an association relationship between the DHCP client and the DHCP server.
A first modifying unit 64, configured to modify the destination address in the DHCP REQUEST message to the MAC address of the target DHCP server.
A first sending unit 65, configured to send the modified DHCP REQUEST message to the target DHCP server.
In the embodiment of the invention, the preset mapping relation is obtained from the controller through the obtaining unit 61, the received DHCP protocol message is identified through the identifying unit 62, if the DHCP protocol message is the DHCPREQUEST REQUEST message, the destination address in the DHCP REQUEST REQUEST message is modified into the MAC address of the target DHCP server through the first modifying unit 64 according to the preset mapping relation and the source address of the DHCP client side through the first determining unit 63, and the modified DHCPREQUEST REQUEST message is sent to the target DHCP server through the first sending unit 65, so that the DHCP REQUEST REQUEST message is sent to the target DHCP server in a unicast mode, the occupied network bandwidth is reduced, and the network pressure is reduced.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, device apparatuses or units, and may also be an electrical, mechanical or other form of connection.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs.
The units in the device of the embodiment of the invention can be merged, divided and deleted according to actual needs.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, an apparatus, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above are preferred embodiments of the invention and are not intended to limit the invention in any way. Various equivalent changes and modifications can be made by those skilled in the art based on the above-described embodiments, and all equivalent changes and modifications within the scope of the claims should be considered as falling within the scope of the present invention.

Claims (8)

1. A processing method of DHCP REQUEST message is characterized in that the method comprises the following steps:
if a DHCP protocol message sent by a DHCP client side is received, identifying whether the DHCP protocol message is a DHCP REQUEST message or not, wherein the DHCP REQUEST message at least comprises a message type, a source address and a destination address, the source address is an MAC address of the DHCP client side, and the destination address is FF-FF-FF-FF-FF-FF;
if yes, determining a target DHCP server and an MAC address of the target DHCP server according to the incidence relation between the DHCP client and the DHCP server and the source address of the DHCP client;
modifying the destination address in the DHCP REQUEST message into the MAC address of the target DHCP server so as to convert the DHCP REQUEST message from a broadcast form into a unicast form;
sending the modified DHCP REQUEST message to the target DHCP server;
determining the MAC address of each standby DHCP server according to the association relationship between the DHCP server and the standby DHCP servers and the MAC address of the target DHCP server, wherein the target DHCP server is configured with at least one standby DHCP server;
modifying the destination address in the DHCP REQUEST message into the MAC address of the standby DHCP server to obtain the DHCP REQUEST message matched with the number of the standby DHCP servers;
and sending each modified DHCP REQUEST message to the corresponding standby DHCP server.
2. The method as claimed in claim 1, wherein said modifying the destination address in the DHCP REQUEST message to the MAC address of the standby DHCP server to obtain a DHCP REQUEST message matching the number of the standby DHCP servers includes:
and sequentially modifying the destination address in the DHCP REQUEST message into the MAC address of the standby DHCP server according to a preset sequence so as to obtain the DHCP REQUEST message matched with the number of the standby DHCP servers.
3. The method as claimed in claim 1, wherein said modifying the destination address in the DHCP REQUEST message to the MAC address of the standby DHCP server to obtain a DHCP REQUEST message matching the number of the standby DHCP servers includes:
and simultaneously modifying the destination address in the DHCP REQUEST message into the MAC address of the standby DHCP server to obtain the DHCP REQUEST message matched with the number of the standby DHCP servers.
4. The method of any one of claims 1 or 3, further comprising:
and acquiring a preset mapping relation from a controller, wherein the controller is used for managing the DHCP client and the DHCP server and allocating the DHCP server for providing the IP service for the DHCP client.
5. An apparatus, comprising:
the DHCP server comprises an identification unit, a processing unit and a processing unit, wherein the identification unit is used for identifying whether a DHCP protocol message sent by a DHCP client is a DHCP REQUEST message or not, the DHCP REQUEST message at least comprises a message type, a source address and a destination address, the source address is an MAC address of the DHCP client, and the destination address is FF-FF-FF-FF-FF;
a first determining unit, configured to determine, if yes, a target DHCP server and an MAC address of the target DHCP server according to an association relationship between the DHCP client and the DHCP server and a source address of the DHCP client;
a first modification unit, configured to modify a destination address in the DHCP REQUEST message to an MAC address of the target DHCP server, so as to convert the DHCP REQUEST message from a broadcast format to a unicast format;
a first sending unit, configured to send the modified DHCP REQUEST message to the target DHCP server;
a second determining unit, configured to determine a MAC address of each backup DHCP server according to an association relationship between the DHCP server and a backup DHCP server and a MAC address of the target DHCP server, where the target DHCP server is configured with at least one backup DHCP server;
a second modification unit, configured to modify a destination address in the DHCP REQUEST message into an MAC address of the standby DHCP server to obtain a DHCP REQUEST message matching the number of the standby DHCP servers;
and the second sending unit is used for sending each modified DHCP REQUEST message to the corresponding standby DHCP server.
6. The apparatus according to claim 5, wherein the second modifying unit is specifically configured to sequentially modify the destination address in the DHCP REQUEST message into the MAC addresses of the standby DHCP servers according to a preset order to obtain the DHCP REQUEST message matching the number of the standby DHCP servers.
7. The apparatus according to claim 5, wherein the second modifying unit is specifically configured to modify the destination address in the DHCPREQUEST REQUEST message to the MAC address of the standby DHCP server at the same time to obtain a DHCP REQUEST message matching the number of the standby DHCP servers.
8. The apparatus of any of claims 5 or 7, further comprising:
and the acquisition unit is used for acquiring a preset mapping relation from a controller, and the controller is used for managing the DHCP client and the DHCP server and allocating the DHCP server for providing the IP service for the DHCP client.
CN201611008408.9A 2016-11-16 2016-11-16 Method and device for processing DHCP REQUEST message Active CN107786682B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611008408.9A CN107786682B (en) 2016-11-16 2016-11-16 Method and device for processing DHCP REQUEST message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611008408.9A CN107786682B (en) 2016-11-16 2016-11-16 Method and device for processing DHCP REQUEST message

Publications (2)

Publication Number Publication Date
CN107786682A CN107786682A (en) 2018-03-09
CN107786682B true CN107786682B (en) 2021-06-29

Family

ID=61437771

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611008408.9A Active CN107786682B (en) 2016-11-16 2016-11-16 Method and device for processing DHCP REQUEST message

Country Status (1)

Country Link
CN (1) CN107786682B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112769600B (en) * 2020-12-29 2022-08-30 新华三技术有限公司 DHCP escape method, device, equipment and machine readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101330531A (en) * 2008-07-31 2008-12-24 杭州华三通信技术有限公司 Method for processing DHCP address allocation and DHCP relay
CN102265568A (en) * 2011-06-13 2011-11-30 华为技术有限公司 Communication method and load equalizer

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101330531A (en) * 2008-07-31 2008-12-24 杭州华三通信技术有限公司 Method for processing DHCP address allocation and DHCP relay
CN102265568A (en) * 2011-06-13 2011-11-30 华为技术有限公司 Communication method and load equalizer

Also Published As

Publication number Publication date
CN107786682A (en) 2018-03-09

Similar Documents

Publication Publication Date Title
EP2608491B1 (en) Method, apparatus and system for allocating public IP address
US7263559B2 (en) Method for preventing IP address cheating in dynamic address allocation
US20080028071A1 (en) Communication load reducing method and computer system
US7971045B1 (en) System and method for selecting a network boot device using a hardware class identifier
US9215206B2 (en) Subnet prioritization for IP address allocation from a DHCP server
US9438679B2 (en) Method, apparatus, name server and system for establishing FCOE communication connection
CN102025630A (en) Load balancing method and load balancing system
EP1202493A2 (en) Friend configuration and corresponding method for network devices
US20140074997A1 (en) Method, device, and system for implementing communication after virtual machine migration
WO2000074333A9 (en) Automatic discovery of nodes associated with a virtual subnet
CN108429824B (en) Address allocation method and device
JP2002169694A (en) Method and system for automatic allocation of boot server to pxe client on network via dhcp server
US20140006568A1 (en) Prioritization based on ip pool and subnet by dhcp
CN103297353A (en) Access method and system of customer premise equipment and broadband network gateway
CN102143247A (en) Method for allocating and configuring address, address allocation server and host machine
EP2442521A1 (en) Method for obtaining ip address of dynamic host configuration protocol version 6 server, dynamic host configuration protocol version 6 server and dynamic host configuration protocol version 6 communication system
CN105245629A (en) DHCP-based host communication method and device
US20220385623A1 (en) Address rotation aware dynamic host control protocol
CN111131445B (en) DHCP cluster scheduling method and DHCP cluster system
CN106790734B (en) Network address allocation method and device
US20180083918A1 (en) Information processing system, proxy server, address duplication prevention method, and computer-readable recording medium
US8868784B2 (en) Sticky IP prioritization based on IP pool and subnet by DHCP
CN107786682B (en) Method and device for processing DHCP REQUEST message
US20150134804A1 (en) Communication device and communication system
CN105847143B (en) Load balancing method and system based on VRRP

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