WO2023284259A1 - 地址分配方法、地址分配系统及计算机可读存储介质 - Google Patents

地址分配方法、地址分配系统及计算机可读存储介质 Download PDF

Info

Publication number
WO2023284259A1
WO2023284259A1 PCT/CN2021/142220 CN2021142220W WO2023284259A1 WO 2023284259 A1 WO2023284259 A1 WO 2023284259A1 CN 2021142220 W CN2021142220 W CN 2021142220W WO 2023284259 A1 WO2023284259 A1 WO 2023284259A1
Authority
WO
WIPO (PCT)
Prior art keywords
service device
client
address
address allocation
current service
Prior art date
Application number
PCT/CN2021/142220
Other languages
English (en)
French (fr)
Inventor
杨斌
Original Assignee
牙木科技股份有限公司
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 牙木科技股份有限公司 filed Critical 牙木科技股份有限公司
Publication of WO2023284259A1 publication Critical patent/WO2023284259A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • 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]

Definitions

  • the invention relates to the technical field of network communication, in particular to an address allocation method for a dynamic host configuration protocol, an address allocation system and a computer-readable storage medium.
  • DHCP Dynamic Host Configuration Protocol
  • IP addresses so that hosts in the network environment can dynamically obtain IP addresses and gateways. Address, DNS server address and other information.
  • the service device In the process of assigning IP addresses through the Dynamic Host Configuration Protocol, the service device provides the client with the service of assigning IP addresses.
  • the performance that a single service device can provide is limited, and more services need to be expanded. The device improves service performance and service efficiency.
  • DHCPFailover Dynamic Host Configuration Protocol failover
  • a method for load balancing of DHCP service devices is also proposed, that is, to deploy a device specially used for load balancing, and the load balancing device distributes the request information of the client to multiple DHCP service devices in a balanced manner. , that is, each service device serves a specified number of clients.
  • each service device serves a specified number of clients.
  • the work and maintenance of the load balancing equipment will also bring certain cost issues.
  • the present invention provides an address allocation method, an address allocation system, and a computer-readable storage medium for a dynamic host configuration protocol, which can realize load balancing between multiple DHCP service devices, and at the same time, multiple service devices Even if a single service device fails to provide services, the work of the service device can be distributed to other service devices in a balanced manner, further ensuring the performance and efficiency of the address allocation service.
  • the technical solution of the present invention provides an address allocation method.
  • the address allocation method is run simultaneously by multiple service devices in the address allocation system, specifically including:
  • Step S1 the current service device receives the address allocation request sent by the client
  • Step S2 the current service device calculates the target service device corresponding to the client information of the client;
  • Step S3 if the target service device is the current service device, the current service device assigns an IP address to the client,
  • the current service device forwards the client information to the target service device;
  • Step S4 returning the IP address assigned to the client to the client.
  • the address allocation method provided in the technical solution of the present invention can also ensure efficient response of address allocation services when faced with relatively large-scale users through multiple service devices running at the same time. And through the preset algorithm, the address allocation task of the client can be evenly allocated to each service device. At the same time, each service device is not completely isolated. When the target service device corresponding to the received client information is not the current service device, the received client information will be forwarded to the corresponding target service device to avoid The address assignment request from the client fails.
  • the above-mentioned address allocation method realizes load balancing among multiple service devices, and at the same time enables communication among various service devices to realize cooperation without relying on load balancing devices.
  • the hash mapping method is used to calculate the target service device corresponding to the client information
  • the key value used by the hash mapping method is the client information
  • the hash mapping method The mapped value used by the method is the target service device. Corresponding the client information with the target service device through hash mapping can ensure the uniqueness of the client corresponding to the target service device. the same one.
  • the address allocation method also includes
  • Step S5 determine whether the client has been assigned an IP address whose lease has not expired, if yes, the current service device directly returns the assigned IP address whose lease has not expired to the client; if not, execute step S2.
  • DHCP address allocation carries a lease, that is to say, after an IP address is allocated to a client, the client cannot use the IP address permanently, but has a time limit specified in the lease. If the time limit is exceeded, that is, the lease has expired, the IP address no longer belongs to the client, and the IP address needs to be renewed or reassigned; The client returns an IP address whose lease has not expired.
  • step S3 in the address allocation method also includes
  • Step S31 if there is no free IP address in the current service device, the current service device forwards the client information to other service devices.
  • the address allocation method also includes
  • Step S6 after the current service device completes the address assignment of the client, it synchronously sends the client information and the IP address assigned to the client to other service devices.
  • each service device can receive and store all client IP address allocation information, so that when receiving a client address allocation request, it first determines whether the client has been allocated an IP address whose lease has not expired to avoid repeated requests , to ensure the uniqueness of the client IP address, simplify the steps of judging and analyzing the client information, and improve the overall efficiency of the address allocation system.
  • the address allocation method also includes
  • Step S7 the current service device regularly or irregularly sends heartbeat packets to other service devices, and receives heartbeat packets sent by other service devices;
  • Step S8 if the current service device detects that one or more heartbeat packets of other service devices are abnormal, then exclude the service device from the mapping value.
  • the status of each service device is monitored in real time through the above-mentioned heartbeat packet mechanism.
  • a service device fails, it is excluded from the mapping value, so that the client's address allocation request will no longer be allocated to the service device, and the client address allocation requests that the service device is responsible for can be distributed evenly to other service devices.
  • a heartbeat packet can also be sent to quickly establish a connection between the new service device and the original service device, so that the service device can be conveniently and quickly realized. expansion.
  • an address allocation system including a plurality of service devices, wherein the current service device stores instructions for performing the following operations:
  • Step S1 receiving the address allocation request sent by the client
  • Step S2 calculating the target service device corresponding to the client information of the client;
  • Step S3 if the target service device is the current service device, the current service device assigns an IP address to the client; if the target service device is not the current service device, the current service device forwards the client information to the target service device;
  • Step S4 returning the IP address assigned to the client to the client.
  • the above address allocation system includes multiple service devices, which can provide address allocation services for large-scale clients.
  • each service device is responsible for the address allocation service of some clients, and the corresponding allocation between the client and the service device can be realized through the cooperation between the service device and the service device, and there is no need to set up additional load balancing devices for adjustment.
  • each service device maintains communication to realize information synchronization, so as to prevent the failure of a single service device from affecting the response of the address service system to some clients' address allocation requests.
  • a computer-readable storage medium is also provided.
  • a computer program is stored on the computer-readable storage medium.
  • the steps of the above-mentioned address allocation method can be realized, so as to realize simultaneous Balance load among multiple service devices at work.
  • FIG. 1 is a schematic diagram of an address allocation method provided in the first embodiment of the present invention
  • FIG. 2 is a schematic diagram of another address allocation method provided in the first embodiment of the present invention.
  • FIG. 3 is a schematic diagram of an address allocation method provided in a second embodiment of the present invention.
  • Fig. 4 is a schematic diagram of another address allocation method provided in the second embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a heartbeat packet of an address allocation method provided in a third embodiment of the present invention.
  • FIG. 6 is a schematic diagram of an abnormal heartbeat packet in another address allocation method provided in the third embodiment of the present invention.
  • Fig. 7 is a schematic diagram of an address allocation system provided in a fourth embodiment of the present invention.
  • Reference numerals 1 - address allocation system, 2 - service device, 21 - current service device.
  • an address allocation method is provided in the first embodiment of the present invention.
  • the address allocation method in this embodiment is run simultaneously by multiple service devices in the address allocation system, specifically including:
  • Step S1 the current service device receives the address allocation request sent by the client
  • Step S2 the current service device calculates the target service device corresponding to the client information of the client;
  • Step S3 if the target service device is the current service device, the current service device assigns an IP address to the client,
  • the current service device forwards the client information to the target service device;
  • Step S4 returning the IP address assigned to the client to the client.
  • DHCP Dynamic Host Configuration Protocol
  • the server's dynamic address assignment task is driven by the client. That is to say, when the DHCP server-as-a-service device receives information requesting address allocation from the client, it will send related address configuration and other information to the client, so as to realize the dynamic configuration of the client address information. And in order to ensure uniqueness, it is necessary to ensure that any IP address can only be used by one client at the same time when performing address allocation.
  • the client can send an address allocation request to the server in the form of unicast or broadcast
  • unicast means that the address allocation request will be sent to a certain server
  • broadcast means that the address allocation request will be sent to multiple servers, and Multiple servers will respond, and the client will receive the fastest response.
  • the faster the response response or the closer the server is to the location where the client request is intensive the greater the load, while the slower response or the server farther away from the request information center is idle for a long time.
  • the load difference is large, and it is difficult to achieve balanced load.
  • the current service device may be any service device that has received the address allocation request sent by the client. After the current service device accepts the request, it calculates and analyzes the client information to obtain its corresponding target service device, and verifies whether it is the target service device corresponding to the client information. Through the calculation mechanism, each client corresponds to a specified target service device. Similarly, each service device only needs to provide address allocation services for the specified client. Thus, it is avoided that client requests are concentrated on some service devices, making them overloaded, reducing work efficiency and even causing errors or failures; while another part of service devices has only a small amount of work or is completely idle, resulting in uneven load and low efficiency of the overall address allocation system.
  • the current service device assigns an IP address to the client; if the target service device is not the current service device, the current service device forwards the client information to the target service device.
  • the service device can not only judge its own working scope, but also exchange information with other service devices, so as to improve the response efficiency of the overall address allocation system.
  • the client information unicast mode if the client information is sent to a non-target service device, the current service device will forward the client information to the target service device, effectively avoiding the failure of the client request.
  • the hash mapping method is used to calculate the target service device corresponding to the client information, and the key value used by the hash mapping method is the client information,
  • the map value used by the hash map method is the target service device.
  • the calculation logic of the hash map is to obtain the mapping value corresponding to the key value through the operation on the key value.
  • the target service device corresponding to the client information is obtained through calculation on the client information.
  • the way of hash mapping can also enable the same service device to provide address allocation service for a client each time, thereby ensuring the uniqueness of the client corresponding to the target service device.
  • the client information may be a unique identity identifier such as a user identifier (UID) and a local area network address (MAC) of the client.
  • UID user identifier
  • MAC local area network address
  • the address allocation method provided in the first embodiment of the present invention further includes
  • Step S5 determine whether the client has been assigned an IP address whose lease has not expired, if yes, the current service device directly returns the assigned IP address whose lease has not expired to the client; if not, execute step S2.
  • the IP address assigned to the client is not permanent, and the IP address assigned to the client also carries a lease.
  • the lease defines the usage period of the IP address used by the client. After the usage period expires, the IP address will be recycled and reassigned; if the client wants to continue to use the IP address, it needs to send a renewal request before the usage period expires. , to renew to extend the usage period.
  • the service device before the service device assigns an IP address to the client, it first judges whether the client has been assigned an IP address whose lease has not expired, which can effectively improve the working efficiency of the service device and avoid repeated assignments, which may result in the loss of IP addresses. waste.
  • the service device finds that the client has been assigned an IP address and the lease of the IP address has not expired, the service device does not need to perform subsequent calculation and analysis, and can directly return the IP address to the client; when the service device finds that the client has been assigned If there is an IP address but the lease of the IP address has expired or the client has not been assigned an IP address, then analyze and calculate the client information and assign an IP address to the client.
  • step S3 in the address allocation method provided in this embodiment also includes
  • Step S31 if there is no free IP address in the current service device, the current service device forwards the client information to other service devices.
  • each service device is allocated a certain amount of IP addresses for subsequent allocation to clients.
  • the IP addresses managed in the service equipment with relatively busy business may be exhausted, resulting in insufficient IP addresses managed in a certain service equipment, so that the IP address cannot be allocated to the client. Therefore, the step of forwarding the client information to other service devices can avoid the problems caused by excessive traffic concentration on a certain service device, so that the cooperation relationship between various service devices can be better strengthened, and load balancing can be achieved. If the client information is sent to a certain service device whose address is exhausted, it will not be able to get a response, so that the cooperative relationship between various service devices can be better strengthened.
  • the address allocation method provided in the second embodiment of the present invention also includes
  • Step S6 after the current service device completes the address assignment of the client, it synchronously sends the client information and the IP address assigned to the client to other service devices.
  • each service device can not only store the IP address allocation information of the client it is responsible for, but also receive and store the client IP address allocation information in other service devices, so as to realize the sharing of the overall address allocation information.
  • the current service device can more accurately and comprehensively determine whether the client has been assigned an IP address whose lease has not expired when receiving the client address allocation request, avoiding repeated requests, ensuring the uniqueness of the client IP address, and simplifying the process for the client.
  • the steps of judging and analyzing terminal information improve the overall efficiency of the address allocation system.
  • the third embodiment of the present invention is a further preferred embodiment on the basis of the first embodiment and the second embodiment.
  • the address allocation method provided in this embodiment also includes
  • Step S7 the current service device regularly or irregularly sends heartbeat packets to other service devices, and receives heartbeat packets sent by other service devices;
  • Step S8 if the current service device detects that one or more heartbeat packets of other service devices are abnormal, then exclude the service device from the mapping value.
  • each client has a corresponding target service device that provides address allocation services for it, that is to say, the address allocation tasks of its corresponding clients are determined by the The target service device provides that even if the client information corresponding to the address allocation requested by the client is received by other service devices, the other service devices will forward the client information to the current target service device.
  • the service device In order to avoid the failure of the address allocation request of the corresponding client when the service device fails, if the heartbeat packet of one or more services is detected to be abnormal, the service device will be excluded from the mapping value. As shown in Figure 6, if the heartbeat packet of service device 2 is abnormal, service device 2 is excluded from the mapping value of the hash map, that is, the service device 2 is no longer the target service device corresponding to any client information, which originally corresponds to The client information will be forwarded to other service devices. Preferably, the original corresponding client information will be evenly distributed to other multiple service devices, so that the failure of a single service device will not affect the overall load balance.
  • the abnormality of the heartbeat packet includes but is not limited to the abnormality of the information in the heartbeat packet sent by the service device, the service device stops sending the heartbeat packet, and other abnormal situations.
  • the fourth embodiment of the present invention provides an address allocation system 1, which specifically includes a plurality of service devices 2, including a current service device 21, which stores instructions for performing the following operations :
  • Step S1 receiving the address allocation request sent by the client
  • Step S2 calculating the target service device corresponding to the client information of the client;
  • Step S3 if the target service device is the current service device 21, the current service device 21 assigns an IP address to the client, if the target service device is not the current service device 21, the current service device 21 forwards the client information to the target service device;
  • Step S4 returning the IP address assigned to the client to the client.
  • the address allocation system 1 provided in the embodiment of the present invention can realize load balancing between multiple DHCP service devices, and simultaneously establish connections between multiple service devices, even if a single service device fails to provide services,
  • the work of the service device can also be evenly distributed to other service devices, thereby further ensuring the performance and efficiency of the address assignment service.
  • the fourth embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned address allocation method are realized.

Abstract

本发明涉及网络通信技术领域,具体提供了一种地址分配方法、地址分配系统及计算机可读存储介质。本发明提供的地址分配方法由地址分配系统中的多个服务设备同时运行,具体包括:步骤S1,当前服务设备接收客户端发送的地址分配请求;步骤S2,当前服务设备计算客户端的客户端信息对应的目标服务设备;步骤S3,若目标服务设备为当前服务设备,则当前服务设备为客户端分配IP地址,若目标服务设备不是当前服务设备,则当前服务设备将客户端信息转发到目标服务设备;步骤S4,将分配给客户端的IP地址,返回给客户端。

Description

地址分配方法、地址分配系统及计算机可读存储介质 技术领域
本发明涉及网络通信技术领域,具体涉及一种用于动态主机配置协议的地址分配方法、地址分配系统及计算机可读存储介质。
背景技术
动态主机配置协议(Dynamic Host Configuration Protocol,以下简称DHCP)通常被应用在大型的局域网络环境中,主要作用是集中的管理、分配IP地址,使网络环境中的主机能够动态地获得IP地址、网关地址、DNS服务器地址等信息。
在通过动态主机配置协议分配IP地址的过程中,服务设备为客户端提供分配IP地址的服务,但在大规模用户的场景下,单台服务设备能够提供的性能有限,需要扩充更多的服务设备提高服务性能和服务效率。
在现有技术中,动态主机配置协议故障转移(DHCPFailover)策略提出同时部署两台服务设备,两台服务设备之间共享服务信息、平衡服务负载。但由于其故障转移机制限制,只能在两台服务设备之间运行,无法扩充到更多设备之间;而且,其均衡服务要求客户端的请求信息必须发送至两台服务设备,才能实现负载均衡。
在RFC3074协议文件中,还提出了一种DHCP服务设备负载均衡的方法,即部署一个专门用来进行负载均衡的设备,该负载均衡设备将客户端的请求信息,均衡地分配到多台DHCP服务设备中,即每台服务设备为指定的部分客户端进行服务。但这种模式下,若一台服务设备发生故障,则由该服务设备负责的客户端将无法获得地址分配服务。而且,负载均衡设备的工作和维护也会带来一定的成本问题。
因此,亟待提供一种技术方案,能够实现多台DHCP服务设备之间的负载均衡,同时能够避免单台服务设备故障影响部分客户端正常获取地址的问题。
发明内容
针对以上问题,本发明提供了一种用于动态主机配置协议的地址分 配方法、地址分配系统及计算机可读存储介质,能够实现多个DHCP服务设备之间的负载均衡,同时在多个服务设备之间建立连接,即使单个服务设备发生故障无法提供服务,也能将该服务设备的工作均衡地分配到其他服务设备中,进一步地保证地址分配服务的性能和效率。
本发明的技术方案中提供了一种地址分配方法,地址分配方法由地址分配系统中的多个服务设备同时运行,具体包括:
步骤S1,当前服务设备接收客户端发送的地址分配请求;
步骤S2,当前服务设备计算客户端的客户端信息对应的目标服务设备;
步骤S3,若目标服务设备为当前服务设备,则当前服务设备为客户端分配IP地址,
若目标服务设备不是当前服务设备,则当前服务设备将客户端信息转发到目标服务设备;
步骤S4,将分配给客户端的IP地址,返回给客户端。
本发明的技术方案中提供的地址分配方法,通过同时运行的多个服务设备,在面临较大规模的用户时,也能保证地址分配服务的高效应答。并且通过预设的算法,使得客户端的地址分配任务能够均衡地分配到各个服务设备中。同时,各个服务设备间并不是完全孤立的,在收到的客户端信息对应的目标服务设备不是当前服务设备时,会将收到的客户端信息转发到其对应的目标服务设备,以避免客户端的地址分配请求落空。上述的地址分配方法实现了多个服务设备之间的负载均衡,同时也使得各个服务设备间保持通信从而实现协作配合,不必依赖负载均衡设备。
优选地,在本发明的技术方案中,地址分配方法的步骤S2中使用哈希映射方法计算客户端信息对应的目标服务设备,哈希映射方法使用的关键字值为客户端信息,哈希映射方法使用的映射值为目标服务设备。通过哈希映射将客户端信息与目标服务设备对应,能够保证客户端对应目标服务设备的唯一性,也就说一个客户端每次发出地址分配请求,为其提供地址分配服务的服务设备都是同一个。
在本发明的较优技术方案中,地址分配方法还包括
步骤S5,判断客户端是否已分配有租约未过期的IP地址,若是,则当前服务设备直接向客户端返回已分配的租约未过期的IP地址;若否,则执行步骤S2。
DHCP地址分配携带有租约,也就是说,将一个IP地址分配给一个客户端后,客户端并非能够永久使用该IP地址,而是有租约规定的时间限制的。若超过时间限制即租约已过期,则该IP地址则不再属于该客户端,需要续约或重新分配IP地址;若未超过时间限制即租约未过期,则无需重新分配IP地址,只需要向客户端返回已分配的租约未过期的IP地址。
优选地,在本发明的技术方案中,地址分配方法中的步骤S3还包括
步骤S31,若当前服务设备中无空闲的IP地址,则当前服务设备将客户端信息转发到其他服务设备。
通过上述的转发步骤,能够有效地避免流量过度集中于某个服务设备,而导致某个服务设备中管理的IP地址不足而无法给客户端分配IP地址;同时,也使得各个服务设备之间能够更好地加强协作关系,实现负载均衡。
在本发明的优选技术方案中,地址分配方法还包括
步骤S6,当前服务设备完成客户端的地址分配后,将客户端信息以及分配给客户端的IP地址同步发送到其他服务设备。
换言之,每个服务设备都能接收并存储有全部的客户端IP地址分配信息,以便在接收到客户端地址分配请求时,首先判断客户端是否已分配有租约未过期的IP地址,避免重复请求,保证客户端IP地址唯一性,同时简化了对客户端信息判断分析的步骤,提高了地址分配系统的整体效率。
进一步地,在本发明的技术方案中,地址分配方法还包括
步骤S7,当前服务设备定期或者不定期向其他服务设备发出心跳包,并接收其他服务设备发送的心跳包;
步骤S8,若当前服务设备检测到其他服务设备中的一台或者多台的心跳包异常,则将该服务设备从映射值中排除。
为避免单个服务设备故障影响对部分客户端的地址分配请求的应答,通过上述心跳包机制,实时监测各个服务设备的状态。在某个服务设备发生故障时,将其从映射值中排除,从而使得客户端的地址分配请求不会再被分配至该服务设备,并且能够将该服务设备负责的客户端地址分配请求均衡地分配至其他服务设备中。进一步地,在地址分配系统中,加入新的服务设备时,也能够通过发送心跳包的方式,使新的服务 设备与原有服务设备之间迅速建立连接,从而能够方便快速地实现服务设备的扩容。
在本发明的技术方案中,还提供了一种地址分配系统,包括多个服务设备,其中当前服务设备内存储有用于执行以下操作的指令:
步骤S1,接收客户端发送的地址分配请求;
步骤S2,计算客户端的客户端信息对应的目标服务设备;
步骤S3,若目标服务设备为当前服务设备,则当前服务设备为客户端分配IP地址,若目标服务设备不是当前服务设备,则当前服务设备将客户端信息转发到目标服务设备;
步骤S4,将分配给客户端的IP地址,返回给客户端。
上述的地址分配系统,包括多个服务设备,能够为大规模的客户端提供地址分配服务。其中,每个服务设备负责一部分客户端的地址分配服务,并且客户端和服务设备之间的对应分配能够通过服务设备及服务设备间的协作来实现,无需另外设置负载均衡设备进行调节。而且,各个服务设备之间保持通信,实现信息同步,以避免单个服务设备故障影响地址服务系统对部分客户端的地址分配请求的应答。
在本发明的技术方案中,还提供了一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时能够实现上述的地址分配方法的步骤,以实现同时工作的多个服务设备之间的均衡负载。
附图说明
图1是本发明的第一实施方式中提供的一种地址分配方法的示意图;
图2是本发明的第一实施方式中提供的另一种地址分配方法的示意图;
图3是本发明的第二实施方式中提供的一种地址分配方法的示意图;
图4是本发明的第二实施方式中提供的另一种地址分配方法的示意图;
图5是本发明的第三实施方式中提供的一种地址分配方法的心跳包的示意图;
图6是本发明的第三实施方式中提供的另一种地址分配方法的心跳包异常的示意图;
图7是本发明的第四实施方式中提供的一种地址分配系统的示意图。
附图标记:1-地址分配系统,2-服务设备,21-当前服务设备。
具体实施方式
下面将结合本发明实施方式中的附图,对本发明实施方式中的技术方案进行清楚、完整地描述,显然,所描述的实施方式仅仅是本发明一部分实施方式,而不是全部的实施方式。基于本发明中的实施方式,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施方式,都属于本发明的保护范围。
[第一实施方式]
如图1所示,本发明的第一实施方式中提供了一种地址分配方法,本实施方式中的地址分配方法由地址分配系统中的多个服务设备同时运行,具体包括:
步骤S1,当前服务设备接收客户端发送的地址分配请求;
步骤S2,当前服务设备计算客户端的客户端信息对应的目标服务设备;
步骤S3,若目标服务设备为当前服务设备,则当前服务设备为客户端分配IP地址,
若目标服务设备不是当前服务设备,则当前服务设备将客户端信息转发到目标服务设备;
步骤S4,将分配给客户端的IP地址,返回给客户端。
动态主机配置协议(DHCP)在提供地址分配服务时,采用的是客户端/服务器架构,服务器的地址动态分配任务由客户端驱动。也就是说,当DHCP服务器即服务设备接收到来自客户端请求分配地址的信息时,才会向客户端发送相关的地址配置等信息,以实现客户端地址信息的动态配置。并且为了保证唯一性,在进行地址分配时,需要保证任何IP地址在同一时刻只能由一个客户端所使用。其中,客户端可以以单播或广播的形式向服务端发出地址分配请求,单播即地址分配请求会发送到某 个服务端;而广播是指地址分配请求会发送向多个服务端,而多个服务端均会进行应答,客户端接收最快返回的应答信息。尤其是在广播的模式中,应答反应越快或距离客户端请求密集的位置越近的服务端负载越大,而应答较慢或距离请求信息中心较远的服务端长期闲置,服务端之间负载差异大,难以实现均衡负载。
本实施方式中提出的地址分配方法中,当前服务设备可以是接收到客户端发送的地址分配请求的任一服务设备。当前服务设备接受请求后,通过对客户端信息进行计算分析得到其对应的目标服务设备,并验证自身是否为客户端信息对应的目标服务设备。通过计算机制,使得每个客户端均对应于指定的目标服务设备,同样地,每个服务设备只需为指定的客户端提供地址分配服务。从而,避免了客户端请求集中于部分服务设备,使其过载工作,工作效率降低乃至产生错误或故障;而另一部分服务设备只有少量工作甚至完全闲置,致使整体地址分配系统负载不均效率低下。
然后根据验证结果,若目标服务设备为当前服务设备,则当前服务设备为客户端分配IP地址;若目标服务设备不是当前服务设备,则当前服务设备将客户端信息转发到目标服务设备。服务设备不仅能判断自身的工作范围,还能与其他的服务设备进行信息交换,以提高整体地址分配系统的应答效率。在客户端信息单播的模式下,若客户端信息被发送到非目标服务设备上,当前服务设备将客户端信息转发到目标服务设备,有效地避免客户端请求落空。
优选地,在本发明的实施方式中提供的地址分配方法中,其步骤S2中使用哈希映射方法计算客户端信息对应的目标服务设备,哈希映射方法使用的关键字值为客户端信息,哈希映射方法使用的映射值为目标服务设备。哈希映射的计算逻辑为通过对关键字值的运算,得到关键字值对应的映射值。在本实施方式中,即为通过对客户端信息的运算,得到客户端信息对应的目标服务设备。哈希映射的方式还能够使得每一次为一个客户端提供地址分配服务的均是同一个服务设备,从而保证客户端对应目标服务设备的唯一性。其中,客户端信息可以为客户端的用户标识(UID)、局域网地址(MAC)等具有唯一性的身份标识。
优选地,如图2所示,本发明的第一实施方式中提供的地址分配方法还包括
步骤S5,判断客户端是否已分配有租约未过期的IP地址,若是,则当前服务设备直接向客户端返回已分配的租约未过期的IP地址;若否,则执行步骤S2。
动态主机配置协议(DHCP)中,分配给客户端的IP地址并不是永久性的,IP地址分配给客户端的同时还携带有租约。租约限定客户端使用该IP地址的使用期限,超过使用期限后,该IP地址会被回收并重新分配;若客户端想要持续使用该IP地址,则需在超过使用期限前,发送续约请求,进行续约以延长使用期限。
本实施方式中,服务设备在为客户端分配IP地址前,先判断该客户端是否已分配有租约未过期的IP地址,能够有效地提高服务设备的工作效率,避免重复分配,造成IP地址的浪费。当服务设备发现客户端已分配有IP地址且IP地址的租约未过期时,服务设备则无需进行后续的计算分析,直接将该IP地址返回给客户端即可;当服务设备发现客户端已分配有IP地址但IP地址的租约已过期或客户端为分配有IP地址时,再进行对客户端信息的分析计算,为该客户端分配IP地址。
[第二实施方式]
本发明的第二实施方式是在第一实施方式的基础上进一步优选的实施方式,如图3所示,本实施方式中提供的地址分配方法中的步骤S3还包括
步骤S31,若当前服务设备中无空闲的IP地址,则当前服务设备将客户端信息转发到其他服务设备。
在完成地址分配工作的多个服务设备中,每个服务设备均分配有一定量的IP地址以供其后续分配给客户端。随着地址分配任务的进行,业务较为繁忙的服务设备中管理的IP地址可能会耗尽,而导致某个服务设备中管理的IP地址不足而无法给客户端分配IP地址。因此,将客户端信息转发到其他服务设备的步骤能够避免流量过度集中于某个服务设备带来的问题,使得各个服务设备之间能够更好地加强协作关系,实现负载均衡,同时也能够避免客户端信息单发至某个地址耗尽的服务设备无法获得应答,使得各个服务设备之间能够更好地加强协作关系。
进一步地,如图4所示,本发明的第二实施方式中提供的地址分配方法还包括
步骤S6,当前服务设备完成客户端的地址分配后,将客户端信息以及分配给客户端的IP地址同步发送到其他服务设备。
通过上述步骤,每个服务设备不仅能够存储有自身负责的客户端的IP地址分配信息,还都能接收并存储有其他服务设备中的客户端IP地址分配信息,实现整体地址分配信息的共享。当前服务设备能够在接收到客户端地址分配请求时,更为准确全面地判断客户端是否已分配有租约未过期的IP地址,避免重复请求,保证客户端IP地址唯一性,同时简化了对客户端信息判断分析的步骤,提高了地址分配系统的整体效率。
[第三实施方式]
本发明的第三实施方式是在第一实施方式和第二实施方式的基础上进一步优选的实施方式,本实施方式中提供的地址分配方法还包括
步骤S7,当前服务设备定期或者不定期向其他服务设备发出心跳包,并接收其他服务设备发送的心跳包;
步骤S8,若当前服务设备检测到其他服务设备中的一台或者多台的心跳包异常,则将该服务设备从映射值中排除。
如图5所示,多个服务设备在为客户端提供地址分配服务的同时,会定期或不定期地向其他服务设备发送心跳包,以通知其他服务设备自身的工作状态;并接收其它设备发送的心跳包,以确认其他服务设备的工作状态。在本实施方式中的地址分配方法指导的地址分配模式下,每个客户端均有对应的为其提供地址分配服务的目标服务设备,也就是说,其对应的客户端的地址分配任务均由该目标服务设备提供,即使对应客户端请求地址分配的客户端信息被其他服务设备接收,其他服务设备也会将客户端信息转发到当该目标服务设备上。
为避免在服务设备出现故障时,其对应客户端的地址分配请求落空,若检测到一台或者多台的服务的心跳包异常,则将该服务设备从映射值中排除。如图6所示,服务设备2的心跳包异常,则将服务设备2从哈希映射的映射值中排除,即该服务设备2不再是任何客户端信息对应的目标服务设备,其原本对应的客户端信息会被转发至其他服务设备。优选地,其原本对应的客户端信息会被均衡地分配到其他的多个服务设备中,使得单个服务设备故障不会影响整体的负载均衡。其中,心跳包异常的情况包括但不限于服务设备发送的心跳包内的信息异常、服务设备 停止发送心跳包等异常情况。
进一步地,在新增服务设备时,也可以通过心跳包的方式将其加入到地址分配的哈希映射的映射值中,即可便捷地加入服务设备,并使得新增的服务设备与原有的服务设备之间保持均衡负载。
[第四实施方式]
如图7所示,本发明的第四实施方式提供了一种地址分配系统1,具体包括多个服务设备2,其中包括当前服务设备21,当前服务设备21内存储有用于执行以下操作的指令:
步骤S1,接收客户端发送的地址分配请求;
步骤S2,计算客户端的客户端信息对应的目标服务设备;
步骤S3,若目标服务设备为当前服务设备21,则当前服务设备21为客户端分配IP地址,若目标服务设备不是当前服务设备21,则当前服务设备21将客户端信息转发到目标服务设备;
步骤S4,将分配给客户端的IP地址,返回给客户端。
通过上述步骤,本发明的实施方式中提供的地址分配系统1能够实现多个DHCP服务设备之间的负载均衡,同时在多个服务设备之间建立连接,即使单个服务设备发生故障无法提供服务,也能将该服务设备的工作均衡地分配到其他服务设备中,进一步地保证地址分配服务的性能和效率。
本发明的第四实施方式中还提供了一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现上述地址分配方法的步骤。
至此,已经结合附图描述了本发明的技术方案。但是,本领域技术人员容易理解的是,本发明的保护范围显然不局限于上述具体实施方式。在不偏离本发明的原理的前提下,本领域技术人员可以对相关技术特征作出等同的更改或替换,这些更改或替换之后的技术方案都将落入本发明的保护范围。

Claims (8)

  1. 一种地址分配方法,所述地址分配方法由地址分配系统中的多个服务设备同时运行,其特征在于,所述地址分配方法包括:
    步骤S1,当前服务设备接收客户端发送的地址分配请求;
    步骤S2,当前服务设备计算所述客户端的客户端信息对应的目标服务设备;
    步骤S3,若所述目标服务设备为所述当前服务设备,则所述当前服务设备为所述客户端分配IP地址,
    若所述目标服务设备不是当前服务设备,则所述当前服务设备将所述客户端信息转发到所述目标服务设备;
    步骤S4,将分配给所述客户端的IP地址,返回给所述客户端。
  2. 如权利要求1所述的地址分配方法,其特征在于,所述步骤S2中使用哈希映射方法计算所述客户端信息对应的所述目标服务设备,所述哈希映射方法使用的关键字值为所述客户端信息,所述哈希映射方法使用的映射值为所述目标服务设备。
  3. 如权利要求1所述的地址分配方法,其特征在于,还包括
    步骤S5,判断所述客户端是否已分配有租约未过期的IP地址,若是,则所述当前服务设备直接向所述客户端返回已分配的租约未过期的IP地址;若否,则执行步骤S2。
  4. 如权利要求1所述的地址分配方法,其特征在于,所述步骤S3还包括
    步骤S31,若所述当前服务设备中无空闲的IP地址,查找有空闲IP地址的其他服务设备,所述当前服务设备将所述客户端信息转发到所述其他服务设备。
  5. 如权利要求1所述的地址分配方法,其特征在于,还包括
    步骤S6,所述当前服务设备完成所述客户端的地址分配后,将所述客户端信息以及分配给所述客户端的IP地址同步发送到其他服务设备。
  6. 如权利要求2所述的地址分配方法,其特征在于,还包括
    步骤S7,所述当前服务设备定期或者不定期向其他服务设备发出心跳包,并接收所述其他服务设备发送的心跳包;
    步骤S8,若所述当前服务设备检测到所述其他服务设备中的一台或者多台的心跳包异常,则将该服务设备从所述映射值中排除。
  7. 一种地址分配系统,包括多个服务设备,其特征在于,所述地址分配系统包括当前服务设备,所述当前服务设备内存储有用于执行以下操作的指令:
    步骤S1,接收客户端发送的地址分配请求;
    步骤S2,计算所述客户端的客户端信息对应的目标服务设备;
    步骤S3,若所述目标服务设备为所述当前服务设备,则所述当前服务设备为所述客户端分配IP地址,若所述目标服务设备不是当前服务设备,则所述当前服务设备将所述客户端信息转发到所述目标服务设备;
    步骤S4,将分配给所述客户端的IP地址,返回给所述客户端。
  8. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1-6中任一项所述的地址分配方法的步骤。
PCT/CN2021/142220 2021-07-16 2021-12-28 地址分配方法、地址分配系统及计算机可读存储介质 WO2023284259A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110808667.4A CN113572830A (zh) 2021-07-16 2021-07-16 地址分配方法、地址分配系统及计算机可读存储介质
CN202110808667.4 2021-07-16

Publications (1)

Publication Number Publication Date
WO2023284259A1 true WO2023284259A1 (zh) 2023-01-19

Family

ID=78165262

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/142220 WO2023284259A1 (zh) 2021-07-16 2021-12-28 地址分配方法、地址分配系统及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN113572830A (zh)
WO (1) WO2023284259A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113572830A (zh) * 2021-07-16 2021-10-29 牙木科技股份有限公司 地址分配方法、地址分配系统及计算机可读存储介质
CN114124887B (zh) * 2021-11-29 2023-09-05 牙木科技股份有限公司 Dns服务器的视图查询方法、dns服务器及可读存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6871210B1 (en) * 2000-09-05 2005-03-22 International Business Machines Corporation Automatic allocation of least loaded boot server to PXE client on a network VIA DHCP server
CN102098354A (zh) * 2011-02-28 2011-06-15 北京星网锐捷网络技术有限公司 动态主机配置协议地址分配方法及服务器
CN103312708A (zh) * 2013-06-07 2013-09-18 福建联迪商用设备有限公司 一种基于租约文件的ip设定方法及系统
CN110086886A (zh) * 2019-05-14 2019-08-02 北京天融信网络安全技术有限公司 动态会话保持方法及装置
CN110730254A (zh) * 2019-10-14 2020-01-24 新华三信息安全技术有限公司 一种地址分配的方法、装置、中继设备及介质
CN113572830A (zh) * 2021-07-16 2021-10-29 牙木科技股份有限公司 地址分配方法、地址分配系统及计算机可读存储介质

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101997920A (zh) * 2010-11-18 2011-03-30 中兴通讯股份有限公司 Dhcp租约处理方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6871210B1 (en) * 2000-09-05 2005-03-22 International Business Machines Corporation Automatic allocation of least loaded boot server to PXE client on a network VIA DHCP server
CN102098354A (zh) * 2011-02-28 2011-06-15 北京星网锐捷网络技术有限公司 动态主机配置协议地址分配方法及服务器
CN103312708A (zh) * 2013-06-07 2013-09-18 福建联迪商用设备有限公司 一种基于租约文件的ip设定方法及系统
CN110086886A (zh) * 2019-05-14 2019-08-02 北京天融信网络安全技术有限公司 动态会话保持方法及装置
CN110730254A (zh) * 2019-10-14 2020-01-24 新华三信息安全技术有限公司 一种地址分配的方法、装置、中继设备及介质
CN113572830A (zh) * 2021-07-16 2021-10-29 牙木科技股份有限公司 地址分配方法、地址分配系统及计算机可读存储介质

Also Published As

Publication number Publication date
CN113572830A (zh) 2021-10-29

Similar Documents

Publication Publication Date Title
CN111464592B (zh) 基于微服务的负载均衡方法、装置、设备及存储介质
US6965930B1 (en) Methods, systems and computer program products for workload distribution based on end-to-end quality of service
CN101316236B (zh) Vrrp备份组负载分担方法及路由器
WO2023284259A1 (zh) 地址分配方法、地址分配系统及计算机可读存储介质
US6954784B2 (en) Systems, method and computer program products for cluster workload distribution without preconfigured port identification by utilizing a port of multiple ports associated with a single IP address
US7593346B2 (en) Distributing and balancing traffic flow in a virtual gateway
US7089281B1 (en) Load balancing in a dynamic session redirector
JP6585837B2 (ja) ユーザの移行
US6397260B1 (en) Automatic load sharing for network routers
JP4420420B2 (ja) ネットワークにおける負荷分配のための方法および装置
US9083709B2 (en) Virtual internet protocol migration and load balancing
US20150058968A1 (en) Proxy methods for suppressing broadcast traffic in a network
US20110320577A1 (en) System and method for location based address assignment in the distribution of traffic in a virtual gateway
CN102025630A (zh) 负载均衡方法及负载均衡系统
CN102333027B (zh) 基于vrrpe备份组的流量负载分担实现方法及其装置
US9071612B2 (en) Service providing system
CN102215158A (zh) 实现vrrp流量传输的方法和路由设备
CN108429824B (zh) 一种地址分配方法及装置
JP2000307657A (ja) ホスト・クラスタのためのネットワーク・ディスパッチャを利用するデータ伝送システムにおけるルータ監視システム
US20160173334A1 (en) Configuration of forwarding rules using the address resolution protocol
CN105743781B (zh) 一种vrrp负载均衡方法和装置
CN101018193A (zh) 负载分流的方法和系统及分配备份组虚ip地址的装置
CN108429641B (zh) 一种网络设备管理方法及装置
Li et al. Dyncast: Use dynamic anycast to facilitate service semantics embedded in ip address
WO2023207189A1 (zh) 负载均衡方法及系统、计算机存储介质、电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21950030

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE