[go: up one dir, main page]

CN105592172A - Dynamic host configuration protocol (DHCP) reconnection method, DHCP server and system - Google Patents

Dynamic host configuration protocol (DHCP) reconnection method, DHCP server and system Download PDF

Info

Publication number
CN105592172A
CN105592172A CN201410571158.4A CN201410571158A CN105592172A CN 105592172 A CN105592172 A CN 105592172A CN 201410571158 A CN201410571158 A CN 201410571158A CN 105592172 A CN105592172 A CN 105592172A
Authority
CN
China
Prior art keywords
terminal
message
dhcp server
dhcp
request message
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.)
Withdrawn
Application number
CN201410571158.4A
Other languages
Chinese (zh)
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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201410571158.4A priority Critical patent/CN105592172A/en
Priority to PCT/CN2015/092657 priority patent/WO2016062268A1/en
Publication of CN105592172A publication Critical patent/CN105592172A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本发明涉及一种动态主机配置协议重连方法、DHCP服务器及系统,其方法包括:终端在从第一DHCP服务器切换到第二DHCP服务器时,向外广播第一DHCP请求报文;第二DHCP服务器在接收到第一DHCP请求报文后,经判断若没有维护终端的相关设备信息,则向终端返回DHCPNAK报文,以告知终端开启新一次重连过程。本发明省去了下挂设备多次DHCPREQUEST重试导致的延时,达到了快速重连的目的。

The present invention relates to a dynamic host configuration protocol reconnection method, a DHCP server and a system. The method comprises: when a terminal is switched from a first DHCP server to a second DHCP server, broadcasting a first DHCP request message; After receiving the first DHCP request message, the server returns a DHCPNAK message to the terminal to inform the terminal to start a new reconnection process after judging that if there is no relevant device information of the maintenance terminal. The invention saves the time delay caused by multiple DHCPREQUEST retries of the downlink device, and achieves the purpose of fast reconnection.

Description

动态主机配置协议重连方法、DHCP服务器及系统Dynamic host configuration protocol reconnection method, DHCP server and system

技术领域technical field

本发明涉及网络通信技术领域,尤其涉及一种动态主机配置协议重连方法、DHCP服务器及系统。The invention relates to the technical field of network communication, in particular to a dynamic host configuration protocol reconnection method, a DHCP server and a system.

背景技术Background technique

动态主机配置协议(DHCP,DynamicHostConfigurationProtocol)是一个局域网的网络协议,使用UDP协议工作,基于Client/Server工作模式,为互联网上主机提供IP地址和配置参数,主要有两个用途:给内部网络或网络服务供应商自动分配IP地址,给用户或者内部网络管理员作为对所有计算机作中央管理的手段。Dynamic Host Configuration Protocol (DHCP, DynamicHostConfigurationProtocol) is a LAN network protocol, using the UDP protocol to work, based on the Client/Server working mode, to provide IP addresses and configuration parameters for hosts on the Internet, mainly for two purposes: to the internal network or network Service providers automatically assign IP addresses to users or internal network administrators as a means of centrally managing all computers.

目前,随着手机等下挂设备的广泛应用,通过DHCP方式获取地址变得越来越重要,但是下挂设备如果切换DHCPServer,对于该下挂设备发送出去的DHCPREQUEST报文,DHCPServer根据RFC2131规范4.3.2节要进行静默处理,目的是应对在同一线路上有多个DHCPServer的情况(参见图1)。这就导致下挂设备连续发送多个DHCPREQUEST得不到响应,只能等待重试结束,重新发送DHCPDISCOVER报文开启新一次连接过程才能获得地址,由此,导致下挂设备重连延时较大,给用户体验较差。At present, with the wide application of downlink devices such as mobile phones, it is becoming more and more important to obtain addresses through DHCP. However, if the downlink device switches to DHCPServer, the DHCPServer will follow RFC2131 specification 4.3 for the DHCPREQUEST message sent by the downlink device. Section .2 needs to be silently processed, and the purpose is to deal with the situation that there are multiple DHCPServers on the same line (see Figure 1). This causes the downlink device to send multiple DHCPREQUESTs in a row without getting a response, and has to wait for the end of the retry, resend the DHCPDISCOVER message to start a new connection process to obtain the address, thus causing a long delay in the reconnection of the downlink device , giving poor user experience.

发明内容Contents of the invention

本发明的主要目的在于提供一种动态主机配置协议重连方法、DHCP服务器及系统,旨在解决下挂设备因切换DHCP服务器造成的获取地址延时较大的问题,实现下挂设备的DHCP快速重连。The main purpose of the present invention is to provide a dynamic host configuration protocol reconnection method, a DHCP server and a system, aiming to solve the problem of a large delay in acquiring addresses caused by switching DHCP servers for downlink devices, and to realize fast DHCP of downlink devices. Reconnection.

为了达到上述目的,本发明提出一种动态主机配置协议重连方法,包括:In order to achieve the above object, the present invention proposes a dynamic host configuration protocol reconnection method, comprising:

终端在从第一DHCP服务器切换到第二DHCP服务器时,向外广播第一DHCP请求报文;When the terminal switches from the first DHCP server to the second DHCP server, it broadcasts the first DHCP request message to the outside;

所述第二DHCP服务器在接收到所述第一DHCP请求报文后,经判断若没有维护所述终端的相关设备信息,则向所述终端返回DHCPNAK报文,以告知所述终端开启新一次重连过程。After receiving the first DHCP request message, the second DHCP server returns a DHCPNAK message to the terminal to notify the terminal to open a new Reconnection process.

优选地,该方法还包括:Preferably, the method also includes:

所述终端在接收到所述DHCPNAK报文后,向所述第二DHCP服务器发送第二DHCP请求报文,确认选择所述第二DHCP服务器;After receiving the DHCPNAK message, the terminal sends a second DHCP request message to the second DHCP server to confirm selection of the second DHCP server;

所述第二DHCP服务器向所述终端返回DHCPACK报文。The second DHCP server returns a DHCPACK packet to the terminal.

优选地,该方法还包括:Preferably, the method also includes:

所述终端在接收到所述DHCPNAK报文后,向外广播DISCOVER报文;After receiving the DHCPNAK message, the terminal broadcasts a DISCOVER message;

所述第二DHCP服务器在接收到所述DISCOVER报文后,向所述终端返回DHCPOFFER报文;After receiving the DISCOVER message, the second DHCP server returns a DHCPOFFER message to the terminal;

所述终端接收到所述DHCPOFFER报文后,向所述第二DHCP服务器发送第二DHCP请求报文,确认选择所述第二DHCP服务器;After receiving the DHCPOFFER message, the terminal sends a second DHCP request message to the second DHCP server to confirm selection of the second DHCP server;

所述第二DHCP服务器向所述终端返回DHCPACK报文。The second DHCP server returns a DHCPACK packet to the terminal.

优选地,所述终端在从第一DHCP服务器切换到第二DHCP服务器时,向外广播第一DHCP请求报文的步骤之前还包括:Preferably, when the terminal switches from the first DHCP server to the second DHCP server, before the step of broadcasting the first DHCP request message, the terminal further includes:

所述终端接入所述第一DHCP服务器后,向外广播DISCOVER报文;After the terminal accesses the first DHCP server, it broadcasts a DISCOVER message;

所述第一DHCP服务器在接收到所述DISCOVER报文后,向所述终端返回DHCPOFFER报文;After receiving the DISCOVER message, the first DHCP server returns a DHCPOFFER message to the terminal;

所述终端接收到所述DHCPOFFER报文后,向所述第一DHCP服务器发送第二DHCP请求报文,确认选择所述第一DHCP服务器;After receiving the DHCPOFFER message, the terminal sends a second DHCP request message to the first DHCP server to confirm selection of the first DHCP server;

所述第一DHCP服务器向所述终端返回DHCPACK报文。The first DHCP server returns a DHCPACK packet to the terminal.

本发明实施例还提出一种动态主机配置协议重连方法,包括:The embodiment of the present invention also proposes a dynamic host configuration protocol reconnection method, including:

DHCP服务器接收终端向外广播的第一DHCP请求报文;The DHCP server receives the first DHCP request message broadcast by the terminal;

根据所述第一DHCP请求报文,判断是否维护有所述终端的相关设备信息;According to the first DHCP request message, determine whether the related device information of the terminal is maintained;

若没有维护所述终端的相关设备信息,则向所述终端返回DHCPNAK报文,以告知所述终端开启新一次重连过程。If the relevant device information of the terminal is not maintained, a DHCPNAK message is returned to the terminal to inform the terminal to start a new reconnection process.

优选地,该方法还包括:Preferably, the method also includes:

接收所述终端发送的第二DHCP请求报文,所述第二DHCP请求报文确认选择所述DHCP服务器;receiving a second DHCP request message sent by the terminal, where the second DHCP request message confirms selection of the DHCP server;

向所述终端返回DHCPACK报文。Return a DHCPACK message to the terminal.

优选地,该方法还包括:Preferably, the method also includes:

接收所述终端向外广播的DISCOVER报文;receiving a DISCOVER message broadcast by the terminal;

根据所述DISCOVER报文,向所述终端返回DHCPOFFER报文;Returning a DHCPOFFER message to the terminal according to the DISCOVER message;

接收所述终端发送的第二DHCP请求报文,所述第二DHCP请求报文确认选择所述DHCP服务器;receiving a second DHCP request message sent by the terminal, where the second DHCP request message confirms selection of the DHCP server;

向所述终端返回DHCPACK报文。Return a DHCPACK message to the terminal.

本发明实施例还提出一种动态主机配置协议重连的DHCP服务器,包括:The embodiment of the present invention also proposes a DHCP server for dynamic host configuration protocol reconnection, including:

接收模块,用于接收终端向外广播的第一DHCP请求报文;A receiving module, configured to receive the first DHCP request message broadcast by the terminal;

判断模块,用于根据所述第一DHCP请求报文,判断是否维护有所述终端的相关设备信息;A judging module, configured to judge whether relevant device information of the terminal is maintained according to the first DHCP request message;

发送模块,用于在判断模块判断没有维护所述终端的相关设备信息时,向所述终端返回DHCPNAK报文,以告知所述终端开启新一次重连过程。The sending module is configured to return a DHCPNAK message to the terminal when the judging module judges that the relevant device information of the terminal is not maintained, so as to inform the terminal to start a new reconnection process.

优选地,该方法所述接收模块,还用于接收所述终端发送的第二DHCP请求报文,所述第二DHCP请求报文确认选择所述DHCP服务器;Preferably, the receiving module in this method is further configured to receive a second DHCP request message sent by the terminal, and the second DHCP request message confirms selection of the DHCP server;

所述发送模块,还用于向所述终端返回DHCPACK报文。The sending module is further configured to return a DHCPACK message to the terminal.

优选地,该方法Preferably, the method

所述接收模块,还用于接收所述终端向外广播的DISCOVER报文;The receiving module is further configured to receive a DISCOVER message broadcast by the terminal;

所述发送模块,还用于根据所述DISCOVER报文,向所述终端返回DHCPOFFER报文;The sending module is further configured to return a DHCPOFFER message to the terminal according to the DISCOVER message;

所述接收模块,还用于接收所述终端发送的第二DHCP请求报文,所述第二DHCP请求报文确认选择所述DHCP服务器;The receiving module is further configured to receive a second DHCP request message sent by the terminal, and the second DHCP request message confirms selection of the DHCP server;

所述发送模块,还用于向所述终端返回DHCPACK报文。The sending module is further configured to return a DHCPACK message to the terminal.

本发明实施例还提出一种动态主机配置协议重连的系统,包括第一DHCP服务器、第二DHCP服务器和与所述第一DHCP服务器、第二DHCP服务器分别通信连接的终端;其中:The embodiment of the present invention also proposes a system for reconnecting with a dynamic host configuration protocol, including a first DHCP server, a second DHCP server, and a terminal respectively communicating with the first DHCP server and the second DHCP server; wherein:

所述第二DHCP服务器为权利要求8-10中任一项所述的DHCP服务器;The second DHCP server is the DHCP server according to any one of claims 8-10;

所述终端,用于在从第一DHCP服务器切换到第二DHCP服务器时,向外广播第一DHCP请求报文;以及接收所述第二DHCP服务器返回的DHCPNAK报文,并根据所述DHCPNAK报文开启新一次重连过程。The terminal is configured to broadcast the first DHCP request message when switching from the first DHCP server to the second DHCP server; and receive the DHCPNAK message returned by the second DHCP server, and according to the DHCPNAK message The text starts a new reconnection process.

本发明实施例提出的一种动态主机配置协议重连方法、DHCP服务器及系统,针对一个终端(下挂设备)不会出现同时连接多个DHCP服务器的情况,如果下挂设备发送DHCPREQUEST请求报文,DHCP服务器经判断并没有维护相关的设备信息,则直接回复DHCPNAK报文,促使下挂设备立即发送DHCPDISCOVER,开启新一次获取地址过程,从而省去了下挂设备多次DHCPREQUEST重试导致的延时,达到了快速重连的目的。A dynamic host configuration protocol reconnection method, a DHCP server and a system proposed in the embodiment of the present invention will not simultaneously connect to multiple DHCP servers for a terminal (downlink device). If the downlink device sends a DHCPREQUEST request message , the DHCP server judges that the relevant device information is not maintained, and then directly replies to the DHCPNAK message, prompting the connected device to immediately send DHCPDISCOVER, and start a new process of obtaining an address, thereby eliminating the delay caused by multiple DHCPREQUEST retries of the connected device. , the purpose of fast reconnection is achieved.

附图说明Description of drawings

图1是现有的终端切换网络时DHCP按规范的交互流程图;Fig. 1 is the interaction flow chart of DHCP according to the standard when the existing terminal switches the network;

图2是本发明动态主机配置协议重连方法一实施例的流程示意图;FIG. 2 is a schematic flow diagram of an embodiment of a method for reconnecting a dynamic host configuration protocol according to the present invention;

图3是本发明动态主机配置协议重连方法另一实施例的流程示意图;FIG. 3 is a schematic flow diagram of another embodiment of the DHCP reconnection method of the present invention;

图4是本发明动态主机配置协议重连方法再一实施例的流程示意图;Fig. 4 is a schematic flow chart of another embodiment of the DHCP reconnection method of the present invention;

图5是图4所示的动态主机配置协议重连方法实施例的详细流程示意图;Fig. 5 is a detailed schematic flow diagram of an embodiment of the dynamic host configuration protocol reconnection method shown in Fig. 4;

图6是本发明动态主机配置协议重连方法又一实施例的流程示意图;FIG. 6 is a schematic flow diagram of another embodiment of the DHCP reconnection method of the present invention;

图7是本发明动态主机配置协议重连方法又一实施例的流程示意图;FIG. 7 is a schematic flow diagram of another embodiment of the DHCP reconnection method of the present invention;

图8是本发明动态主机配置协议重连方法又一实施例的流程示意图;Fig. 8 is a schematic flow chart of another embodiment of the DHCP reconnection method of the present invention;

图9是本发明动态主机配置协议重连方法又一实施例的流程示意图;FIG. 9 is a schematic flow chart of another embodiment of the DHCP reconnection method of the present invention;

图10是本发明动态主机配置协议重连的DHCP服务器一实施例功能模块示意图;Fig. 10 is a schematic diagram of functional modules of an embodiment of the DHCP server of the reconnection of the dynamic host configuration protocol of the present invention;

图11是本发明动态主机配置协议重连的系统一实施例的结构示意图。FIG. 11 is a schematic structural diagram of an embodiment of a system for dynamic host configuration protocol reconnection according to the present invention.

一实施例的结构示意图;The structural representation of an embodiment;

图5是本发明基于物联网大数据平台的智能用户画像装置另一实施例的结构示意图。Fig. 5 is a schematic structural diagram of another embodiment of the intelligent user portrait device based on the big data platform of the Internet of Things according to the present invention.

为了使本发明的技术方案更加清楚、明了,下面将结合附图作进一步详述。In order to make the technical solution of the present invention clearer and clearer, it will be further described below in conjunction with the accompanying drawings.

具体实施方式detailed description

本发明实施例的解决方案主要是:针对一个终端(下挂设备)不会出现同时连接多个DHCP服务器的情况,如果下挂设备发送DHCPREQUEST请求报文,DHCP服务器经判断并没有维护相关的设备信息,则直接回复DHCPNAK报文,促使下挂设备立即发送DHCPDISCOVER,开启新一次获取地址过程,从而省去了下挂设备多次DHCPREQUEST重试导致的延时,达到了快速重连的目的。The solution of the embodiment of the present invention is mainly: for a terminal (downlink device) that does not connect to multiple DHCP servers at the same time, if the downlink device sends a DHCPREQUEST request message, the DHCP server does not maintain the relevant equipment after judging information, it directly replies to the DHCPNAK message, prompting the connected device to immediately send DHCPDISCOVER, and start a new process of obtaining an address, thereby saving the delay caused by multiple DHCPREQUEST retries of the connected device, and achieving the purpose of fast reconnection.

首先说明一下现有的终端切换DHCP服务器的实现方式。Firstly, an existing implementation manner of switching a DHCP server by a terminal is described.

参照图1,图1为终端(下挂设备)切换网络时DHCP按规范的交互流程图,具体处理流程如下:Referring to Fig. 1, Fig. 1 is an interactive flow chart of DHCP according to the specification when the terminal (downloaded device) switches the network, and the specific processing flow is as follows:

步骤1,下挂设备A使用无线或有线的方式接入DHCPServer1(第一DHCP服务器)所在设备;Step 1, the downlink device A connects to the device where DHCPServer1 (the first DHCP server) is located in a wireless or wired manner;

步骤2,下挂设备A发送DHCPDISCOVER报文;Step 2, the downlink device A sends a DHCPDISCOVER message;

步骤3,DHCPServer1回复DHCPOFFER报文;Step 3, DHCPServer1 replies to the DHCPOFFER message;

步骤4,下挂设备A发送DHCPREQUEST报文,确认选择DHCPServer1;Step 4, the downlink device A sends a DHCPREQUEST message to confirm the selection of DHCPServer1;

步骤5,DHCPServer1回复DHCPACK报文,下挂设备A获得地址;Step 5, DHCPServer1 replies with a DHCPACK message, and the downlink device A obtains an address;

步骤6,下挂设备A切换DHCP服务器,切换到DHCPServer2(第二DHCP服务器)所在设备;现实中的应用场景为:手机切换WIFI热点,AC切换AP等;Step 6: Switch the DHCP server of the connected device A to the device where DHCPServer2 (the second DHCP server) is located; the actual application scenario is: the mobile phone switches the WIFI hotspot, the AC switches the AP, etc.;

步骤7,切换DHCP服务器后,下挂设备A会发出DHCPREQUEST报文;Step 7: After switching the DHCP server, the connected device A will send a DHCPREQUEST message;

步骤8,按照RFC2131的规范要求,此处DHCPServer2要进行静默处理;Step 8, according to the specification requirements of RFC2131, DHCPServer2 should perform silent processing here;

步骤9,挂设备A连续发送多个DHCPREQUEST报文得不到响应后,等待重试结束,发送DISCOVER报文;Step 9: After sending multiple DHCPREQUEST messages continuously and receiving no response, the hanging device A waits for the end of the retry and sends a DISCOVER message;

步骤10,DHCPServer2回复DHCPOFFER报文;Step 10, DHCPServer2 replies to the DHCPOFFER message;

步骤11,下挂设备A发送DHCPREQUEST报文,确认选择DHCPServer2;Step 11, the downlink device A sends a DHCPREQUEST message to confirm the selection of DHCPServer2;

步骤12,DHCPServer2回复DHCPACK报文,下挂设备A获得地址。In step 12, DHCPServer2 replies with a DHCPACK message, and the downlink device A obtains an address.

由上述流程可知,现有的这种下挂设备切换网络实现方式,会导致下挂设备连续发送多个DHCPREQUEST得不到响应,只能等待重试结束,重新发送DHCPDISCOVER报文开启新一次连接过程才能获得地址,由此,导致下挂设备重连延时较大,给用户体验较差。It can be seen from the above process that the existing downlink device switching network implementation method will cause the downlink device to send multiple DHCPREQUESTs in succession without receiving a response, and can only wait for the end of the retry, and resend the DHCPDISCOVER message to start a new connection process The address can only be obtained. As a result, the reconnection delay of the connected device is relatively large, and the user experience is poor.

本实施例方案在下挂设备切换DHCPServer时,若新接入的DHCPServer没有维护此下挂设备的相关信息,则直接回复DHCPNAK报文,让下挂设备立即开启新一次重连过程,从而省去下挂设备多次DHCPREQUEST重试导致的延时,达到快速重连的目的。When the program of this embodiment switches the DHCPServer of the downlink device, if the newly accessed DHCPServer does not maintain the relevant information of the downlink device, it will directly reply the DHCPNAK message, allowing the downlink device to start a new reconnection process immediately, thereby saving the downlink The delay caused by multiple DHCPREQUEST retries of the hanging device achieves the purpose of fast reconnection.

基于上述分析,提出本发明动态主机配置协议重连方法实施例。Based on the above analysis, an embodiment of the DHCP reconnection method of the present invention is proposed.

具体地,如图2所示,本发明一实施例提出一种动态主机配置协议重连方法,包括:Specifically, as shown in FIG. 2, an embodiment of the present invention proposes a dynamic host configuration protocol reconnection method, including:

步骤S101,终端在从第一DHCP服务器切换到第二DHCP服务器时,向外广播第一DHCP请求报文;Step S101, the terminal broadcasts the first DHCP request message when switching from the first DHCP server to the second DHCP server;

步骤S102,所述第二DHCP服务器在接收到所述第一DHCP请求报文后,经判断若没有维护所述终端的相关设备信息,则向所述终端返回DHCPNAK报文,以告知所述终端开启新一次重连过程。Step S102, after receiving the first DHCP request message, the second DHCP server returns a DHCPNAK message to the terminal to inform the terminal if it determines that the relevant device information of the terminal is not maintained Start a new reconnection process.

在本实施例中,终端在从第一DHCP服务器切换到第二DHCP服务器时,向外广播第一DHCPREQUEST报文,以对外告知该终端需要从第一DHCP服务器切换到第二DHCP服务器,该第一DHCPREQUEST报文中携带终端当前使用的IP地址。In this embodiment, when switching from the first DHCP server to the second DHCP server, the terminal broadcasts the first DHCPREQUEST message to the outside to inform the terminal that it needs to switch from the first DHCP server to the second DHCP server. A DHCPREQUEST message carries the IP address currently used by the terminal.

第二DHCP服务器在接收到终端发送的第一DHCP请求报文后,判断本地是否维护有该终端的相关设备信息,经判断若没有维护所述终端的相关设备信息,则第二DHCP服务器向所述终端返回DHCPNAK报文,以告知终端开启新一次重连过程,也就是说,第二DHCP服务器通过DHCPNAK报文告知终端:当前逻辑参数无法满足终端的请求,无法向终端提供相应的服务,需要终端重新开启获取地址过程。After the second DHCP server receives the first DHCP request message sent by the terminal, it judges whether the relevant device information of the terminal is maintained locally, and if it is judged that the relevant device information of the terminal is not maintained, the second DHCP server sends the The terminal returns a DHCPNAK message to inform the terminal to start a new reconnection process. That is to say, the second DHCP server informs the terminal through the DHCPNAK message that the current logical parameters cannot meet the terminal's request and cannot provide the corresponding service to the terminal. The terminal restarts the process of obtaining the address.

这样,终端就无需连续发送多个DHCPREQUEST等待响应,无需等待重试结束,而是可以直接重新发送DHCPDISCOVER报文开启新一次连接过程获得地址,从而省去终端多次DHCPREQUEST重试导致的延时,达到快速重连的目的。In this way, the terminal does not need to continuously send multiple DHCPREQUESTs to wait for a response, and does not need to wait for the end of the retry, but can directly resend the DHCPDISCOVER message to start a new connection process to obtain the address, thereby saving the delay caused by the terminal's multiple DHCPREQUEST retries. To achieve the purpose of fast reconnection.

如图3所示,本发明另一实施例提出一种动态主机配置协议重连方法,基于上述图2所示的实施例,还包括终端开启新一次重连过程的相应步骤,具体包括:As shown in FIG. 3, another embodiment of the present invention proposes a DHCP reconnection method. Based on the above-mentioned embodiment shown in FIG. 2, it also includes corresponding steps for the terminal to start a new reconnection process, specifically including:

步骤S103,所述终端在接收到所述DHCPNAK报文后,向所述第二DHCP服务器发送第二DHCP请求报文,确认选择所述第二DHCP服务器;Step S103, after receiving the DHCPNAK message, the terminal sends a second DHCP request message to the second DHCP server to confirm selection of the second DHCP server;

步骤S104,所述第二DHCP服务器向所述终端返回DHCPACK报文。Step S104, the second DHCP server returns a DHCPACK message to the terminal.

相比上述图2所示的实施例,本实施例还包括终端开启新一次重连过程的具体方案。Compared with the above-mentioned embodiment shown in FIG. 2 , this embodiment also includes a specific solution for the terminal to start a new reconnection process.

首先,终端在接收到第二DHCP服务器返回的DHCPNAK报文后,直接向第二DHCP服务器发送第二DHCP请求报文,该第二DHCP请求报文携带有选定第二DHCP服务器获取相关IP地址的信息,即确认选择第二DHCP服务器。First, after receiving the DHCPNAK message returned by the second DHCP server, the terminal directly sends the second DHCP request message to the second DHCP server, and the second DHCP request message carries the selected second DHCP server to obtain the relevant IP address. information, that is, to confirm the selection of the second DHCP server.

第二DHCP服务器在接收到终端发送的第二DHCP请求报文后,向终端返回DHCPACK报文,该DHCPACK报文作为确认报文,携带有分配给终端设备的IP地址、路由、子网掩码、DNS、租期等信息,终端由此获取到上网需要的IP地址、路由、子网掩码、DNS、租期等关键信息,重连过程结束。After the second DHCP server receives the second DHCP request message sent by the terminal, it returns a DHCPACK message to the terminal. The DHCPACK message is used as a confirmation message and carries the IP address, route, and subnet mask assigned to the terminal device. , DNS, lease period and other information, the terminal obtains key information such as IP address, route, subnet mask, DNS, lease period, etc. required for Internet access, and the reconnection process ends.

如图4所示,本发明再一实施例提出一种动态主机配置协议重连方法,基于上述图2所示的实施例,还包括终端开启新一次重连过程的相应步骤,其实现方式与上述图3所示的终端开启新一次重连过程不同。具体包括:As shown in FIG. 4 , another embodiment of the present invention proposes a method for reconnecting with a dynamic host configuration protocol. Based on the above-mentioned embodiment shown in FIG. 2 , it also includes corresponding steps for the terminal to start a new reconnection process. The implementation method is the same as that of The process of starting a new reconnection by the terminal shown in FIG. 3 above is different. Specifically include:

步骤S105,所述终端在接收到所述DHCPNAK报文后,向外广播DISCOVER报文;Step S105, the terminal broadcasts a DISCOVER message after receiving the DHCPNAK message;

步骤S106,所述第二DHCP服务器在接收到所述DISCOVER报文后,向所述终端返回DHCPOFFER报文;Step S106, the second DHCP server returns a DHCPOFFER message to the terminal after receiving the DISCOVER message;

步骤S1031,所述终端接收到所述DHCPOFFER报文后,向所述第二DHCP服务器发送第二DHCP请求报文,确认选择所述第二DHCP服务器;Step S1031, after receiving the DHCPOFFER message, the terminal sends a second DHCP request message to the second DHCP server to confirm selection of the second DHCP server;

步骤S1041,所述第二DHCP服务器向所述终端返回DHCPACK报文。Step S1041, the second DHCP server returns a DHCPACK message to the terminal.

相比上述图2所示的实施例,本实施例还包括终端开启新一次重连过程的具体方案。Compared with the above-mentioned embodiment shown in FIG. 2 , this embodiment also includes a specific solution for the terminal to start a new reconnection process.

首先,终端在接收到第二DHCP服务器返回的DHCPNAK报文后,不是直接向第二DHCP服务器发送第二DHCP请求报文,而是对外广播DISCOVER报文。该DISCOVER报文携带有终端的设备标识、厂商类别标识、主机名,以及一系列请求信息,该请求信息包括但不限于子网掩码、路由、域名,以及DNS等信息。First, after receiving the DHCPNAK message returned by the second DHCP server, the terminal does not directly send the second DHCP request message to the second DHCP server, but broadcasts a DISCOVER message to the outside. The DISCOVER message carries the terminal device identifier, vendor category identifier, host name, and a series of request information, including but not limited to subnet mask, routing, domain name, DNS and other information.

第二DHCP服务器在接收到所述DISCOVER报文后,向终端返回DHCPOFFER报文,向终端提供IP地址、路由、子网掩码、DNS、租期等信息。After receiving the DISCOVER message, the second DHCP server returns a DHCPOFFER message to the terminal, and provides the terminal with information such as IP address, route, subnet mask, DNS, and lease period.

终端在接收到第二DHCP服务器发送的DHCPOFFER报文后,向第二DHCP服务器发送第二DHCP请求报文,该第二DHCP请求报文携带有选定第二DHCP服务器获取相关IP地址的信息,即确认选择第二DHCP服务器。After receiving the DHCPOFFER message sent by the second DHCP server, the terminal sends a second DHCP request message to the second DHCP server, where the second DHCP request message carries information for selecting the second DHCP server to obtain the relevant IP address, That is, confirm to select the second DHCP server.

第二DHCP服务器在接收到终端发送的第二DHCP请求报文后,向终端返回DHCPACK报文,该DHCPACK报文作为确认报文,携带有分配给终端设备的IP地址、路由、子网掩码、DNS、租期等信息,终端由此获取到上网需要的IP地址、路由、子网掩码、DNS、租期等关键信息,重连过程结束。After the second DHCP server receives the second DHCP request message sent by the terminal, it returns a DHCPACK message to the terminal. The DHCPACK message is used as a confirmation message and carries the IP address, route, and subnet mask assigned to the terminal device. , DNS, lease period and other information, the terminal obtains key information such as IP address, route, subnet mask, DNS, lease period, etc. required for Internet access, and the reconnection process ends.

下面结合图5详细阐述本实施例的处理流程:The processing flow of this embodiment is described in detail below in conjunction with FIG. 5:

参照图5,图5为本实施例中,终端(下挂设备)切换网络时的交互流程图,具体处理流程如下:With reference to Fig. 5, Fig. 5 is in this embodiment, the interaction flowchart when the terminal (download device) switches networks, and specific processing flow is as follows:

步骤1,下挂设备A(终端)使用无线或有线的方式接入DHCPServer1(第一DHCP服务器)所在设备;Step 1, the downlink device A (terminal) accesses the device where DHCPServer1 (the first DHCP server) is located in a wireless or wired manner;

步骤2,下挂设备A发送DHCPDISCOVER报文;Step 2, the downlink device A sends a DHCPDISCOVER message;

步骤3,DHCPServer1回复DHCPOFFER报文;此处可通过下挂设备收到的DHCPOFFER报文来源,判断是否符合本发明提出的应用场景:一个下挂设备不会同时接入多个DHCPServer。如果只有一个来源,则符合本发明的应用场景;如果有多个来源,则不符合;Step 3, DHCPServer1 replies to the DHCPOFFER message; here, the source of the DHCPOFFER message received by the downlink device can be used to judge whether it meets the application scenario proposed by the present invention: one downlink device will not simultaneously access multiple DHCPServers. If there is only one source, it meets the application scenario of the present invention; if there are multiple sources, it does not meet;

步骤4,下挂设备A发送DHCPREQUEST报文,确认选择DHCPServer1;Step 4, the downlink device A sends a DHCPREQUEST message to confirm the selection of DHCPServer1;

步骤5,DHCPServer1回复DHCPACK报文,下挂设备A获得地址;Step 5, DHCPServer1 replies with a DHCPACK message, and the downlink device A obtains an address;

步骤6,下挂设备A切换DHCP服务器,切换到DHCPServer2(第二DHCP服务器)所在设备;现实中的应用场景为:手机切换WIFI热点,AC切换AP等;Step 6: Switch the DHCP server of the connected device A to the device where DHCPServer2 (the second DHCP server) is located; the actual application scenario is: the mobile phone switches the WIFI hotspot, the AC switches the AP, etc.;

步骤7,切换DHCP服务器后,下挂设备A会发出DHCPREQUEST报文;Step 7: After switching the DHCP server, the connected device A will send a DHCPREQUEST message;

步骤8,按照RFC2131的规范要求,此处DHCPServer2要进行静默处理;而按照本发明的要求,DHCPServer2直接回复DHCPNAK报文,让下挂设备立即开始新一次获取地址过程,从而节省了DHCPREQUEST的重试时间;Step 8, according to the normative requirement of RFC2131, here DHCPServer2 will carry out quiet processing; And according to the requirement of the present invention, DHCPServer2 directly replies DHCPNAK message, allows the next hanging device to start a new acquisition address process immediately, thereby saving the retry of DHCPREQUEST time;

步骤9,下挂设备A收到DHCPNAK报文后,发送DISCOVER报文;Step 9: After receiving the DHCPNAK message, the downlink device A sends a DISCOVER message;

步骤10,DHCPServer2回复DHCPOFFER报文;Step 10, DHCPServer2 replies to the DHCPOFFER message;

步骤11,下挂设备A发送DHCPREQUEST报文,确认选择DHCPServer2;Step 11, the downlink device A sends a DHCPREQUEST message to confirm the selection of DHCPServer2;

步骤12,DHCPServer2回复DHCPACK报文,下挂设备A获得地址。In step 12, DHCPServer2 replies with a DHCPACK message, and the downlink device A obtains an address.

本实施例通过上述方案,针对一个终端(下挂设备)不会出现同时连接多个DHCP服务器的情况,如果下挂设备发送DHCPREQUEST请求报文,DHCP服务器经判断并没有维护相关的设备信息,则直接回复DHCPNAK报文,促使下挂设备立即发送DHCPDISCOVER,开启新一次获取地址过程,从而省去了下挂设备多次DHCPREQUEST重试导致的延时,达到了快速重连的目的。In this embodiment, through the above scheme, a terminal (downloaded device) will not be connected to multiple DHCP servers at the same time. If the downlink device sends a DHCPREQUEST request message, the DHCP server does not maintain relevant device information after judging, then Reply directly to the DHCPNAK message, prompting the connected device to send DHCPDISCOVER immediately, and start a new process of obtaining an address, thereby saving the delay caused by multiple DHCPREQUEST retries of the connected device, and achieving the purpose of fast reconnection.

如图6所示,本发明又一实施例提出一种动态主机配置协议重连方法,基于上述图4所示的实施例,终端在从第一DHCP服务器切换到第二DHCP服务器时,向外广播第一DHCP请求报文的步骤之前还包括:As shown in FIG. 6, another embodiment of the present invention proposes a dynamic host configuration protocol reconnection method. Based on the embodiment shown in FIG. 4 above, when the terminal switches from the first DHCP server to the second DHCP server, the external Before the step of broadcasting the first DHCP request message, it also includes:

步骤S107,所述终端接入所述第一DHCP服务器后,向外广播DISCOVER报文;Step S107, after the terminal accesses the first DHCP server, it broadcasts a DISCOVER message;

步骤S108,所述第一DHCP服务器在接收到所述DISCOVER报文后,向所述终端返回DHCPOFFER报文;Step S108, the first DHCP server returns a DHCPOFFER message to the terminal after receiving the DISCOVER message;

步骤S109,所述终端接收到所述DHCPOFFER报文后,向所述第一DHCP服务器发送第二DHCP请求报文,确认选择所述第一DHCP服务器;Step S109, after receiving the DHCPOFFER message, the terminal sends a second DHCP request message to the first DHCP server to confirm selection of the first DHCP server;

步骤S110,所述第一DHCP服务器向所述终端返回DHCPACK报文。Step S110, the first DHCP server returns a DHCPACK message to the terminal.

相比上述实施例,本实施例还包括终端接入第一DHCP服务器的方案,该过程与现有的DHCP规范相同,可以参照图1所示的具体流程,在此不再赘述。Compared with the above-mentioned embodiment, this embodiment also includes a solution for the terminal to access the first DHCP server. This process is the same as the existing DHCP specification, and can refer to the specific process shown in FIG. 1 , which will not be repeated here.

需要说明的是,本实施例还可以与上述图2及图3所示的实施例组合实施,在此不再赘述。It should be noted that this embodiment can also be implemented in combination with the above embodiments shown in FIG. 2 and FIG. 3 , which will not be repeated here.

图7所示,本发明又一实施例提出一种动态主机配置协议重连方法,是从DHCP服务器侧提出的方法实施例,该方法包括:As shown in FIG. 7, another embodiment of the present invention proposes a method for reconnecting with the Dynamic Host Configuration Protocol, which is a method embodiment proposed from the DHCP server side, and the method includes:

步骤S201,DHCP服务器接收终端向外广播的第一DHCP请求报文;Step S201, the DHCP server receives the first DHCP request message broadcast by the terminal;

步骤S202,根据所述第一DHCP请求报文,判断是否维护有所述终端的相关设备信息;Step S202, according to the first DHCP request message, judging whether the related device information of the terminal is maintained;

步骤S203,若没有维护所述终端的相关设备信息,则向所述终端返回DHCPNAK报文,以告知所述终端开启新一次重连过程。Step S203, if the relevant device information of the terminal is not maintained, return a DHCPNAK message to the terminal to inform the terminal to start a new reconnection process.

具体地,在本实施例中,终端在从第一DHCP服务器切换到第二DHCP服务器时,向外广播第一DHCPREQUEST报文,以对外告知该终端需要从第一DHCP服务器切换到第二DHCP服务器,该第一DHCPREQUEST报文中携带终端当前使用的IP地址。Specifically, in this embodiment, when switching from the first DHCP server to the second DHCP server, the terminal broadcasts the first DHCPREQUEST message to the outside to notify the terminal that it needs to switch from the first DHCP server to the second DHCP server. , the first DHCPREQUEST message carries the IP address currently used by the terminal.

第二DHCP服务器在接收到终端发送的第一DHCP请求报文后,判断本地是否维护有该终端的相关设备信息,经判断若没有维护所述终端的相关设备信息,则第二DHCP服务器向所述终端返回DHCPNAK报文,以告知终端开启新一次重连过程,也就是说,第二DHCP服务器通过DHCPNAK报文告知终端:当前逻辑参数无法满足终端的请求,无法向终端提供相应的服务,需要终端重新开启获取地址过程。After the second DHCP server receives the first DHCP request message sent by the terminal, it judges whether the relevant device information of the terminal is maintained locally, and if it is judged that the relevant device information of the terminal is not maintained, the second DHCP server sends the The terminal returns a DHCPNAK message to inform the terminal to start a new reconnection process. That is to say, the second DHCP server informs the terminal through the DHCPNAK message that the current logical parameters cannot meet the terminal's request and cannot provide the corresponding service to the terminal. The terminal restarts the process of obtaining the address.

这样,终端就无需连续发送多个DHCPREQUEST等待响应,无需等待重试结束,而是可以直接重新发送DHCPDISCOVER报文开启新一次连接过程获得地址,从而省去终端多次DHCPREQUEST重试导致的延时,达到快速重连的目的。In this way, the terminal does not need to continuously send multiple DHCPREQUESTs to wait for a response, and does not need to wait for the end of the retry, but can directly resend the DHCPDISCOVER message to start a new connection process to obtain the address, thereby saving the delay caused by the terminal's multiple DHCPREQUEST retries. To achieve the purpose of fast reconnection.

图8所示,本发明又一实施例提出一种动态主机配置协议重连方法,基于上述图7所示的实施例,还包括:As shown in FIG. 8 , another embodiment of the present invention proposes a dynamic host configuration protocol reconnection method, based on the above-mentioned embodiment shown in FIG. 7 , further comprising:

步骤S204,接收所述终端发送的第二DHCP请求报文,所述第二DHCP请求报文确认选择所述DHCP服务器;Step S204, receiving a second DHCP request message sent by the terminal, the second DHCP request message confirming selection of the DHCP server;

步骤S205,向所述终端返回DHCPACK报文。Step S205, returning a DHCPACK message to the terminal.

相比上述图7所示的实施例,本实施例还包括终端开启新一次重连过程的具体方案。Compared with the above-mentioned embodiment shown in FIG. 7 , this embodiment also includes a specific solution for the terminal to start a new reconnection process.

首先,终端在接收到第二DHCP服务器返回的DHCPNAK报文后,直接向第二DHCP服务器发送第二DHCP请求报文,该第二DHCP请求报文携带有选定第二DHCP服务器获取相关IP地址的信息,即确认选择第二DHCP服务器。First, after receiving the DHCPNAK message returned by the second DHCP server, the terminal directly sends the second DHCP request message to the second DHCP server, and the second DHCP request message carries the selected second DHCP server to obtain the relevant IP address. information, that is, to confirm the selection of the second DHCP server.

第二DHCP服务器在接收到终端发送的第二DHCP请求报文后,向终端返回DHCPACK报文,该DHCPACK报文作为确认报文,携带有分配给终端设备的IP地址、路由、子网掩码、DNS、租期等信息,终端由此获取到上网需要的IP地址、路由、子网掩码、DNS、租期等关键信息,重连过程结束。After the second DHCP server receives the second DHCP request message sent by the terminal, it returns a DHCPACK message to the terminal. The DHCPACK message is used as a confirmation message and carries the IP address, route, and subnet mask assigned to the terminal device. , DNS, lease period and other information, the terminal obtains key information such as IP address, route, subnet mask, DNS, lease period, etc. required for Internet access, and the reconnection process ends.

图9所示,本发明又一实施例提出一种动态主机配置协议重连方法,基于上述图7所示的实施例,还包括终端开启新一次重连过程的相应步骤,其实现方式与上述图8所示的终端开启新一次重连过程不同。具体还包括:As shown in FIG. 9, another embodiment of the present invention proposes a dynamic host configuration protocol reconnection method. Based on the above-mentioned embodiment shown in FIG. 7, it also includes corresponding steps for the terminal to start a new reconnection process. The terminal shown in FIG. 8 starts a new reconnection process differently. Specifically, it also includes:

步骤S206,接收所述终端向外广播的DISCOVER报文;Step S206, receiving the DISCOVER message broadcast by the terminal;

步骤S207,根据所述DISCOVER报文,向所述终端返回DHCPOFFER报文;Step S207, returning a DHCPOFFER message to the terminal according to the DISCOVER message;

步骤S208,接收所述终端发送的第二DHCP请求报文,所述第二DHCP请求报文确认选择所述DHCP服务器;Step S208, receiving a second DHCP request message sent by the terminal, the second DHCP request message confirming selection of the DHCP server;

步骤S209,向所述终端返回DHCPACK报文。Step S209, returning a DHCPACK message to the terminal.

首先,终端在接收到第二DHCP服务器返回的DHCPNAK报文后,不是直接向第二DHCP服务器发送第二DHCP请求报文,而是对外广播DISCOVER报文。该DISCOVER报文携带有终端的设备标识、厂商类别标识、主机名,以及一系列请求信息,该请求信息包括但不限于子网掩码、路由、域名,以及DNS等信息。First, after receiving the DHCPNAK message returned by the second DHCP server, the terminal does not directly send the second DHCP request message to the second DHCP server, but broadcasts a DISCOVER message to the outside. The DISCOVER message carries the terminal device identifier, vendor category identifier, host name, and a series of request information, including but not limited to subnet mask, routing, domain name, DNS and other information.

第二DHCP服务器在接收到所述DISCOVER报文后,向终端返回DHCPOFFER报文,向终端提供IP地址、路由、子网掩码、DNS、租期等信息。After receiving the DISCOVER message, the second DHCP server returns a DHCPOFFER message to the terminal, and provides the terminal with information such as IP address, route, subnet mask, DNS, and lease period.

终端在接收到第二DHCP服务器发送的DHCPOFFER报文后,向第二DHCP服务器发送第二DHCP请求报文,该第二DHCP请求报文携带有选定第二DHCP服务器获取相关IP地址的信息,即确认选择第二DHCP服务器。After receiving the DHCPOFFER message sent by the second DHCP server, the terminal sends a second DHCP request message to the second DHCP server, where the second DHCP request message carries information for selecting the second DHCP server to obtain the relevant IP address, That is, confirm to select the second DHCP server.

第二DHCP服务器在接收到终端发送的第二DHCP请求报文后,向终端返回DHCPACK报文,该DHCPACK报文作为确认报文,携带有分配给终端设备的IP地址、路由、子网掩码、DNS、租期等信息,终端由此获取到上网需要的IP地址、路由、子网掩码、DNS、租期等关键信息,重连过程结束。After the second DHCP server receives the second DHCP request message sent by the terminal, it returns a DHCPACK message to the terminal. The DHCPACK message is used as a confirmation message and carries the IP address, route, and subnet mask assigned to the terminal device. , DNS, lease period and other information, the terminal obtains key information such as IP address, route, subnet mask, DNS, lease period, etc. required for Internet access, and the reconnection process ends.

本实施例通过上述方案,针对一个终端(下挂设备)不会出现同时连接多个DHCP服务器的情况,如果下挂设备发送DHCPREQUEST请求报文,DHCP服务器经判断并没有维护相关的设备信息,则直接回复DHCPNAK报文,促使下挂设备立即发送DHCPDISCOVER,开启新一次获取地址过程,从而省去了下挂设备多次DHCPREQUEST重试导致的延时,达到了快速重连的目的。In this embodiment, through the above scheme, a terminal (downloaded device) will not be connected to multiple DHCP servers at the same time. If the downlink device sends a DHCPREQUEST request message, the DHCP server does not maintain relevant device information after judging, then Reply directly to the DHCPNAK message, prompting the connected device to send DHCPDISCOVER immediately, and start a new process of obtaining an address, thereby saving the delay caused by multiple DHCPREQUEST retries of the connected device, and achieving the purpose of fast reconnection.

对应地,提出本发明动态主机配置协议重连的DHCP服务器的实施例。Correspondingly, an embodiment of the DHCP server for dynamic host configuration protocol reconnection of the present invention is proposed.

具体地,如图10所示,本发明一实施例提出一种动态主机配置协议重连的DHCP服务器,包括:接收模块301、判断模块302、发送模块303,其中:Specifically, as shown in FIG. 10 , an embodiment of the present invention proposes a DHCP server for dynamic host configuration protocol reconnection, including: a receiving module 301, a judging module 302, and a sending module 303, wherein:

接收模块301,用于接收终端向外广播的第一DHCP请求报文;The receiving module 301 is configured to receive the first DHCP request message broadcast by the terminal;

判断模块302,用于根据所述第一DHCP请求报文,判断是否维护有所述终端的相关设备信息;A judging module 302, configured to judge whether relevant device information of the terminal is maintained according to the first DHCP request message;

发送模块303,用于在判断模块判断没有维护所述终端的相关设备信息时,向所述终端返回DHCPNAK报文,以告知所述终端开启新一次重连过程。The sending module 303 is configured to return a DHCPNAK message to the terminal when the judging module judges that the relevant device information of the terminal is not maintained, so as to inform the terminal to start a new reconnection process.

具体地,在本实施例中,终端在从第一DHCP服务器切换到第二DHCP服务器时,向外广播第一DHCPREQUEST报文,以对外告知该终端需要从第一DHCP服务器切换到第二DHCP服务器,该第一DHCPREQUEST报文中携带终端当前使用的IP地址。Specifically, in this embodiment, when switching from the first DHCP server to the second DHCP server, the terminal broadcasts the first DHCPREQUEST message to the outside to notify the terminal that it needs to switch from the first DHCP server to the second DHCP server. , the first DHCPREQUEST message carries the IP address currently used by the terminal.

第二DHCP服务器在接收到终端发送的第一DHCP请求报文后,判断本地是否维护有该终端的相关设备信息,经判断若没有维护所述终端的相关设备信息,则第二DHCP服务器向所述终端返回DHCPNAK报文,以告知终端开启新一次重连过程,也就是说,第二DHCP服务器通过DHCPNAK报文告知终端:当前逻辑参数无法满足终端的请求,无法向终端提供相应的服务,需要终端重新开启获取地址过程。After the second DHCP server receives the first DHCP request message sent by the terminal, it judges whether the relevant device information of the terminal is maintained locally, and if it is judged that the relevant device information of the terminal is not maintained, the second DHCP server sends the The terminal returns a DHCPNAK message to inform the terminal to start a new reconnection process. That is to say, the second DHCP server informs the terminal through the DHCPNAK message that the current logical parameters cannot meet the terminal's request and cannot provide the corresponding service to the terminal. The terminal restarts the process of obtaining the address.

这样,终端就无需连续发送多个DHCPREQUEST等待响应,无需等待重试结束,而是可以直接重新发送DHCPDISCOVER报文开启新一次连接过程获得地址,从而省去终端多次DHCPREQUEST重试导致的延时,达到快速重连的目的。In this way, the terminal does not need to continuously send multiple DHCPREQUESTs to wait for a response, and does not need to wait for the end of the retry, but can directly resend the DHCPDISCOVER message to start a new connection process to obtain the address, thereby saving the delay caused by the terminal's multiple DHCPREQUEST retries. To achieve the purpose of fast reconnection.

进一步地,作为一种终端开启新一次重连过程的实现方式,所述接收模块301,还用于接收所述终端发送的第二DHCP请求报文,所述第二DHCP请求报文确认选择所述DHCP服务器;Further, as an implementation method for the terminal to start a new reconnection process, the receiving module 301 is also configured to receive a second DHCP request message sent by the terminal, and the second DHCP request message confirms that the selected the DHCP server;

所述发送模块303,还用于向所述终端返回DHCPACK报文。The sending module 303 is further configured to return a DHCPACK message to the terminal.

本实施例还包括终端开启新一次重连过程的具体方案。This embodiment also includes a specific solution for the terminal to start a new reconnection process.

首先,终端在接收到第二DHCP服务器返回的DHCPNAK报文后,直接向第二DHCP服务器发送第二DHCP请求报文,该第二DHCP请求报文携带有选定第二DHCP服务器获取相关IP地址的信息,即确认选择第二DHCP服务器。First, after receiving the DHCPNAK message returned by the second DHCP server, the terminal directly sends the second DHCP request message to the second DHCP server, and the second DHCP request message carries the selected second DHCP server to obtain the relevant IP address. information, that is, to confirm the selection of the second DHCP server.

第二DHCP服务器在接收到终端发送的第二DHCP请求报文后,向终端返回DHCPACK报文,该DHCPACK报文作为确认报文,携带有分配给终端设备的IP地址、路由、子网掩码、DNS、租期等信息,终端由此获取到上网需要的IP地址、路由、子网掩码、DNS、租期等关键信息,重连过程结束。After the second DHCP server receives the second DHCP request message sent by the terminal, it returns a DHCPACK message to the terminal. The DHCPACK message is used as a confirmation message and carries the IP address, route, and subnet mask assigned to the terminal device. , DNS, lease period and other information, the terminal obtains key information such as IP address, route, subnet mask, DNS, lease period, etc. required for Internet access, and the reconnection process ends.

进一步地,作为另一种终端开启新一次重连过程的实现方式,所述接收模块301,还用于接收所述终端向外广播的DISCOVER报文;Further, as another implementation method for the terminal to start a new reconnection process, the receiving module 301 is also configured to receive the DISCOVER message broadcast by the terminal;

所述发送模块303,还用于根据所述DISCOVER报文,向所述终端返回DHCPOFFER报文;The sending module 303 is further configured to return a DHCPOFFER message to the terminal according to the DISCOVER message;

所述接收模块301,还用于接收所述终端发送的第二DHCP请求报文,所述第二DHCP请求报文确认选择所述DHCP服务器;The receiving module 301 is further configured to receive a second DHCP request message sent by the terminal, where the second DHCP request message confirms selection of the DHCP server;

所述发送模块303,还用于向所述终端返回DHCPACK报文。The sending module 303 is further configured to return a DHCPACK message to the terminal.

首先,终端在接收到第二DHCP服务器返回的DHCPNAK报文后,不是直接向第二DHCP服务器发送第二DHCP请求报文,而是对外广播DISCOVER报文。该DISCOVER报文携带有终端的设备标识、厂商类别标识、主机名,以及一系列请求信息,该请求信息包括但不限于子网掩码、路由、域名,以及DNS等信息。First, after receiving the DHCPNAK message returned by the second DHCP server, the terminal does not directly send the second DHCP request message to the second DHCP server, but broadcasts a DISCOVER message to the outside. The DISCOVER message carries the terminal device identifier, vendor category identifier, host name, and a series of request information, including but not limited to subnet mask, routing, domain name, DNS and other information.

第二DHCP服务器在接收到所述DISCOVER报文后,向终端返回DHCPOFFER报文,向终端提供IP地址、路由、子网掩码、DNS、租期等信息。After receiving the DISCOVER message, the second DHCP server returns a DHCPOFFER message to the terminal, and provides the terminal with information such as IP address, route, subnet mask, DNS, and lease period.

终端在接收到第二DHCP服务器发送的DHCPOFFER报文后,向第二DHCP服务器发送第二DHCP请求报文,该第二DHCP请求报文携带有选定第二DHCP服务器获取相关IP地址的信息,即确认选择第二DHCP服务器。After receiving the DHCPOFFER message sent by the second DHCP server, the terminal sends a second DHCP request message to the second DHCP server, where the second DHCP request message carries information for selecting the second DHCP server to obtain the relevant IP address, That is, confirm to select the second DHCP server.

第二DHCP服务器在接收到终端发送的第二DHCP请求报文后,向终端返回DHCPACK报文,该DHCPACK报文作为确认报文,携带有分配给终端设备的IP地址、路由、子网掩码、DNS、租期等信息,终端由此获取到上网需要的IP地址、路由、子网掩码、DNS、租期等关键信息,重连过程结束。After the second DHCP server receives the second DHCP request message sent by the terminal, it returns a DHCPACK message to the terminal. The DHCPACK message is used as a confirmation message and carries the IP address, route, and subnet mask assigned to the terminal device. , DNS, lease period and other information, the terminal obtains key information such as IP address, route, subnet mask, DNS, lease period, etc. required for Internet access, and the reconnection process ends.

本实施例通过上述方案,针对一个终端(下挂设备)不会出现同时连接多个DHCP服务器的情况,如果下挂设备发送DHCPREQUEST请求报文,DHCP服务器经判断并没有维护相关的设备信息,则直接回复DHCPNAK报文,促使下挂设备立即发送DHCPDISCOVER,开启新一次获取地址过程,从而省去了下挂设备多次DHCPREQUEST重试导致的延时,达到了快速重连的目的。In this embodiment, through the above scheme, a terminal (downloaded device) will not be connected to multiple DHCP servers at the same time. If the downlink device sends a DHCPREQUEST request message, the DHCP server does not maintain relevant device information after judging, then Reply directly to the DHCPNAK message, prompting the connected device to send DHCPDISCOVER immediately, and start a new process of obtaining an address, thereby saving the delay caused by multiple DHCPREQUEST retries of the connected device, and achieving the purpose of fast reconnection.

此外,如图11所示,本发明一实施例还提出一种动态主机配置协议重连的系统,包括第一DHCP服务器401、第二DHCP服务器402和与所述第一DHCP服务器401、第二DHCP服务器402分别通信连接的终端403;其中:In addition, as shown in FIG. 11 , an embodiment of the present invention also proposes a dynamic host configuration protocol reconnection system, including a first DHCP server 401, a second DHCP server 402 and the first DHCP server 401, the second The terminals 403 connected by the DHCP server 402 respectively; wherein:

所述第二DHCP服务器402可以为上述实施例所述的DHCP服务器;The second DHCP server 402 may be the DHCP server described in the foregoing embodiment;

所述终端403,用于在从第一DHCP服务器401切换到第二DHCP服务器402时,向外广播第一DHCP请求报文;以及接收所述第二DHCP服务器402返回的DHCPNAK报文,并根据所述DHCPNAK报文开启新一次重连过程。The terminal 403 is configured to broadcast the first DHCP request message when switching from the first DHCP server 401 to the second DHCP server 402; and receive the DHCPNAK message returned by the second DHCP server 402, and according to The DHCPNAK message starts a new reconnection process.

其中,第一DHCP服务器401、第二DHCP服务器402和终端403交互实现动态主机配置协议重连的过程,请参照上述各实施例,在此不再赘述。Wherein, the first DHCP server 401, the second DHCP server 402, and the terminal 403 interact to realize the process of dynamic host configuration protocol reconnection, please refer to the above-mentioned embodiments, which will not be repeated here.

本发明实施例动态主机配置协议重连方法、DHCP服务器及系统,针对一个终端403(下挂设备)不会出现同时连接多个DHCP服务器的情况,如果下挂设备发送DHCPREQUEST请求报文,DHCP服务器经判断并没有维护相关的设备信息,则直接回复DHCPNAK报文,促使下挂设备立即发送DHCPDISCOVER,开启新一次获取地址过程,从而省去了下挂设备多次DHCPREQUEST重试导致的延时,达到了快速重连的目的。In the embodiment of the present invention, the dynamic host configuration protocol reconnection method, DHCP server and system will not simultaneously connect to multiple DHCP servers for a terminal 403 (downloaded device). If the downlink device sends a DHCPREQUEST request message, the DHCP server After judging that the relevant device information has not been maintained, it will directly reply to the DHCPNAK message, prompting the connected device to immediately send DHCPDISCOVER, and start a new process of obtaining an address, thus saving the delay caused by multiple DHCPREQUEST retries of the connected device, reaching for the purpose of fast reconnection.

以上所述仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或流程变换,或直接或间接运用在其它相关的技术领域,均同理包括在本发明的专利保护范围内。The above is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or process transformation made by using the description of the present invention and the contents of the accompanying drawings, or directly or indirectly used in other related technical fields , are all included in the scope of patent protection of the present invention in the same way.

Claims (11)

1.一种动态主机配置协议重连方法,其特征在于,包括:1. A Dynamic Host Configuration Protocol reconnection method, characterized in that, comprising: 终端在从第一DHCP服务器切换到第二DHCP服务器时,向外广播第一DHCP请求报文;When the terminal switches from the first DHCP server to the second DHCP server, it broadcasts the first DHCP request message to the outside; 所述第二DHCP服务器在接收到所述第一DHCP请求报文后,经判断若没有维护所述终端的相关设备信息,则向所述终端返回DHCPNAK报文,以告知所述终端开启新一次重连过程。After receiving the first DHCP request message, the second DHCP server returns a DHCPNAK message to the terminal to notify the terminal to open a new Reconnection process. 2.根据权利要求1所述的方法,其特征在于,还包括:2. The method according to claim 1, further comprising: 所述终端在接收到所述DHCPNAK报文后,向所述第二DHCP服务器发送第二DHCP请求报文,确认选择所述第二DHCP服务器;After receiving the DHCPNAK message, the terminal sends a second DHCP request message to the second DHCP server to confirm selection of the second DHCP server; 所述第二DHCP服务器向所述终端返回DHCPACK报文。The second DHCP server returns a DHCPACK packet to the terminal. 3.根据权利要求1所述的方法,其特征在于,还包括:3. The method according to claim 1, further comprising: 所述终端在接收到所述DHCPNAK报文后,向外广播DISCOVER报文;After receiving the DHCPNAK message, the terminal broadcasts a DISCOVER message; 所述第二DHCP服务器在接收到所述DISCOVER报文后,向所述终端返回DHCPOFFER报文;After receiving the DISCOVER message, the second DHCP server returns a DHCPOFFER message to the terminal; 所述终端接收到所述DHCPOFFER报文后,向所述第二DHCP服务器发送第二DHCP请求报文,确认选择所述第二DHCP服务器;After receiving the DHCPOFFER message, the terminal sends a second DHCP request message to the second DHCP server to confirm selection of the second DHCP server; 所述第二DHCP服务器向所述终端返回DHCPACK报文。The second DHCP server returns a DHCPACK message to the terminal. 4.根据权利要求1所述的方法,其特征在于,所述终端在从第一DHCP服务器切换到第二DHCP服务器时,向外广播第一DHCP请求报文的步骤之前还包括:4. The method according to claim 1, wherein, when the terminal is switched from the first DHCP server to the second DHCP server, before the step of broadcasting the first DHCP request message, the terminal also includes: 所述终端接入所述第一DHCP服务器后,向外广播DISCOVER报文;After the terminal accesses the first DHCP server, it broadcasts a DISCOVER message; 所述第一DHCP服务器在接收到所述DISCOVER报文后,向所述终端返回DHCPOFFER报文;After receiving the DISCOVER message, the first DHCP server returns a DHCPOFFER message to the terminal; 所述终端接收到所述DHCPOFFER报文后,向所述第一DHCP服务器发送第二DHCP请求报文,确认选择所述第一DHCP服务器;After receiving the DHCPOFFER message, the terminal sends a second DHCP request message to the first DHCP server to confirm selection of the first DHCP server; 所述第一DHCP服务器向所述终端返回DHCPACK报文。The first DHCP server returns a DHCPACK message to the terminal. 5.一种动态主机配置协议重连方法,其特征在于,包括:5. A dynamic host configuration protocol reconnection method, characterized in that, comprising: DHCP服务器接收终端向外广播的第一DHCP请求报文;The DHCP server receives the first DHCP request message broadcast by the terminal; 根据所述第一DHCP请求报文,判断是否维护有所述终端的相关设备信息;According to the first DHCP request message, determine whether the related device information of the terminal is maintained; 若没有维护所述终端的相关设备信息,则向所述终端返回DHCPNAK报文,以告知所述终端开启新一次重连过程。If the relevant device information of the terminal is not maintained, a DHCPNAK message is returned to the terminal to inform the terminal to start a new reconnection process. 6.根据权利要求5所述的方法,其特征在于,还包括:6. The method according to claim 5, further comprising: 接收所述终端发送的第二DHCP请求报文,所述第二DHCP请求报文确认选择所述DHCP服务器;receiving a second DHCP request message sent by the terminal, where the second DHCP request message confirms selection of the DHCP server; 向所述终端返回DHCPACK报文。Return a DHCPACK message to the terminal. 7.根据权利要求5所述的方法,其特征在于,还包括:7. The method according to claim 5, further comprising: 接收所述终端向外广播的DISCOVER报文;receiving a DISCOVER message broadcast by the terminal; 根据所述DISCOVER报文,向所述终端返回DHCPOFFER报文;Returning a DHCPOFFER message to the terminal according to the DISCOVER message; 接收所述终端发送的第二DHCP请求报文,所述第二DHCP请求报文确认选择所述DHCP服务器;receiving a second DHCP request message sent by the terminal, where the second DHCP request message confirms selection of the DHCP server; 向所述终端返回DHCPACK报文。Return a DHCPACK message to the terminal. 8.一种动态主机配置协议重连的DHCP服务器,其特征在于,包括:8. A DHCP server for dynamic host configuration protocol reconnection, characterized in that, comprising: 接收模块,用于接收终端向外广播的第一DHCP请求报文;A receiving module, configured to receive the first DHCP request message broadcast by the terminal; 判断模块,用于根据所述第一DHCP请求报文,判断是否维护有所述终端的相关设备信息;A judging module, configured to judge whether relevant device information of the terminal is maintained according to the first DHCP request message; 发送模块,用于在判断模块判断没有维护所述终端的相关设备信息时,向所述终端返回DHCPNAK报文,以告知所述终端开启新一次重连过程。The sending module is configured to return a DHCPNAK message to the terminal when the judging module judges that the relevant device information of the terminal is not maintained, so as to inform the terminal to start a new reconnection process. 9.根据权利要求8所述的DHCP服务器,其特征在于,9. DHCP server according to claim 8, is characterized in that, 所述接收模块,还用于接收所述终端发送的第二DHCP请求报文,所述第二DHCP请求报文确认选择所述DHCP服务器;The receiving module is further configured to receive a second DHCP request message sent by the terminal, and the second DHCP request message confirms selection of the DHCP server; 所述发送模块,还用于向所述终端返回DHCPACK报文。The sending module is further configured to return a DHCPACK message to the terminal. 10.根据权利要求8所述的DHCP服务器,其特征在于,10. DHCP server according to claim 8, is characterized in that, 所述接收模块,还用于接收所述终端向外广播的DISCOVER报文;The receiving module is further configured to receive a DISCOVER message broadcast by the terminal; 所述发送模块,还用于根据所述DISCOVER报文,向所述终端返回DHCPOFFER报文;The sending module is further configured to return a DHCPOFFER message to the terminal according to the DISCOVER message; 所述接收模块,还用于接收所述终端发送的第二DHCP请求报文,所述第二DHCP请求报文确认选择所述DHCP服务器;The receiving module is further configured to receive a second DHCP request message sent by the terminal, and the second DHCP request message confirms selection of the DHCP server; 所述发送模块,还用于向所述终端返回DHCPACK报文。The sending module is further configured to return a DHCPACK message to the terminal. 11.一种动态主机配置协议重连的系统,其特征在于,包括第一DHCP服务器、第二DHCP服务器和与所述第一DHCP服务器、第二DHCP服务器分别通信连接的终端;其中:11. A system for dynamic host configuration protocol reconnection, characterized in that it includes a first DHCP server, a second DHCP server, and terminals respectively connected in communication with the first DHCP server and the second DHCP server; wherein: 所述第二DHCP服务器为权利要求8-10中任一项所述的DHCP服务器;The second DHCP server is the DHCP server according to any one of claims 8-10; 所述终端,用于在从第一DHCP服务器切换到第二DHCP服务器时,向外广播第一DHCP请求报文;以及接收所述第二DHCP服务器返回的DHCPNAK报文,并根据所述DHCPNAK报文开启新一次重连过程。The terminal is configured to broadcast the first DHCP request message when switching from the first DHCP server to the second DHCP server; and receive the DHCPNAK message returned by the second DHCP server, and according to the DHCPNAK message The text starts a new reconnection process.
CN201410571158.4A 2014-10-23 2014-10-23 Dynamic host configuration protocol (DHCP) reconnection method, DHCP server and system Withdrawn CN105592172A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201410571158.4A CN105592172A (en) 2014-10-23 2014-10-23 Dynamic host configuration protocol (DHCP) reconnection method, DHCP server and system
PCT/CN2015/092657 WO2016062268A1 (en) 2014-10-23 2015-10-23 Dynamic host configuration protocol reconnection method, dhcp server and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410571158.4A CN105592172A (en) 2014-10-23 2014-10-23 Dynamic host configuration protocol (DHCP) reconnection method, DHCP server and system

Publications (1)

Publication Number Publication Date
CN105592172A true CN105592172A (en) 2016-05-18

Family

ID=55760315

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410571158.4A Withdrawn CN105592172A (en) 2014-10-23 2014-10-23 Dynamic host configuration protocol (DHCP) reconnection method, DHCP server and system

Country Status (2)

Country Link
CN (1) CN105592172A (en)
WO (1) WO2016062268A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109347994A (en) * 2018-10-19 2019-02-15 Oppo广东移动通信有限公司 Internet Protocol IP address acquisition method, device, storage medium and electronic device

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002077B (en) * 2021-03-01 2024-03-22 炬芯科技股份有限公司 Method for DHCP client to acquire IP address and related equipment
CN118612058B (en) * 2024-03-05 2025-07-18 广州芯德通信科技股份有限公司 A production test pairing method for terminal equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101043465A (en) * 2006-06-20 2007-09-26 华为技术有限公司 Dynamic host configuration protocol service managing method and system thereof
CN101350809A (en) * 2007-07-19 2009-01-21 华为技术有限公司 A method and system for realizing authentication
CN101778103A (en) * 2009-12-30 2010-07-14 中兴通讯股份有限公司 Method for wireless terminal to assign IP addresses to PCs
CN103944867A (en) * 2013-01-23 2014-07-23 华为技术有限公司 Dynamic host configuration protocol (DHCP) message processing method, device and system
US20140280467A1 (en) * 2013-03-13 2014-09-18 Everfocus Electronics Corp. Method of managing port dhcp server protocol addresses

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101043465A (en) * 2006-06-20 2007-09-26 华为技术有限公司 Dynamic host configuration protocol service managing method and system thereof
CN101350809A (en) * 2007-07-19 2009-01-21 华为技术有限公司 A method and system for realizing authentication
CN101778103A (en) * 2009-12-30 2010-07-14 中兴通讯股份有限公司 Method for wireless terminal to assign IP addresses to PCs
CN103944867A (en) * 2013-01-23 2014-07-23 华为技术有限公司 Dynamic host configuration protocol (DHCP) message processing method, device and system
US20140280467A1 (en) * 2013-03-13 2014-09-18 Everfocus Electronics Corp. Method of managing port dhcp server protocol addresses

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109347994A (en) * 2018-10-19 2019-02-15 Oppo广东移动通信有限公司 Internet Protocol IP address acquisition method, device, storage medium and electronic device
CN109347994B (en) * 2018-10-19 2021-02-09 Oppo广东移动通信有限公司 Internet protocol IP address obtaining method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
WO2016062268A1 (en) 2016-04-28

Similar Documents

Publication Publication Date Title
US8787200B2 (en) Device, system, and method for automatically configuring application terminals in home network
JP5967173B2 (en) Network relay device, method for setting operation mode of packet relay processing unit included in network relay device, and computer program
CN102594635B (en) Based on the terminal access method of home gateway and system and home gateway
EP2536108B1 (en) Method, system and apparatus for acquiring ipv6 configuration information in ipv6 transient network
EP2579519A1 (en) Method, network device and system for automatically configuring network device in internet protocol version 6 network
CN101510902B (en) Method, system and equipment for preventing wireless client terminal from disconnection during internet process
CN104521189B (en) The network terminal obtains method, equipment, the system of business
CN105245629B (en) Host communication method based on DHCP and device
RU2013106254A (en) METHOD OF TERMINAL ACCESS AUTHENTICATION AND EQUIPMENT LOCATED IN THE SUBSCRIBER'S TERRITORY
CN101753635A (en) Method and system of collocating IPV6 (internet protocol version 6) addresses
KR101589239B1 (en) Method and apparatus for packet call setup
CN104935564B (en) Make the equipment based on mDNS agreements and service the method found mutually in a local network
CN102447746B (en) Information supply method, family gateway and family network system
CN110995886A (en) Network address management method, device, electronic equipment and medium
EP2765743A1 (en) Layer 2 inter-connecting method, apparatus and system based on ipv6
CN105188047A (en) Wifi wireless roaming Internet access method and mobile terminal
JP2015164286A (en) Network relay device, method for setting operation mode of packet relay processing unit in network relay device, and computer program
CN103227842B (en) A kind of method and apparatus obtaining sip server address
CN105592172A (en) Dynamic host configuration protocol (DHCP) reconnection method, DHCP server and system
EP3048756B1 (en) Management method and apparatus for dynamic host configuration protocol server and relay
CN108076025B (en) Method and device for registering network equipment
WO2016177185A1 (en) Method and apparatus for processing media access control (mac) address
KR100595524B1 (en) Device discovery system and method
CN102811263A (en) Communication method and system based on IPv6 for mobile terminal and mobile terminal
EP3021529A1 (en) Method and device for implementing layer 3 virtual private network

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20160518