CN108259636B - Message processing method and device - Google Patents

Message processing method and device Download PDF

Info

Publication number
CN108259636B
CN108259636B CN201710909590.3A CN201710909590A CN108259636B CN 108259636 B CN108259636 B CN 108259636B CN 201710909590 A CN201710909590 A CN 201710909590A CN 108259636 B CN108259636 B CN 108259636B
Authority
CN
China
Prior art keywords
dhcp
message
bgp
dhcp server
relay
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
CN201710909590.3A
Other languages
Chinese (zh)
Other versions
CN108259636A (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 Technologies Co Ltd
Original Assignee
New H3C 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 Technologies Co Ltd filed Critical New H3C Technologies Co Ltd
Priority to CN201710909590.3A priority Critical patent/CN108259636B/en
Publication of CN108259636A publication Critical patent/CN108259636A/en
Application granted granted Critical
Publication of CN108259636B publication Critical patent/CN108259636B/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
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0668Management of faults, events, alarms or notifications using network fault recovery by dynamic selection of recovery network elements, e.g. replacement by the most appropriate element after failure
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity

Abstract

The invention provides a message processing method and a device, wherein the method comprises the following steps: when receiving a DHCP message sent by a DHCP client, carrying out BGP packaging on the DHCP message, and sending the DHCP message packaged by the BGP to a main DHCP server; when receiving a DHCP response message encapsulated by BGP sent by the main DHCP server, removing the BGP encapsulation to obtain a DHCP response message, and sending the DHCP response message to the DHCP client; and when the BGP connection with the main DHCP server is detected to be disconnected, selecting a standby DHCP server with normal BGP connection to be switched to the main DHCP server. The application of the invention can ensure that the DHCP relay can sense the available state of the main DHCP server in time, and improve the address allocation efficiency.

Description

Message processing method and device
Technical Field
The present invention relates to the field of network communication technologies, and in particular, to a method and an apparatus for processing a packet.
Background
A DHCP (Dynamic Host Configuration Protocol) Protocol is generally applied to a large-scale local area network environment, and mainly functions to centrally manage and allocate IP addresses, so that a Host in the network environment dynamically obtains the IP addresses, and the utilization rate of the addresses can be improved.
The DHCP protocol employs a client/server model, with the task of dynamic allocation of host addresses driven by the network host. When the DHCP server receives the information of applying address from the network host, it will send the relevant address configuration information to the network host to realize the dynamic configuration of the network host address information.
When the DHCP client and the DHCP server are in different physical network segments, the DHCP client can communicate with the DHCP server through a DHCP relay (relay) to acquire an IP address.
After the DHCP relay selects the DHCP server by using the master-standby mode, the DHCP request message is preferentially forwarded to the address of the first configured DHCP server. When the DHCP server determines that the IP address can not be allocated, the DHCP relay forwards the subsequent DHCP request message to the address of the next DHCP server. If the DHCP relay has switched to the last DHCP server address configured and finds that the DHCP server is still unavailable, the first DHCP server address configured is reselected into the next cycle.
However, in the above address allocation scheme, when the current active DHCP server is unavailable, the DHCP relay cannot timely know the available state of the active DHCP server, so that the active DHCP server cannot be timely switched to the next standby DHCP server.
Disclosure of Invention
The invention provides a message processing method and a message processing device, which are used for solving the problem that a DHCP relay in the existing address allocation scheme cannot timely acquire the available state of a main DHCP server.
According to a first aspect of the embodiments of the present invention, there is provided a packet processing method, applied to a DHCP relay, where a BGP neighbor is established between the DHCP relay and a DHCP server, the method including:
when receiving a DHCP message sent by a DHCP client, carrying out BGP packaging on the DHCP message, and sending the DHCP message packaged by the BGP to a main DHCP server;
when receiving a DHCP response message encapsulated by BGP sent by the main DHCP server, removing the BGP encapsulation to obtain a DHCP response message, and sending the DHCP response message to the DHCP client;
and when the BGP connection with the main DHCP server is detected to be disconnected, selecting a standby DHCP server with normal BGP connection to be switched to the main DHCP server.
According to a second aspect of the embodiments of the present invention, there is provided a message processing method applied to a DHCP server, where a BGP neighbor is established between the DHCP server and a DHCP relay, the method including:
when a BGP encapsulated DHCP message sent by a DHCP relay is received, the BGP encapsulation is removed to obtain a DHCP message, and the DHCP message is processed;
and sending a DHCP response message encapsulated by BGP to the DHCP relay.
According to a third aspect of the embodiments of the present invention, there is provided a packet processing apparatus, applied to a DHCP relay, where a BGP neighbor is established between the DHCP relay and a DHCP server, the apparatus including:
a receiving unit, configured to receive a packet;
the packaging unit is used for carrying out BGP packaging on the DHCP message when the receiving unit receives the DHCP message sent by the DHCP client;
a sending unit, configured to send the BGP encapsulated DHCP message to a primary DHCP server;
the encapsulating unit is further configured to, when the receiving unit receives the BGP-encapsulated DHCP reply packet sent by the primary DHCP server, remove the BGP encapsulation to obtain a DHCP reply packet
The sending unit is further configured to send a DHCP reply message to the DHCP client;
the detection unit is used for detecting whether the BGP connection with the DHCP server is disconnected;
and the switching unit is used for selecting a standby DHCP server with normal BGP connection to be switched to the main DHCP server when the detection unit detects that the BGP connection with the main DHCP server is disconnected.
According to a fourth aspect of the embodiments of the present invention, there is provided a packet processing apparatus, which is applied to a DHCP server, and a BGP neighbor is established between the DHCP server and a DHCP relay, the apparatus including:
a receiving unit, configured to receive a packet;
the packaging unit is used for removing BGP packaging to obtain a DHCP message when the receiving unit receives the DHCP message packaged by BGP sent by the DHCP relay;
the processing unit is used for processing the DHCP message;
the encapsulation unit is also used for carrying out BGP encapsulation on the DHCP response message;
and the sending unit is used for sending the DHCP response message encapsulated by the BGP to the DHCP relay.
By applying the embodiment of the invention, the BGP neighbor is established between the BGP relay and the BGP server, when the DHCP message sent by the DHCP client is received, the BGP is packaged, and the DHCP message packaged by the BGP is sent to the main DHCP server; when a DHCP response message packaged by BGP sent by a main DHCP server is received, the BGP packaging is removed to obtain a DHCP response message, and the DHCP response message is sent to a DHCP client; when the BGP connection with the main DHCP server is detected to be disconnected, a standby DHCP server with normal BGP connection is selected to be switched to the main DHCP server, so that the DHCP relay can sense the available state of the main DHCP server in time, and the address allocation efficiency is improved.
Drawings
Fig. 1 is a schematic structural diagram of a message processing system according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of BGP neighbor establishment according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a message processing method according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of a message processing method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a message processing apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of another message processing apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of another message processing apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a message processing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution in the embodiment of the present invention, a brief description is given below of a system architecture to which the embodiment of the present invention is applicable.
Referring to fig. 1, for a schematic diagram of an architecture of a message processing system provided in an embodiment of the present invention, as shown in fig. 1, a TCP (Transmission Control Protocol) connection may be established between a DHCP relay and a DHCP server, and further, a BGP (Border Gateway Protocol) neighbor is established, where a flow of establishing a BGP neighbor between the DHCP relay and the DHCP server may be shown in fig. 2, and details of related implementation thereof may be referred to related descriptions in an existing BGP Protocol, which is not described in detail in the embodiment of the present invention.
In the embodiment of the invention, the protocol cluster supported by the BGP can be expanded, the DHCP protocol cluster is added, and the DHCP messages interacted between the DHCP relay and the DHCP server are all packaged in the BGP messages for transmission.
In order to make the aforementioned objects, features and advantages of the embodiments of the present invention more comprehensible, embodiments of the present invention are described in detail below with reference to the accompanying drawings.
Referring to fig. 3, a schematic flow chart of a message processing method according to an embodiment of the present invention is shown, where the message processing method may be applied to the DHCP relay in fig. 1, and as shown in fig. 3, the message processing method may include:
step 301, when receiving a DHCP message sent by a DHCP client, performing BGP encapsulation on the DHCP message, and sending the BGP encapsulated DHCP message to a primary DHCP server.
In the embodiment of the invention, the DHCP message sent by the DHCP client comprises a DHCP Discover message or a DHCP Request message; the specific implementation of sending the DHCP message to the DHCP relay by the DHCP client may refer to the related description in the existing DHCP protocol, and the embodiment of the present invention is not described herein again.
In the embodiment of the invention, when the DHCP relay receives the DHCP message sent by the DHCP client, the DHCP relay can carry out BGP encapsulation on the DHCP message to obtain the DHCP message encapsulated by BGP, and send the DHCP message encapsulated by BGP to the main DHCP server.
The message format of the BGP-encapsulated DHCP message may be as shown in table 1:
TABLE 1
BGP message header
DHCP message
Step 302, when receiving the DHCP reply message encapsulated by the BGP from the primary DHCP server, the BGP is decapsulated to obtain the DHCP reply message, and the DHCP reply message is sent to the DHCP client.
In the embodiment of the invention, when the main DHCP server receives the DHCP message encapsulated by the BGP sent by the DHCP relay, the main DHCP server can decapsulate the DHCP message encapsulated by the BGP, strip the BGP message header of the DHCP message encapsulated by the BGP to obtain the DHCP message carried in the main DHCP message, and carry out corresponding processing according to the type (Discover or Request) of the DHCP message. The specific processing flow of the DHCP Discover message or the DHCP Request message by the DHCP server may refer to the related description in the existing DHCP protocol, which is not described in detail in the embodiment of the present invention.
When the DHCP message sent by the DHCP client is a DHCP Discover message, the DHCP response message sent by the main DHCP server is a DHCP Offer message; when the DHCP message sent by the DHCP client is a DHCP Request message, the DHCP reply message sent by the active DHCP server is a DHCP ACK (acknowledge) message.
In the embodiment of the invention, when the main DHCP server replies the DHCP response message to the DHCP relay, the BGP encapsulation is needed to be carried out on the DHCP response message, and the DHCP response message encapsulated by the BGP is sent to the DHCP relay.
When the DHCP relay receives the DHCP response message encapsulated by the BGP sent by the main DHCP server, the DHCP relay decapsulates the DHCP response message encapsulated by the BGP, strips the BGP message header of the DHCP response message encapsulated by the BGP to obtain the DHCP response message carried in the DHCP response message, and sends the DHCP response message to the DHCP client.
And step 303, when detecting that the BGP connection with the primary DHCP server is disconnected, selecting a standby DHCP server with a normal BGP connection to switch to the primary DHCP server.
In the embodiment of the invention, when the DHCP server is unavailable, the BGP connection between the DHCP relay and the DHCP server is disconnected.
Correspondingly, when the DHCP relay detects that the BGP connection between itself and the primary DHCP server is disconnected, the DHCP relay determines that the primary DHCP server is unavailable, and at this time, to avoid that the DHCP client cannot go online, the DHCP relay may select one standby DHCP server from the standby DHCP servers that are normally connected to itself to switch to the primary DHCP server, and perform DHCP message interaction with the new primary DHCP server as described in steps 301 to 302.
For example, the DHCP relay may select to switch to the primary DHCP server according to the configuration sequence, that is, when there are a plurality of standby DHCP servers that are normally connected to the BGP relay, the standby DHCP server configured first is switched to the primary DHCP server; or, the BGP connection with the DHCP relay may be selected to be normal according to a preset priority (or weight), and the standby DHCP server with the highest priority is switched to the primary DHCP server.
It can be seen that, in the method flow shown in fig. 3, the DHCP relay establishes a BGP neighbor with the DHCP server, and then when the DHCP relay finds that the BGP connection between itself and the DHCP server is disconnected, the DHCP relay may determine a BGP neighbor state Down (non-working), thereby determining that the DHCP server is unavailable, that is, the DHCP server may quickly sense the state of the DHCP server according to the BGP neighbor state, and when the primary DHCP server is unavailable, switch to another DHCP server in time to perform address allocation, thereby improving the efficiency of address allocation.
Further, in the embodiment of the present invention, it is considered that a plurality of available IP addresses used as gateway addresses are configured in the DHCP relay, the plurality of available IP addresses respectively correspond to network segments in the DHCP server, and one of the plurality of available IP addresses is configured as a primary IP address.
For example, assuming that the address network segments that can be allocated in the DHCP server include segment 1 to segment 10, the DHCP relay may configure 10 available IP addresses (assumed as IP1 to IP10) for serving as gateway addresses, where the 10 available IP addresses correspond to segment 1 to segment 10 respectively, e.g., IP1 belongs to segment 1, IP2 belongs to segment 2.
When the DHCP relay sends a DHCP message to the DHCP server, the giaddr field of the message is filled with the main IP address (namely, the main IP address is used as the giaddr address), and when the network segment address allocation corresponding to the giaddr field in the DHCP server is full (namely, all the network segment addresses are allocated), the DHCP server does not reply the DHCP response message; when the DHCP relay needs not to receive the DHCP reply message sent by the DHCP server within the preset time, the DHCP relay discovers the situation (that is, the network segment address corresponding to the giaddr field in the DHCP server is fully allocated) by retransmitting the DHCP message for the preset number of times, and fills the giaddr field of the message with the next available IP address, so that the DHCP client cannot allocate an IP address in time.
Therefore, in order to further improve the address allocation efficiency, in the embodiment of the present invention, the DHCP server may send an address pool status notification message to the DHCP relay according to a preset policy, where the address pool status notification message may carry a network segment address allocation status in the DHCP server that sends the message, and the DHCP relay may learn the network segment address allocation status in the DHCP server according to the address pool status notification message, so as to learn a situation that the network segment address allocation is full in time, and update the giaddr address.
The sending, by the DHCP server, the address pool state notification message to the DHCP relay according to the preset policy may include sending, at regular time (e.g., periodically), the address pool state notification message to the DHCP relay, or/and sending the address pool state notification message to the DHCP relay when any network segment address allocation is full.
Correspondingly, in one embodiment of the invention, when the DHCP relay receives the address pool state notification message sent by the main DHCP server, the network segment address allocation state carried in the message is obtained;
and when the network segment address corresponding to the currently used giaddr address is determined to be fully allocated according to the network segment address allocation state, updating the currently used giaddr address.
In this embodiment, in order to implement the address pool state notification, the type of the DHCP packet may be extended, and the address pool state notification packet type is newly added.
Correspondingly, when the DHCP relay receives a BGP message encapsulated by BGP sent by the primary DHCP server, the DHCP relay may decapsulate the DHCP message to strip off the BGP message header, obtain the DHCP message carried therein, and obtain the message type of the DHCP message, if the DHCP message is a new address pool state notification message, the DHCP relay may obtain a network segment address assignment state carried in the message, and determine whether the network segment address corresponding to the currently used giaddr address is fully assigned according to the network segment address assignment state. If the network segment address corresponding to the currently used giaddr address is determined to be fully allocated, updating the currently used giaddr address; otherwise, no special processing may be required.
It should be noted that, in this embodiment, when the DHCP relay obtains the network segment address allocation status carried in the address pool status notification message, the network segment address allocation status may also be recorded, and further, when it is determined that the currently used giaddr address needs to be updated, according to the network segment address allocation status recorded by the DHCP relay, an available IP address that is not full may be allocated from one of the pre-configured available IP addresses as a new giaddr address.
For example, the DHCP relay may select, according to the configuration order, the available IP address with the earliest configuration time and the corresponding segment address assignment being not full, or select the available IP address with the highest priority (or the highest weight) and the corresponding segment address assignment being not full, as the new giaddr address.
In addition, in this embodiment, when the DHCP relay determines that the message type of the DHCP message is not the newly added address pool state notification message, the DHCP relay may perform corresponding processing according to the method described in step 302, which is not described herein again in this embodiment of the present invention.
Therefore, in the embodiment of the invention, the DHCP server sends the address pool state notification message to the DHCP relay, and the DHCP relay can quickly sense that the network segment address corresponding to the currently used giaddr address is fully allocated and update the giaddr address, so that the address allocation efficiency is improved.
Referring to fig. 4, a schematic flow chart of a message processing method according to an embodiment of the present invention is shown in fig. 4, where the message processing method includes the following steps:
step 401, the DHCP relay establishes a BGP neighbor with the DHCP server.
In the embodiment of the present invention, an interaction flow of the DHCP relay and the DHCP server establishing the BGP neighbor may be as shown in fig. 2, and specific implementation thereof is not described herein again.
Step 402, the DHCP relay receives a DHCP message sent by the DHCP client, performs BGP encapsulation on the DHCP message, and sends the BGP encapsulated DHCP message to the primary DHCP server.
In the embodiment of the invention, when the DHCP client is on line, the DHCP client can broadcast the DHCP message to request for allocating the IP address. The DHCP message includes a DHCP Discover message or a DHCP Request message.
And when the DHCP relay receives a DHCP message broadcasted by the DHCP client, the IP address of the relay main interface is used for filling the giaddr address of the DHCP message, the DHCP message is encapsulated by BGP, and then the DHCP message encapsulated by BGP is sent to the main DHCP server in a unicast mode.
Step 403, the main DHCP server receives the BGP encapsulated DHCP message sent by the DHCP relay, removes the BGP encapsulation to obtain a DHCP message, and processes the DHCP message.
In the embodiment of the invention, when the main DHCP server receives the BGP encapsulated DHCP message sent by the DHCP relay, the main DHCP server can decapsulate the message, strip off the BGP message header of the message to obtain the DHCP message, and carry out corresponding processing according to the type of the DHCP message (namely DHCP Discover or DHCP Request).
Step 404, the primary DHCP server sends a BGP encapsulated DHCP reply message to the DHCP relay.
In the embodiment of the invention, when the DHCP replies the DHCP response message, BGP encapsulation is needed to be carried out on the DHCP response message.
When the DHCP message sent by the DHCP client side is a DHCP Discover message, the DHCP response message replied by the main DHCP server is a DHCP Offer message;
and when the DHCP message sent by the DHCP client side is a DHCP Request message, the DHCP response message replied by the main DHCP server is a DHCP ACK message.
And 405, the DHCP relay receives a DHCP response message encapsulated by the BGP sent by the main DHCP server, removes the BGP encapsulation to obtain a DHCP response message, and sends the DHCP response message to the DHCP client.
In the embodiment of the invention, when the DHCP relay receives the DHCP response message packaged by the BGP sent by the main DHCP server, the DHCP response message packaged by the BGP is unpacked, the BGP message head of the DHCP response message packaged by the BGP is stripped to obtain the DHCP response message carried in the DHCP response message, and the DHCP response message is sent to the DHCP client.
And step 406, the master DHCP server sends an address pool state notification message to the DHCP relay according to a preset policy.
In the embodiment of the invention, in order to enable the DHCP relay to timely sense the address allocation state of each network segment in the DHCP, the DHCP server can send the address pool state notification message to the DHCP server at regular time, or/and the DHCP server can send the address pool state notification message to the DHCP server when any network segment is fully allocated.
The method comprises the steps that an address pool state notification message is obtained by expanding a DHCP message, an address pool state message type is newly added in the existing DHCP message, after a DHCP relay receives the BGP encapsulated DHCP message sent by a main DHCP server, the DHCP relay decapsulates the message, strips off a BGP message header of the message, judges the type of the DHCP message, and processes the message according to the related description in the existing DHCP protocol if the message is a DHCP Offer message or a DHCP ACK message; if the message is an address pool status message, go to step 407.
Step 407, the DHCP relay receives the address pool state notification message sent by the master DHCP server, and obtains the network segment address assignment state carried in the message.
And step 408, when the DHCP relay determines that the network segment address corresponding to the currently used giaddr address is fully allocated according to the acquired network segment address allocation state, selecting an available IP address which is not fully allocated to a corresponding network segment address from the pre-configured available IP addresses as a new giaddr address.
In the embodiment of the invention, when the DHCP relay receives the address pool state notification message sent by the main DHCP server, the network segment address distribution state carried in the address pool state notification message can be obtained and recorded, the network segment address distribution state corresponding to the currently used giaddr address is determined according to the network segment address distribution state, and if the network segment address distribution corresponding to the currently used giaddr address is full, an available IP address which is not fully distributed in the corresponding network segment address can be selected as a new giaddr address according to the network segment address distribution state recorded by the DHCP relay.
And 409, when the DHCP relay detects that the BGP connection with the main DHCP server is disconnected, selecting a standby DHCP server with normal BGP connection to be switched to the main DHCP server.
In the embodiment of the invention, when the DHCP relay detects that the BGP connection between the DHCP relay and the main DHCP server is disconnected, the DHCP relay determines that the main DHCP server is unavailable, and at the moment, in order to avoid the situation that the DHCP client cannot be on line, the DHCP relay needs to select a standby DHCP server with normal BGP connection to switch to the main DHCP server.
As can be seen from the above description, in the technical solution provided in the embodiment of the present invention, by establishing a BGP neighbor between a BGP relay and a BGP server, when receiving a DHCP message sent by a DHCP client, performing BGP encapsulation on the DHCP message, and sending the BGP-encapsulated DHCP message to a primary DHCP server; when a DHCP response message packaged by BGP sent by a main DHCP server is received, the BGP packaging is removed to obtain a DHCP response message, and the DHCP response message is sent to a DHCP client; when the BGP connection with the main DHCP server is detected to be disconnected, a standby DHCP server with normal BGP connection is selected to be switched to the main DHCP server, so that the DHCP relay can sense the available state of the main DHCP server in time, and the address allocation efficiency is improved.
Referring to fig. 5, a schematic structural diagram of a message processing apparatus according to an embodiment of the present invention is provided, where the apparatus may be applied to a DHCP relay in the foregoing method embodiment, and as shown in fig. 5, the message processing apparatus may include:
a receiving unit 510, configured to receive a message;
an encapsulating unit 520, configured to perform BGP encapsulation on the DHCP message sent by the DHCP client when the receiving unit 510 receives the DHCP message;
a sending unit 530, configured to send the BGP encapsulated DHCP message to the primary DHCP server;
the encapsulating unit 520 is further configured to, when the receiving unit 510 receives the BGP encapsulated DHCP reply message sent by the primary DHCP server, remove the BGP encapsulation to obtain a DHCP reply message;
the sending unit 530 is further configured to send a DHCP reply message to the DHCP client;
a detecting unit 540, configured to detect whether a BGP connection with the DHCP server is disconnected;
a switching unit 550, configured to select a standby DHCP server with a normal BGP connection to switch to the primary DHCP server when the detecting unit 540 detects that the BGP connection with the primary DHCP server is disconnected.
Referring to fig. 6 together, which is a schematic structural diagram of another message processing apparatus according to an embodiment of the present invention, as shown in fig. 6, on the basis of the message processing apparatus shown in fig. 5, the message processing apparatus shown in fig. 6 may further include:
an obtaining unit 560, configured to obtain a network segment address assignment state carried in a message when the receiving unit 310 receives an address pool state notification message sent by a master DHCP server;
and the updating unit 570 is configured to update the currently used giaddr address when it is determined that the segment address allocation corresponding to the currently used giaddr address is full according to the segment address allocation state.
Referring to fig. 7 together, a schematic structural diagram of another message processing apparatus according to an embodiment of the present invention is shown in fig. 7, where, on the basis of the message processing apparatus shown in fig. 6, the message processing apparatus shown in fig. 7 may further include:
a recording unit 580, configured to record the network segment address allocation status;
the updating unit 570 is specifically configured to select one corresponding network segment address from the pre-configured available IP addresses and allocate an insufficient available IP address as a new giaddr address.
Referring to fig. 8, a schematic structural diagram of a message processing apparatus according to an embodiment of the present invention is provided, where the message processing apparatus may be applied to a DHCP server in the foregoing method embodiment, and as shown in fig. 8, the message processing apparatus may include:
a receiving unit 810, configured to receive a message;
an encapsulating unit 820, configured to, when the receiving unit 810 receives a BGP encapsulated DHCP message sent by a DHCP relay, remove BGP encapsulation to obtain a DHCP message;
a processing unit 830, configured to process the DHCP message;
the encapsulating unit 820 is further configured to perform BGP encapsulation on the DHCP reply message;
a sending unit 840, configured to send a BGP response packet encapsulated by the BGP relay to the DHCP relay.
In an optional embodiment, the sending unit 840 is further configured to send an address pool status notification message to the DHCP relay according to a preset policy.
In an optional embodiment, the sending unit 840 is specifically configured to send an address pool status notification message to the DHCP relay at regular time; or/and when any network segment address allocation is full, sending an address pool state notification message to the DHCP relay.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and 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 modules can be selected according to actual needs to achieve the purpose of the scheme of the invention. One of ordinary skill in the art can understand and implement it without inventive effort.
As can be seen from the above embodiments, by establishing a BGP neighbor between a BGP relay and a BGP server, when receiving a DHCP message sent by a DHCP client, the BGP neighbor encapsulates the DHCP message, and sends the BGP encapsulated DHCP message to a primary DHCP server; when a DHCP response message packaged by BGP sent by a main DHCP server is received, the BGP packaging is removed to obtain a DHCP response message, and the DHCP response message is sent to a DHCP client; when the BGP connection with the main DHCP server is detected to be disconnected, a standby DHCP server with normal BGP connection is selected to be switched to the main DHCP server, so that the DHCP relay can sense the available state of the main DHCP server in time, and the address allocation efficiency is improved.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (12)

1. A message processing method is applied to a Dynamic Host Configuration Protocol (DHCP) relay, and is characterized in that a Border Gateway Protocol (BGP) neighbor is established between the DHCP relay and a DHCP server, and the method comprises the following steps:
when receiving a DHCP message sent by a DHCP client, carrying out BGP packaging on the DHCP message, and sending the DHCP message packaged by the BGP to a main DHCP server;
when receiving a DHCP response message encapsulated by BGP sent by the main DHCP server, removing the BGP encapsulation to obtain a DHCP response message, and sending the DHCP response message to the DHCP client;
and when the BGP connection with the main DHCP server is detected to be disconnected, selecting a standby DHCP server with normal BGP connection to be switched to the main DHCP server.
2. The method of claim 1, further comprising:
when an address pool state notification message sent by a main DHCP server is received, acquiring a network segment address allocation state carried in the message;
and when the network segment address allocation corresponding to the currently used giaddr address is determined to be full according to the network segment address allocation state, updating the currently used giaddr address.
3. The method of claim 2, wherein after obtaining the segment address assignment status carried in the message, the method further comprises:
recording the network segment address allocation state;
the updating of the currently used giaddr address includes:
and selecting one corresponding network segment address from the pre-configured available IP addresses to allocate the insufficient available IP address as a new giaddr address.
4. A message processing method is applied to a dynamic host protocol DHCP server, and is characterized in that a Border Gateway Protocol (BGP) neighbor is established between the DHCP server and a DHCP relay, and the method comprises the following steps:
when a BGP encapsulated DHCP message sent by a DHCP relay is received, the BGP encapsulation is removed to obtain a DHCP message, and the DHCP message is processed;
sending a DHCP response message encapsulated by BGP to the DHCP relay;
when the DHCP server is used as a standby DHCP server, if the DHCP server is selected as a main DHCP server by the DHCP relay, the DHCP server is switched to the main DHCP server; and the DHCP relay is to switch the DHCP server selected as the standby DHCP server to the main DHCP server when detecting that the BGP connection with the original main DHCP server is disconnected.
5. The method of claim 4, further comprising:
and sending an address pool state notification message to the DHCP relay according to a preset strategy.
6. The method of claim 5, wherein the sending an address pool status notification message to the DHCP relay according to a preset policy comprises:
regularly sending an address pool state notification message to the DHCP relay; and/or the first and/or second light sources,
and when any network segment address allocation is full, the main DHCP server sends an address pool state notification message to the DHCP relay.
7. A message processing device is applied to a Dynamic Host Configuration Protocol (DHCP) relay, and is characterized in that a Border Gateway Protocol (BGP) neighbor is established between the DHCP relay and a DHCP server, and the device comprises:
a receiving unit, configured to receive a packet;
the packaging unit is used for carrying out BGP packaging on the DHCP message when the receiving unit receives the DHCP message sent by the DHCP client;
a sending unit, configured to send the BGP encapsulated DHCP message to a primary DHCP server;
the encapsulating unit is further configured to, when the receiving unit receives the BGP encapsulated DHCP reply message sent by the primary DHCP server, remove the BGP encapsulation to obtain a DHCP reply message;
the sending unit is further configured to send a DHCP reply message to the DHCP client;
the detection unit is used for detecting whether the BGP connection with the DHCP server is disconnected;
and the switching unit is used for selecting a standby DHCP server with normal BGP connection to be switched to the main DHCP server when the detection unit detects that the BGP connection with the main DHCP server is disconnected.
8. The apparatus of claim 7, further comprising:
the acquiring unit is used for acquiring a network segment address allocation state carried in a message when the receiving unit receives an address pool state notification message sent by a main DHCP server;
and the updating unit is used for updating the currently used giaddr address when the network segment address corresponding to the currently used giaddr address is determined to be fully allocated according to the network segment address allocation state.
9. The apparatus of claim 8, further comprising:
the recording unit is used for recording the network segment address allocation state;
the updating unit is specifically configured to select one corresponding network segment address from the pre-configured available IP addresses and allocate an insufficient available IP address as a new giaddr address.
10. A message processing device is applied to a dynamic host protocol DHCP server, and is characterized in that a Border Gateway Protocol (BGP) neighbor is established between the DHCP server and a DHCP relay, and the device comprises:
a receiving unit, configured to receive a packet;
the packaging unit is used for removing BGP packaging to obtain a DHCP message when the receiving unit receives the DHCP message packaged by BGP sent by the DHCP relay;
the processing unit is used for processing the DHCP message;
the encapsulation unit is also used for carrying out BGP encapsulation on the DHCP response message;
a sending unit, configured to send a BGP response packet encapsulated by the BGP relay to the DHCP relay;
a switching unit, configured to switch the DHCP server to a primary DHCP server if the DHCP server is selected as the primary DHCP server by the DHCP relay when the DHCP server is used as a standby DHCP server; and the DHCP relay is to switch the DHCP server selected as the standby DHCP server to the main DHCP server when detecting that the BGP connection with the original main DHCP server is disconnected.
11. The apparatus of claim 10,
the sending unit is further configured to send an address pool state notification message to the DHCP relay according to a preset policy.
12. The apparatus of claim 11,
the sending unit is specifically configured to send an address pool state notification message to the DHCP relay at regular time; or/and when any network segment address allocation is full, sending an address pool state notification message to the DHCP relay.
CN201710909590.3A 2017-09-29 2017-09-29 Message processing method and device Active CN108259636B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710909590.3A CN108259636B (en) 2017-09-29 2017-09-29 Message processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710909590.3A CN108259636B (en) 2017-09-29 2017-09-29 Message processing method and device

Publications (2)

Publication Number Publication Date
CN108259636A CN108259636A (en) 2018-07-06
CN108259636B true CN108259636B (en) 2021-11-02

Family

ID=62722326

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710909590.3A Active CN108259636B (en) 2017-09-29 2017-09-29 Message processing method and device

Country Status (1)

Country Link
CN (1) CN108259636B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111629083B (en) * 2020-06-01 2023-06-27 瑞斯康达科技发展股份有限公司 Method and device for acquiring IP address, storage medium and electronic device
CN115550319B (en) * 2022-11-24 2023-03-28 新华三信息技术有限公司 Address allocation method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101197811A (en) * 2006-12-04 2008-06-11 中兴通讯股份有限公司 Method for improving server reliability in dynamic main unit configuration protocol under proxy mode
CN102404146A (en) * 2011-11-17 2012-04-04 福建星网锐捷网络有限公司 Master-slave switching method, network device and DHCP server
CN104253874A (en) * 2013-06-27 2014-12-31 华为技术有限公司 Message sending and processing method, device and system
CN106331202A (en) * 2015-06-30 2017-01-11 中兴通讯股份有限公司 Dynamic host configuration protocol (DHCP) server management method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030079027A1 (en) * 2001-10-18 2003-04-24 Michael Slocombe Content request routing and load balancing for content distribution networks
CN101567839B (en) * 2008-04-23 2012-06-20 华为技术有限公司 Message transmitting method, hometown agent device, route device and system
JP5364671B2 (en) * 2010-10-04 2013-12-11 アラクサラネットワークス株式会社 Terminal connection status management in network authentication
US9419892B2 (en) * 2013-09-30 2016-08-16 Juniper Networks, Inc. Methods and apparatus for implementing connectivity between edge devices via a switch fabric
CN106254203B (en) * 2016-09-05 2020-02-11 新华三技术有限公司 Message forwarding method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101197811A (en) * 2006-12-04 2008-06-11 中兴通讯股份有限公司 Method for improving server reliability in dynamic main unit configuration protocol under proxy mode
CN102404146A (en) * 2011-11-17 2012-04-04 福建星网锐捷网络有限公司 Master-slave switching method, network device and DHCP server
CN104253874A (en) * 2013-06-27 2014-12-31 华为技术有限公司 Message sending and processing method, device and system
CN106331202A (en) * 2015-06-30 2017-01-11 中兴通讯股份有限公司 Dynamic host configuration protocol (DHCP) server management method and device

Also Published As

Publication number Publication date
CN108259636A (en) 2018-07-06

Similar Documents

Publication Publication Date Title
CN101227407B (en) Method and apparatus for sending message based on two layer tunnel protocol
CN102752152B (en) Method and device used for configuring VRRP (Virtual Router Redundancy Protocol) backup group
CN106412142B (en) Resource equipment address obtaining method and device
US9525648B2 (en) Method for acquiring physical address of virtual machine
CN102244690B (en) Address allocation method and system of dynamic host configuration protocol (DHCP) as well as client side and servers of same
EP2579519A1 (en) Method, network device and system for automatically configuring network device in internet protocol version 6 network
US20130343394A1 (en) Method and Apparatus for Converting Virtual Local Area Network Identity
US9438557B2 (en) Adaptive dynamic host configuration protocol assignment with virtual local area network pool
CN111526223B (en) Management method of edge service server, service data processing method and device
WO2012163007A1 (en) Method for solving internet protocol address allocation conflict and related device and system thereof
CN103684966A (en) Method and device for processing dynamic host configuration protocol messages
CN106302322B (en) Virtual machine data flow management method and system
KR101694223B1 (en) Method, routing bridge, and system for sending packet
CN102118453B (en) Method, service device, client and communication system for automatic configuration of IP address
CN101873320B (en) Client information verification method based on DHCPv6 relay and device thereof
CN103001868A (en) Method and device used for synchronous ARP (Address Resolution Protocol) list item of virtual router redundancy protocol backup set
CN104754070A (en) Method and device for learning address resolution protocol table entries and network device
CN108259636B (en) Message processing method and device
CN109088823B (en) Method and device for realizing terminal interconnection
CN106878481B (en) Method, device and system for acquiring Internet Protocol (IP) address
CN106850869B (en) IP address configuration method and network equipment
CN104426759A (en) Host machine router acquiring method, host machine router acquiring device, and host machine router acquiring system
CN102859947B (en) Method, apparatus and system for neighbor discovery
WO2018006684A1 (en) Message processing method and device, and router
CN109842692B (en) VxLAN switch, system and method for obtaining host information in physical network

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