CN113037882A - Method for acquiring additional information of host and proxy equipment - Google Patents

Method for acquiring additional information of host and proxy equipment Download PDF

Info

Publication number
CN113037882A
CN113037882A CN202110181562.0A CN202110181562A CN113037882A CN 113037882 A CN113037882 A CN 113037882A CN 202110181562 A CN202110181562 A CN 202110181562A CN 113037882 A CN113037882 A CN 113037882A
Authority
CN
China
Prior art keywords
address
host
dhcp
proxy
additional information
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.)
Granted
Application number
CN202110181562.0A
Other languages
Chinese (zh)
Other versions
CN113037882B (en
Inventor
杨雷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Digital Technologies Suzhou Co Ltd
Original Assignee
Huawei Digital Technologies Suzhou Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Digital Technologies Suzhou Co Ltd filed Critical Huawei Digital Technologies Suzhou Co Ltd
Priority to CN202110181562.0A priority Critical patent/CN113037882B/en
Publication of CN113037882A publication Critical patent/CN113037882A/en
Application granted granted Critical
Publication of CN113037882B publication Critical patent/CN113037882B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]

Abstract

The embodiment of the invention provides a method for acquiring additional information of a host and proxy equipment, which are used for conveniently acquiring the additional information of the host. The method comprises the following steps: the proxy equipment acquires a request message sent by a DHCP client, wherein the request message carries a first transactioniD and an MAC address of a host where the DHCP client is located; the proxy equipment acquires a confirmation message sent by the DHCP server, wherein the confirmation message comprises a second transactioniD and an IP address distributed by the DHCP server for the DHCP client; the proxy apparatus requests additional information of the host from the host using the IP address when the first TransactionID and the second TransactionID are the same. The modification of a DHCP server for acquiring additional information of a host is avoided, and the proxy equipment does not need to specially detect the IP address of the client by using a detection tool.

Description

Method for acquiring additional information of host and proxy equipment
The present application claims a divisional application of the chinese patent application entitled "a method and an agent apparatus for acquiring additional information of a host" filed by the chinese patent office on 22/11/2016 under the reference of application number 201611029102.1, which is incorporated herein by reference in its entirety.
Technical Field
The present invention relates to the field of communications, and in particular, to a method and proxy device for acquiring additional information of a host.
Background
DHCP (Dynamic Host Configuration Protocol; chinese name: Dynamic Host Configuration Protocol) is a network Protocol for a local area network, and functions to provide Configuration information to a Host accessing the Internet in a TCP/IP-based network. DHCP adopts client/server mode to work, DHCP server software is installed in one host computer in the local area network, and DHCP client software is installed in other host computers. And sending a configuration application to a DHCP server by the DHCP client, wherein the configuration application is used for requesting the server to distribute configuration information to the client, and the configuration information comprises parameters such as an IP address, a subnet mask, a default gateway and the like. And the DHCP server returns corresponding configuration information to the DHCP client according to the strategy.
Through message interaction between the DHCP client and the DHCP server, on one hand, the DHCP client finishes IP (Internet Protocol; Chinese name: Internet Protocol) address acquisition, and on the other hand, the DHCP server records the mapping relation between the IP address allocated to the DHCP client and the host MAC (Media Access Control; Chinese name: Media Access Control) address of the DHCP client.
However, the prior art has the following disadvantages:
in order to manage the host, network management personnel often need to obtain additional information such as a host name, however, any device in the local area network, such as a relay device or a switch, cannot obtain more additional information during the process of performing DHCP message interaction between the DHCP client and the DHCP server.
Disclosure of Invention
The embodiment of the invention provides a method for acquiring additional information of a host and proxy equipment, which are used for conveniently acquiring the additional information of the host.
In a first aspect, an embodiment of the present invention provides a method for acquiring additional information of a host, where the method is performed by a proxy device, and the proxy device is in communication connection with a DHCP client and a DHCP server, respectively, and the method includes:
the method comprises the steps that agent equipment deployed between a DHCP client and a DHCP server obtains a first discovery message sent by the DHCP client, wherein the first discovery message carries an MAC address of a host where the DHCP client is located. Then, the MAC address of the host on the first discovery message sent by the DHCP client is screened to determine whether the additional information of the host is acquired. If the proxy equipment does not store the host name corresponding to the MAC address, the proxy equipment allocates a temporary IP address to the host, so that the proxy equipment can determine the network position of the host according to the temporary IP address. The proxy device then requests additional information of the host from the host using the temporary IP address. The proxy device includes but is not limited to a proxy server, a DHCP relay agent, etc., and the additional information includes but is not limited to information carried on the host, such as host name, home department information, software and hardware configuration information, etc.
In such a way, the modification of the DHCP server for acquiring the additional information of the host is avoided, the proxy equipment does not need to specially detect the IP address of the client by using a detection tool, and the user of the client is prevented from carrying out corresponding shielding measures because the user worrys about excessive exposure of the information of the user. Therefore, the method provided by the embodiment of the invention is simple and feasible.
With reference to the first aspect, in a first possible implementation manner, after the proxy device requests the host for additional information of the host by using the temporary IP address, the method of this implementation manner further includes: the agent device establishes and stores the corresponding relationship between the additional information of the host and the MAC address, so that the agent device can use the corresponding relationship after acquiring the second discovery message sent by the DHCP client. The second discovery message carries the MAC address, and the second discovery message is sent by the DHCP client after the temporary IP address is released. And if the agent equipment is determined to store the additional information corresponding to the MAC address carried by the second discovery message according to the corresponding relation between the additional information and the MAC address of the host, the agent equipment transmits the second discovery message to the DHCP server so that the DHCP server allocates a real IP address for the host. And then, the agent equipment acquires at least one DHCP message interacted between the DHCP server and the DHCP client, wherein the at least one DHCP message carries a real IP address and an MAC address. Then, the agent device reuses the corresponding relationship between the additional information and the MAC address of the host, and establishes the corresponding relationship among the additional information, the MAC address and the real IP address according to the MAC address contained in the at least one DHCP message and the corresponding relationship.
The method avoids the modification of the DHCP server for establishing the corresponding relation of the host name, the host MAC address and the real IP address, the proxy equipment does not need to specially detect the IP address and the MAC address of the client by using a detection tool, and the corresponding shielding measures are prevented from being carried out by a user of the client because the user worrys about the excessive exposure of the information of the user, so that the method for establishing the corresponding relation of the host name, the MAC address and the IP address is simple and easy to implement.
With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, the at least one DHCP message includes an acknowledgement message sent by a DHCP server, or a provisioning message sent by the DHCP server. The confirmation message and the offer message carry the real IP address assigned by the DHCP server so that the proxy device can use the real IP address.
With reference to the first aspect, the first or second possible implementation manner of the first aspect, in a third possible implementation manner, the requesting, by the proxy device, additional information of the host from the host using the temporary IP address includes: the proxy equipment sends a response request message for requesting additional information to the host, wherein the response request message carries a temporary IP address; therefore, the proxy equipment acquires the response message sent by the host, the source IP address of the response message is the temporary IP address, and the response message carries the additional information of the host. The agent device and the host interact through ICMP messages, and the agent device obtains additional information of the host.
With reference to the first aspect, the first or second possible implementation manner of the first aspect, in a fourth possible implementation manner, the allocating, by the proxy device, a temporary IP address to the host includes: the proxy equipment sends a providing message to the DHCP client, and the providing message carries a temporary IP address; then, the agent equipment acquires a request message sent by the DHCP client, wherein the request message carries the temporary IP address and also carries the MAC address; if the agent device does not store the additional information corresponding to the MAC address, the agent device is indicated to need to acquire the additional information of the host, and the request message cannot be released. And then, the proxy equipment judges whether the content of the Server Identifier field of the request message is the IP address of the proxy equipment, if the content of the Server Identifier field of the request message is the IP address of the proxy equipment, the proxy equipment sends a confirmation message to the DHCP client, and the confirmation message is used for indicating that the proxy equipment completes the process of allocating the temporary IP address to the DHCP client. Thus, the proxy device can complete the assignment of the temporary IP address to the host.
With reference to the first aspect, the first or second possible implementation manner of the first aspect, in a fifth possible implementation manner, after the proxy device requests the host for additional information of the host by using the temporary IP address, the method of this implementation manner further includes: and when acquiring the request message broadcasted by the DHCP client, the proxy equipment sends a negative acknowledgement message to the DHCP client. Then, when the proxy equipment acquires the release message sent by the DHCP client, the temporary IP address is released. The DHCP client thereby releases the temporary IP address.
With reference to the first aspect, the first or second possible implementation manner of the first aspect, in a sixth possible implementation manner, after requesting additional information of the host from the host using the temporary IP address, the method further includes: when the proxy equipment acquires a unicast request message of the client, the proxy equipment does not respond to the DHCP client; and when acquiring the request message broadcast by the client, the proxy equipment sends a negative acknowledgement message to the DHCP client. Then, when the proxy equipment acquires the release message sent by the DHCP client, the temporary IP address is released. The DHCP client thereby releases the temporary IP address.
With reference to the first aspect, the first or second possible implementation manner of the first aspect, in a seventh possible implementation manner, the additional information is a host name of the host.
With reference to the first aspect, the first or second possible implementation manner of the first aspect, in an eighth possible implementation manner, the lease time of the temporary IP address allocated by the proxy device to the host is less than a preset time threshold.
In a second aspect, an embodiment of the present invention provides a proxy device, where the proxy device has a function of the proxy device in the foregoing method. The functions may be implemented by hardware, or by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the functions described above.
In one possible implementation, the proxy device includes:
the first acquiring unit is used for acquiring a first discovery message sent by the DHCP client, wherein the first discovery message carries an MAC address of a host where the DHCP client is located;
the distribution unit is used for distributing a temporary IP address for the host if the host name corresponding to the MAC address is not stored in the proxy equipment;
a requesting unit for requesting additional information of the host to the host using the temporary IP address.
In another possible implementation manner, the proxy device includes:
a transceiver, a processor;
the processor performs the following acts: acquiring a first discovery message sent by a DHCP client, wherein the first discovery message carries an MAC address of a host where the DHCP client is located;
the processor performs the following acts: if the agent equipment does not store the host name corresponding to the MAC address, a temporary IP address is allocated to the host;
the processor performs the following acts: additional information of the host is requested from the host using the temporary IP address.
In a third aspect, an embodiment of the present invention provides a computer storage medium, where the computer storage medium stores a program code for instructing to execute the method according to the first aspect or any one of the possible implementation manners of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a method for acquiring additional information of a host, where the method is performed by a proxy device, and the proxy device is in communication connection with a DHCP client and a DHCP server, respectively, and the method includes: the proxy equipment acquires a request message sent by the DHCP client, wherein the request message carries the first transactioniD and the MAC address of a host where the DHCP client is located. And the proxy equipment acquires a confirmation message sent by the DHCP server, wherein the confirmation message comprises the second transactioniD and an IP address distributed by the DHCP server for the DHCP client. And when the first transactioniD and the second transactioniD are the same, the agent equipment determines that the IP address on the confirmation message is allocated to the host connected with the agent equipment. The proxy device can determine the network position of the corresponding host according to the IP address, so that the proxy device uses the IP address to request the additional information of the host from the host.
In such a way, the modification of the DHCP server for acquiring the additional information of the host is avoided, the proxy equipment does not need to specially detect the IP address of the client by using a detection tool, and the user of the client is prevented from carrying out corresponding shielding measures because the user worrys about excessive exposure of the information of the user. Therefore, the method provided by the embodiment of the invention is simple and feasible.
With reference to the fourth aspect, in a first possible implementation manner, before the proxy device requests the host for additional information of the host using the IP address, the method of this implementation manner further includes: the agent device establishes and stores the corresponding relationship between the MAC address and the IP address. After the proxy device uses the IP address to request the host for additional information of the host, the method of this implementation further includes: and the proxy equipment establishes the corresponding relation among the IP address, the additional information and the MAC address according to the stored corresponding relation and the IP address.
In such a way, the modification of the DHCP server for establishing the corresponding relation of the host name, the MAC address and the IP address is avoided, the proxy equipment does not need to specially detect the IP address and the MAC address of the client by using a detection tool, and the corresponding shielding measures are prevented from being carried out by the user of the client because the user worrys about the excessive exposure of the information of the user. Therefore, the method for establishing the corresponding relation among the host name, the MAC address and the IP address is simple and easy to implement.
With reference to the first implementation manner of the fourth aspect, in a second possible implementation manner of the fourth aspect, the requesting, by the proxy device, additional information of the host from the host using the IP address includes: the proxy equipment sends a response request message for requesting additional information to the host, and the response request message carries the IP address. Then, the agent device obtains a response message sent by the host, and the response message carries additional information of the host. The agent device and the host interact through ICMP messages, and the agent device obtains additional information of the host.
In a fifth aspect, an embodiment of the present invention provides a proxy device, where the proxy device has a function of the proxy device in the foregoing method. The functions may be implemented by hardware, or by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the functions described above.
In one possible implementation, the proxy device includes:
the first obtaining unit is used for obtaining a request message sent by a DHCP client, wherein the request message carries a first transactioniD and an MAC address of a host where the DHCP client is located;
the second obtaining unit is used for obtaining a confirmation message sent by the DHCP server, wherein the confirmation message comprises a second transactioniD and an IP address distributed by the DHCP server for the DHCP client;
and a requesting unit for requesting additional information of the host to the host using the IP address when the first TransactionID and the second TransactionID are the same.
In another possible implementation manner, the proxy device includes:
a transceiver, a processor;
the transceiver performs the following actions: acquiring a request message sent by a DHCP client, wherein the request message carries a first transactioniD and an MAC address of a host where the DHCP client is located;
the transceiver performs the following actions: acquiring a confirmation message sent by the DHCP server, wherein the confirmation message comprises a second transactioniD and an IP address allocated by the DHCP server for the DHCP client;
the processor performs the following acts: when the first TransactionID and the second TransactionID are the same, additional information of the host is requested from the host using the IP address.
In a sixth aspect, an embodiment of the present invention provides a computer storage medium, where the computer storage medium stores program codes for instructing to execute the method according to any one of the possible implementation manners of the fourth aspect or the fourth aspect.
According to the technical scheme, the embodiment of the invention has the following advantages:
when the DHCP client applies for an IP address, the proxy equipment is in communication connection with the DHCP client and the DHCP server respectively, the IP address of the DHCP client is determined by acquiring a DHCP message of the DHCP client or a DHCP message interacted between the DHCP client and the DHCP server, and the network position of a host where the DHCP client is located can be determined according to the IP address so as to acquire additional information of the host according to the IP address of the host. Therefore, the modification of the DHCP server for acquiring the additional information of the host is avoided, the proxy equipment does not need to specially detect the IP address of the client by using a detection tool, and the user of the client is prevented from carrying out corresponding shielding measures for worrying about excessive exposure of the information of the user. Therefore, the method provided by the embodiment of the invention is simple and feasible.
Drawings
Fig. 1 is a diagram of a network architecture according to a method for acquiring additional information of a host according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for obtaining additional information of a host according to another embodiment of the present invention;
fig. 3 is a flowchart of a method for obtaining additional information of a host according to another embodiment of the present invention;
FIG. 4 is a flowchart of a method for obtaining additional information of a host according to another embodiment of the present invention;
FIG. 5 is a flowchart of a method for obtaining additional information of a host according to another embodiment of the present invention;
fig. 6 is a schematic structural diagram of a proxy device according to another embodiment of the present invention;
fig. 7 is a schematic diagram of a hardware structure of a proxy device according to another embodiment of the present invention;
fig. 8 is a schematic structural diagram of a proxy device according to another embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method for acquiring additional information of a host and proxy equipment, which are used for conveniently acquiring the additional information of the host.
Fig. 1 is a diagram illustrating a network architecture according to a method for acquiring additional information of a host according to an embodiment of the present invention. As shown in fig. 1, the network architecture includes a host 101, a proxy device 102, and a DHCP server 103. A DHCP client is provided on the host 101, the host 101 can request an IP address through the DHCP client provided thereon, and the DHCP server 103 has an IP address assignment function. The interaction of the DHCP messages is performed between the DHCP client and the DHCP server 103, so that the DHCP server 103 can allocate an IP address to the DHCP client.
The proxy device 102 is connected to the DHCP client and the DHCP server 103, respectively, and when the DHCP client and the DHCP server 103 perform DHCP message interaction, the DHCP messages pass through the proxy device 102, and the proxy device 102 may not only pass the DHCP messages through to the next device, but also intercept and process the DHCP messages.
The proxy equipment of the embodiment of the invention is configured with an IP address allocation function based on DHCP, and the proxy equipment can allocate IP addresses to the host. The proxy device may also request additional information from the host, such as information such as the host name.
It can be understood that the proxy device in the embodiment of the present invention includes various implementation manners, for example, the proxy device may be a proxy server, or a DHCP Relay Agent (Relay Agent), and the embodiment of the present invention is not particularly limited thereto.
In some embodiments of the present invention, the proxy device has communication connections with the DHCP client and the DHCP server, respectively, and acquires a first discovery packet sent by the DHCP client, where the first discovery packet carries an MAC address of a host where the DHCP client is located, and if the proxy device does not store a host name corresponding to the MAC address, the proxy device allocates a temporary IP address to the host, and then requests the host for additional information using the temporary IP address.
In some embodiments of the present invention, the proxy device has communication connections with the DHCP client and the DHCP server, respectively, and the proxy device obtains a request message sent by the DHCP client, where the request message carries the first TransactionID and the MAC address of the host where the DHCP client is located; the proxy equipment also acquires a confirmation message sent by the DHCP server, wherein the confirmation message comprises a second transactioniD and an IP address distributed by the DHCP server for the DHCP client; when the first TransactionID and the second TransactionID match, the proxy device determines that the IP address is the IP address of the host to which the proxy device is connected, so that the proxy device requests additional information to the host using the IP address.
Therefore, the agent equipment is only needed to be deployed between the DHCP client and the DHCP server, when the agent equipment applies for the IP address at the DHCP client, the MAC address of the host on the discovery message sent by the DHCP client is used for screening to determine whether the additional information of the host is acquired, if the additional information of the host is not acquired, the agent equipment allocates a temporary IP address for the DHCP client, so that the network position of the host where the DHCP client is located can be determined through the temporary IP address, and the agent equipment can request the additional information of the host from the host by using the temporary IP address. In such a way, the modification of the DHCP server for acquiring the additional information of the host is avoided, the proxy equipment does not need to specially detect the IP address of the client by using a detection tool, and the user of the client is prevented from carrying out corresponding shielding measures due to worrying about the excessive exposure of the information of the user, so that the method of the embodiment is simple and easy to implement.
In order to facilitate a better understanding of the information processing method according to the embodiments of the present invention, two specific examples are described in detail below.
Fig. 2 is a flowchart of a method for acquiring additional information of a host according to an embodiment of the present invention.
Referring to the network architecture diagram of fig. 1 and above, and referring to fig. 2, a method of an embodiment of the invention comprises:
step 201: the proxy equipment acquires a first discovery message sent by the DHCP client.
The discovery (DHCP discovery) message is a message in the initial stage of the DHCP address assignment process. The "first discovery packet" and the "second discovery packet" in this embodiment do not represent a sequential relationship, but are used to distinguish different discovery packets, and the first discovery packet, the second discovery packet, and the like mentioned in the following documents are also used to distinguish different discovery packets.
The first discovery message carries the MAC address of the host where the DHCP client is located.
When a DHCP client side needs to apply for an IP address, the DHCP client side broadcasts a discovery message to a network. In the embodiment of the invention, the proxy server is in communication connection with the DHCP client and the DHCP server respectively, so that the proxy server and the DHCP server acquire the first discovery message first. The first discovery packet carries the MAC address of the host where the DHCP client is located.
Step 202: if the agent device does not store the additional information corresponding to the MAC address, the agent device allocates a temporary IP address to the host.
And the agent equipment analyzes the first discovery message and acquires the MAC address in the chaddr field value of the first discovery message. The MAC address is the MAC address of the host where the DHCP client is located.
Then, the agent device detects whether the additional information corresponding to the MAC address exists or not to determine a corresponding operation on the first discovery packet, and if the additional information corresponding to the MAC address does not exist, the agent device allocates a temporary IP address to the host to determine a location on the network of the host according to the temporary IP address, thereby requesting the additional information of the host from the host according to the temporary IP address. If the proxy device stores additional information corresponding to the MAC address, the proxy device does not need to assign a temporary IP address to the DHCP client. The proxy equipment sets lease time for the temporary IP address, and releases the temporary IP address after the lease time expires. When the temporary IP address is released, the DHCP client side initiates the process of applying for the IP address again.
The additional information may be information such as a host name of the host.
Step 203: the proxy server requests additional information of the host from the host using the temporary IP address.
The proxy device assigns a temporary IP address to the host to determine a location on the network of the host based on the temporary IP address, thereby requesting additional information of the host from the host based on the temporary IP address.
The mode of requesting the additional information from the host by the proxy device has various modes, for example, the proxy device and the host obtain the additional information through ICMP (Internet Control Message Protocol, chinese name) Message interaction. Specifically, the proxy device sends an Echo request (ICMP Echo request) message for requesting additional information to the host, and the host feeds back an Echo response (ICMP Echo reply) message carrying additional information of the host according to the Echo request message.
In summary, in the proxy device in communication connection with the DHCP client and the DHCP server, the proxy device obtains a first discovery packet sent by the DHCP client, where the first discovery packet carries an MAC address of a host where the DHCP client is located. If the proxy equipment does not store the host name corresponding to the MAC address, the proxy equipment allocates a temporary IP address for the host. Then, additional information of the host is requested from the host using the temporary IP address. Therefore, the agent equipment is only needed to be deployed between the DHCP client and the DHCP server, and when the agent equipment applies for an IP address at the DHCP client, the agent equipment performs screening through the MAC address of the host on the discovery message sent by the DHCP client to determine whether the additional information of the host is acquired. If not, the proxy equipment allocates a temporary IP address for the DHCP client, so that the network position of the host where the DHCP client is located can be determined through the temporary IP address, and the proxy equipment can request the host for additional information of the host by using the temporary IP address. In such a way, the modification of the DHCP server for acquiring the additional information of the host is avoided, the proxy equipment does not need to specially detect the IP address of the client by using a detection tool, and the user of the client is prevented from carrying out corresponding shielding measures because the user worrys about excessive exposure of the information of the user. Therefore, the method provided by the embodiment of the invention is simple and feasible.
Optionally, in order to facilitate the proxy server to manage a large amount of information related to the hosts in the network, or to facilitate subsequent quick query of additional information of the hosts, in some embodiments, the proxy server may further establish a corresponding relationship among the additional information, the MAC address, and the real IP address. At this time, in this embodiment, after step 203, the following steps are further included.
Step 204: the agent device establishes and stores the corresponding relationship between the additional information and the MAC address of the host.
After the agent device acquires the additional information of the host by using the temporary IP address, the corresponding relation between the additional information of the host and the MAC address of the host carried in the first discovery message is established and stored. Through the correspondence, the additional information of the host and the MAC address of the host can be identified from each other. And can be used as a condition for executing subsequent operation of the proxy equipment.
Step 205: and the proxy equipment acquires a second discovery message sent by the DHCP client.
And the second discovery message carries the MAC address.
After the agent device allocates a temporary IP address to the DHCP client and acquires the additional information of the host where the DHCP client is located according to the IP address, the temporary IP address is released after the lease time of the temporary IP address of the host expires. The host will reapply the IP address through the DHCP client, and at this time, the DHCP client broadcasts a second discovery message to the network.
Step 206: and if the agent equipment is determined to store the additional information corresponding to the MAC address carried by the second discovery message according to the corresponding relation between the additional information of the host and the MAC address, the agent equipment transmits the second discovery message to the DHCP server so that the DHCP server allocates a real IP address for the host.
In step 204, the proxy device establishes and stores the correspondence between the additional information of the host and the MAC address, and after the proxy device obtains the second discovery packet, the proxy device parses the MAC address of the host carried in the second discovery packet, and finds out the corresponding additional information from the correspondence between the pre-stored additional information and the MAC address according to the MAC address. At this time, the proxy device can inquire the corresponding additional information, so that the proxy device transparently transmits the second discovery message to the DHCP server, so that the DHCP server allocates a real IP address for the host.
Step 207: the agent equipment obtains at least one DHCP message interacted between the DHCP server and the DHCP client.
Wherein, the at least one DHCP message carries a real IP address and an MAC address.
After receiving the second discovery message, the DHCP server allocates a real IP address to the DHCP client that sends the second discovery message, where the real IP address is an IP address allocated to the DHCP client by the DHCP server.
The real IP address allocation process is implemented by a DHCP offer message, a DHCP request message, and an acknowledgement message, which are interacted between the DHCP server and the DHCP client.
In some embodiments of the present invention, the proxy device may obtain the confirmation packet, and analyze the real IP address allocated to the DCHP client and the MAC address of the host from the confirmation packet.
In some embodiments of the present invention, the proxy device may obtain the request packet and the confirmation packet, analyze the first TransactionID and the MAC address of the host where the DHCP client is located from the request packet, analyze the second TransactionID and the IP address allocated by the DHCP server to the DHCP client from the confirmation packet, and determine the real IP address and the MAC address of the host corresponding to each other by matching the first TransactionID and the second TransactionID.
In some embodiments of the invention, the proxy device may obtain the true IP address from the provide message, while the MAC address of the host may be obtained from other messages.
Step 208: the agent device establishes the corresponding relation among the additional information, the MAC address and the real IP address according to the MAC address contained in the at least one DHCP message and the stored corresponding relation.
In step 204, the proxy device establishes and stores a corresponding relationship between the additional information and the MAC address of the host, and after the proxy device acquires the MAC address and the real IP address of the host in step 207, the proxy device can query the corresponding relationship between the additional information and the MAC address according to the MAC address to acquire the corresponding additional information of the host, thereby establishing a corresponding relationship between the additional information, the MAC address, and the real IP address, and after establishing the corresponding relationship between the additional information, the MAC address, and the real IP address, the proxy device can store the corresponding relationship.
In summary, on the proxy device in communication connection with the DHCP client and the DHCP server, the proxy device obtains a first discovery packet sent by the DHCP client, where the first discovery packet carries an MAC address of a host where the DHCP client is located. And screening the host through the MAC address to determine the host which does not acquire the additional information. If the proxy device does not hold a host name corresponding to the MAC address, the proxy device assigns a temporary IP address to the host, so that the proxy device can request additional information of the host from the host using the temporary IP address. In order to establish the corresponding relationship among the additional information, the MAC address and the real IP address, the agent first establishes and stores the corresponding relationship between the additional information and the MAC address of the host to prepare. Then the agent equipment acquires a second discovery message sent by the DHCP client, wherein the second discovery message carries an MAC address; and if the agent equipment is determined to store the additional information corresponding to the MAC address according to the corresponding relation between the additional information of the host and the MAC address, the agent equipment transmits a second discovery message to the DHCP server so that the DHCP server allocates a real IP address for the host. Therefore, the agent equipment acquires at least one DHCP message interacted between the DHCP server and the DHCP client, wherein the at least one DHCP message carries a real IP address and an MAC address; the agent device establishes the corresponding relation among the additional information, the MAC address and the real IP address according to the MAC address contained in the at least one DHCP message and the stored corresponding relation.
In such a way, the modification of the DHCP server for establishing the corresponding relation of the host name, the host MAC address and the real IP address is avoided, the proxy equipment does not need to specially detect the IP address and the MAC address of the client by using a detection tool, and the user of the client is prevented from carrying out corresponding shielding measures because the user worrys about excessive exposure of the information, so that the method for acquiring the additional information of the host provided by the embodiment of the invention is simple and easy to implement.
Fig. 3 is a flowchart of a method for acquiring additional information of a host according to an embodiment of the present invention. In the embodiment of the present invention, the proxy device is used as a proxy server, and the additional information of the host is used as a host name. Referring to fig. 3 in conjunction with the network architecture diagram shown in fig. 1 and the content of the embodiment shown in fig. 2, a method flow provided by the embodiment of the present invention includes:
step 301: the proxy server obtains a first discovery message sent by the DHCP client. The first discovery message carries the MAC address of the host where the DHCP client is located.
The host requiring the IP address broadcasts a first discovery message to the network through the DHCP client to request a lease of the IP address. Since the host to which the first discovery message belongs has not yet assigned an IP address, the source IP address in the first discovery message is 0.0.0.0.
All hosts on the local network can receive this broadcasted first discovery message, but only the DHCP server or the device with the function of assigning an IP address replies to this broadcast message.
As shown in fig. 1, the proxy server is in communication connection with the DHCP client and the DHCP server, i.e., the proxy server is connected in series between the DHCP client and the DHCP server, so the proxy server acquires the first discovery message before the DHCP server.
Step 302: and if the proxy server does not store the host name corresponding to the MAC address, the proxy server sends a first providing message to the DHCP client.
Wherein the first provisioning packet carries the temporary IP address.
After the proxy server acquires the first discovery message, the proxy server reads the MAC address in the chaddr field value of the first discovery message. The MAC address is the MAC address of the host where the DHCP client is located.
The proxy server searches the host name corresponding to the MAC address locally in the proxy server and judges whether the host name corresponding to the MAC address exists on the proxy server. And if the proxy server stores the host name corresponding to the MAC address, the first discovery message is transmitted in a transparent mode, so that the DHCP server allocates the IP address for the DHCP client. If the proxy server does not store the host name corresponding to the MAC address, the proxy server replies a providing message to the client. The proxy server is configured with the function of allocating an IP address of the DHCP server, so the proxy server can feed back a DHCP message such as a provisioning message to allocate a temporary IP address to the client.
And after the proxy server judges that the host name corresponding to the MAC address on the first discovery message is not stored on the proxy server, the proxy server allocates a temporary IP address to the DHCP client.
In some embodiments of the present invention, the lease time set by the proxy server for the temporary IP address is less than a preset time value. The lease time of the temporary IP address can be set to be smaller by setting the preset time value, for example, the preset time value is much smaller than the lease time corresponding to the real IP address allocated by the DHCP server. Thus, the proxy server sets a very small lease time to the temporary IP address. Therefore, the host to which the DHCP client belongs only uses the temporary IP address within a short period of time, and the DHCP client can reapply the IP address within a short period of time due to the expiration of lease time, so that the function limitation of the DHCP client caused by using the IP address which is not allocated by the DHCP server is reduced.
It can be understood that, in some embodiments, the lease time of the temporary IP address set by the proxy server may not be limited, as long as the proxy server can obtain the host name of the host where the DHCP client is located according to the temporary IP address.
In an embodiment of the present invention, the lease time is uniformly configured by the proxy server, and the proxy server may notify the DHCP client of the lease time through the first offer message and/or the first acknowledgement message.
In order to allocate a temporary IP address to the DHCP client, the proxy server sends a first offer packet to the DHCP client, where the first offer packet includes configuration information such as the temporary IP address allocated to the DHCP client.
For example, after acquiring the first discovery message of the DHCP client, the proxy server resolves that the MAC address of the chaddr field value of the first discovery message is "02-60-8C-57-a 1-02". After the proxy server inquires that the host name corresponding to the MAC address does not exist, the proxy server takes an IP address '209.0.0.5' from a free IP address pool managed by the proxy server as a temporary IP address, and allocates the temporary IP address to the client. The proxy server assigns a lease time of 1 minute to the temporary IP address. Then, the proxy server constructs a first providing message according to the information such as the temporary IP address, and sends the first providing message, wherein the YIaddr field on the first providing message carries the temporary IP address.
Step 303: the proxy server obtains a first request message sent by the DHCP client.
The request message includes the MAC address of the host where the DHCP client is located.
After acquiring a first providing message sent by the proxy server, the DHCP client selects a temporary IP address of a Yiaddr field carried in the first providing message as an address of the DHCP client, and constructs a first request message to send to the proxy server.
The DHCP client side responds to the first providing message sent by the proxy server by sending the first request message. The source addresses of the first request message are all 0 s, but the temporary IP address is carried in an option50requested IP address field of the first request message, that is, the first request message carries the temporary IP address.
The DHCP client may be connected to more than one proxy server, or may be connected to both the proxy server and other DHCP servers. At this time, the DHCP client broadcasts the first discovery message to the network, and the server that receives the first discovery message and is capable of providing the IP address responds with an provide message to the client to provide an IP address to the client. The client may receive offer messages from more than one server and the client may select one of the offer messages. And broadcasts a request message to the network indicating that it has accepted an IP address provided by a server. The request message contains the accepted IP address and the IP address of the server that has been accepted.
In the embodiment of the invention, a DHCP client broadcasts a first request message, the first request message carries the temporary IP address, and indicates that the DHCP client has accepted the temporary IP address distributed by the proxy server, and other DHCP servers know that: they can release the addresses that have been provided and return them to the free address pool.
The DHCP part identifies the data packet as a Request and confirms the provided Address by using a DHCP, Requested Address field. The Server Identifier field shows the IP address of the DHCP Server that provides the lease.
In the embodiment of the invention, the client selects the first providing message sent by the proxy server and returns the first request message to the proxy server.
Step 304: the proxy server sends a first confirmation message to the DHCP client.
After receiving a first request message sent by a DHCP client, the proxy server analyzes a chaddr field value carried in the request message to obtain an MAC address carried by the field.
The proxy server locally searches the host name corresponding to the MAC address. And if the host name corresponding to the MAC address exists, the proxy server passes through the request message. If the proxy Server does not store the host name corresponding to the MAC address, the proxy Server judges whether the content of the Server Identifier field of the first request message is the IP address of the proxy Server. If the message is not the IP address of the proxy server, the DHCP client side does not select the temporary IP address allocated by the proxy server, and therefore the message is discarded by the proxy server. If the content of the Server Identifier field of the first request message is the IP address of the proxy Server, it indicates that the DHCP client selects the temporary IP address allocated by the proxy Server, and the proxy Server sends a first acknowledgement message to the DHCP client. Generally, the confirmation message is a message sent by the DHCP server to confirm the lease of the IP address, and after the DHCP server sends the confirmation message, the IP address allocated in the allocation process is deleted from the free address pool, and the correspondence between the IP address allocated in the allocation process and the MAC address of the host to be allocated is added to the address allocation table. In this embodiment, it may also be understood that the first acknowledgement message indicates that the proxy server has completed the process of allocating the temporary IP address to the DHCP client.
The proxy server broadcasts and sends a first confirmation message to the DHCP client, which indicates that the proxy server has accepted the selection of the client, and puts the legal lease of the temporary IP address and other configuration information into the message and sends the message to the client. So that the proxy server has completed assigning the temporary IP address to the DHCP client.
After receiving the first acknowledgement message, the DHCP client uses the information in the message to perform a corresponding configuration operation. And the DHCP client binds the temporary IP address with the MAC address of the host. After the DHCP client is in the bound state, the IP address allocation process is completed, and the host where the DHCP client is located can use the temporary IP address to carry out network communication.
Step 305: the proxy server sends a response request message for requesting the host name to the host.
Wherein, the response request message carries the temporary IP address.
After the operation of allocating the temporary IP address to the client by the proxy server is completed, the proxy server can determine that the IP address currently used by the DHCP client is the temporary IP address, and the proxy server can determine the network position of the host where the DHCP client is located according to the temporary IP address. Therefore, in order to acquire the host name of the host, the proxy server sends a response request message to the host bound with the temporary IP address according to the temporary IP address, wherein the response request message is used for requesting the host name of the client.
For example, the response request message is sent out as an IP datagram composed of data of the IP datagram and a header of the datagram. The destination address of the IP datagram carrying the response request message is a temporary IP address bound by the DHCP client, i.e., the address of the host where the DHCP client is located, "209.0.0.5", and the source address is the IP address "128.30.33.33" of the proxy server.
Step 306: the proxy server obtains the response message sent by the host.
Wherein, the response message carries the host name of the host.
In some embodiments of the present invention, the proxy server may further obtain other additional information, such as information of a home department of the host, software and hardware configuration information of the host, and the like.
After the host where the DHCP client is located obtains the response request message, the host name of the host is obtained according to the indication of the message, a response message is constructed according to the host name, and the host sends the response message to the proxy server so that the proxy server obtains the host name of the host.
For example, the host constructs a response reply message according to its host name "PC 01", and the response reply message is sent out as IP datagram data, and adds the header of the datagram. The destination address of the IP datagram carrying the response reply message is the IP address "128.30.33.33" of the proxy server, and the source address is the temporary IP address "209.0.0.5" bound by the host.
Step 304 and step 305 are one way to request the host name of the host from the host using the temporary IP address.
As can be seen from the above, in order to obtain the host name of the host, the proxy server determines the network location of the host first, and when the host sends a discovery message through the DHCP client to apply for an IP address, the proxy server pre-allocates a temporary IP address to the DHCP client, and after the DHCP client binds the temporary IP address, the proxy server can determine the network location of the host where the DHCP client is located according to the temporary IP address, and send a request for obtaining the host name to the host according to the temporary IP address, so as to obtain the host name of the host. Because the temporary IP address is allocated to the DHCP client by the proxy server, the current IP address of the host where the DHCP client is located does not need to be detected.
Step 307: the proxy server establishes a corresponding relation between the host name and the MAC address of the host;
after the proxy server obtains the response message, the message is analyzed to obtain the host name of the host where the DHCP client side is located, which is carried by the message, and then the corresponding relation between the host name of the host and the MAC address of the host is established. And storing the corresponding relation between the host name and the MAC address.
The corresponding relationship may be established by the process that the response packet carries the temporary IP address and the host name, so that the host name and the temporary IP address belonging to the same host are obtained according to the response packet, and then the proxy server establishes the corresponding relationship between the host name of the host and the MAC address of the host by using the temporary IP address as an index according to the corresponding relationship between the MAC address and the temporary IP address pre-established on the proxy server. Or, with the order as an intermediary, after the proxy server obtains the MAC address of a host and allocates a temporary IP address to the host to which the MAC address belongs, the proxy server only sends a response request message, and then, after the proxy server obtains the first response message, the proxy server directly establishes the corresponding relationship between the host name and the MAC address by using the host name carried in the response message and the MAC address obtained before. The proxy server may also use other methods to establish the corresponding relationship between the host name and the MAC address, which is not specifically limited in the embodiment of the present invention.
As shown in table one, the proxy server according to the embodiment of the present invention may establish and store a corresponding relationship between multiple groups of host names and MAC addresses.
Watch 1
MAC address Host name
02-60-8C-57-A1-02 PC01
00-00-C0-15-AD-18 PC02
08-00-2B-00-EE-0A PC03
After the proxy server obtains the host name, the host to which the host name belongs can release the temporary IP address, so that the host can obtain a real IP address distributed by a real DHCP server through a DHCP client, and a normal network communication function is realized. And the proxy server can also acquire the real IP address allocated to the DHCP client by the DHCP server. There are various methods for the DHCP client to release the temporary IP address, which is not specifically limited in this embodiment of the present invention. For example:
method 1
As described above, since the lease time of the temporary IP address bound by the DHCP client is short, after the lease time expires, the DHCP client broadcasts the request message to the proxy server again to request for updating the lease. And when acquiring a request message broadcasted by the DHCP client, the proxy server sends a negative acknowledgement message to the DHCP client. After the DHCP client receives the negative acknowledgement message, the DHCP client stops using the temporary IP address, and the DHCP client sends a release message to the proxy server. And when the release message sent by the DHCP client is obtained, the proxy server releases the temporary IP address. Thus, the state of the DHCP client enters the initial state, and the request IP address is restarted.
In the embodiment shown in fig. 3, a first method is used, that is, the method of the embodiment of the present invention further includes:
step 308: and the DHCP client sends a second request message to the proxy server.
Step 309: the proxy server sends a negative acknowledgement message to the DHCP client.
Step 310: and the DHCP client sends a release message to the proxy server.
The second way,
When the lease time of the temporary IP address acquired by the DHCP client reaches 50% of the lease time, the DHCP client sends a request message in a unicast mode, and the proxy server does not respond to the client. That is, when the unicast request message of the DHCP client is acquired, the proxy server does not respond to the DHCP client.
And when the lease time of the temporary IP address of the DHCP client reaches 87.5 percent of the lease, the DHCP client sends a request message in a broadcasting mode. And when acquiring a request message broadcasted by the DHCP client, the proxy server sends a negative acknowledgement message to the DHCP client. And after receiving the negative acknowledgement message, the DHCP client sends a release message to the proxy server. And when the release message sent by the DHCP client is obtained, the proxy server releases the temporary IP address. Thus, the state of the DHCP client enters the initial state, and the request IP address is restarted.
Therefore, the proxy server can release the temporary IP address allocated to the DHCP client before by sending the negative acknowledgement message.
Mode III
When the lease time of the temporary IP address acquired by the DHCP client reaches 50% of the lease time, the DHCP client sends a unicast request message, and the proxy server does not respond to the client. When the lease time of the temporary IP address of the DHCP client reaches 87.5 percent of the lease time, the DHCP client sends out a broadcast request message, and the proxy server does not respond to the DHCP client. And when the address lease of the DHCP client is over, the DHCP client sends a release message or does not send any message, and directly restarts applying for the address.
That is, in the third method, the proxy server does not respond to the DHCP messages of the same type as the lease time update of the DHCP client. And the client unbinds the temporary IP address after the lease time of the temporary IP address is expired.
After returning to the initial state, the DHCP client restarts a new round of IP address lease process. The following is a corresponding execution flow of each device in the embodiment of the present invention after the proxy server obtains the host name.
Step 311: and the proxy server acquires a second discovery message sent by the DHCP client.
And the second discovery message carries the MAC address of the host where the DHCP client is located.
The DHCP client applies for the IP address again, the DHCP client broadcasts a second discovery message to the DHCP server, and the proxy server is arranged between the DHCP server and the DHCP client, so that the proxy server obtains the second discovery message before the DHCP server.
Step 312: and the proxy server transparently transmits the second discovery message to the DHCP server.
After the proxy server obtains the second discovery message, the proxy server analyzes the second discovery message, and obtains an MAC address on a chaddr field on the discovery message, where the MAC address is an MAC address of a host where the DHCP client is located.
And the proxy server searches whether the host name corresponding to the MAC address on the second discovery message exists on the proxy server according to the pre-established corresponding relation between the host name and the MAC address. And if the host name corresponding to the MAC address is stored in the proxy server according to the corresponding relation, the proxy server transmits the second discovery message to a DHCP server so that the DHCP server allocates a real IP address for the host. If the proxy server does not have the corresponding host name, the proxy server assigns a temporary IP address to the client, i.e. the method of the embodiment of the present invention is executed from step 302.
Step 313: and the DHCP server sends a second providing message to the DHCP client.
And after the DHCP server acquires the second discovery message, distributing a real IP address for the DHCP client. The DHCP server searches the configuration information of the DHCP client in a database thereof, and if the configuration information is found, the found configuration information is returned; if not, the DHCP server takes an IP address from the idle IP address pool of the DHCP server and allocates the IP address to the DHCP client. Therefore, the DHCP server constructs a second provisioning packet according to the IP address allocated to the client, where the second provisioning packet carries configuration information such as the IP address. And the DHCP server sends the second providing message to the DHCP client. The IP address allocated by the DHCP server carried by the second offer packet to the DHCP client is the real IP address.
In the embodiment of the present invention, the lease time set by the DHCP server may be configured by the DHCP server, and the DHCP server may notify the client of the lease time through the second DHCP offer message and/or the second DHCP acknowledge message.
Step 314: and the DHCP client sends a third request message to the DHCP server.
After receiving the second DHCP offer message, the DHCP client selects the Yiaddr field value carried in the message as the address of the host where the DHCP client is located, and constructs a third request message to send to the DHCP server.
In the embodiment of the present invention, the third request packet is first obtained by the proxy server, and then transmitted to the DHCP server by the proxy server.
And after receiving the third request message sent by the DHCP client, the DHCP server responds a second confirmation message to the DHCP client.
Step 315: and the proxy server acquires a second confirmation message sent by the DHCP server.
The second acknowledgement message carries the real IP address and the MAC address of the host where the DHCP client is located.
And after receiving the third request message sent by the DHCP client, the DHCP server responds to the second confirmation message. Since the Yiaddr field value of the second acknowledgement packet carries the real IP address assigned by the client and the chaddr field value carries the MAC address of the host where the DHCP client is located, the proxy server analyzes the second acknowledgement packet, and thus the real IP address and the MAC address of the host can be obtained. Because the IP address and the MAC address come from the same confirmation message, the IP address and the MAC address can be determined to belong to the same host.
Step 316: the proxy server establishes a correspondence between the host name, the MAC address, and the real IP address according to the MAC address in the second acknowledgment packet and the correspondence stored in step 307.
After the proxy server obtains the IP address allocated to the DHCP client by the DHCP server and the MAC address of the host where the DHCP client is located, the proxy server queries the host name corresponding to the MAC address of the second confirmation message from the pre-established and stored corresponding relationship between the host name and the MAC address, and after the corresponding host name is obtained, the proxy server can establish the corresponding relationship among the real IP address, the host name of the host and the MAC address of the host. After the corresponding relation of the three is established, the proxy server stores the corresponding relation.
For example, after acquiring the second acknowledgement message sent by the DHCP server, the proxy server resolves that the MAC address of the host where the DHCP client in the chaddr field value is located on the message is "02-60-8C-57-a 1-02", and the IP address allocated to the DHCP client in the Yiaddr field value of the message is "209.0.0.11". The proxy server can search the host name of the local record through the MAC address of the chaddr field value, and after the host name is searched, the proxy server can establish the corresponding relation between the host name, the IP address allocated by the DHCP client and the MAC address of the host. For example, if the correspondence between the MAC address and the host name is stored in the proxy server as shown in Table one, the proxy server identifies the host name PC01 from the correspondence in Table one according to the MAC address "02-60-8C-57-A1-02" in the chaddr field value in the acknowledgment packet. Thus, the proxy server can establish the correspondence among the correspondence MAC address, IP address, and host name: 02-60-8C-57-A1-02, 209.0.0.11 and PC 01.
Step 317: and the proxy server transparently transmits the second confirmation message to the DHCP client.
After the proxy server obtains the second confirmation message, the proxy server may pass through the second confirmation message to the DHCP client, so that the DHCP client completes the binding of the IP address and the MAC address of the host where the DHCP client is located, and the host starts to use the IP address allocated by the DHCP server.
It is understood that the execution order of step 317 is not particularly limited in the embodiment of the present invention, as long as it is after step 315.
In summary, on the proxy device in communication connection with the DHCP client and the DHCP server, the proxy device obtains a first discovery packet sent by the DHCP client, where the first discovery packet carries an MAC address of a host where the DHCP client is located. And screening the host through the MAC address to determine the host which does not acquire the additional information. If the proxy device does not hold a host name corresponding to the MAC address, the proxy device assigns a temporary IP address to the host, so that the proxy device can request additional information of the host from the host using the temporary IP address. In order to establish the corresponding relationship among the additional information, the MAC address and the real IP address, the agent first establishes and stores the corresponding relationship between the additional information and the MAC address of the host to prepare. Then the agent equipment acquires a second discovery message sent by the DHCP client, wherein the second discovery message carries an MAC address; and if the agent equipment is determined to store the additional information corresponding to the MAC address according to the corresponding relation between the additional information of the host and the MAC address, the agent equipment transmits a second discovery message to the DHCP server so that the DHCP server allocates a real IP address for the host. Therefore, the agent equipment acquires at least one DHCP message interacted between the DHCP server and the DHCP client, wherein the at least one DHCP message carries a real IP address and an MAC address; the agent device establishes the corresponding relation among the additional information, the MAC address and the real IP address according to the MAC address contained in the at least one DHCP message and the stored corresponding relation.
In such a way, the modification of the DHCP server for establishing the corresponding relation of the additional information of the host, the MAC address of the host and the real IP address is avoided, the proxy equipment does not need to specially detect the IP address and the MAC address of the client by using a detection tool, and the corresponding shielding measures are prevented from being carried out by the user of the client because the user worrys about the excessive exposure of the information of the user. Therefore, the method for acquiring the additional information of the host provided by the embodiment of the invention is simple and easy to implement.
Fig. 4 is a flowchart of a method for acquiring additional information of a host according to an embodiment of the present invention, where the method is executed by a proxy device, and the proxy device is in communication connection with a DHCP client and a DHCP server, respectively, and the method includes:
step 401: the proxy equipment acquires a request message sent by the DHCP client.
The request message carries the first transactioniD and the MAC address of the host where the DHCP client is located.
When a DHCP client applies for an IP address, the DHCP client broadcasts a discovery message to a network, a DHCP server which acquires the discovery message allocates the IP address to the DHCP client, and the DHCP server sends a providing message to the DHCP client, wherein the providing message comprises the IP address allocated by the DHCP server.
Because the proxy equipment is arranged between the DHCP servers of the DHCP client, the proxy equipment can transparently transmit the discovery message and the provided message after acquiring the two messages. After the DHCP client side obtains the provided message, the request message is sent to the DHCP server, at the moment, the agent equipment obtains the message to be requested, the agent equipment transmits the request message in a transparent mode, and the request message is analyzed to obtain the first transactioniD of the request message. In some embodiments, after the proxy device analyzes the request packet, the proxy device further obtains an MAC address of a host where the DHCP client is located.
Step 402: the agent equipment acquires the confirmation message sent by the DHCP server.
The confirmation message includes the second TransactionID and an IP address allocated by the DHCP server to the DHCP client.
After obtaining the request message, the DHCP server sends a confirmation message to the DHCP client, where the confirmation message carries the second TransactionID and an IP address allocated by the DHCP server to the DHCP client. After intercepting the confirmation message, the agent device analyzes the confirmation message to obtain the second transactioniD and the IP address.
Step 403: when the first TransactionID and the second TransactionID are the same, the proxy apparatus requests additional information of the host from the host using the IP address.
And the agent equipment compares the first transactioniD with the second transactioniD, and if the first transactioniD is the same as the second transactioniD, the IP address on the confirmation message is determined to be allocated to the host connected with the agent equipment. The proxy device may determine the network location of the corresponding host based on the IP address, such that the proxy device may request additional information from the host assigned to the IP address using the IP address.
Optionally, in some embodiments, the proxy server may further establish a correspondence relationship between the additional information, the MAC address, and the real IP address. At this time, in this embodiment, before requesting additional information of the host from the host using the IP address, the method further includes:
the corresponding relation between the MAC address and the IP address is established and stored, so that the MAC address and the IP address can be mutually identified on the agent equipment and belong to the same host, and the MAC address and the IP address on the agent equipment are prevented from being mixed when the agent equipment is connected with a plurality of hosts.
And after requesting additional information of the host from the host using the IP address, the method of an embodiment of the present invention further includes: and establishing the corresponding relation among the IP address, the additional information and the MAC address according to the stored corresponding relation and the IP address.
Thus, the additional information of the host is requested from the host by using the IP address, the additional information corresponding to the IP address can be obtained, the corresponding relation between the MAC address and the IP address which is established in advance is searched according to the IP address, the corresponding MAC address is found out, the proxy equipment can establish the corresponding relation between the IP address, the additional information and the MAC address, and after the corresponding relation between the IP address, the additional information and the MAC address is established, the proxy equipment can store the corresponding relation between the IP address, the additional information and the MAC address or send the corresponding relation between the IP address, the additional information and the MAC address to other equipment.
In summary, on the proxy device in communication connection with the DHCP client and the DHCP server, the proxy device obtains a request message sent by the DHCP client, where the request message carries the first TransactionID and the MAC address of the host where the DHCP client is located; the proxy equipment also acquires a confirmation message sent by the DHCP server, wherein the confirmation message comprises a second transactioniD and an IP address distributed by the DHCP server for the DHCP client; when the first transactioniD is matched with the second transactioniD, the corresponding relation between the MAC address and the IP address is established and stored, so that the agent equipment can enable the MAC address and the IP address on the agent equipment to be mutually identified and determine the MAC address and the IP address which are positioned in the same host. Then, the proxy device uses the IP address to request the additional information of the host from the host, and establishes the corresponding relation among the IP address, the additional information and the MAC address according to the stored corresponding relation and the IP address.
In such a way, the modification of the DHCP server for establishing the corresponding relation of the additional information, the MAC address and the IP address of the host is avoided, the proxy equipment does not need to specially detect the IP address and the MAC address of the client by using a detection tool, and the corresponding shielding measures are prevented from being carried out by the user of the client because the user worrys about the excessive exposure of the information of the user. Therefore, the method for acquiring the additional information of the host provided by the embodiment of the invention is simple and easy to implement.
Fig. 5 is a flowchart of a method for acquiring additional information of a host according to an embodiment of the present invention. In the embodiment shown in fig. 5, the proxy device is used as a proxy server, and the additional information of the host is a host name. Referring to fig. 5 in conjunction with the network architecture diagram shown in fig. 1 and the content of the above embodiment shown in fig. 4, a method flow provided by the embodiment of the present invention includes:
step 501: the DHCP client sends a discovery message to the DHCP server.
The DHCP client broadcasts a discovery message to request a lease of an IP address. Since the client does not currently have its own IP address, it sets the source IP address of the IP datagram to which the DHCP discover message belongs to all 0 s.
The proxy server is arranged between the client and the server, so that messages interacted between the client and the server pass through the proxy server. In the embodiment of the invention, the proxy server can directly transmit the discovery message to the DHCP server. The transparent transmission of the embodiment of the invention can mean that the message passes through the proxy server, and the proxy server analyzes the MAC and IP header information of the message and directly transmits the message without the intervention of the proxy server in the midway.
Step 502: the DHCP server sends a provisioning message to the DHCP client.
Implementation details of step 502 may refer to step 313.
Step 503: the proxy server obtains a request message sent by the DHCP client.
The request message carries the first transactioniD and the MAC address of the host where the DHCP client is located.
The DHCP client may receive a plurality of offer messages sent by different DHCP servers, select one of the DHCP servers, and send a DHCP request message to the selected DHCP server. In this embodiment, the client sends the DHCP request message to the DHCP server, and the proxy server obtains the DHCP request message before the DHCP server.
After the proxy server obtains the DHCP request message sent by the client, the proxy server analyzes the DHCP request message to obtain the MAC address and the first transactioniD of the host where the DHCP client is located, wherein the MAC address and the first transactioniD are carried in the message. And the proxy server transparently transmits the DHCP request message to the DHCP server.
Step 504: and the proxy server transmits the request message to the DHCP server.
And after acquiring the request message, the proxy server transmits the request message to the DHCP server.
Step 505: the proxy server obtains the confirmation message sent by the DHCP server.
The confirmation message includes the second TransactionID and an IP address allocated by the DHCP server to the DHCP client.
After the DHCP server selected by the DHCP client side obtains the request message, a confirmation message is broadcasted and returned to the DHCP client side, the fact that the selection of the DHCP client side is accepted is indicated, and the IP address and other configuration information are placed in the message and sent to the DHCP client side. Because the proxy server is arranged between the client and the server, the proxy server acquires the confirmation message sent to the DHCP client by the DHCP server before the client.
And after obtaining the confirmation message, the proxy server transparently transmits the confirmation message to the DHCP client, and analyzes the confirmation message on the proxy server to obtain the IP address and the second transactioniD allocated to the DHCP client on the confirmation message. The Transaction ID is a random number selected by the client each time the client sends a DHCP request message, and the response message for matching the DHCP server is a response corresponding to which request message. The DHCP client may discard the response packet with "transaction ID" mismatch.
Thus, the proxy server obtains the IP address allocated by the DHCP client.
Step 506: when the first transactioniD and the second transactioniD are the same, the proxy server establishes and stores the corresponding relation between the MAC address and the IP address.
Since the MAC address acquired in step 304 corresponds to the TransactionID and the IP address acquired in step 306 corresponds to the TransactionID, the proxy server establishes a correspondence between the MAC address of the client and the IP address of the client according to the index of the TransactionID.
Step 507: and the proxy server transparently transmits the confirmation message to the client.
After the proxy server obtains the confirmation message, the proxy server can transmit the confirmation message to the DHCP client so that the client can complete the binding of the IP address and the MAC address of the client, and thus the host where the DHCP client is located starts to use the IP address allocated by the DHCP server.
Step 508: the proxy server sends a response request message for requesting the host name to the host.
Wherein, the response request message carries the IP address allocated by the host.
After the DHCP client binds the IP address, the host where the DHCP client is located can use the IP address. After the proxy server obtains the IP address allocated by the DHCP client, the proxy server can judge that the DHCP client uses the IP address currently, and then sends a response request message to a host bound with the IP address according to the IP address. The response request message is used for requesting the host name of the client.
In particular, step 305 may be referred to for implementation details of step 508.
Step 509: the proxy server obtains the response message sent by the host.
Wherein, the response message carries the host name of the host.
Implementation details of step 509 may refer to step 306.
Step 508 and step 509 are one way for the particular proxy server to request a host name from the machine using the IP address.
Step 510: and the proxy server establishes the corresponding relation among the IP address, the host name and the MAC address according to the stored corresponding relation and the IP address.
The response message sent by the host carries the IP address of the host, so that the proxy server analyzes the response message to obtain the IP address and the host name of the host. The proxy server acquires the MAC address corresponding to the IP address carried by the response message according to the pre-established corresponding relationship between the MAC address and the IP address, so that the corresponding relationship between the host name of the host and the MAC address and the IP address of the host can be established, namely the corresponding relationship between the IP address and the pre-stored MAC address and IP address is established. The established correspondence of IP addresses, host names, and MAC addresses may then be stored.
In summary, on the proxy device in communication connection with the DHCP client and the DHCP server, the proxy device obtains a request message sent by the DHCP client, where the request message carries the first TransactionID and the MAC address of the host where the DHCP client is located. The proxy equipment also acquires a confirmation message sent by the DHCP server, wherein the confirmation message comprises the second transactioniD and an IP address distributed by the DHCP server for the DHCP client. And when the first transactioniD and the second transactioniD are the same, establishing and storing the corresponding relation between the MAC address and the IP address. In this way, the proxy device can make the MAC address and the IP address on the proxy device mutually identify, and determine the MAC address and the IP address of the same host. Then, the proxy device uses the IP address to request the additional information of the host from the host, and establishes the corresponding relation among the IP address, the additional information and the MAC address according to the stored corresponding relation and the IP address.
In such a way, the modification of the DHCP server for establishing the corresponding relation of the host name, the MAC address and the IP address is avoided, the proxy equipment does not need to specially detect the IP address and the MAC address of the client by using a detection tool, and the corresponding shielding measures are prevented from being carried out by the user of the client because the user worrys about the excessive exposure of the information of the user. Therefore, the method for acquiring the additional information of the host provided by the embodiment of the invention is simple and easy to implement.
Fig. 6 is a schematic structural diagram of a proxy device according to an embodiment of the present invention, where the proxy device is configured to execute a function executed by the proxy device implemented in any one of embodiments corresponding to fig. 2 and fig. 3. The proxy device is in communication connection with the DHCP client and the DHCP server, respectively, see fig. 6, and comprises:
a first obtaining unit 601, configured to obtain a first discovery packet sent by a DHCP client, where the first discovery packet carries an MAC address of a host where the DHCP client is located;
an allocating unit 602, configured to allocate a temporary IP address to the host if the host name corresponding to the MAC address is not stored in the proxy device;
a requesting unit 603 for requesting additional information of the host from the host using the temporary IP address.
Alternatively,
the proxy device further includes:
a first establishing unit 604, configured to establish and store a corresponding relationship between additional information of the host and the MAC address;
a second obtaining unit 605, configured to obtain a second discovery packet sent by the DHCP client, where the second discovery packet carries an MAC address, and the second discovery packet is sent after the temporary IP address of the DHCP client is released;
a transparent transmission unit 606, configured to transmit the second discovery message to the DHCP server if it is determined that the proxy device stores additional information corresponding to the MAC address carried in the second discovery message according to a correspondence between the additional information of the host and the MAC address, so that the DHCP server allocates a real IP address for the host;
a third obtaining unit 607, configured to obtain at least one DHCP message exchanged between the DHCP server and the DHCP client, where the at least one DHCP message carries a real IP address and an MAC address;
a second establishing unit 608, configured to establish a corresponding relationship among the additional information, the MAC address, and the real IP address according to the MAC address included in the at least one DHCP message and the stored corresponding relationship.
Alternatively,
and the at least one DHCP message comprises an acknowledgement message sent by the DHCP server or a providing message sent by the DHCP server.
Alternatively,
a requesting unit 603, including:
a first sending subunit 609, configured to send a response request packet for requesting additional information to the host, where the response request packet carries a temporary IP address;
the first obtaining subunit 610 is configured to obtain a response message sent by the host, where a source IP address of the response message is a temporary IP address, and the response message carries additional information of the host.
Alternatively,
a dispensing unit 602, comprising:
the second sending subunit 611 is configured to send a providing packet to the DHCP client, where the providing packet carries the temporary IP address;
a second obtaining subunit 612, configured to obtain a request packet sent by the DHCP client, where the request packet carries a temporary IP address, and the request packet carries an MAC address;
a determining subunit 613, configured to determine whether the content of the Server Identifier field of the request packet is the IP address of the proxy device if the proxy device does not store the additional information corresponding to the MAC address;
a third sending subunit 614, configured to send, if the content of the Server Identifier field of the request message is the IP address of the proxy device, a confirmation message to the DHCP client, where the confirmation message is used to indicate that the proxy device has completed the process of allocating the temporary IP address to the DHCP client.
Alternatively,
the proxy device further includes:
a first sending unit 615, configured to send a negative acknowledgement message to the DHCP client when acquiring the request message broadcast by the DHCP client;
a first releasing unit 616, configured to release the temporary IP address when obtaining a release packet sent by the DHCP client.
Alternatively,
the proxy device further includes:
a third obtaining unit 617, configured to not respond to the DHCP client when obtaining the request packet of the client unicast;
a second sending unit 618, configured to send a negative acknowledgement message to the DHCP client when acquiring the request message broadcast by the client;
a second releasing unit 619, configured to release the temporary IP address when the release packet sent by the DHCP client is obtained.
In summary, in the proxy device that is in communication connection with the DHCP client and the DHCP server, respectively, the first obtaining unit 601 obtains a first discovery packet sent by the DHCP client, where the first discovery packet carries an MAC address of a host where the DHCP client is located. If the proxy device does not hold a host name corresponding to the MAC address, the assigning unit 602 assigns a temporary IP address to the host. Then, the requesting unit 603 requests additional information of the host from the host using the temporary IP address. Therefore, the agent equipment is only needed to be deployed between the DHCP client and the DHCP server, and when the agent equipment applies for an IP address at the DHCP client, the agent equipment performs screening through the MAC address of the host on the discovery message sent by the DHCP client to determine whether the additional information of the host is acquired. If not, the proxy equipment allocates a temporary IP address for the DHCP client, so that the network position of the host where the DHCP client is located can be determined through the temporary IP address, and the proxy equipment can request the host for additional information of the host by using the temporary IP address. In such a way, the modification of the DHCP server for acquiring the additional information of the host is avoided, the proxy equipment does not need to specially detect the IP address of the client by using a detection tool, and the user of the client is prevented from carrying out corresponding shielding measures because the user worrys about excessive exposure of the information of the user. Therefore, the method provided by the embodiment of the invention is simple and feasible.
Fig. 7 is a schematic diagram of a hardware structure of a proxy device according to an embodiment of the present invention. Referring to fig. 7, another embodiment of the proxy device in the embodiment of the present invention specifically includes: the proxy device 700 may vary significantly depending on configuration or performance, and may include one or more Central Processing Units (CPUs) 701 (e.g., one or more processors) and memory 702, one or more storage media 503 (e.g., one or more mass storage devices) storing applications 7031 or data 7032. Memory 702 and storage medium 703 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 703 may include one or more modules (not shown), each of which may include a series of instructions operating on a server. Further, the central processor 701 may be configured to communicate with the storage medium 703, and execute a series of instruction operations in the storage medium 703 on the proxy apparatus 700.
The proxy device 700 may also include one or more power supplies 704, one or more wired or wireless network interfaces 705, one or more input-output interfaces 706, and/or one or more operating systems 7033, such as Windows Server (TM), Mac OS XTM, Unix (TM), Linux (TM), FreeBSD (TM), and so forth.
The steps performed by the proxy device in the above embodiments may be based on the proxy device structure shown in fig. 7.
The specific situation is as follows:
the central processing unit 701 has the following functions:
acquiring a first discovery message sent by a DHCP client, wherein the first discovery message carries an MAC address of a host where the DHCP client is located;
if the agent equipment does not store the host name corresponding to the MAC address, a temporary IP address is allocated to the host;
additional information of the host is requested from the host using the temporary IP address.
Optionally, the central processing unit 701 specifically has the following functions:
establishing and storing the corresponding relation between the additional information of the host and the MAC address;
acquiring a second discovery message sent by the DHCP client, wherein the second discovery message carries an MAC address and is sent by the DHCP client after the temporary IP address is released;
if the agent equipment is determined to store the additional information corresponding to the MAC address carried by the second discovery message according to the corresponding relation between the additional information of the host and the MAC address, transmitting the second discovery message to the DHCP server so that the DHCP server allocates a real IP address for the host;
acquiring at least one DHCP message interacted between a DHCP server and a DHCP client, wherein the at least one DHCP message carries a real IP address and an MAC address;
and establishing the corresponding relation among the additional information, the MAC address and the real IP address according to the MAC address contained in the at least one DHCP message and the stored corresponding relation.
Optionally, the central processing unit 701 specifically has the following functions:
sending a response request message for requesting additional information to the host, wherein the response request message carries a temporary IP address;
and acquiring a response message sent by the host, wherein the source IP address of the response message is a temporary IP address, and the response message carries additional information of the host.
Optionally, the central processing unit 701 specifically has the following functions:
sending a providing message to the DHCP client, wherein the providing message carries a temporary IP address;
acquiring a request message sent by a DHCP client, wherein the request message carries a temporary IP address and the request message carries an MAC address;
if the proxy equipment does not store the additional information corresponding to the MAC address, judging whether the content of the Server Identifier field of the request message is the IP address of the proxy equipment or not;
and if the content of the Server Identifier field of the request message is the IP address of the proxy equipment, sending a confirmation message to the DHCP client, wherein the confirmation message is used for indicating that the proxy equipment completes the process of allocating the temporary IP address to the DHCP client.
Optionally, the central processing unit 701 specifically has the following functions:
when a request message broadcasted by a DHCP client is acquired, a denial message is sent to the DHCP client;
and when a release message sent by the DHCP client is obtained, releasing the temporary IP address.
Optionally, the central processing unit 701 specifically has the following functions:
when a request message of client unicast is acquired, the DHCP client is not responded;
when a request message sent by a client in a broadcast mode is acquired, a negative acknowledgement message is sent to a DHCP client;
and when a release message sent by the DHCP client is obtained, releasing the temporary IP address.
In summary, in the proxy device that is in communication connection with the DHCP client and the DHCP server, respectively, the central processor 701 obtains a first discovery packet sent by the DHCP client, where the first discovery packet carries an MAC address of a host where the DHCP client is located. If the proxy device does not store the host name corresponding to the MAC address, the central processing unit 701 allocates a temporary IP address to the host. Then, the central processor 701 requests additional information of the host from the host using the temporary IP address. Therefore, the agent equipment is only needed to be deployed between the DHCP client and the DHCP server, and when the agent equipment applies for an IP address at the DHCP client, the agent equipment performs screening through the MAC address of the host on the discovery message sent by the DHCP client to determine whether the additional information of the host is acquired. If not, the proxy equipment allocates a temporary IP address for the DHCP client, so that the network position of the host where the DHCP client is located can be determined through the temporary IP address, and the proxy equipment can request the host for additional information of the host by using the temporary IP address. In such a way, the modification of the DHCP server for acquiring the additional information of the host is avoided, the proxy equipment does not need to specially detect the IP address of the client by using a detection tool, and the user of the client is prevented from carrying out corresponding shielding measures because the user worrys about excessive exposure of the information of the user. Therefore, the method provided by the embodiment of the invention is simple and feasible.
Fig. 8 is a schematic structural diagram of a proxy device according to an embodiment of the present invention, where the proxy device is configured to execute a function executed by the proxy device implemented in any one of embodiments corresponding to fig. 4 and fig. 5. The proxy device is in communication connection with the DHCP client and the DHCP server, respectively, see fig. 8, and comprises:
a first obtaining unit 801, configured to obtain a request message sent by a DHCP client, where the request message carries a first TransactionID and an MAC address of a host where the DHCP client is located;
a second obtaining unit 802, configured to obtain a confirmation message sent by the DHCP server, where the confirmation message includes a second TransactionID and an IP address allocated by the DHCP server to the DHCP client;
a requesting unit 803, configured to request additional information of the host from the host using the IP address when the first TransactionID and the second TransactionID are the same.
Alternatively,
the proxy device further includes: a first establishing unit 804 and a second establishing unit 805,
a first establishing unit 804, configured to establish and store a correspondence between an MAC address and an IP address;
a second establishing unit 805, configured to establish a corresponding relationship among the IP address, the additional information, and the MAC address according to the stored corresponding relationship and the IP address.
Alternatively,
a request unit 803, including:
a sending subunit 806, configured to send a response request packet for requesting additional information to the host, where the response request packet carries an IP address;
the obtaining subunit 807 is configured to obtain a response message sent by the host, where the response message carries additional information of the host.
In summary, on the proxy devices respectively in communication connection with the DHCP client and the DHCP server, the first obtaining unit 801 obtains a request message sent by the DHCP client, where the request message carries the first TransactionID and the MAC address of the host where the DHCP client is located; the second obtaining unit 802 obtains a confirmation message sent by the DHCP server, where the confirmation message includes a second TransactionID and an IP address allocated by the DHCP server to the DHCP client; when the first TransactionID and the second TransactionID match, the requesting unit 803 requests the host for additional information of the host using the IP address. In such a way, the modification of the DHCP server for acquiring the additional information of the host is avoided, the proxy equipment does not need to specially detect the IP address of the client by using a detection tool, and the user of the client is prevented from carrying out corresponding shielding measures because the user worrys about excessive exposure of the information of the user. Therefore, the method provided by the embodiment of the invention is simple and feasible.
The proxy device in the embodiment of the present invention has another embodiment, and referring to the hardware structure of the proxy device shown in fig. 7, the proxy device also has a hardware structure similar to the hardware structure of the proxy device shown in fig. 7, that is, the proxy device specifically includes: the agent device may vary significantly depending on configuration or performance, and may include one or more Central Processing Units (CPUs) (e.g., one or more processors) and memory, one or more storage media (e.g., one or more mass storage devices) that store applications or data. The memory and storage medium may be, among other things, transient or persistent storage. The program stored on the storage medium may include one or more modules (not shown), each of which may include a series of instructions operating on the database control system. Still further, the central processor may be configured to communicate with the storage medium to execute a series of instruction operations in the storage medium on the proxy device.
The proxy device may also include one or more power supplies, one or more wired or wireless network interfaces, one or more input-output interfaces, and/or one or more operating systems, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, and the like.
The steps performed by the proxy device in the embodiments of fig. 4 and 5 described above may be based on the proxy device structure described above. The functions of the proxy apparatus shown in fig. 8 may be performed based on the hardware structure of the proxy apparatus of the embodiment of the present invention.
The specific situation is as follows:
the central processing unit of the agent device has the following functions: acquiring a request message sent by a DHCP client, wherein the request message carries a first transactioniD and an MAC address of a host where the DHCP client is located; acquiring a confirmation message sent by the DHCP server, wherein the confirmation message comprises a second transactioniD and an IP address allocated by the DHCP server for the DHCP client; when the first TransactionID and the second TransactionID are the same, additional information of the host is requested from the host using the IP address.
Optionally, the central processing unit of the proxy device has the following functions:
establishing and storing a corresponding relation between the MAC address and the IP address; and establishing the corresponding relation among the IP address, the additional information and the MAC address according to the stored corresponding relation and the IP address.
Optionally, the central processing unit of the proxy device has the following functions: sending a response request message for requesting additional information to the host, wherein the response request message carries an IP address; and acquiring a response message sent by the host, wherein the response message carries additional information of the host.
In summary, on the proxy device in communication connection with the DHCP client and the DHCP server, the central processing unit obtains a request message sent by the DHCP client, where the request message carries the first TransactionID and the MAC address of the host where the DHCP client is located. The central processing unit also acquires a confirmation message sent by the DHCP server, wherein the confirmation message comprises a second transactioniD and an IP address distributed by the DHCP server for the DHCP client; when the first TransactionID and the second TransactionID match, the central processor requests additional information of the host from the host using the IP address. In such a way, the modification of the DHCP server for acquiring the additional information of the host is avoided, the proxy equipment does not need to specially detect the IP address of the client by using a detection tool, and the user of the client is prevented from carrying out corresponding shielding measures because the user worrys about excessive exposure of the information of the user. Therefore, the method provided by the embodiment of the invention is simple and feasible.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (8)

1. A method for obtaining additional information of a host, the method being performed by an agent device, the agent device being communicatively coupled to a DHCP client and a DHCP server, respectively, the method comprising:
the proxy equipment acquires a request message sent by the DHCP client, wherein the request message carries a first transactioniD and an MAC address of a host where the DHCP client is located;
the proxy equipment acquires a confirmation message sent by the DHCP server, wherein the confirmation message comprises a second transactioniD and an IP address distributed by the DHCP server for the DHCP client;
and when the first transactioniD and the second transactioniD are the same, the proxy equipment uses the IP address to request the additional information of the host from the host.
2. The method of claim 1,
before the proxy device requests additional information of the host from the host using the IP address, the method further includes:
the agent device establishes and stores the corresponding relation between the MAC address and the IP address;
after the proxy device requests additional information of the host from the host using the IP address, the method further includes:
and the proxy equipment establishes the corresponding relation between the IP address, the additional information and the MAC address according to the stored corresponding relation and the IP address.
3. The method of claim 2,
the proxy device requesting additional information of the host from the host using the IP address, including:
the proxy equipment sends a response request message for requesting additional information to the host, wherein the response request message carries the IP address;
the proxy equipment acquires a response message sent by the host, wherein the response message carries additional information of the host.
4. An agent device, wherein the agent device is communicatively connected to a DHCP client and a DHCP server, respectively, the agent device comprising:
a first obtaining unit, configured to obtain a request packet sent by the DHCP client, where the request packet carries a first TransactionID and an MAC address of a host where the DHCP client is located;
a second obtaining unit, configured to obtain a confirmation message sent by the DHCP server, where the confirmation message includes a second TransactionID and an IP address allocated by the DHCP server to the DHCP client;
a requesting unit configured to request additional information of the host from the host using the IP address when the first TransactionID and the second TransactionID are the same.
5. The proxy device of claim 4,
the proxy device further includes: a first establishing unit and a second establishing unit,
a first establishing unit, configured to establish and store a corresponding relationship between the MAC address and the IP address;
and the second establishing unit is used for establishing the corresponding relation between the IP address, the additional information and the MAC address according to the stored corresponding relation and the IP address.
6. The proxy device of claim 5,
the request unit includes:
a sending subunit, configured to send a response request packet for requesting additional information to the host, where the response request packet carries the IP address;
and the acquiring subunit is used for acquiring a response message sent by the host, wherein the response message carries additional information of the host.
7. A proxy device, comprising a processor and a transceiver;
the transceiver is used for acquiring a request message sent by the DHCP client, wherein the request message carries a first transactioniD and an MAC address of a host where the DHCP client is located; acquiring a confirmation message sent by the DHCP server, wherein the confirmation message comprises a second transactioniD and an IP address allocated by the DHCP server to the DHCP client;
the processor is configured to request additional information of the host from the host using the IP address when the first TransactionID and the second TransactionID are the same.
8. A computer-readable storage medium, characterized in that a program code is stored therein, which when executed by a computer causes the computer to perform the method of any of claims 1 to 3.
CN202110181562.0A 2016-11-22 2016-11-22 Method for acquiring additional information of host and proxy equipment Active CN113037882B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110181562.0A CN113037882B (en) 2016-11-22 2016-11-22 Method for acquiring additional information of host and proxy equipment

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611029102.1A CN108093091B (en) 2016-11-22 2016-11-22 Method for acquiring additional information of host and proxy equipment
CN202110181562.0A CN113037882B (en) 2016-11-22 2016-11-22 Method for acquiring additional information of host and proxy equipment

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201611029102.1A Division CN108093091B (en) 2016-11-22 2016-11-22 Method for acquiring additional information of host and proxy equipment

Publications (2)

Publication Number Publication Date
CN113037882A true CN113037882A (en) 2021-06-25
CN113037882B CN113037882B (en) 2022-12-27

Family

ID=62169571

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201611029102.1A Active CN108093091B (en) 2016-11-22 2016-11-22 Method for acquiring additional information of host and proxy equipment
CN202110181562.0A Active CN113037882B (en) 2016-11-22 2016-11-22 Method for acquiring additional information of host and proxy equipment

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN201611029102.1A Active CN108093091B (en) 2016-11-22 2016-11-22 Method for acquiring additional information of host and proxy equipment

Country Status (1)

Country Link
CN (2) CN108093091B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002067A (en) * 2022-04-19 2022-09-02 深圳市共进电子股份有限公司 Client host name processing method, device, system, equipment and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102111406A (en) * 2010-12-20 2011-06-29 杭州华三通信技术有限公司 Authentication method, system and DHCP proxy server
CN102238245A (en) * 2011-06-03 2011-11-09 杭州华三通信技术有限公司 Address allocation method and equipment
CN102594937A (en) * 2012-02-06 2012-07-18 神州数码网络(北京)有限公司 Method and system for realizing DHCP (Dynamic Host Configuration Protocol) v6 relay agent through two-layer network exchange equipment
CN105991791A (en) * 2015-05-12 2016-10-05 杭州迪普科技有限公司 Message forwarding method and device

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101471966B (en) * 2006-07-06 2011-07-20 华为技术有限公司 System and device for preventing IP address from leakage
CN101662808A (en) * 2009-08-27 2010-03-03 上海交通大学 Method for quickly switching network layers of IEEE802.11 wireless local area network
CN102244689B (en) * 2010-05-13 2014-01-01 华为技术有限公司 Method and equipment for obtaining remote IP address
CN101909089A (en) * 2010-06-07 2010-12-08 友达光电股份有限公司 Method for controlling multiple computers in local area network
CN102088377B (en) * 2011-01-04 2012-05-23 深圳市易聆科信息技术有限公司 Man-machine correspondence method and device for assets management
CN102594839B (en) * 2012-03-16 2015-04-01 杭州华三通信技术有限公司 Method for distinguishing pseudo dynamic host configuration protocol (DHCP) servers and switchboards
CN103516742B (en) * 2012-06-25 2016-09-07 和沛科技股份有限公司 Cloud server and management-control method thereof
CN104065758A (en) * 2013-03-18 2014-09-24 杭州华三通信技术有限公司 Active device automatic deployment method, device and system
EP3035648A1 (en) * 2014-12-19 2016-06-22 Alcatel Lucent Determining dynamic user attributes using dynamic host configuration protocol

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102111406A (en) * 2010-12-20 2011-06-29 杭州华三通信技术有限公司 Authentication method, system and DHCP proxy server
CN102238245A (en) * 2011-06-03 2011-11-09 杭州华三通信技术有限公司 Address allocation method and equipment
CN102594937A (en) * 2012-02-06 2012-07-18 神州数码网络(北京)有限公司 Method and system for realizing DHCP (Dynamic Host Configuration Protocol) v6 relay agent through two-layer network exchange equipment
CN105991791A (en) * 2015-05-12 2016-10-05 杭州迪普科技有限公司 Message forwarding method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002067A (en) * 2022-04-19 2022-09-02 深圳市共进电子股份有限公司 Client host name processing method, device, system, equipment and medium

Also Published As

Publication number Publication date
CN108093091A (en) 2018-05-29
CN113037882B (en) 2022-12-27
CN108093091B (en) 2021-06-08

Similar Documents

Publication Publication Date Title
US6678732B1 (en) Dynamic host configuration protocol server for allocating IP addresses to a plurality of clients
EP1079583B1 (en) Method and system for optimizing performance and availability of a dynamic host configuration protocol (DHCP) service
US9344397B2 (en) Client aware DHCP lease management
US20080091844A1 (en) Handover method in dhcpv4, handover apparatus and medium having instructions for performing the method
US20080028071A1 (en) Communication load reducing method and computer system
US7568048B2 (en) Method, apparatus, and system for assigning an IP address on a network
US8495190B2 (en) Providing access by a client application program over an internet protocol (IP) network to a server application program instance
CN101075944B (en) Method and system for allocating IP address
CN101951417A (en) Method, system and trunk equipment for assigning multiple server addresses
CN111935335B (en) DHCP address allocation method and device
US9118721B1 (en) Socket-based internet protocol for wireless networks
EP2442521A1 (en) Method for obtaining ip address of dynamic host configuration protocol version 6 server, dynamic host configuration protocol version 6 server and dynamic host configuration protocol version 6 communication system
EP1073244A1 (en) Method and system for monitoring dynamic host configuration protocol (DHCP) service in an internet protocol network
CN104969515A (en) Methods and gateways for processing DNS request
US7403997B2 (en) Method for dynamically allocating IP addresses for hosts on a network
CN107615723B (en) Internet protocol address allocation method and relay equipment
CN106878481B (en) Method, device and system for acquiring Internet Protocol (IP) address
CN108093091B (en) Method for acquiring additional information of host and proxy equipment
EP3048756B1 (en) Management method and apparatus for dynamic host configuration protocol server and relay
JP2001308909A (en) Method for assigning logical network address and terminal
CN111064819B (en) Address backup method and device
JP3775378B2 (en) Firewall system that supports dynamic IP address assignment
CN111586196B (en) Method, device and system for realizing network double stacks of virtual machine
JP4893041B2 (en) IP address assignment method
JP2004193643A (en) Ip address automatic assignment method / program, and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant