A method for dynamically allocating access device addresses in a multi-DHCP server network and a gateway device.
By introducing address pool request and advertisement messages in a multi-DHCP server network, the master and slave servers are elected, which solves the problem of device interoperability in multiple broadband networks, realizes address allocation of devices in the same network segment, and ensures interoperability and conflict-free communication within the local area network.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-02
- Publication Date
- 2026-03-13
AI Technical Summary
In a multi-broadband network environment, devices connected to the same home gateway cannot directly interconnect, causing functions such as DLNA to malfunction within the local area network. Furthermore, DHCP Relay is not applicable in Layer 2 connectivity scenarios, leading to address allocation conflicts and unnecessary broadband usage.
By introducing address pool request and announcement messages in a multi-DHCP server network, a master and slave server are elected. The master server dynamically allocates address pools to slave servers, which then allocate them to devices, ensuring that all devices are on the same network segment and enabling LAN interconnection.
It enables interoperability between devices on different routers, avoids address conflicts, improves user experience, and simplifies operation.
Smart Images

Figure CN114844863B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of local area network (LAN) sharing technology, specifically to a method or apparatus for sharing a LAN among multiple broadband access devices in a home, and more specifically to a method and gateway device for controlling multiple DHCP (Dynamic Host Configuration Protocol) servers to reasonably allocate host addresses. Background Technology
[0002] Currently, commonly used home gateways connect to the telecommunications network upstream and provide domain name resolution and dynamic address allocation services to downstream access devices. They forward packets for accessing the internet from these devices and forge packets for access between devices. Devices connected to the same home gateway are on the same local area network (LAN) and can share various services. However, due to the rise of high-bandwidth services such as video and gaming, a single broadband connection may not be sufficient. A household may deploy multiple broadband connections with multiple gateways, each connecting to a different gateway and using its own broadband connection. In this scenario, the access devices on different gateways are on different LANs and cannot directly interconnect. Functions such as DLNA (Digital Living Network Alliance) within the LAN will not function.
[0003] The current common practice is to connect devices to the same gateway. These two devices are on the same local area network but can only share one broadband connection. Alternatively, the LAN / WLAN ports of two gateways can be connected, and each gateway address and DHCP address pool must be manually assigned to ensure they are on the same network segment and there are no address conflicts. This approach results in a poor user experience and requires considerable expertise. Furthermore, after Layer 2 connectivity, it's possible that the access device might obtain an address from an indirect gateway instead of the directly connected one, causing the access device to use the indirect gateway's broadband connection. While DHCP Relay can transmit DHCP messages between different subnets and physical network segments, it is primarily used in Layer 3 switches or routers and is not suitable for Layer 2 connectivity scenarios. Summary of the Invention
[0004] The main objective of this invention is to propose a method and gateway device for access devices to share a local area network in a multi-broadband network environment. This aims to solve the interoperability problem between devices connected to different routers in a network where multiple routers independently access the Internet, enabling connected devices such as PCs and mobile phones to access the Internet.
[0005] This invention provides a method for dynamically allocating access device addresses in a network with multiple DHCP servers, characterized by the following steps:
[0006] Each DHCP server sends an address pool request message, which includes the MAC address of the DHCP server that sent the address pool request message and the address pool.
[0007] Each DHCP server receives address pool request messages from other DHCP servers, elects a master server based on the address pool request messages, and the rest are slave servers;
[0008] The master server allocates its address pool to each slave server according to the number of slave servers, and sends an address pool announcement message. The address pool announcement message contains the MAC address of each slave server and the address pool allocated by the master server to each slave server.
[0009] The slave server receives the address pool notification message sent by the master server and sets the address pool of the slave server according to the address pool allocated by the master server;
[0010] The master server allocates IP addresses from its address pool to devices accessing the master server, and each slave server allocates IP addresses from its own address pool to devices accessing the slave server.
[0011] This invention also provides a gateway device configured with a DHCP server, wherein the DHCP server comprises:
[0012] The message sending module is used for the DHCP server to send an address pool request message to the DHCP server of other gateway devices, or for the master server to send an address pool announcement message to the slave server; the address pool request message contains the MAC address and address pool of the DHCP server that sent the address pool request message; the address pool announcement message contains the MAC address of the slave server and the address pool allocated to the slave server by the master server.
[0013] The message receiving module is used for the DHCP server to receive the address pool request message, or to receive the address pool announcement message from the server.
[0014] The master server election module is used to elect a master server from the DHCP servers of multiple gateway devices;
[0015] Address pool allocation module: used by the master server to allocate address pools to slave servers;
[0016] Address pool setting module: used to set the address pool of the slave server according to the address pool allocated by the master server;
[0017] An IP address allocation module is used for the master server to allocate IP addresses from its address pool to devices accessing the master server, and for each slave server to allocate IP addresses from its address pool to devices accessing the slave server. Preferably, the master server election module includes:
[0018] The address pool comparison module is used by the DHCP server to compare the number of addresses in the address pool of the DHCP server with the address pool of the DHCP server of other gateway devices.
[0019] A MAC address comparison module is used by the DHCP server to compare the MAC address of the DHCP server with the MAC address of the DHCP server of other gateway devices.
[0020] The election module is used to elect a master server from the DHCP servers of multiple gateway devices based on the comparison results of the address pool comparison module or the MAC address comparison module.
[0021] This invention discloses a method and gateway device for dynamically allocating addresses to access devices in a multi-DHCP server network. Multiple interconnected DHCP servers interact via the DHCP protocol to jointly elect a master DHCP server, with the others acting as slave DHCP servers. The master DHCP server allocates its address pool to the slave DHCP servers. Each slave DHCP server selects the smallest or largest address from its address pool allocated by the master server as its server address (which also serves as the DNS or router address). The remaining addresses are allocated to directly connected clients. In this way, clients under both master and slave servers are on the same network segment and, based on a physical connection, are on the same local area network (LAN). This invention completes the DHCP address pool allocation through simple protocol interaction, solving the problem of different DHCP servers allocating addresses on the same network segment. It enables devices connected to different WANs to share a LAN, avoids address conflicts, and is simple for users to operate. Attached Figure Description
[0022] Figure 1 This is a flowchart illustrating the method for dynamically allocating access device addresses in a network with multiple DHCP servers.
[0023] Figure 2 This is a diagram of a DHCP master-slave server network.
[0024] Figure 3 This is a diagram illustrating DHCP master-slave server election and address pool allocation;
[0025] Figure 4 This is a schematic diagram of the DHCP server structure;
[0026] Figure 5This is a schematic diagram of the main server election module structure. Detailed Implementation
[0027] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0028] Example 1
[0029] This invention provides a method for dynamically allocating access device addresses in a network with multiple DHCP servers, such as... Figure 1 As shown, it includes the following steps:
[0030] 101: Each DHCP server sends an address pool request message.
[0031] The Address Pool Request message is a new message added to the DHCP protocol in this embodiment. The Address Pool Request message is a message that can be sent between DHCP servers, and it contains the MAC address and address pool of the DHCP server sending the message.
[0032] 102: Each DHCP server receives address pool request messages sent by other DHCP servers, and elects a master server based on the address pool request messages, with the rest being slave servers.
[0033] Specifically, after receiving an address pool request message, each DHCP server obtains the MAC addresses and address pools of other DHCP servers through the message. First, it compares the number of addresses in the address pools of other DHCP servers with the number in its own. The DHCP server with the more addresses in its address pool is the master server, and the others are slave servers. If the number of addresses in the address pools of other DHCP servers is the same as the number in its own, then it compares the MAC addresses of each DHCP server to determine the master server. The DHCP server with the larger MAC address is the master server, and the others are slave servers.
[0034] 103: The master server allocates its address pool to each slave server according to the number of slave servers and sends an address pool announcement message.
[0035] The Address Pool Advertisement message is another message added to the DHCP protocol in this embodiment. The Address Pool Advertisement message is sent by the master DHCP server to the slave DHCP servers after the master server is elected in step 102. It contains the MAC address of each slave server and the address pool allocated to each slave server by the master server.
[0036] 104: Receive the address pool announcement message sent by the master server from the server, and set its own address pool according to the address pool allocated by the master server.
[0037] Specifically, after receiving the address pool announcement message sent by the master server, the server finds the corresponding address pool allocated by the master server in the address pool announcement message sent by the master server according to its own MAC address, sets it as its own address pool, and then selects the smallest or largest address from its own address pool as its own server address. This server address is the DNS or router address that is issued.
[0038] 105: The master server allocates IP addresses to the devices accessing it from its own address pool, and each slave server allocates IP addresses to the devices accessing it from its own address pool. The address allocation process is a normal DHCP interaction process.
[0039] like Figure 3 Address pool request messages and address pool advertisement messages are two new messages added to the DHCP protocol in this invention. Both messages are sent in broadcast form. Address pool advertisement messages can be sent periodically by the master server or initiated by a slave server, which then forwards the message to the slave server upon receiving the request. The MAC address and address pool information contained in the address pool request and advertisement messages are added to the extended options.
[0040] This embodiment adds two new message types to the DHCP protocol. Multiple interconnected DHCP servers interact through the DHCP protocol to jointly elect a master DHCP server, with the others acting as slave DHCP servers. The master DHCP server allocates its address pool to the slave DHCP servers. Each slave DHCP server selects the smallest or largest address from the address pool allocated by the master server as its server address (which also serves as the DNS or router address). The remaining addresses are allocated to directly connected clients. In this way, clients under both master and slave servers are on the same network segment, and with a physical connection, they are on the same local area network (LAN). This solves the problem of different DHCP servers assigning addresses to the same network segment, enabling devices connected to different WANs to share the LAN, and also avoids address conflicts.
[0041] Example 2
[0042] like Figure 2 The diagram shows a network structure using the method of this invention. The gateway device of this invention will be described using a router as an example.
[0043] Connect multiple routers in the environment via Ethernet LAN ports or via Wi-Fi. The routers have multiple Ethernet ports, and the Wi-Fi supports AP and STA modes. One Ethernet port is used as a WAN port to connect to the Internet, while the other Ethernet ports are used as LAN ports to connect wired connections. A Wi-Fi AP allows devices to access the network wirelessly, while a Wi-Fi STA allows the router to connect to other APs wirelessly.
[0044] Each router is configured with a DHCP server, such as Figure 4 As shown, the DHCP server includes the following modules:
[0045] The message sending module 1 is used for the DHCP server to send an address pool request message to the DHCP server of other gateway devices, or for the master server to send an address pool announcement message to the slave server; the address pool request message contains the MAC address and address pool of the DHCP server that sent the address pool request message; the address pool announcement message contains the MAC address of the slave server and the address pool allocated to the slave server by the master server.
[0046] The message receiving module 2 is used for the DHCP server to receive the address pool request message, or to receive the address pool announcement message from the server;
[0047] Master server election module 3 is used to elect a master server from the DHCP servers of multiple gateway devices;
[0048] Address pool allocation module 4: Used by the master server to allocate the address pool to the slave servers;
[0049] Address pool setting module 5: Used for slave servers to set their own address pools based on the address pools allocated by the master server;
[0050] IP address allocation module 6 is used by the master server to allocate IP addresses from its own address pool to the devices accessing it, and each slave server to allocate IP addresses from its own address pool to the devices accessing it.
[0051] Among them, such as Figure 5 As shown, the master server election module includes:
[0052] Address pool comparison module 301 is used by the DHCP server to compare the number of addresses in its own address pool with the address pools of the DHCP servers of other gateway devices.
[0053] MAC address comparison module 302 is used by the DHCP server to compare its own MAC address with the MAC address of the DHCP server of other gateway devices;
[0054] The election module 303 is used to elect a master server from the DHCP servers of multiple gateway devices based on the comparison results of the address pool comparison module or the MAC address comparison module.
[0055] The DHCP server dynamically assigns addresses to access devices through the following steps:
[0056] (1) After each DHCP server starts up, the message sending module sends address pool request messages in the form of broadcast.
[0057] (2) After each DHCP server receives a request message sent by another DHCP server through the message receiving module, it uses the address pool comparison module to compare the number of addresses in the address pool. If the number of addresses in the address pool is the same, it uses the MAC address comparison module to compare the MAC addresses. The election module selects the DHCP server with the larger number of addresses in the address pool or the larger MAC address from the DHCP servers of multiple gateway devices according to the comparison results of the address pool comparison module or the MAC address comparison module. The others are slave servers.
[0058] (3) The master server uses the address pool allocation module to allocate its own address pool to each slave server according to the number of slave servers. The simplest method is to allocate the address pool equally according to the number of slave servers. Alternatively, it can be allocated according to the load balancing strategy based on the number of downstream devices of the slave servers, or other suitable allocation strategies can be adopted according to the specific application.
[0059] (4) After the address pool is allocated, the main server uses the message sending module to send the address pool announcement message in the form of broadcast.
[0060] (5) After receiving the address pool announcement message sent by the master server through the message receiving module, the address pool setting module finds the address pool allocated by the master server according to the MAC information in the address pool announcement message, sets it as its own address pool, and selects an address from its own address pool as the server address (which is also the DNS address or router address).
[0061] (6) The master and slave servers allocate IP addresses to the connected devices from their respective address pools. The address allocation process is a normal DHCP interaction process.
[0062] Example 3
[0063] This embodiment provides a storage medium storing at least one program, which can be executed by at least one processor to achieve... Figure 1 The steps of the method for dynamically allocating access device addresses in a multi-DHCP server network, as shown, include:
[0064] 101: Each DHCP server sends an address pool request message;
[0065] 102: Each DHCP server receives address pool request messages sent by other DHCP servers, and jointly elects a master server by comparing the number of addresses in the address pools of other DHCP servers and its own address pool; the rest are slave servers.
[0066] 103: The master server allocates its address pool to each slave server according to the number of slave servers and sends an address pool announcement message;
[0067] 104: Receive the address pool announcement message sent by the master server from the server, and set its own address pool according to the address pool allocated by the master server;
[0068] 105: The master server allocates IP addresses to the devices accessing it from its own address pool, and each slave server allocates IP addresses to the devices accessing it from its own address pool. The address allocation process is a normal DHCP interaction process.
[0069] The preferred embodiments of the present invention have been described above with reference to the accompanying drawings, but this does not limit the scope of the invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and spirit of the present invention should be within the scope of the present invention.
Claims
1. A method for dynamically allocating access device addresses in a multiple DHCP server network, the method comprising: The method comprises the following steps: Each DHCP server sends an address pool request message, which contains the MAC address and address pool of the DHCP server sending the address pool request message; Each DHCP server receives the address pool request message sent by other DHCP servers, and elects a master server according to the address pool request message, and the rest are slave servers; The master server allocates the address pool of the master server to each slave server according to the number of slave servers, and sends an address pool announcement message, which contains the MAC address of each slave server and the address pool allocated to each slave server by the master server; The slave server receives the address pool announcement message sent by the master server, and sets the address pool of the slave server according to the address pool allocated by the master server; The master server allocates IP addresses from the address pool of the master server to devices accessing the master server, and each slave server allocates IP addresses from the address pool of each slave server to devices accessing the slave server.
2. The method for dynamically assigning an access device address by a multi-DHCP server network of claim 1, wherein, The method for each DHCP server to receive the address pool request message sent by other DHCP servers according to the address pool request message is that the DHCP server with more addresses in the address pool is the master server, and the rest are slave servers.
3. The method for dynamically assigning an access device address by a multi-DHCP server network of claim 2, wherein, If the number of addresses in the address pool of each DHCP server is the same, the MAC addresses of each DHCP server are compared, and the DHCP server with the larger MAC address is the master server, and the rest are slave servers.
4. The method for dynamically assigning access device addresses by a multiple DHCP server network as recited in claim 1 wherein, After the slave server receives the address pool announcement message sent by the master server and sets the address pool of the slave server according to the address pool allocated by the master server, the method further comprises the following steps: the slave server selects a minimum or maximum address from the set address pool of the slave server as the server address of the slave server, and the remaining addresses are used to allocate to devices accessing the slave server.
5. The method for dynamically assigning access device addresses by a multiple DHCP server network as recited in claim 1 wherein, The method for the slave server to receive the address pool announcement message sent by the master server and set the address pool of the slave server according to the address pool allocated by the master server is that the slave server finds the corresponding address pool allocated by the master server from the address pool announcement message sent by the master server according to the MAC address of the slave server, and sets it as the address pool of the slave server.
6. The method for dynamically assigning access device addresses by a multiple DHCP server network as recited in claim 1 wherein, The master server periodically sends the address pool announcement message, or sends the address pool announcement message after receiving a request from a slave server.
7. The method for dynamically assigning access device addresses by a multiple DHCP server network as recited in claim 1 wherein, The MAC address and address pool contained in the address pool announcement message and the address pool request message are added in the option of the extension.
8. The method for dynamically assigning access device addresses by a multiple DHCP server network as recited in claim 1 wherein, The address pool announcement message and the address pool request message are sent in the form of broadcast.
9. A gateway device configured with a DHCP server, characterized in that The DHCP server comprises: A message sending module, which is used for the DHCP server to send an address pool request message to other gateway device DHCP servers, or for the master server to send an address pool announcement message to slave servers; the address pool request message contains the MAC address and address pool of the DHCP server sending the address pool request message; and the address pool announcement message contains the MAC address of the slave server and the address pool allocated to the slave server by the master server; The message receiving module is configured to receive the address pool request message by the DHCP server, or receive the address pool announcement message from the server; The master server election module is configured to elect a master server from the DHCP servers of the plurality of gateway devices; The address pool allocation module is configured to allocate the address pool by the master server to the slave servers; The address pool setting module is configured to set the address pool of the slave servers according to the address pool allocated by the master server; The IP address allocation module is configured to allocate IP addresses by the master server to devices accessing the master server from the address pool of the master server, and allocate IP addresses by each slave server to devices accessing the slave server from the address pool of the slave server.
10. The gateway device of claim 9, wherein The master server election module comprises: The address pool comparison module is configured to compare the number of addresses in the address pool of the DHCP server with the number of addresses in the address pool of the DHCP server of the other gateway device; The MAC address comparison module is configured to compare the MAC address of the DHCP server with the MAC address of the DHCP server of the other gateway device; The election module is configured to elect a master server from the DHCP servers of the plurality of gateway devices according to the comparison result of the address pool comparison module or the MAC address comparison module.
11. A storage medium, characterized by The storage medium stores at least one program, and the at least one program can be executed by at least one processor to implement the steps of the method for dynamically allocating addresses of access devices in a multi-DHCP server network according to any one of claims 1-8.
Citation Information
Patent Citations
Method and server for allocating dynamic host configuration protocol (DHCP) addresses
CN102098354A
Method of controlling multiple DHCP Server dynamic distribution host addresses
CN106302854A