CN111683159A - IP address allocation method, device, system and storage medium - Google Patents

IP address allocation method, device, system and storage medium Download PDF

Info

Publication number
CN111683159A
CN111683159A CN201910182177.0A CN201910182177A CN111683159A CN 111683159 A CN111683159 A CN 111683159A CN 201910182177 A CN201910182177 A CN 201910182177A CN 111683159 A CN111683159 A CN 111683159A
Authority
CN
China
Prior art keywords
address
gateway
server
client device
relay agent
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.)
Pending
Application number
CN201910182177.0A
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201910182177.0A priority Critical patent/CN111683159A/en
Publication of CN111683159A publication Critical patent/CN111683159A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/668Internet protocol [IP] address subnets
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/695Types of network addresses using masks or ranges of addresses

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application provides an IP address allocation method, a server, a system and a storage medium. In the embodiment of the application, when the server allocates the IP address to the client device, the server allocates the IP address to the client device from the IP subnet address space corresponding to the gateway IP address configured on the relay agent device, and generates the routing information for the client device according to the gateway IP address configured on the relay agent device. The IP address allocation mode does not depend on the network environment of the client device any more, does not need manual participation, can realize automatic allocation of the IP address, and is beneficial to improving the IP address allocation efficiency.

Description

IP address allocation method, device, system and storage medium
Technical Field
The present application relates to the field of wireless communications technologies, and in particular, to a method, a device, a system, and a storage medium for allocating an IP address.
Background
In various network device installation scenarios, there is no Internet Protocol (IP) address set on the network device, and a corresponding server is required to allocate an IP address to the network device. The existing IP address allocation mode depends on the network environment of the network equipment, and the IP address allocation efficiency is low.
Disclosure of Invention
Aspects of the present application provide a method, device, system, and storage medium for IP address allocation, so as to decouple IP address allocation from a network environment, thereby improving IP address allocation efficiency.
The embodiment of the application provides an IP address allocation method, which is suitable for a server and comprises the following steps:
receiving an address allocation request message from client equipment forwarded by relay agent equipment, wherein the address allocation request message comprises a gateway IP address configured on the relay agent equipment;
allocating an IP address to the client device from an IP subnet address space corresponding to the gateway IP address, and generating routing information for the client device according to the gateway IP address;
and returning an address distribution response message to the equipment of the relay agent, wherein the address distribution response message comprises an IP address distributed for the client equipment and generated routing information so that the equipment of the relay agent can forward the IP address to the client equipment.
An embodiment of the present application further provides a server, including: a memory, a processor, and a communications component;
the memory for storing a computer program;
the processor, coupled to the memory, to execute the computer program to:
receiving, by the communication component, an address assignment request packet from a client device forwarded by a relay agent device, where the address assignment request packet includes a gateway IP address configured on the relay agent device;
allocating an IP address to the client device from an IP subnet address space corresponding to the gateway IP address, and generating routing information for the client device according to the gateway IP address;
and returning an address allocation response message to the equipment of the relay agent through the communication component, wherein the address allocation response message comprises an IP address allocated to the client equipment and generated routing information, so that the equipment of the relay agent forwards the address allocation response message to the client equipment.
An embodiment of the present application further provides an IP address allocation system, including: a client device, a relay proxy device, and a server; wherein the content of the first and second substances,
the client device is configured to send an address allocation request message to the relay agent device and receive an address allocation response message from the server, where the address allocation response message includes an IP address allocated by the server to the client device and generated routing information;
the relay agent equipment is used for receiving the address allocation request message, writing a gateway IP address configured on the relay agent equipment into the address allocation request message, and forwarding the address allocation request message including the gateway IP address to the server; receiving the address allocation response message returned by the server, and forwarding the address allocation response message to the client device;
the server is used for receiving the address allocation request message comprising the gateway IP address; allocating an IP address to the client device from an IP subnet address space corresponding to the gateway IP address, and generating routing information for the client device according to the gateway IP address; and sending the address allocation response message to the relay agent equipment.
An embodiment of the present application further provides a data center network system, including: network equipment to be installed, relay agent equipment and an address allocation server; the network equipment to be loaded and the address distribution server are in different subnets;
the network equipment to be installed is used for sending an address allocation request message to the relay agent equipment after the installation of the operating system is finished;
the relay agent equipment is used for receiving the address allocation request message, writing a gateway IP address configured by the relay agent equipment into the address allocation request message and forwarding the address allocation request message to the address allocation server; the address allocation response message returned by the address allocation server is forwarded to the network equipment to be installed;
the address allocation server is used for receiving an address allocation request message comprising the gateway IP address; distributing an IP address for the network equipment to be loaded from an IP subnet address space corresponding to the gateway IP address, and generating routing information for the network equipment to be loaded according to the gateway IP address; sending the address allocation response message to the relay agent equipment; the address allocation response message comprises an IP address allocated to the network equipment to be loaded by the address allocation server and generated routing information;
and the network equipment to be loaded is also used for carrying out network configuration according to the IP address and the routing information in the address allocation response message.
Embodiments of the present application also provide a computer-readable storage medium storing computer instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the above-described method.
In the embodiment of the application, when the server allocates the IP address to the client device, the server allocates the IP address to the client device from the IP subnet address space corresponding to the gateway IP address configured on the relay agent device, and generates the routing information for the client device according to the gateway IP address configured on the relay agent device. The IP address allocation mode does not depend on the network environment of the client device any more, and can realize automatic allocation of the IP address without manual participation, thereby being beneficial to improving the IP address allocation efficiency.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1a is a schematic structural diagram of an IP address allocation system according to an embodiment of the present application;
fig. 1b is a signaling diagram of IP address allocation provided in this embodiment of the present application;
fig. 2a is a schematic flowchart of an IP address allocation method according to an embodiment of the present application;
fig. 2b is a schematic structural diagram of a data center network system according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
When the network device is installed or the use of the IP address expires, the IP address is not set on the network device, and the IP address allocation server is required to allocate the IP address to the network device. In the existing IP address allocation method, a network administrator needs to pre-enter a currently occupied IP address into a server, and then the server allocates another IP address different from the currently occupied IP address to a network device. However, as the network environment of the network device changes continuously, this requires to update the IP address managed by the server manually, which in turn results in low efficiency of IP address allocation.
In some embodiments of the present application, when the server allocates an IP address to the client device, the server allocates the IP address to the client device from an IP subnet address space corresponding to a configured gateway IP address on the relay proxy device, and generates routing information for the client device according to the configured gateway IP address on the relay proxy device. The IP address allocation mode does not depend on the network environment of the client device any more, does not need manual participation, can realize automatic allocation of the IP address, and is beneficial to improving the IP address allocation efficiency.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1a is a schematic structural diagram of an IP address allocation system according to an embodiment of the present application. As shown in fig. 1a, the system comprises: a client device 10a, a relay proxy device 10b and a server 10 c. The implementation form and number of the client device 10a, the relay agent device 10b, and the server 10c shown in fig. 1a are only exemplary and are not limited thereto.
In this embodiment, the client device 10a may be wirelessly or wired with the relay proxy device 10 b. The relay proxy device 10b may be in wireless or wired connection with the server 10 c. Optionally, the client device 10a and the relay proxy device 10b, and the relay proxy device 10b and the server 10c may be communicatively connected through a mobile network, and accordingly, the network format of the mobile network may be any one of 2G (gsm), 2.5G (gprs), 3G (WCDMA, TD-SCDMA, CDMA2000, UTMS), 4G (LTE), 4G + (LTE +), WiMax, and the like. Alternatively, the client device 10a may be communicatively connected to the relay agent device 10b by bluetooth, WiFi, infrared, or the like. Of course, the relay agent device 10b may be communicatively connected to the server 10c by bluetooth, WiFi, infrared, or the like.
In this embodiment, the client device 10a may be a personal computer, a smart device, a router, a switch, a gateway device, a server, or other various network devices that need to access the internet through an IP address.
In the present embodiment, the relay agent device 10b refers to a hardware infrastructure for forwarding a packet (packet) between the client device 10a and the server 10c, and may be a device having a relay function, such as a gateway, a switch, and a router in a system. Besides, the relay agent device 10b may also be a server, a computer device, a Virtual Machine (VM), or the like having a relay function. Alternatively, the relay agent device 10b may be a single server device, a cloud server array, or a VM running in a cloud server array.
In the present embodiment, the server 10c refers to a hardware infrastructure for IP address allocation and management. One or more servers 10c may be provided. The present embodiment does not limit the implementation form of the server 10 c. For example, the server 10c may be a conventional server, a cloud host, a virtual center, or the like. The server device mainly includes a processor, a hard disk, a memory, a system bus, and the like, and is similar to a general computer architecture. Alternatively, the server 10c may be a single server device, a cloud server array, or a VM running in a cloud server array. In addition, the server 10c may also refer to other computing devices with corresponding service capabilities, such as a computer device running a corresponding service program, an intelligent terminal, and the like.
In this embodiment, the client device 10a needs the server 10c to assign it an IP address and routing information. The routing information of the client device 10a refers to the gateway IP address of the client device 10a, i.e. the IP address of the next hop when the client device 10a performs communication. For example, when the client device 10a is installed, the client device 10a has not yet assigned any IP address, so the server 10c is required to assign corresponding IP address and routing information thereto. As another example, when the lease expires for the IP address to which the client device 10a has been assigned, the assigned IP address may expire, requiring the server 10c to reassign the IP address and routing information thereto.
Alternatively, if the client device 10a knows the jurisdiction of which server it belongs to (taking server 10c as an example), it may communicate with server 10c in a unicast communication manner, requesting server 10c to assign an IP address to it. If the client device 10a does not know the jurisdiction of which server it belongs to, the client device 10a may broadcast an address assignment request message in a broadcast manner to request the server having jurisdiction to assign an IP address to the server. In any communication method, after the client device 10a issues the address assignment request message, the address assignment request message may reach the relay agent device 10b in the same subnet as the client device 10 a. Accordingly, the relay agent device 10b receives the address allocation request message, and writes the locally configured gateway IP address into a corresponding field of the address allocation request message, for example, into a gateway IP address (Giaddr) field; the address assignment request message including the gateway IP address is then forwarded to the server 10 c.
The server 10c receives the address assignment request message forwarded by the relay agent device 10b, and acquires the gateway IP address configured on the relay agent device 10b from the address assignment request message. Alternatively, if the gateway IP address is carried in the Giaddr field of the address allocation request, the server 10c may obtain the gateway IP address configured on the relay agent device 10b from the Giaddr field in the address allocation request message. Then, the server 10c allocates an IP address to the client device 10a from the IP subnet address space corresponding to the acquired gateway IP address, and generates routing information for the client device 10a based on the gateway IP address. That is, a gateway IP address, that is, an IP address of the next hop of the client device 10a, is generated for the client device 10a according to the gateway IP address configured on the relay proxy device 10 b. Further, the server 10c writes the IP address allocated to the client device 10a and the generated routing information into an address allocation response message, and returns the address allocation response message to the relay agent device 10 b. The gateway IP address allocated to the relay agent apparatus 10b is previously allocated by an IP address management server (IPMS).
Accordingly, the relay agent device 10b receives the address assignment response message returned by the server 10c and forwards it to the client device 10 a. Further, the client device 10a receives the address assignment response message, and may acquire the IP address and the routing information assigned thereto by the server 10c from the address assignment response message.
In this embodiment, after acquiring the IP address and the routing information allocated to the client device 10a by the server 10c, the client device 10a may further perform subsequent interaction with the server 10c through the relay agent device 10 b. For example, the client device 10a may send an address use request message to the relay agent device 10b after acquiring the IP address and the routing information allocated thereto by the server 10 c. Accordingly, the relay agent device 10b receives the address use request message and forwards it to the server 10 c. After the server 10c allocates the IP address to the client device 10a, a lease is pre-generated, and when receiving the address use request message, the server 10c writes the lease allocated to the IP address of the client device 10a into a lease file, which indicates that the IP address is already allocated to the client device 10a for use, and the term of use for the client device 10a is the lease period in the record lease file. Alternatively, when the server 10c allocates an IP address to the client device 10a based on a Dynamic Host Configuration Protocol (DHCP), the lease file is a DHCP. In addition, the server returns an address assignment acknowledgement message to the client device through the relay proxy device.
In practical applications, there may be one or more servers 10 c. The following describes a case where there are a plurality of servers 10c in detail.
In the case where there are a plurality of servers 10c, each server 10c may receive the address assignment request message forwarded by the relay agent apparatus 10 b. Accordingly, each server 10c allocates an IP address to the client device 10a from the IP subnet address space corresponding to the gateway IP address configured on the relay proxy device 10b, and generates routing information for the client device 10a according to the gateway IP address. Thereafter, each server writes the IP address allocated to the client device 10a and the routing information generated for the client device 10a into the address allocation response message, and returns the address allocation response message to the relay agent device 10 b.
The relay agent device 10b receives the address assignment response messages returned by the plurality of servers 10c, and forwards the address assignment response messages to the client device 10 a. The client device 10a may select one of the received address allocation response messages as a destination address allocation response message according to a preset selection rule, and determine to use the IP address and the routing information in the destination address allocation response message. Further, the client device 10a writes the IP address of the server corresponding to the destination address assignment response message into the address use request message, and sends the address use request message to the relay agent device 10 b. Alternatively, the selection rule in the client device 10a may be, but is not limited to, selecting the first received address assignment response message as the destination address assignment response message, or selecting the last received address assignment response message as the destination address assignment response message.
Accordingly, the relay agent device 10b forwards the address use request message to each of the plurality of servers 10 c. For any server, after receiving the address use request message, it is determined whether the IP address in the address use request message is the IP address of the server. If the determination result is yes, the server writes the lease of the IP address allocated to the client device 10a into a lease file, which indicates that the IP address is already allocated to the client device 10a for use, and returns an address allocation confirmation message to the client device 10a through the relay agent device 10 b. If the determination result is negative, the server releases the IP address allocated to the client device 10a, and the released IP address is in an idle state.
In the case of one server or a plurality of servers, after the server 10c transmits an address assignment acknowledgement message to the relay agent apparatus 10b, the relay agent apparatus 10b transfers the received address assignment acknowledgement message to the client apparatus 10 a. The client device 10a, upon receiving the address assignment acknowledgement message, may use the IP address assigned to it by the server 10c for the valid lease period.
In this embodiment, when allocating an IP address to the client device, the server allocates the IP address to the client device from an IP subnet address space corresponding to the gateway IP address configured on the relay agent device, and generates routing information for the client device according to the gateway IP address configured on the relay agent device. The IP address allocation mode does not depend on the network environment of the client device any more, and can realize automatic allocation of the IP address without manual participation, thereby being beneficial to improving the IP address allocation efficiency.
In some optional embodiments, the server 10c may maintain an IP subnet address space corresponding to the gateway IP address configured on the relay agent device 10b locally in advance, or the server 10c may also generate a corresponding IP subnet address space for the gateway IP address configured on the relay agent device 10b in real time when receiving the first address allocation request. Based on this, the server 10c may determine whether an IP subnet address space corresponding to the gateway IP address exists locally according to the gateway IP address configured on the relay agent device 10 b. The following description exemplifies a manner in which the server 10c allocates an IP address to the client device 10a, in both cases where an IP subnet address space corresponding to a gateway IP address configured on the relay agent device 10b exists in the server 10c and where an IP subnet address space corresponding to a gateway IP address configured on the relay agent device 10b does not exist in the server 10 c.
Distribution mode 1: the server 10c has an IP subnet address space corresponding to the gateway IP address configured in the relay agent device 10 b. The IP subnet address space includes at least one IP address. Based on this, the server 10c acquires the configured gateway IP address on the relay agent device 10b from the address allocation request message; and searches for an idle IP address in the IP subnet address space corresponding to the gateway IP address configured on the relay agent device 10 b. If a free IP address is found in the IP subnet address space, an IP address is assigned to the client device 10a from the found free IP address. Accordingly, if there is no free IP address in the IP subnet address space, the allocation of the IP address to the client device 10a at this time will fail, and the operation of allocating the IP address to the client device 10a may be ended, and the arrival of the next address allocation request message may be waited.
Further, the manner in which the server 10c allocates the IP address to the client device 10a from the found free IP address includes: randomly selecting one IP address from the found idle IP addresses to be distributed to the client equipment 10 a; or, according to a preset allocation rule, one IP address is selected from the found idle IP addresses to be allocated to the client device 10 a. For example, the server 10c may select the smallest IP address from the found free IP addresses to allocate to the client device 10 a; alternatively, the server 10c selects the largest IP address from the found free IP addresses to assign to the client device 10a, and so on.
Distribution mode 2: if the IP subnet address space corresponding to the gateway IP address configured on the relay agent device 10b does not exist in the server 10c, the IP subnet address space corresponding to the gateway IP address may be generated, and an IP address may be allocated to the client device from the generated IP subnet address space.
Further, in the above allocation mode 2, different methods may be adopted to generate the IP subnet address space corresponding to the gateway IP address. The following is an exemplary description in connection with several alternative embodiments.
Alternative embodiment a: the address mask used to generate the IP subnet may be preset. Based on this, an IP subnet address space corresponding to the gateway IP address can be generated based on the set address mask and the gateway IP address configured on the relay proxy apparatus 10 b. In the embodiment of the present application, the number of bits of the set address mask is not limited. The number of bits of the set address mask may be 24 bits, 28 bits, 30 bits, etc., but is not limited thereto. The number of bits of the address mask indicates how many bits are 1 before the address mask, for example, for a 24-bit address mask, the first 24 bits are 1, that is, the 24-bit address mask is 255.255.255.0.
The process of generating the IP subnet address space is exemplified below in conjunction with a 24-bit address mask. If the preset address mask is 255.255.255.0, and the gateway IP address configured on the relay proxy device 10b is 192.168.10.10, the address space of the IP subnet corresponding to the gateway IP address is: 192.168.10.10&255.255.255.0 ═ 192.168.10.0, where the specific IP addresses in the IP subnet address space are: 192.168.10.10&0.0.0.x, where x is 1-255 and the and operator.
Alternative embodiment B: after receiving the address assignment request, the relay agent device 10b writes the gateway address mask into a corresponding field in the address assignment request message, and sends the message to the server 10 c. Accordingly, the server 10c may parse the gateway address mask from the address allocation request packet, and generate an IP subnet address space corresponding to the gateway IP address according to the gateway address mask and the gateway IP address. The gateway IP address and the gateway address mask may be subjected to and operation to obtain an IP subnet address space corresponding to the gateway IP address, and the specific IP address in the IP subnet address space may be obtained by performing and operation on a result of negation of the gateway IP address and the gateway address mask.
Further optionally, in the optional embodiment B, capability extension may be performed on the Giaddr field in the address allocation request message, so that the Giaddr field may carry more information. Based on this, after receiving the address assignment request message, the relay agent device 10b may write the gateway address mask and the gateway IP address together into the Giaddr field in the address assignment request message, and then transmit the address assignment request message to the server 10 c. Accordingly, the server 10c may parse the gateway address mask and the gateway IP address from the Giaddr field of the address assignment request message. Alternatively, a reserved field in the address allocation request message may be fully utilized, based on which the relay agent device 10b may write the gateway IP address into the Giaddr field in the address allocation request message, write the gateway address mask into the reserved field in the address allocation request message, and then transmit the address allocation request message to the server 10 c. Accordingly, server 10c may resolve the gateway IP address from the Giaddr field of the address assignment request message and the gateway address mask from the reserved field of the address assignment request message.
Alternative embodiment C: a new protocol message can be added on the basis of the existing address allocation protocol. In the process that the server 10c allocates the IP address to the client device 10a, the relay proxy device 10b may write the gateway address mask into a corresponding field in the new protocol packet, and send the new protocol packet containing the gateway address mask to the server 10 c. Accordingly, the server 10c may parse the gateway address mask from the newly added protocol message, and generate an IP subnet address space corresponding to the gateway IP address according to the gateway address mask and the gateway IP address configured on the relay agent device 10 b. For a specific implementation process of generating an IP subnet address space corresponding to the gateway IP address according to the gateway address mask and the gateway IP address, reference may be made to the related contents in the above optional embodiment a, which is not described herein again.
Further, based on the IP subnet address space generated in the above alternative embodiment A, B or C, the server 10C may then assign an IP address to the client device 10a from the generated IP subnet address space. Alternatively, server 10c may determine an unoccupied IP address in the IP subnet address space and assign an IP address to client device 10a from the unoccupied IP address in the IP subnet address space. Alternatively, the server 10c may read the occupied IP address in the IP subnet address space from the memory block stored therein. For the case where the server 10c allocates an IP address to the client device 10a based on the DHCP protocol, the IP address that has been occupied in the IP subnet address space is recorded in a dhcpd.
Considering that the client device 10a wants to communicate with other devices normally, it needs to know not only its own IP address but also its own gateway IP address, i.e., routing information. Based on this, in the embodiment of the present application, the server 10c may also generate routing information for the client device 10a according to the gateway IP address configured on the relay proxy device 10b, that is, the gateway IP address corresponding to the client device 10 a.
Further, the server 10c may write the IP address allocated for the client device 10a, the IP address of the server 10c, and the gateway IP address of the client device 10a into corresponding fields of the address allocation response message. After that, the server 10c transmits an address assignment response message to the relay agent device 10 b. Accordingly, the relay agent device 10b forwards the address assignment response packet to the client device 10 a. The client device 10a receives the address assignment response message, and may obtain the IP address and the routing information assigned thereto by the server 10c, and may further perform network communication with other devices based on the IP address and the routing information.
In the system embodiment, the subsequent method embodiment, the device embodiment, and the data center network system embodiment, the server may allocate an IP address to the client device based on different address allocation protocols, where the implementation forms of the messages are different according to the difference in the address allocation protocols. Assuming that an address assignment protocol adopted by the server is a DHCP protocol, the address assignment request message is a DHCP discovery (DHCP discover) message; the address assignment response message is a DHCP offer (DHCP offer) message. Accordingly, the address use request message is a DHCP request (DHCP request) message; the address assignment acknowledgement message is a DHCP acknowledgement (DHCP ACK) message. Accordingly, the above-described IP subnet address space may be referred to as an address pool.
In the following, an example is given in which the server allocates an IP address to the client device based on the DHCP protocol, and an IP address allocation manner is exemplarily described.
Fig. 1b is an interactive signaling diagram of an IP address allocation method according to an embodiment of the present application. As shown in fig. 1b, the IP address allocation process mainly includes:
step 1: the client device 10a broadcasts a DHCP discover message to the relay agent device 10 b.
Step 2: the relay agent device 10b receives the DHCP discover message and writes the gateway IP address configured on itself into the Giaddr field of the DHCP discover message.
And step 3: the relay agent device 10b transmits a DHCP discover message including the own gateway IP address to the server 10 c.
And 4, step 4: the server 10c receives the DHCP discovery message, and acquires the gateway IP address of the relay agent device 10b from the Giaddr field in the DHCP discovery message.
And 5: the server 10c allocates an IP address to the client device 10a from the IP address pool corresponding to the gateway IP address of the relay proxy device 10 b. For a specific allocation manner, reference may be made to the allocation manners 1 and 2, which are not described herein again.
Step 6: the server 10c sets the gateway IP address of the relay proxy apparatus 10b as the gateway IP address of the client apparatus 10a, i.e., configures the routing information for the client apparatus 10 a.
In the embodiment of the present application, the execution order of steps 5 and 6 is not limited, and the two steps may be executed in parallel or in series. For example, step 5 may be performed first, and then step 6 may be performed; step 6 may be performed first, and then step 5 may be performed.
And 7: the server 10c writes the IP address allocated to the client device 10a, the gateway IP address (the gateway IP address of the relay agent device 10 b), and the own IP address into corresponding fields in the DHCP offer message, respectively.
And 8: the server 10c transmits the DHCP offer message to the relay agent apparatus 10 b.
And step 9: the relay agent device 10b forwards the DHCP offer message to the client device 10 a.
Step 10: the client device 10a receives the DHCP offer message and obtains the IP address assigned to it by the server 10c and the gateway IP address assigned to it by the server 10 c. In the present embodiment, the gateway IP address is the IP address of the relay agent device 10 b.
Step 11: the client device 10a generates a DHCP request message and transmits the DHCP request message to the relay agent device 10 b. Alternatively, the client device 10a may write the IP address of the server 10c into the corresponding field of the DHCP request message.
Step 12: the relay agent device 10b receives the DHCP request message and forwards the DHCP request message to the server 10 c.
Step 13: the server 10c receives the DHCP request message. Then, the lease is written into a corresponding field in the DHCP acknowledge message, and the DHCP acknowledge message is sent to the relay agent 10 b.
Optionally, the server 10c may obtain an IP address carried in the DHCP request packet, and determine whether the IP address is a self IP address. And if so, writing the lease into a corresponding field of the DHCP acknowledgement message.
Step 14: the relay agent device 10b receives the DHCP acknowledge message and forwards the message to the client device 10 a.
Step 15: the client device 10a receives the DHCP acknowledge message and obtains therefrom the use lease for the IP address assigned to it by the server 10 c. The client device 10a may then use the IP address assigned to it by the server 10c for the valid lease.
It should be noted that the IP address allocation method provided in this embodiment is not only applicable to a scenario in which the client device 10a is installed, but also applicable to an application scenario in which the client device 10a continues to use an IP address.
In addition to the above system embodiments, the present application provides an IP address allocation method. The following describes an example of an IP address assignment method provided in an embodiment of the present application from the perspective of a server.
Fig. 2a is a schematic flowchart of an IP address allocation method according to an embodiment of the present application. The method is suitable for the server. For the implementation form of the server, reference may be made to the related description in fig. 1a, which is not described herein again. As shown in fig. 2a, the method comprises:
201. and receiving an address allocation request message from the client equipment forwarded by the relay agent equipment, wherein the address allocation request message comprises a gateway IP address configured on the relay agent equipment.
202. And allocating an IP address for the client equipment from an IP subnet address space corresponding to the gateway IP address configured on the relay agent equipment, and generating routing information for the client equipment according to the gateway IP address configured on the relay agent equipment.
203. And returning an address distribution response message to the equipment of the relay agent, wherein the address distribution response message comprises an IP address distributed for the client equipment and generated routing information so that the equipment of the relay agent forwards the IP address to the client equipment.
In this embodiment, the implementation forms of the client device, the relay proxy device, and the server and the communication modes between them may refer to the related descriptions in the above system embodiments, and are not described herein again.
In this embodiment, the client device requires the server to assign an IP address to it. For example, when the client device is installed, the client device does not have any IP address assigned yet, so the server is required to assign the corresponding IP address and routing information to the client device. As another example, when a lease expires for an IP address to which a client device has been assigned, the assigned IP address may fail, requiring the server to reassign the IP address and routing information for it. For the description of the routing information, reference may be made to relevant contents in the above system embodiment, and details are not described herein again.
Alternatively, if the client device knows the jurisdiction of which server it belongs to, it may communicate with the server belonging to the jurisdiction in a unicast communication manner, requesting the server to allocate an IP address to the server. If the client device does not know the jurisdiction of which server it belongs to, the client device may use a broadcast mode to distribute a request message to an external broadcast address to request the server having jurisdiction to distribute an IP address and routing information to the server. In any communication method, after the client device sends the address assignment request message, the address assignment request message may reach the relay agent device in the same subnet as the client device. Accordingly, the relay agent device receives the address allocation request message, writes the gateway IP address of itself into a corresponding field of the address allocation request message, for example, into a Giaddr field, and then forwards the address allocation request message including the gateway IP address of itself to the server.
Accordingly, in step 201, the server receives the address assignment request message from the client device forwarded by the relay proxy device. Then, in step 202, the server allocates an IP address to the client device from an IP subnet address space corresponding to the gateway IP address of the relay agent device; and generating routing information for the client device according to the gateway IP address of the relay agent device. Further, the server writes the IP address allocated to the client device and the generated routing information into an address allocation response packet, and returns the address allocation response packet to the relay agent device. Wherein the gateway IP address of the relay agent device is previously assigned by an IP address management server (IPMS).
Correspondingly, the relay agent equipment receives the address assignment response message returned by the server and forwards the address assignment response message to the client equipment. Further, the client device receives an address allocation response message, and acquires the IP address and the routing information allocated to it by the server from the address allocation response message.
In this embodiment, after acquiring the IP address and the routing information allocated to the client device by the server, the client device may further perform subsequent interaction with the server through the relay agent device. For example, after acquiring the IP address and the routing information allocated to the client device by the server, the client device may send an address use request packet to the relay agent device. Accordingly, the relay agent device receives the address use request message and forwards the address use request message to the server. Based on this, after step 203, the server may further receive the address use request message, write the lease generated in advance for the IP address allocated to the client device into a lease file, and return an address allocation confirmation message to the client device through the relay agent device.
In practical applications, there may be one or more servers. The following describes the case where there are a plurality of servers in detail.
Each server may receive the address assignment request message forwarded by the relay agent device. Correspondingly, each server allocates an IP address to the client device from an IP subnet address space corresponding to the gateway IP address configured on the relay proxy device, and generates routing information for the client device according to the gateway IP address. And then, each server writes the IP address distributed for the client equipment and the routing information generated for the client equipment into an address distribution response message and returns the address distribution response message to the relay agent equipment.
The relay agent equipment receives address allocation response messages returned by the plurality of servers and forwards the address allocation response messages to the client equipment. The client device may select one of the received address allocation response messages as a destination address allocation response message according to a preset selection rule, and determine to use the IP address and the routing information in the destination address allocation response message. Further, the client device writes the IP address of the server corresponding to the destination address allocation response message into the address use request message, and sends the address use request message to the relay agent device. Alternatively, the selection rule in the client device may be, but is not limited to, selecting the first received address assignment response packet as the destination address assignment response packet, or selecting the last received address assignment response packet as the destination address assignment response packet.
Accordingly, the relay agent device forwards the address use request message to each of the plurality of servers. For any server, after receiving the address use request message, it is determined whether the IP address in the address use request message is the IP address of the server. If the judgment result is yes, the server writes the lease of the IP address allocated to the client equipment into a lease file, the IP address is indicated to be allocated to the client equipment for use, and an address allocation confirmation message is returned to the client equipment through the relay agent equipment. If the judgment result is negative, the server releases the IP address allocated to the client equipment, and the released IP address is in an idle state.
In the case of one server or a plurality of servers, after the server transmits the address assignment acknowledgement message to the relay agent apparatus, the relay agent apparatus forwards the received address assignment acknowledgement message to the client apparatus. The client device receives the address allocation confirmation message, and can use the IP address allocated to the client device by the server in the effective lease period.
In this embodiment, when allocating an IP address to the client device, the server allocates the IP address to the client device from an IP subnet address space corresponding to the gateway IP address configured on the relay agent device, and generates routing information for the client device according to the gateway IP address configured on the relay agent device. The IP address allocation mode does not depend on the network environment of the client device any more, and can realize automatic allocation of the IP address without manual participation, thereby being beneficial to improving the IP address allocation efficiency.
In this embodiment of the present application, in step 202, the server may determine whether an IP subnet address space corresponding to the gateway IP address exists locally according to the gateway IP address configured on the relay proxy device. The following describes an exemplary manner in which the server allocates an IP address to the client device, in view of two situations that an IP subnet address space corresponding to the gateway IP address configured on the relay proxy device exists in the server and an IP subnet address space corresponding to the gateway IP address configured on the relay proxy device does not exist in the server.
Distribution mode 1: the server has an IP subnet address space corresponding to the gateway IP address configured on the relay agent device. The IP subnet address space includes at least one IP address. Based on this, an alternative implementation of step 202 is: the server acquires the gateway IP address of the relay agent equipment from the address allocation request message; and searching an idle IP address in an IP subnet address space corresponding to the gateway IP address of the relay agent equipment. And if the idle IP address is found in the IP subnet address space, allocating the IP address for the client equipment from the found idle IP address. Correspondingly, if no idle IP address exists in the IP subnet address space, the allocation of the IP address to the client device at this time fails, and the operation of allocating the IP address to the client device may be ended, and the arrival of the next address allocation request message is waited.
Further, the manner of allocating the IP address for the client device from the found idle IP address by the server includes: randomly selecting one IP address from the searched idle IP addresses to be distributed to the client equipment; or selecting one IP address from the searched idle IP addresses according to a preset allocation rule to allocate to the client equipment. For example, the server may select the smallest IP address from the free IP addresses to assign to the client device; alternatively, the server selects the largest IP address from among the free IP addresses to assign to the client device, and so on.
Distribution mode 2: if the IP subnet address space corresponding to the gateway IP address configured on the relay agent device 10b does not exist in the server, the IP subnet address space corresponding to the gateway IP address can be generated, and the IP address is allocated to the client from the generated IP subnet address space.
Further, in the above allocation mode 2, different methods may be adopted to generate the IP subnet address space. The following is an exemplary description in connection with several alternative embodiments.
Alternative embodiment a: the address mask used to generate the IP subnet may be preset. Based on the address mask and the gateway IP address configured on the relay proxy equipment, the IP subnet address space corresponding to the gateway IP address can be generated. In the embodiment of the present application, the number of bits of the set address mask is not limited. The number of bits of the set address mask may be 24 bits, 28 bits, 30 bits, etc., but is not limited thereto. The number of bits of the address mask indicates how many bits are 1 before the address mask, for example, for a 24-bit address mask, the first 24 bits are 1, that is, the 24-bit address mask is 255.255.255.0. For a specific implementation of generating an IP subnet address space according to the set address mask and the gateway IP address configured on the relay agent device, reference may be made to relevant contents in the above system embodiment, which is not described herein again.
Alternative embodiment B: after receiving the address allocation request, the relay agent device writes the gateway address mask into a corresponding field in the address allocation request message and sends the address allocation request message to the server. Correspondingly, the server can analyze the gateway address mask from the address allocation request message and generate an IP subnet address space corresponding to the gateway IP address according to the gateway address mask and the gateway IP address. The specific implementation process of generating the IP subnet address space according to the gateway address mask and the gateway IP address may refer to the related contents in the above system embodiment, and is not described herein again.
Further, in the optional implementation B, capability expansion may be performed on the Giaddr field in the address allocation request message, so that the Giaddr field may carry more information. Based on this, after receiving the address allocation request message, the relay agent device may write the gateway address mask and the gateway IP address into the Giaddr field in the address allocation request message, and then send the address allocation request message to the server. Accordingly, the server may parse the gateway address mask and the gateway IP address from the Giaddr field of the address assignment request message. Or, optionally, a reserved field in the address allocation request message may be fully utilized, based on which the relay agent device may write the gateway IP address into the Giaddr field in the address allocation request message, write the gateway address mask into the reserved field in the address allocation request message, and then send the address allocation request message to the server. Accordingly, the server may resolve the gateway IP address from the Giaddr field of the address assignment request message and the gateway address mask from the reserved field of the address assignment request message.
Alternative embodiment C: a new protocol message can be added on the basis of the existing address allocation protocol. In the process that the server distributes the IP address for the client device, the relay agent device can write the gateway address mask code into the corresponding field in the newly added protocol message and send the newly added protocol message containing the gateway address mask code to the server. Correspondingly, the server can analyze the gateway address mask from the newly added protocol message, and generate an IP subnet address space corresponding to the gateway IP address according to the gateway address mask and the gateway IP address configured on the relay agent device. For a specific implementation process of generating an IP subnet address space according to the gateway address mask and the gateway IP address, reference may be made to the related contents in the above optional implementation a, which is not described herein again.
Further, based on the generation of the IP subnet address space in the above alternative embodiment A, B or C, the server may then assign an IP address to the client device from the generated IP subnet address space. Alternatively, the server may determine an occupied IP address in the generated IP subnet address space and assign an IP address to the client device from the unoccupied IP address in the IP subnet address space. Alternatively, the server may read the occupied IP address in the IP subnet address space from its memory block. For the case that the server allocates an IP address to the client device based on the DHCP protocol, the occupied IP address in the IP subnet address space is recorded in a dhcpd.
Considering that a client device wants to communicate with other devices normally, it needs to not only own its own IP address but also know its own gateway IP address. In step 202, the server may use the gateway IP address of the relay proxy device as the gateway IP address of the client device, i.e., the routing information of the client device, when generating the routing information for the client device. Based on this, an alternative implementation of step 203 is: and writing the IP address distributed for the client equipment, the gateway IP address and the IP address of the server into a corresponding field of the address distribution response message. And then, the server sends the address allocation response message to the relay agent equipment. Accordingly, the relay agent device forwards the address allocation response message to the client device. The client device receives the address allocation response message and acquires the IP address allocated to the address allocation response message by the server.
It should be noted that the execution subjects of the steps of the methods provided in the above embodiments may be the same device, or different devices may be used as the execution subjects of the methods. For example, the execution subject of step 201 and 203 may be device a; for another example, the execution subject of step 201 may be device a, and the execution subject of step 202 may be device B; and so on.
In addition, in some of the flows described in the above embodiments and the drawings, a plurality of operations are included in a specific order, but it should be clearly understood that the operations may be executed out of the order presented herein or in parallel, and the sequence numbers of the operations, such as 201, 202, etc., are merely used for distinguishing different operations, and the sequence numbers do not represent any execution order per se. Additionally, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel.
Accordingly, embodiments of the present application also provide a computer-readable storage medium storing computer instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the above-described method.
The IP address allocation scheme provided by the above embodiment may be applied to a scenario in which network devices in a data center network system are installed, or may also be applied to an application scenario in which an IP address of a network device expires and an IP address allocation server needs to reallocate an IP address for a network device. The installed scene address of the network device in the data center network system is taken as an example for illustration.
Fig. 2b is a schematic structural diagram of a data center network system according to an embodiment of the present application. As shown in fig. 2b, the network system includes: a network device 20a to be loaded, a relay agent device 20b and an address assignment server 20 c. The number of network devices 20a to be loaded may be one or more.
In this embodiment, the data center network system may include a plurality of subnets. In the case that there are a plurality of network devices 20a to be installed, the plurality of network devices 20a to be installed may be distributed in the same subnet or may be distributed in different subnets. Wherein the network device 20a to be loaded and the address assignment server 20c are in different subnets. The network device 20a to be loaded can communicate with the address assignment server 20c through the relay agent device 20 b.
It should be noted that the data center network system of this embodiment may be a network system formed by one data center, or may be a network system formed by interconnecting a plurality of data centers. In the case of the data center network system of this embodiment formed by interconnecting a plurality of data centers, the network device to be installed 20a, the relay agent device 20b, and the address assignment server 20c may be deployed in the same data center, or may be deployed in different data centers. Whether the network device 20a to be mounted, the relay agent device 20b and the address assignment server 20c are deployed in the same data center or in different data centers, the network device 20a to be mounted and the address assignment server 20c are in different subnets, and the network device 20a to be mounted communicates with the address assignment server 20c through the relay agent device 20 b.
Optionally, the network device 20a to be installed, the relay agent device 20b, and the address assignment server 20c may be implemented as the client device 10a, the relay agent device 10b, and the server 10c in fig. 1a, respectively, and the connection manner and the implementation manner between the network device 20a to be installed, the relay agent device 20b, and the address assignment server 20c may refer to relevant contents in the embodiment shown in fig. 1a, which is not described herein again.
In this embodiment, the network device 20a to be installed may be a server, a router, a switch, a gateway device, and other various network devices in a data center that need to access the internet through an IP address.
In this embodiment, the network device 20a to be installed may be a bare-metal device or a half-bare-metal device with an operating system installed, and is therefore referred to as a network device to be installed. In order to allow the data center network system to operate normally and provide external services, the network device 20a to be installed in the system needs to be installed with installed services. If the network device 20a to be installed is a bare machine device, the operating system is installed first during the installation process, and after the installation of the operating system is completed, network configuration is performed for the network device 20a to be installed. In this embodiment, the manner of installing the operating system for the network device to be installed 20a is not limited, and the network configuration process after the installation of the operating system is completed is mainly described in this embodiment.
In order to allow the network device 20a to be installed to provide network services, the address assignment server 20c is required to assign corresponding IP addresses and routing information to the network device 20a, so that the network device 20a to be installed can access the internet. Further, for the network device 20a to be installed, after the operating system is installed, an address allocation request message may be sent to the relay agent device 20b to request the address allocation server having jurisdiction authority to allocate an IP address to the address allocation server. For an embodiment in which the network device 20a to be installed sends the address allocation request packet to the address allocation server 20c, reference may be made to the related description in fig. 1a, which is not described herein again.
Accordingly, the relay agent device 20b receives the address allocation request message, and writes the locally configured gateway IP address into a corresponding field of the address allocation request message, for example, into a Giaddr field of the gateway IP address; the address assignment request message including the gateway IP address is then forwarded to address assignment server 20 c.
The address assignment server 20c receives the address assignment request message forwarded by the relay agent device 20b, and obtains the gateway IP address configured on the relay agent device 20b from the address assignment request message. Alternatively, if the gateway IP address is carried in the Giaddr field of the address allocation request, the address allocation server 20c may obtain the gateway IP address configured on the relay agent device 20b from the Giaddr field in the address allocation request message. Then, the address allocating server 20c allocates an IP address to the network device 20a to be installed from the IP subnet address space corresponding to the acquired gateway IP address, and generates routing information for the network device 20a to be installed according to the gateway IP address. That is, the gateway IP address, that is, the IP address of the next hop of the network device 20a to be installed, is generated for the network device 20a to be installed according to the gateway IP address configured on the relay agent device 20 b. Further, the address assignment server 20c writes the IP address assigned to the network device 20a to be installed and the generated routing information into an address assignment response packet, and returns the address assignment response packet to the relay agent device 20 b. The IP address of the gateway configured on the relay agent device 20b is previously assigned by the IPMS.
Accordingly, the relay agent device 20b receives the address assignment response message returned by the address assignment server 20c, and forwards the address assignment response message to the network device 20a to be installed. Further, the network device 20a to be installed receives the address allocation response message, may obtain the IP address and the routing information allocated to it by the address allocation server 20c from the address allocation response message, and performs network configuration according to the IP address and the routing information in the address allocation response message. The network configuration refers to the configuration of IP address and routing information of the network card.
In the data center network system provided in this embodiment, in the installation process of the network device to be installed, the address allocation server allocates an IP address to the client device from an IP subnet address space corresponding to the gateway IP address configured on the relay agent device, and generates routing information for the client device according to the gateway IP address configured on the relay agent device. The IP address allocation mode does not depend on the network environment of the network equipment to be installed any more, and the automatic allocation of the IP addresses can be realized without manual participation, so that the IP address allocation efficiency is improved, the installation efficiency is further improved, and the automatic installation is realized.
In this embodiment of the application, after obtaining the IP address and the routing information allocated to the to-be-installed device 20a by the address allocation server 20c, the to-be-installed device 20a may further perform subsequent interaction with the address allocation server 20c through the relay agent device 20 b. For example, after acquiring the IP address and the routing information allocated to the network device 20a by the address allocation server 20c, the network device 20a to be installed may send an address use request message to the relay agent device 20 b. Accordingly, the relay agent device 20b receives the address use request message and forwards it to the address assignment server 20 c. After the address allocation server 20c allocates the IP address to the network device 20a to be installed, a lease is pre-generated, and when receiving the address use request message, the address allocation server 20c writes the lease allocated to the IP address of the network device 20a to be installed into the lease file, which indicates that the IP address is already allocated to the network device 20a to be installed for use, and the term of use of the network device 20a to be installed is the lease period recorded in the lease file. Optionally, when the address allocation server 20c allocates an IP address to the network device 20a to be installed based on the DHCP protocol, the lease file is a DHCP. In addition, the server returns an address assignment acknowledgement message to the client device through the relay proxy device.
In practical applications, there may be one or more address assignment servers 20 c. The following describes the case where there are a plurality of address assignment servers 20c in detail.
In the case where there are a plurality of address assignment servers 20c, each address assignment server 20c may receive the address assignment request message forwarded by the relay agent device 20 b. Accordingly, each address assignment server 20c assigns an IP address to the network device 20a to be installed from the IP subnet address space corresponding to the gateway IP address configured on the relay proxy device 20b, and generates routing information for the network device 20a to be installed according to the gateway IP address. Then, each server writes the IP address allocated to the network device 20a to be installed and the routing information generated for the network device 20a to be installed into the address allocation response packet, and returns the address allocation response packet to the relay agent device 20 b.
The relay agent device 20b receives the address assignment response messages returned by the plurality of address assignment servers 20c, and forwards the address assignment response messages to the network device 20a to be loaded. The network device 20a to be installed may select one of the received address allocation response messages as a destination address allocation response message according to a preset selection rule, and determine to use the IP address and the routing information in the destination address allocation response message. Further, the network device 20a to be installed writes the IP address of the server corresponding to the destination address allocation response message into the address use request message, and sends the address use request message to the relay agent device 20 b. Alternatively, the selection rule in the network device 20a to be installed may be, but is not limited to, selecting the first received address assignment response message as the destination address assignment response message, or selecting the last received address assignment response message as the destination address assignment response message.
Accordingly, the relay agent device 20b forwards the address use request message to each of the plurality of address assignment servers 20 c. For any server, after receiving the address use request message, it is determined whether the IP address in the address use request message is the IP address of the server. If the determination result is yes, the server writes the lease of the IP address allocated to the network device 20a to be installed into the lease file, which indicates that the IP address is already allocated to the network device 20a to be installed for use, and returns an address allocation confirmation message to the network device 20a to be installed through the relay agent device 10 b. If the judgment result is no, the server releases the IP address allocated to the network device 20a to be installed, and the released IP address is in an idle state.
In the case of one address assignment server or a plurality of address assignment servers, after the address assignment server 20c transmits an address assignment acknowledgement message to the relay agent device 20b, the relay agent device 20b transfers the received address assignment acknowledgement message to the address assignment server 20 c. When receiving the address assignment acknowledgement message, the network device 20a to be installed may use the IP address assigned by the address assignment server 20c during the valid lease.
In some optional embodiments, the address assignment server 20c may previously maintain an IP subnet address space corresponding to the gateway IP address configured on the relay agent device 20b locally, or the address assignment server 20c may also generate a corresponding IP subnet address space for the gateway IP address configured on the relay agent device 20b in real time when receiving the first address assignment request. Based on this, the address assignment server 20c can determine whether an IP subnet address space corresponding to the gateway IP address exists locally according to the gateway IP address configured on the relay agent device 20 b. In the two cases that the IP subnet address space corresponding to the gateway IP address configured on the relay agent device 20b exists in the address allocation server 20C, and the IP subnet address space corresponding to the gateway IP address configured on the relay agent device 20b does not exist in the address allocation server 20C, the manner in which the address allocation server 20C allocates the IP address to the device 20a to be loaded may refer to allocation manners 1 and 2 and optional embodiments A, B and C in the foregoing embodiments, and details are not described here.
Considering that the network device 20a to be installed needs to communicate with other devices normally, it needs to know its own gateway IP address, i.e. routing information, as well as its own IP address. Based on this, in this embodiment of the application, the address assignment server 20c may further generate routing information for the network device 20a to be installed according to the gateway IP address configured on the relay agent device 20b, that is, the gateway IP address corresponding to the network device 20a to be installed.
Further, the address assignment server 20c may write the IP address assigned to the network device 20a to be installed, the IP address of the address assignment server 20c, and the gateway IP address of the network device 20a to be installed into the corresponding field of the address assignment response packet. After that, the address assignment server 20c transmits an address assignment response message to the relay agent device 20 b. Accordingly, the relay agent device 20b forwards the address assignment response packet to the network device to be provisioned 20 a. The network device 20a to be installed receives the address assignment response message, and may obtain the IP address and the routing information assigned thereto by the address assignment server 20c, and further may perform network communication with other devices based on the IP address and the routing information.
Fig. 3 is a schematic structural diagram of a server according to an embodiment of the present application. As shown in fig. 3, the server includes: a memory 30a, a processor 30b and a communication component 30 c.
In the present embodiment, the memory 30a is used to store a computer program, and may be configured to store other various data to support operations on the server. Wherein the processor 30b may execute a computer program stored in the memory 30a to implement the corresponding control logic. The memory 30a may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
In the present embodiment, the processor 30b, coupled to the memory 30a, is configured to execute a computer program for: receiving, by the communication component 30c, an address assignment request packet from the client device forwarded by the relay proxy device, where the address assignment request packet includes a gateway IP address configured on the relay proxy device; allocating an IP address for the client equipment from an IP subnet address space corresponding to the gateway IP address of the relay agent equipment, and generating routing information for the client equipment according to the gateway IP address of the relay agent equipment; and returning an address assignment response message to the relay agent device via the communication component 30c, the address assignment response message including the IP address assigned to the client device and the generated routing information for the relay agent device to forward to the client device.
In an optional embodiment, when the processor 30b allocates the IP address to the client device, it is specifically configured to: judging whether an IP subnet address space corresponding to the gateway IP address exists locally or not according to the gateway IP address of the relay agent equipment; and if the IP subnet address space corresponding to the gateway IP address does not exist locally, generating an IP subnet address space corresponding to the gateway IP address of the relay agent equipment, and allocating an IP address for the client equipment from the generated IP subnet address space. Correspondingly, if an IP subnet address space corresponding to the gateway IP address of the relay agent device exists locally, a free IP address is searched from the IP subnet address space, and an IP address is allocated to the client device from the searched free IP address. Optionally. The processor 30b may obtain the gateway IP address configured on the relay agent device from the gateway IP address field in the address assignment request message.
Further, if there is an IP subnet address space corresponding to the gateway IP address of the relay agent device locally, when the processor 30b allocates an IP address to the client device from the found idle IP address, the processor is specifically configured to: selecting the minimum IP address from the searched idle IP addresses to distribute to the client equipment; or selecting the largest IP address from the searched idle IP addresses to distribute to the client equipment; or, optionally one IP address is allocated to the client device from the searched free IP addresses.
Further, if there is no IP subnet address space corresponding to the gateway IP address locally, the processor 30b is specifically configured to: generating an IP subnet address space corresponding to the gateway IP address of the relay agent equipment according to the set address mask and the gateway IP address of the relay agent equipment; or analyzing the gateway address mask from the address allocation request message, and generating an IP subnet address space corresponding to the gateway IP address of the relay proxy device according to the gateway address mask and the gateway IP address of the relay proxy device.
Further, optionally, when the processor 30b parses the gateway address mask from the address allocation request message, it is specifically configured to: analyzing a gateway address mask from a gateway IP address field of the address allocation request message; or, the gateway address mask is analyzed from the reserved field of the address allocation request message.
In another optional embodiment, when generating the routing information for the client device according to the gateway IP address of the relay agent device, the processor 30b is specifically configured to: and taking the gateway IP address of the relay proxy equipment as the gateway IP address of the client equipment.
Correspondingly, when the processor 30b returns the address assignment response packet to the relay agent device, the processor is specifically configured to: writing the IP address distributed for the client equipment, the gateway IP address and the IP address of the server into corresponding fields of the address distribution response message; and sending the address allocation response message to the relay agent device, so that the relay agent device forwards the address allocation response message to the client device.
In yet another alternative embodiment, the processor 30b is further configured to: receiving an address use request message from client equipment forwarded by relay agent equipment; and writing the lease of the IP address allocated for the client equipment into an address allocation confirmation message, and sending the address allocation confirmation message to the relay agent equipment so that the relay agent equipment can forward the address allocation confirmation message to the client equipment.
It should be noted that, in this embodiment, the processor 30b may allocate an IP address to the client device based on different address allocation protocols, where the implementation forms of the messages are different according to the different address allocation protocols. Assuming that an address assignment protocol adopted by the server is a DHCP protocol, the address assignment request message is a DHCP discovery (DHCPdiscover) message; the address assignment response message is a DHCP offer (DHCP offer) message. Accordingly, the address use request message is a DHCP request (DHCP request) message; the address assignment acknowledgement message is a DHCP acknowledgement (DHCP ACK) message.
In some optional embodiments, as shown in fig. 3, the server may further include: power supply 30d, audio 30e, and screen 30 f. Only some of the components are shown schematically in fig. 3, and it is not meant that the server must contain all of the components shown in fig. 3, nor that the server can only contain the components shown in fig. 3.
Wherein the communication component 30c is configured to facilitate wired or wireless communication between the server and other devices. The server may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component may also be implemented based on Near Field Communication (NFC) modules, Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
Wherein the power supply component 30d is configured to provide power to the various components of the server. The power components 106 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the devices in which the power components are located.
Wherein audio component 30e may be configured to output and/or input audio signals. For example, the audio component includes a Microphone (MIC) configured to receive an external audio signal when the device in which the audio component is located is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in a memory or transmitted via the communication component 30 c. In some embodiments, the audio assembly further comprises a speaker for outputting audio signals. For example, for a server having a language interaction function, voice interaction with a user or the like can be realized through the audio component 30 e.
The screen 30f may include a Liquid Crystal Display (LCD) and a Touch Panel (TP), among others. If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
When the server provided by the embodiment allocates the IP address to the client device, the IP address is allocated to the client device from the IP action domain to which the IP address of the relay proxy device belongs.
It should be noted that, the descriptions of "first", "second", etc. in this document are used for distinguishing different messages, devices, modules, etc., and do not represent a sequential order, nor limit the types of "first" and "second" to be different.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (12)

1. An IP address allocation method, applied to a server, includes:
receiving an address allocation request message from client equipment forwarded by relay agent equipment, wherein the address allocation request message comprises a gateway IP address configured on the relay agent equipment;
allocating an IP address to the client device from an IP subnet address space corresponding to the gateway IP address, and generating routing information for the client device according to the gateway IP address;
and returning an address distribution response message to the equipment of the relay agent, wherein the address distribution response message comprises an IP address distributed for the client equipment and generated routing information so that the equipment of the relay agent can forward the IP address to the client equipment.
2. The method of claim 1, wherein the allocating an IP address for the client device from an IP subnet address space corresponding to the gateway IP address comprises:
judging whether an IP subnet address space corresponding to the gateway IP address exists locally or not according to the gateway IP address;
and if the IP subnet address space corresponding to the gateway IP address does not exist locally, generating an IP subnet address space corresponding to the gateway IP address, and distributing an IP address for the client equipment from the generated IP subnet address space.
3. The method of claim 2, wherein generating an IP subnet address space corresponding to the gateway IP address comprises:
generating an IP subnet address space corresponding to the gateway IP address according to the set address mask and the gateway IP address; or
Analyzing a gateway address mask from the address allocation request message, and generating an IP subnet address space corresponding to the gateway IP address according to the gateway address mask and the gateway IP address.
4. The method of claim 3, wherein parsing a gateway address mask from the address assignment request message comprises:
analyzing the gateway address mask from the gateway IP address field of the address allocation request message; alternatively, the first and second electrodes may be,
and analyzing the gateway address mask from the reserved field of the address allocation request message.
5. The method of claim 2, further comprising:
if the IP subnet address space corresponding to the gateway IP address exists locally, searching for a free IP address from the IP subnet address space, and allocating an IP address for the client device from the searched free IP address.
6. The method of claim 5, wherein assigning an IP address to the client device from the found free IP address comprises:
selecting the minimum IP address from the searched idle IP addresses to be distributed to the client equipment;
alternatively, the first and second electrodes may be,
selecting the largest IP address from the searched idle IP addresses to be distributed to the client equipment;
alternatively, the first and second electrodes may be,
and optionally selecting one IP address from the searched idle IP addresses to be distributed to the client equipment.
7. The method of any one of claims 1-6, wherein generating routing information for the client device based on the gateway IP address comprises:
and taking the gateway IP address as the gateway IP address of the client equipment.
8. The method of claim 7, wherein the address assignment request message is a DHCP discovery message; the address assignment response message provides a message for DHCP.
9. A server, comprising: a memory, a processor, and a communications component;
the memory for storing a computer program;
the processor, coupled to the memory, to execute the computer program to:
receiving, by the communication component, an address assignment request packet from a client device forwarded by a relay agent device, where the address assignment request packet includes a gateway IP address configured on the relay agent device;
allocating an IP address to the client device from an IP subnet address space corresponding to the gateway IP address, and generating routing information for the client device according to the gateway IP address;
and returning an address allocation response message to the equipment of the relay agent through the communication component, wherein the address allocation response message comprises an IP address allocated to the client equipment and generated routing information, so that the equipment of the relay agent forwards the address allocation response message to the client equipment.
10. An IP address assignment system, comprising: a client device, a relay proxy device, and a server; wherein the content of the first and second substances,
the client device is configured to send an address allocation request message to the relay agent device and receive an address allocation response message from the server, where the address allocation response message includes an IP address allocated by the server to the client device and generated routing information;
the relay agent equipment is used for receiving the address allocation request message, writing a gateway IP address configured on the relay agent equipment into the address allocation request message, and forwarding the address allocation request message including the gateway IP address to the server; receiving the address allocation response message returned by the server, and forwarding the address allocation response message to the client device;
the server is used for receiving the address allocation request message comprising the gateway IP address; allocating an IP address to the client device from an IP subnet address space corresponding to the gateway IP address, and generating routing information for the client device according to the gateway IP address; and sending the address allocation response message to the relay agent equipment.
11. A computer-readable storage medium having stored thereon computer instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the method of any one of claims 1-8.
12. A data center network system, comprising: network equipment to be installed, relay agent equipment and an address allocation server; the network equipment to be loaded and the address distribution server are in different subnets;
the network equipment to be installed is used for sending an address allocation request message to the relay agent equipment after the installation of the operating system is finished;
the relay agent equipment is used for receiving the address allocation request message, writing a gateway IP address configured by the relay agent equipment into the address allocation request message and forwarding the address allocation request message to the address allocation server; the address allocation response message returned by the address allocation server is forwarded to the network equipment to be installed;
the address allocation server is used for receiving an address allocation request message comprising the gateway IP address; distributing an IP address for the network equipment to be loaded from an IP subnet address space corresponding to the gateway IP address, and generating routing information for the network equipment to be loaded according to the gateway IP address; sending the address allocation response message to the relay agent equipment; the address allocation response message comprises an IP address allocated to the network equipment to be loaded by the address allocation server and generated routing information;
and the network equipment to be loaded is also used for carrying out network configuration according to the IP address and the routing information in the address allocation response message.
CN201910182177.0A 2019-03-11 2019-03-11 IP address allocation method, device, system and storage medium Pending CN111683159A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910182177.0A CN111683159A (en) 2019-03-11 2019-03-11 IP address allocation method, device, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910182177.0A CN111683159A (en) 2019-03-11 2019-03-11 IP address allocation method, device, system and storage medium

Publications (1)

Publication Number Publication Date
CN111683159A true CN111683159A (en) 2020-09-18

Family

ID=72433173

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910182177.0A Pending CN111683159A (en) 2019-03-11 2019-03-11 IP address allocation method, device, system and storage medium

Country Status (1)

Country Link
CN (1) CN111683159A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112702447A (en) * 2020-12-17 2021-04-23 中国建设银行股份有限公司 Method, device and storage medium for automatically allocating IP addresses
CN115334042A (en) * 2021-04-25 2022-11-11 中国移动通信有限公司研究院 Data transmission method, device and system and communication equipment
CN115378990A (en) * 2022-08-09 2022-11-22 北京联合大学 Automatic discovery network informatization teaching demonstration method based on 4G/5G communication system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1949784A (en) * 2005-10-12 2007-04-18 华为技术有限公司 IP address requesting method for DHCP client by DHCP repeater
CN101141308A (en) * 2007-10-15 2008-03-12 清华大学 Topology discovering method of IP backbone network
CN106254567A (en) * 2015-06-15 2016-12-21 中兴通讯股份有限公司 A kind of method and apparatus obtaining address
CN106357838A (en) * 2016-09-26 2017-01-25 杭州昆海信息技术有限公司 Method and device for distributing IP (Internet protocol) address

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1949784A (en) * 2005-10-12 2007-04-18 华为技术有限公司 IP address requesting method for DHCP client by DHCP repeater
CN101141308A (en) * 2007-10-15 2008-03-12 清华大学 Topology discovering method of IP backbone network
CN106254567A (en) * 2015-06-15 2016-12-21 中兴通讯股份有限公司 A kind of method and apparatus obtaining address
CN106357838A (en) * 2016-09-26 2017-01-25 杭州昆海信息技术有限公司 Method and device for distributing IP (Internet protocol) address

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112702447A (en) * 2020-12-17 2021-04-23 中国建设银行股份有限公司 Method, device and storage medium for automatically allocating IP addresses
CN112702447B (en) * 2020-12-17 2022-09-16 中国建设银行股份有限公司 Method, device and storage medium for automatically allocating IP addresses
CN115334042A (en) * 2021-04-25 2022-11-11 中国移动通信有限公司研究院 Data transmission method, device and system and communication equipment
CN115378990A (en) * 2022-08-09 2022-11-22 北京联合大学 Automatic discovery network informatization teaching demonstration method based on 4G/5G communication system
CN115378990B (en) * 2022-08-09 2023-11-10 北京联合大学 Automatic discovery network informatization teaching demonstration method based on 4G/5G communication system

Similar Documents

Publication Publication Date Title
JP5663549B2 (en) Method, apparatus and system for assigning public IP addresses
WO2017206572A1 (en) Ip address management method for use in network environment having multiple dhcp servers, and dhcp client
CN102075591A (en) Method, device and system for acquiring media access control address
CN111431956B (en) Cross-network service access method, device, system and storage medium
CN111683159A (en) IP address allocation method, device, system and storage medium
CN106878480B (en) DHCP service process sharing method and device
CN106453681B (en) IP address allocation method and device
JP2017517171A (en) Method and apparatus for high speed IP address assignment
CN106254571B (en) Client IP address allocation method and device
US20190253383A1 (en) Method to distribute a centralized service
CN106302861B (en) Address allocation method and device
CN111107119B (en) Data access method, device and system based on cloud storage system and storage medium
CN106878479B (en) Address allocation method and device
WO2013117172A1 (en) Private network address allocation method, device, and system
CN110636149B (en) Remote access method, device, router and storage medium
CN112689029A (en) Method, device and equipment for acquiring IP address of group user
CN107547684B (en) IPv6 address allocation method and device
KR101506852B1 (en) Method for Selecting Network Mode, Mobile Router Therefor
US10728828B2 (en) IP address management method and apparatus, IP address anchor, and mobile node
WO2017215381A1 (en) Method and device for indicating virtual expansion port, and storage medium
CN107770070B (en) Information transmission method, equipment and system
JP5777464B2 (en) COMMUNICATION DEVICE, COMMUNICATION SYSTEM, COMMUNICATION METHOD, AND PROGRAM
CN113542091B (en) Communication and access control method, device, apparatus, system and storage medium
CN113395366A (en) Network address allocation method and device
CN113542444B (en) IP address allocation method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200918

RJ01 Rejection of invention patent application after publication