WO2012079461A1 - Ip地址分配方法、装置以及系统 - Google Patents

Ip地址分配方法、装置以及系统 Download PDF

Info

Publication number
WO2012079461A1
WO2012079461A1 PCT/CN2011/083222 CN2011083222W WO2012079461A1 WO 2012079461 A1 WO2012079461 A1 WO 2012079461A1 CN 2011083222 W CN2011083222 W CN 2011083222W WO 2012079461 A1 WO2012079461 A1 WO 2012079461A1
Authority
WO
WIPO (PCT)
Prior art keywords
address
server
client
subnet
current
Prior art date
Application number
PCT/CN2011/083222
Other languages
English (en)
French (fr)
Inventor
李斌
王晟
徐超
Original Assignee
联想(北京)有限公司
北京联想软件有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 联想(北京)有限公司, 北京联想软件有限公司 filed Critical 联想(北京)有限公司
Priority to US13/993,225 priority Critical patent/US9100303B2/en
Publication of WO2012079461A1 publication Critical patent/WO2012079461A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0823Errors, e.g. transmission errors
    • 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/5046Resolving address allocation conflicts; Testing of addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]

Definitions

  • IP address allocation method for device and system
  • Embodiments of the present invention relate to the field of the Internet, and in particular, to a method, an apparatus, and a system for allocating an IP address. Background technique
  • the existing Internet Internet mainly uses TCP (Transmit Control Protocol) / IP (Internet Protocol) to network and complete data transmission.
  • TCP Transmission Control Protocol
  • IP Internet Protocol
  • the two terminals connected to the Internet communicate with each other and must have their own IP addresses.
  • DHCP Dynamic Host Configure Protocol
  • DHCP server temporarily allocates an IP address from the address pool to the user terminal.
  • the IP address assigned each time the network is connected may be different.
  • the DHCP server assigns this address to other user terminals that are networked thereafter.
  • each terminal must have at least one IP address to communicate with other terminals.
  • a terminal may have multiple IP addresses.
  • a client connects to multiple DHCP servers. This client is assigned an IP address by multiple DHCP servers. This client communicates with other terminals that exist in different subnets through these DHCP servers. Because the DHCP server acts as a subnet gateway, it assigns an IP address to itself and the client connecting it in the IP address subnet segment. Therefore, there may be a subnet IP address conflict between different DHCP servers.
  • the embodiment of the present invention provides a method for IP address allocation, including:
  • the first server is assigned a third IP address; wherein the second server is assigned as the second IP The client of the address is connected.
  • the subnet conflict between the first IP address and the current IP address of the second server includes: the first IP address is the same as the current IP address of the second server, and is not received within a preset time.
  • the connection message of the client includes: the first IP address is the same as the current IP address of the second server, and is not received within a preset time.
  • the method before assigning the second IP address to the client connected to the first server, the method further includes: detecting physical access of the client;
  • the method further includes: initiating monitoring of the client.
  • the monitoring result indicates that the first IP address has a subnet conflict with the current IP address of the second server, including: receiving a message from the client as a subnet conflict message, where the subnet conflict message indicates The subnet where the first server is located has a subnet conflict with the subnet where the second server is located.
  • the subnet conflict between the first IP address and the current IP address of the second server further includes: maintaining the monitoring after receiving the connection message of the client within the preset time;
  • the subnet conflict message indicating that a subnet conflict exists between a subnet where the first server is located and a subnet where the second server is located.
  • the assigning the first IP address to the first server and/or assigning the third IP address to the first server is a random allocation.
  • the random allocation comprises:
  • An IP address segment is randomly assigned, and an IP address in the IP address segment is allocated to the first server.
  • the method further includes: obtaining a list of IP address segments;
  • the address in the IP address segment list is avoided.
  • the method further includes:
  • the invention also provides a server for assigning an IP address, comprising:
  • a server address allocation module configured to allocate a first IP address to the server itself
  • a client address allocation module configured to allocate a second IP address to the client connected to the server
  • a monitoring module configured to monitor the client, and the monitoring result indicates the first IP address of the server
  • the server address allocation module is notified to allocate a third IP address to the server; wherein the second server is connected to the client and different from the server.
  • the listening module is configured to: when the listening module does not receive the connection message of the client within a preset time, obtain the first IP address of the server and the current current of the second server. As a result of the IP address conflict, the IP address conflicts with the result of the IP address conflict, and the monitoring result of the subnet conflict between the first IP address of the server and the current IP address of the second server is obtained.
  • the monitoring module is further configured to:
  • the monitoring result of the subnet conflict between the first IP address of the server and the current IP address of the second server is obtained.
  • the monitoring result indicates that the first IP address of the server has a subnet conflict with the current IP address of the second server, including: receiving a message from the client as a subnet conflict message, where the subnet conflicts The message indicates that the first IP address of the server has a subnet conflict with the current IP address of the second server.
  • the server further includes: a detecting module, configured to notify the client address allocation module after detecting that the client establishes a physical connection with the server;
  • the client address allocation module is further configured to notify the listening module to initiate monitoring of the client after assigning the second IP address to the client.
  • the server address allocation module is specifically configured to allocate the first IP address and/or the third IP address in a random manner.
  • the server further includes a storage module, configured to store a list of IP address segments
  • the server address allocation module is further configured to obtain the IP address list from the storage module, and avoid the IP address range included in the IP address segment list when assigning the first IP address and/or the third IP address .
  • the server further includes an IP address segment adding module, configured to store the current IP address and the subnet mask of the second server into the IP address segment list when receiving the monitoring result notification of the monitoring module; , said The monitoring result is that there is a subnet conflict between the first IP address of the server and the current IP address of the second server.
  • an IP address segment adding module configured to store the current IP address and the subnet mask of the second server into the IP address segment list when receiving the monitoring result notification of the monitoring module; , said The monitoring result is that there is a subnet conflict between the first IP address of the server and the current IP address of the second server.
  • the invention also provides a network system, comprising a first server and a client,
  • the first server is configured to allocate a first IP address to itself, and assign a second IP address to the client, where the client is connected to the first server;
  • the first server is further configured to monitor the client, and assign a third IP address to the first IP address when the monitoring result indicates that the first IP address has a subnet conflict with the current IP address of the second server;
  • the second server is connected to the client and different from the first server.
  • the client is configured to calculate a current IP address and a subnet mask of a server that allocates an IP address to the client, when the first IP address and a current IP address of the second server are generated.
  • the sub-network conflict message is sent to the first server, indicating that the first IP address and the current IP address of the second server have a subnet conflict.
  • the server is configured to send a connection message to a server that allocates an IP address to the client, where the first server is further configured to: when the connection message of the client is not received within a preset time, Getting the first
  • the monitoring result of the subnet conflict exists between the IP address and the current IP address of the second server.
  • the client does not include a display unit
  • the display unit in the server is used to display data of the client and/or the server.
  • Figure 1 is a schematic diagram of a client connecting multiple servers at the same time.
  • FIG. 2 is a schematic diagram of monitoring according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of monitoring according to another embodiment of the present invention.
  • FIG. 4 is a structural diagram of an embodiment of an apparatus of the present invention. detailed description
  • an embodiment of the present invention provides the following implementation manner:
  • Server A 110 assigns itself a first IP address
  • Server A 110 assigns a second IP address to client 150 connected to server A 110;
  • Server A 110 listens to client 150 to which the second IP address is assigned;
  • the server A 110 is assigned a third IP address, wherein the server B 120 is assigned with the second IP address.
  • the client 150 is connected.
  • DHCP server is used as an example in the following embodiments, and other servers that can dynamically allocate IP addresses can also be implemented, which should be limited to those skilled in the art, and is not limited to a DHCP server.
  • FIG. 2 shows an embodiment of an IP address allocation method, and is combined with the scenario in FIG. 1.
  • the IP address assigned by DHCP server A 110 to itself is the first IP address.
  • the DHCP server A 110 assigns an IP address to itself for the first time. When it connects to the network after it is started, it applies to the network to obtain a subnet segment and allocates it in the subnet segment.
  • the IP address of DHCP itself that is, the gateway address of the subnet segment. This subnet segment can be represented by the gateway address and subnet mask.
  • client 150 attempts to establish a network connection with server A 110.
  • the DHCP server A 110 detects a physical connection from the client 150, including the client 150 connecting through the network cable and connecting through the wireless network card, at 203, the client 150 is assigned an IP address a in the subnet segment.
  • the subnet mask and the gateway address that is, the current IP address of the DHCP server A 110 (in this case, the first IP address) are sent to the client 150.
  • client 150 receives the IP address.
  • DHCP server A 110 initiates snooping of the client 150.
  • the client 150 receives the assigned IP address a, it needs to send a connection message to the DHCP server A 110.
  • This connection message can be a simple ACK, that is, a response received, or a packet carrying valid data.
  • DHCP server A 110 receives the connection message, it indicates that client 150 is properly connected to DHCP server A 110.
  • the connection is successful.
  • the client 150 Prior to this, the client 150 has been properly connected to the DHCP server B 120, that is, the DHCP server B 120 has assigned itself an IP address B, and also assigned the IP address b to the client 150 and established with the client 150.
  • the communication connection the client 150 also stores the gateway address of the subnet segment where the DHCP server B 120 is located, that is, the current IP address B of the DHCP server B 120.
  • the client 150 When the value of the IP address B is the same as the value of the first IP address, that is, when the current IP address of the DHCP server A 110 conflicts with the current IP address of the DHCP server B 120, the client 150 The connection message to be sent to DHCP server A 110, due to the first IP address that is in conflict with the value of IP address B, is likely to be sent to DHCP server B 120 at 206, thereby causing DHCP in listening state at 209. Server A 110 has not received a connection message from the client 150 within a predetermined time. When the client 150 and the server are wired, the predetermined time can be set to 4 to 5 seconds, and if it is a wireless connection, the predetermined time can be extended to 20 seconds.
  • the DHCP server A 110 does not receive the connection message from the client 150 within a predetermined time, that is, the monitoring result is the first IP address and other DHCP servers connected to the client 150 at the same time (in this embodiment, DHCP)
  • An IP address conflict occurs at the current IP address of server B 120). Therefore, the subnet segment where the DHCP server A 110 and the DHCP server B 120 are located at least partially overlap, and the subnet conflicts between the two subnet segments causes an IP address conflict.
  • DHCP server A 110 automatically switches the IP address. For example, the DHCP server A 110 does not switch the subnet segment, only switches the IP address, which is at least for a one-to-one network connection, for example, the server A 110 is only connected to the client 150 through a connection interface or a connection line (such as USB), the server A It is applicable if there is no other device in the network composed of 110 and client 150.
  • DHCP server A 110 switches the subnet segment and selects a new IP address. For example, a third IP address is assigned to itself within a new subnet segment, and the client 150 is assigned a new IP address within the new subnet segment.
  • DHCP server A 110 sends the new gateway address, client IP address, and subnet mask to client 150.
  • the subnet mask indicates the number of IP addresses in the subnet segment.
  • the DHCP server A 110 may not change the process of re-applying the subnet segment. Therefore, when the IP address is assigned to the client 150 again, the IP address may not be sent.
  • the subnet mask is given to the client 150, and the subnet mask obtained when the IP address is first obtained is still retained at the client 150.
  • the client 150 After the client 150 receives the new IP address, it also needs to send a connection message to the DHCP server A 110.
  • the current IP address of the DHCP server A that is, the third IP address does not exist between the current IP address of other DHCP servers (such as the DHCP server B and the C 120, 130 shown in FIG. 1) that are simultaneously connected to the client.
  • the client 150 can send a connection message to the correct destination, DHCP server A 110, meaning that DHCP server A 110 and the client 150 establish a normal communication connection.
  • the DHCP server A 110 that received the connection message can now turn off the listening to the client 150 without having to switch the subnet segment again and reassign the IP address to itself and the client 150.
  • the third IP address is again associated with the DHCP server C 130 (see FIG. 1). As shown, the DHCP server C also has a conflict with the current IP address of the client. The client 150 should send a connection message to the DHCP server A 110. The same may be sent to the third IP address.
  • the DHCP server A 110 does not receive the connection message from the client 150 within a preset time, and the monitoring result is its own
  • the current IP address that is, the third IP address and other DHCP servers connected to the client 150 at the same time, in this example, the IP address conflict exists in the current IP address of the DHCP server C 130, so the DHCP server A 110 and the DHCP server C 130 are located.
  • Subnet conflicts also exist in subnet segments.
  • DHCP server A 110 again switches the subnet segment, assigns itself a fourth IP address within the new subnet segment, and assigns the client 150 a new IP address within the new subnet segment.
  • the server's own IP address is automatically reassigned and then reallocated.
  • the client IP address avoids the trouble of manually modifying the server IP address manually in the prior art. The user can conveniently use the DHCP server without having considerable network knowledge and without having a certain understanding of the server operating system.
  • FIG. 3 is a schematic diagram of another embodiment of an IP address allocation method according to the present invention, which processes a subnet conflict between a current IP address of a DHCP server when two or more DHCP servers have established a communication connection with the same client.
  • the client 150 establishes a communication connection with the three DHCP servers A, B, and C.
  • the DHCP server A 110 is a DHCP server applied in the embodiment of the present invention, and applies to the network.
  • the subnet segment is assigned a first IP address in the subnet segment, and a second IP address different from the first IP address in the subnet segment is assigned to the client 150, and is received by the client 150.
  • the client 150 is monitored.
  • the DHCP server B and the C 120, 130 are DHCP servers in the prior art.
  • the client 150 detects whether there is a subnet conflict between the current IP addresses of the three DHCP servers connected thereto.
  • the client 150 respectively calculates the gateway address sent by each DHCP server that it receives, that is, the current IP address of the server, and the subnet mask, and the operation results in that each DHCP server obtains network approval and can freely allocate an IP address. IP address segment.
  • the client can also use the assigned IP address and subnet mask to calculate the IP address segment.
  • the client compares the IP address segments. When the IP address segment where the DHCP server A 110 is located overlaps or partially overlaps with the IP address segment where the DHCP server B is located, the current IP addresses of the DHCP servers A and B 110, 120 exist. Subnet conflicts.
  • the client 150 does not know to select DHCP if it wants to communicate with the device at the IP address covered by the coincidence portion.
  • Server A 110 or DHCP server C 130 acts as a gateway. Therefore, it may be sent to any network, causing problems. Therefore, in the case where such IP address segments partially overlap, there is a subnet conflict between the current addresses of the DHCP server A and the C 110, 120.
  • both the DHCP server B and the C 120, 130 are also applicable to the DHCP server in the present invention, since the DHCP server A 110 and the client 150 have obtained the connection and have been compared and compared by the client 150, The subnet segment comparison between DHCP server B and C 120, 130 is not required.
  • the server device type is detected. For example, at 203, when it is detected that the DHCP server B 120 is a server type that cannot automatically assign an IP address to itself, that is, an existing DHCP server, a subnet conflict message is sent to the DHCP server A 110. At 303, server A 110 receives the subnet conflict message.
  • the client may randomly send a subnet conflict message to any of the DHCP servers, or may set the access to the client (or The DHCP server that first accesses) sends a subnet conflict message.
  • the DHCP server A 110 that listens to the subnet conflict message from the client 150 determines that the conflict message indicates that there is a subnet conflict between the current IP address of the DHCP server A 110 and the current IP address of the DHCP server B 120.
  • DHCP server A 110 automatically switches the subnet segment, assigns itself a third IP address in 305 within the new subnet segment, and assigns a new IP address to the client 150 in 306 within the new subnet segment, sending To the client 150.
  • client 150 receives the IP address that DHCP server A 110 reassigned to client 150, and
  • the DHCP server A 110 After the third IP address of the DHCP server A 110, it continues to detect whether there is a subnet conflict at 301. Through the client 150's operation of the IP address segment and the detection of the subnet conflict, and the communication with the DHCP server, when the subnet conflict occurs between the servers, the DHCP server automatically switches the subnet segment, reassigns the server's own IP address, and then re-assigns Assigning the client IP address avoids the trouble of manually modifying the server IP address manually in the prior art, and the user does not need to have considerable network knowledge and does not need to have a certain understanding of the server operating system.
  • the connection message sent by the client 150 may be It is sent to the DHCP server A 110, and may also be sent to the DHCP server B 120. If the connection message is sent to the DHCP server A 110, in the process of establishing the communication connection, the DHCP server A 110 does not obtain the monitoring result of the IP address conflict between the servers connecting the same client, that is, the current server addresses are not obtained.
  • the IP address has the result of a subnet conflict, and it does not switch the subnet segment and reassign itself and the IP address of the client.
  • the DHCP server A 110 that received the connection message does not turn off the monitoring, but continues to monitor.
  • the DHCP server A 110 establishes a communication connection with the client, and the client establishes a communication connection with the newly accessed server (in this case, the DHCP server A).
  • the DHCP server A it is detected whether there is a subnet conflict between the current IP address of the DHCP server A 110 and the current IP address of another server connected to itself.
  • the client sends a subnet conflict message to notify the DHCP server that is applicable to the present invention, which is DHCP server A 110 in this embodiment.
  • the DHCP server A 110 After receiving the conflict message, the DHCP server A 110 automatically switches the subnet segment, reassigns the IP address to itself, and then reassigns the IP address to the client.
  • the DHCP server A 110 newly connected to the client listens to the client 150, and the client sends the network configuration information of the DHCP server B and the C 120, 130 to the DHCP server A 110, and the DHCP server A 110 pairs the subnet segment.
  • the range is calculated to determine whether there is a subnet conflict between the DHCP server B and A, and between the DHCP server C and A.
  • the monitoring result indicates that the DHCP server The current IP address of A has a subnet conflict with DHCP server B or C.
  • the DHCP server randomly allocates an IP address segment, and allocates itself in the address segment. IP address.
  • the DHCP server itself is assigned an IP address in the address segment, generally selecting a specific address in the address segment, such as the first IP address in the segment, or randomly selecting an IP address in the segment.
  • the IP address segment has already been written in the server and needs to be manually changed when enabled. If the method of randomly assigning IP address segments when enabled is used, one does not need to be manually changed, and the other is randomly assigned to generate an IP address conflict.
  • the random allocation method is not only used when the DHCP server is started, but also used in combination with the above three embodiments. For example, it is used when the first IP address is assigned, or when the third IP address is assigned when reassigning, or when both the first IP address and the third IP address are assigned.
  • the present invention also provides an embodiment of an IP address list. Create a list of IP addresses or address segments, and list the IP addresses of the common and common routers and other IP address allocation devices on the market. Avoid this list when assigning IP addresses to the DHCP server itself. For example, directly After the address segment in the list is crossed, or after the IP address segment is allocated, it is detected that the IP address segment is in the list, or when there is at least a partial overlap with the range of the address segment segment, the IP address segment is reassigned.
  • the IP address segment list may be avoided, and other IP address segments may be randomly assigned to itself, or only randomly assigned IP address segments.
  • the DHCP server may randomly allocate an IP address segment or randomly allocate an IP address segment based on the list of IP address segments.
  • the detection result indicates that a subnet conflict occurs, Add the conflicting IP address and/or the subnet segment where the conflicting IP address is located to the IP address segment list so that the conflict can be avoided directly during the allocation.
  • the specific implementation manner is that the gateway address (that is, the current IP address of the server) and the subnet mask are added to the IP address segment list.
  • the current IP address of DHCP server A and DHCP server B has a subnet conflict, that is, the first IP address and IP address B have a subnet conflict, and DHCP server A receives the interception result, and will "IP address B ten subnet mask. "Join the list of IP address segments.
  • the DHCP server A switches the IP address segment, it avoids the address segment where the IP address B is located, thereby allocating the third IP address and the client IP address.
  • the last way to add an IP address segment is more suitable for establishing a temporary space to save such an IP address segment.
  • the temporary space is cleared or cleared. Of course, Automatically empty, but manually cleared.
  • the present invention also provides an apparatus embodiment of a DHCP server applicable to the above method embodiments. As shown in Figure 4,
  • the DHCP server A 410 includes a server address assignment module 411, a client address assignment module 412, and a snooping module 413.
  • the server address allocation module 411 is configured to allocate an IP address to the DHCP server A itself;
  • the client address allocation module 412 is configured to allocate a second IP address to the client 450 connected to the DHCP server A 410;
  • the client 450 that is assigned the second IP address is monitored, and when the monitoring result indicates that the current IP address of the DHCP server A 410 and the current IP address of the DHCP server B 420 have an IP address conflict, the server address allocation module 411 is notified.
  • the DHCP server A 410 is reassigned an IP address, and the DHCP server B 420 is also connected to the client 450 to which the second IP address is assigned.
  • the listening module 413 can include a timer (not shown).
  • the DHCP server A 410 further includes a detecting module (not shown).
  • the client address assignment module 412 is notified to assign an IP address to the client.
  • the timer in the monitoring module 413 is preset for a certain time.
  • the server address allocation module 411 is notified, and the notification content indicates that the DHCP server A 410 and The other IP address of the DHCP server connected to the client has an IP address conflict.
  • the server address allocation module switches the IP address segment and reassigns the IP address to itself.
  • the listening module 413 receives the client from the client to which the second IP address is assigned.
  • An IP address conflict message indicating that the DHCP server A 410 has an IP address conflict with the current IP address of another DHCP server (such as DHCP server B 420) connected to the client.
  • the listening module 413 notifies the server address assigning module 411 of the conflict message, and the server address assigning module 411 switches the IP address segment and reassigns the IP address to itself.
  • Another preferred embodiment combines the above two embodiments.
  • the listening module 413 determines not only the DHCP server A 410 and other DHCP connected to the client 450 but not receiving the connection message from the client 450 within a predetermined time.
  • the server's current IP address has an IP address conflict, and the server address assignment module 411 is notified, and the server address assignment module 411 can be notified of the IP address conflict message from the client.
  • the server address assignment module 411 switches the IP address segment and re-allocates the IP address from the address segment, and then reassigns the IP address to the client from the address segment.
  • the present invention also provides such an apparatus embodiment:
  • the DHCP server A 410 includes a server address allocation module 411, which has a random allocation of the server's own IP address segment, and the selection of the IP address in the address segment may also be random. Or specific, such as selecting the IP address at the beginning of the address segment.
  • the present invention also provides such an apparatus embodiment:
  • the DHCP server A 410 includes a storage module (not shown) and a server address assignment module 411.
  • the storage module is used to store the IP address list, and the server address allocation module 411 avoids the address segment in the IP address list when the server IP address segment is allocated.
  • the server address assignment module 411 can avoid the address segment in the IP address list when the DHCP server A is enabled; or can receive the address segment in the IP address list after receiving the IP address conflict message; It is also possible to always use the way of avoiding the address segments in the IP address list.
  • a preferred embodiment on this basis is to combine the random assignment and IP address list with the first and second device embodiments.
  • the server address assignment module 411 avoids the address segment in the IP address list and then randomly assigns the IP address segment of the DHCP server A.
  • the server address allocation module 411 adopts the method of avoiding the address segment in the IP address list and randomly assigning the IP address segment of the DHCP server A.
  • the DHCP server A 410 may further include an IP address segment adding module (not shown).
  • the server address assigning module 411 When the server address assigning module 411 receives the monitoring result of the IP address conflict, the current IP address segment of the DHCP server A is added to the storage module.
  • a temporary storage space is set in the storage module, and the current IP address segment of the DHCP server A (or the IP address segment where the DHCP server B is currently located) is added to the temporary storage space, and the next DHCP server A is used. Clears the IP address segment in the temporary storage space when enabled.
  • the present invention also provides an embodiment of a network system including a DHCP server A and a client that can perform the above method embodiments.
  • the client can be a portable computer
  • the server can be a mobile terminal (including a smart phone) or a mobile terminal such as a tablet, so that a portable computer can be connected to multiple mobile phones or tablets.
  • the server side can also be a tablet, including a display unit
  • the client is a portable computer, does not include a display unit, a server and a client. They can be connected to each other by wired (such as USB port or other type of interface), and can also be connected to each other by wireless (WiFi or Bluetooth).
  • the display unit of the server can display data of the server and/or the client.
  • the display unit can display the data of the server; when the server and the client are physically (wired or wireless) connected, the display unit can separately display the data of the client or display the data of the server separately or simultaneously display the server and the client. Data at the end.
  • the client includes a first host module and a first interface module
  • the first host module includes: a first processing unit (such as a CPU and an EC), a first storage unit (such as a hard disk and a memory), a first input unit (such as a keyboard);
  • a first processing unit such as a CPU and an EC
  • a first storage unit such as a hard disk and a memory
  • a first input unit such as a keyboard
  • the first interface module is coupled to the first host module through a rotating shaft, and the first interface module is rotatable around the first host module.
  • the server includes a second host module and a second interface module
  • the second host module includes: a second processing unit (such as a CPU and an MCU), a second storage unit (such as a hard disk and a memory), a display unit, and a second input unit (for example, a touch sensor that is overlapped with the display unit) Unit); the second interface unit and the second host module are rigidly connected.
  • a second processing unit such as a CPU and an MCU
  • a second storage unit such as a hard disk and a memory
  • a display unit such as a hard disk and a memory
  • a second input unit for example, a touch sensor that is overlapped with the display unit
  • the server and the first interface unit can be rotated around the first host module to form a system similar to the current conventional notebook computer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Small-Scale Networks (AREA)

Description

IP地址分配方法、 装置以及系统 技术领域
本发明的实施例涉及互联网领域, 尤其涉及一种 IP地址分配的方法、 装置和系统。 背景技术
现有的 Internet 互联网主要是通过 TCP (Transmit Control Protocol, 传输控制协 议) /IP (Internet Protocol, 因特网协议)来进行组网并完成数据传输的。 两台连接到互联 网上的终端相互之间通信, 必须有各自的 IP地址。 但由于现在的 IP地址资源有限, 运营 商不能做到给每个终端用户都能分配一个固定的 IP地址。 所以, 目前采用 DHCP (Dynamic Host Configure Protocol , 动态主机配置协议) 方式对联网的终端进行临时的地址分配。 也即用户终端联网时, DHCP服务器从地址池里临时分配一个 IP地址给用户终端。 每次联 网时分配的 IP地址可能会不一样。 当用户终端断网时, DHCP服务器将这个地址分配给之 后联网的其他用户终端。 这样可以有效节约 IP 地址, 既保证了终端用户通信, 又能提高 IP地址的使用率。 在使用 TCP/IP协议的网络中, 每一台终端都必须至少有一个 IP地址, 才能与其他终 端进行通信。 但有时可能出现一台终端拥有多个 IP地址的情况。 如图 1所示, 一个客户端 连接到多个 DHCP服务器上。 由多个 DHCP服务器分别给这个客户端分配 IP地址。这个客户 端分别通过这些 DHCP服务器与存在于不同子网中的其他终端进行通信。 由于 DHCP服务器 作为子网网关, 在自身也具有 IP地址子网段内给自身和连接它的客户端分配 IP地址, 所 以不同的 DHCP服务器之间可能存在子网 IP地址冲突的情况。 现有技术对 DHCP服务器的 IP地址子网出现冲突的解决办法, 只能通过手工对 DHCP服务器的 IP地址子网段做改动。 并且, 由于同一批次的 DHCP服务器具有相同的出厂配置、 即相同 IP地址和子网掩码, 在 启用 DHCP服务器时也需要手工配置 DHCP服务器的 IP地址。
发明内容
为了解决在服务器存在子网 IP地址冲突时自动分配 IP地址的问题, 本发明实施例提 供了一种 IP地址分配的方法, 包括:
给第一服务器分配第一 IP地址; 给与所述第一服务器相连接的客户端分配第二 IP地址;
对所述被分配为第二 IP地址的所述客户端进行监听;
当监听结果表明所述第一 IP地址与第二服务器的当前 IP地址存在子网冲突时, 给所 述第一服务器分配第三 IP地址; 其中, 所述第二服务器与被分配为第二 IP地址的所述客 户端相连接。
具体的, 所述第一 IP地址与第二服务器的当前 IP地址存在子网冲突包括: 所述第一 IP地址与所述第二服务器的当前 IP地址相同, 在预设时间之内未接收到所述客户端的连 接消息。
或者具体的, 给与所述第一服务器相连接的客户端分配第二 IP地址之前进一步包括: 检测到所述客户端的物理接入;
给与所述第一服务器相连接的客户端分配第二 IP地址之后进一步包括:启动对所述客 户端的监听。
或者具体的, 所述监听结果表明第一 IP地址与第二服务器的当前 IP地址存在子网冲 突包括: 接收到来自所述客户端的消息为子网冲突消息, 所述子网冲突消息指示所述第一 服务器所在子网与所述第二服务器所在子网存在子网冲突。
或者, 所述第一 IP地址与第二服务器的当前 IP地址存在子网冲突进一步包括: 在预 设时间之内接收到所述客户端的连接消息之后, 维持监听;
接收到来自所述客户端的子网冲突消息, 所述子网冲突消息指示第一服务器所在子网 与所述第二服务器所在子网存在子网冲突。
或者,所述给第一服务器分配第一 IP地址和 /或给第一服务器分配第三 IP地址为随机 分配。
更优的, 所述随机分配包括:
随机分配 IP地址段, 并将所述 IP地址段内的一 IP地址分配给所述第一服务器。 或者具体的, 所述方法进一步包括: 获得 IP地址段清单;
所述给所述第一服务器分配所述第一 IP地址和 /或给所述第一服务器分配所述第三 IP 地址时, 避开所述 IP地址段清单中的地址。
更优的, 所述方法进一步包括:
当监听结果表明所述第一 IP地址与所述第二服务器的当前 IP地址存在子网冲突时, 将所述第二服务器的当前 IP地址和子网掩码加入所述 IP地址名单。 本发明还提供了一种分配 IP地址的服务器, 包括:
服务器地址分配模块, 用于对所述服务器自身分配第一 IP地址;
客户端地址分配模块, 用于对所述服务器相连接的客户端分配第二 IP地址; 监听模块, 用于对所述客户端进行监听, 并在监听结果表明所述服务器的第一 IP地址 与第二服务器的当前 IP地址存在子网冲突时,通知所述服务器地址分配模块对所述服务器 分配第三 IP地址; 其中, 所述第二服务器与所述客户端连接且不同于所述服务器。
具体的, 所述监听模块具体用于, 在预设时间之内所述监听模块未接收到所述客户端 的连接消息时,得出所述服务器的第一 IP地址与所述第二服务器的当前 IP地址存在 IP地 址冲突的结果, 再由所述 IP地址冲突的结果, 得出所述服务器的第一 IP地址与所述第二 服务器的当前 IP地址存在子网冲突的监听结果。
更优的, 所述监听模块进一步用于,
在预设时间之内未接收到所述客户端的连接消息之后保持监听; 在接收到来自所述客 户端的子网冲突消息,所述子网冲突消息指示所述服务器的第一 IP地址与第二服务器的当 前 IP地址存在子网冲突时,得出所述服务器的第一 IP地址与第二服务器的当前 IP地址存 在子网冲突的监听结果。
或者具体的, 所述监听结果表明所述服务器的第一 IP地址与第二服务器的当前 IP地 址存在子网冲突包括: 接收到来自所述客户端的消息为子网冲突消息, 所述子网冲突消息 指示所述服务器的第一 IP地址与所述第二服务器的当前 IP地址存在子网冲突。
或者具体的, 所述服务器进一步包括: 检测模块, 用于在检测到所述客户端与所述服 务器建立物理连接后, 通知所述客户端地址分配模块;
所述客户端地址分配模块还用于, 在给所述客户端分配第二 IP地址后, 通知所述监听 模块启动对所述客户端的监听。
或者具体的, 所述服务器地址分配模块具体用于, 使用随机方式分配第一 IP地址和 / 或第三 IP地址。
或者, 所述服务器进一步包括存储模块, 用于存储 IP地址段清单;
所述服务器地址分配模块进一步用于, 从所述存储模块获得所述 IP地址清单, 在分配 第一 IP地址和 /或第三 IP地址时避开所述 IP地址段清单中包含的 IP地址范围。
更优的, 所述服务器进一步包括 IP地址段添加模块, 用于接收到监听模块的监听结果 通知时, 将所述第二服务器当前 IP地址和子网掩码存入所述 IP地址段清单; 其中, 所述 监听结果为所述服务器的第一 IP地址与第二服务器的当前 IP地址存在子网冲突。
本发明还提供了一种网络系统, 包括第一服务器和一个客户端,
所述第一服务器用于给自身分配第一 IP地址, 并给所述客户端分配第二 IP地址, 此 时所述客户端与所述第一服务器相连;
所述第一服务器还用于对所述客户端进行监听,并在监听结果表明所述第一 IP地址与 第二服务器的当前 IP地址存在子网冲突时, 给自身分配第三 IP地址; 其中, 所述第二服 务器与所述客户端连接且不同于所述第一服务器。
具体的, 所述客户端用于对给所述客户端分配 IP地址的服务器的当前 IP地址和子网 掩码进行运算, 当所述第一 IP地址和所述第二服务器的当前 IP地址发生子网冲突时, 向 所述第一服务器发送子网冲突消息, 指示所述第一 IP地址和所述第二服务器的当前 IP地 址发生子网冲突。
或者, 所述客户端用于接收到给所述客户端分配 IP地址的服务器发送连接消息; 所述 第一服务器进一步用于, 在预设时间之内未收到所述客户端的连接消息时, 得出所述第一
IP地址与所述第二服务器的当前 IP地址存在子网冲突的监听结果。
更优的, 所述客户端不含显示单元, 所述服务器中的显示单元用来显示所述客户端和 / 或所述服务器的数据。
通过监听, 可以在客户端连接服务器时, 以及客户端与服务器取得连接之后获知子网 冲突, 并及时且自动给服务器自身重新分配 IP地址, 解决了现有技术服务器存在子网冲突 时靠手动调整服务器 IP地址的问题。 而且通过在服务器启动时随机分配 IP地址段, 以及 避开 IP地址段清单来分配 IP地址段以及二者的组合等, 能在很大程度上避免子网冲突。 附图说明
图 1为一个客户端同时连接多个服务器的示意图。
图 2为本发明一实施例的监听示意图。
图 3为本发明另一实施例的监听示意图。
图 4为本发明一装置实施例的结构图。 具体实施方式
下面结合附图对本发明进行进一步具体描述。 以图 1中的场景为例, 本发明的实施例提供如下实施方式:
服务器 A 110给自身分配第一 IP地址;
服务器 A 110给与服务器 A 110相连接的客户端 150分配第二 IP地址;
服务器 A 110对被分配了第二 IP地址的客户端 150进行监听;
当监听结果表明第一 IP地址与服务器 B 120或者服务器 C 130的当前 IP地址存在 IP 地址冲突时, 给服务器 A 110分配第三 IP地址, 其中, 服务器 B 120与被分配了第二 IP 地址的客户端 150相连。
为方便叙述, 以下的实施例中皆以 DHCP服务器为例, 而其他可动态分配 IP地址的服务 器同样能够实现, 应以所述领域技术人员可想到的为限, 不局限于 DHCP服务器。
图 2所示为一 IP地址分配方法的实施例, 并结合图 1中的场景。
首先, DHCP服务器 A 110给自身分配的 IP地址为第一 IP地址。 DHCP服务器 A 110首 次给自身分配 IP地址, 是在其开机启动后连接到网络时, 向网络申请获得某子网段, 并在 该子网段内进行分配。 DHCP 自身的 IP地址, 即该子网段的网关地址。 该子网段即可由网 关地址和子网掩码来表示。
在 201, 客户端 150试图建立与服务器 A 110的网络连接。 在 202, 当 DHCP服务器 A 110 检测到来自客户端 150的物理连接,包括客户端 150通过网线连接和通过无线网卡连接时, 在 203,在上述子网段内给该客户端 150分配 IP地址 a,同时将子网掩码和网关地址即 DHCP 服务器 A 110当前 IP地址 (此时为第一 IP地址) 一齐发送给该客户端 150。 在 204, 客户 端 150收到该 IP地址。
接着, 在 205, DHCP服务器 A 110启动对该客户端 150的监听。 在 208, 客户端 150接 到被分配的 IP地址 a后, 需要向 DHCP服务器 A 110发送一个连接消息。 这个连接消息可 以是一个简单的 ACK, 即收到回应, 或者携带有效数据的数据包。 在 207, 如果 DHCP服务 器 A 110收到这个连接消息, 表明客户端 150已正常与 DHCP服务器 A 110连接。 在 210, 连接成功。
在此之前, 该客户端 150已经与 DHCP服务器 B 120正常连接, 即 DHCP服务器 B 120已 经给自身分配了 IP地址 B, 且也给该客户端 150分配了 IP地址 b并与该客户端 150建立 了通信连接, 该客户端 150也存有 DHCP服务器 B 120所在子网段的网关地址, 即 DHCP服 务器 B 120的当前 IP地址 B。 当 IP地址 B的值与第一 IP地址的值相同时, 即 DHCP服务 器 A 110的当前 IP地址与 DHCP服务器 B 120的当前 IP地址发生冲突时, 该客户端 150本 应向 DHCP服务器 A 110发送的连接消息, 因发向与 IP地址 B的值冲突的第一 IP地址, 所 以很可能在 206被发送至 DHCP服务器 B 120, 从而在 209导致处于监听状态中的 DHCP服 务器 A 110在预定时间之内都未收到来自该客户端 150的连接消息。 当客户端 150与服务 器之间是有线连接时, 预定时间可设为 4〜5 秒, 如果是无线连接, 预定时间可以延长至 20秒。 DHCP服务器 A 110在预定的时间内未收到来自该客户端 150的连接消息, 即表明监 听结果为第一 IP地址与同时与该客户端 150相连的其他 DHCP服务器 (本实施例中即为 DHCP 服务器 B 120) 的当前 IP地址发生 IP地址冲突。 所以, DHCP服务器 A 110与 DHCP服务器 B 120所在的子网段至少部分重合, 两个子网段存在子网冲突, 才引起 IP地址的冲突。
于是, DHCP服务器 A 110自动切换 IP地址。 例如, DHCP服务器 A 110不切换子网段, 仅切换 IP地址, 这至少对于一对一的网络连接, 例如服务器 A 110仅和客户端 150通过连 接接口或连接线 (比如 USB) 连接, 服务器 A 110和客户端 150组成的网络中没有另一个 设备存在的情况下可以适用。
或者, DHCP服务器 A 110切换子网段, 并选择新的 IP地址。 例如, 在新的子网段内给 自身分配第三 IP地址, 并在该新的子网段内给该客户端 150分配新的 IP地址。 DHCP服务 器 A 110将新的网关地址、 客户端 IP地址以及子网掩码一同发送给客户端 150。 子网掩码 表示该子网段内的 IP地址个数, 在 DHCP服务器 A 110重新申请子网段的过程中可能不会 变化, 所以再次给客户端 150分配 IP地址时, 也可以不再发送子网掩码给客户端 150, 客 户端 150处仍保留首次获得 IP地址时得到的子网掩码。
该客户端 150收到新的 IP地址后, 同样需要向 DHCP服务器 A 110发送一个连接消息。 此时, DHCP服务器 A的当前 IP地址即第三 IP地址与同时与该客户端相连的其他 DHCP服 务器 (如图 1所示的 DHCP服务器 B和 C 120, 130) 的当前 IP地址之间不存在冲突, 该客 户端 150能将连接消息发送到正确的目的端即 DHCP服务器 A 110,意味着 DHCP服务器 A 110 和该客户端 150建立正常的通信连接。 收到连接消息的 DHCP服务器 A 110此时可以关闭对 该客户端 150的监听, 无需再次切换子网段以及给自身和该客户端 150重新分配 IP地址。
也有可能的是, 在上述步骤中, 当 DHCP服务器 A 110给自身分配第三 IP地址, 并给该 客户端 150也重新分配 IP地址后,第三 IP地址又与 DHCP服务器 C 130 (如图 1所示, DHCP 服务器 C也与该客户端有通信连接) 的当前 IP地址存在冲突, 该客户端 150本应发送至 DHCP服务器 A 110的连接消息,因发向第三 IP地址,则同样可能被发送至 DHCP服务器 C 130, DHCP服务器 A 110在预设时间内未接到来自客户端 150的连接消息, 其监听结果为自身的 当前 IP地址即第三 IP地址与同时与该客户端 150相连的其他 DHCP服务器,本例中为 DHCP 服务器 C 130的当前 IP地址存在 IP地址冲突,所以 DHCP服务器 A 110与 DHCP服务器 C 130 所在的子网段也存在子网冲突。 于是, DHCP服务器 A 110再次切换子网段, 在新的子网段 内给自身分配第四 IP地址, 并在该新的子网段内给该客户端 150分配新的 IP地址。
这样, 通过预设时间的监听, 判断 DHCP服务器的当前 IP地址是否与其他网络实体的当 前 IP地址发生 IP地址冲突,并在监听到冲突结果时,自动重新分配服务器自身的 IP地址, 再重新分配客户端 IP地址,避免了现有技术中通过人工的手动修改服务器 IP地址的麻烦. 使用者无需具有相当的网络知识且无需对服务器的操作系统有一定了解, 就可以便捷的使 用 DHCP服务器。
图 3为本发明 IP地址分配方法的另一实施例, 对两个或两个以上的 DHCP服务器与同 一客户端已经建立起通信连接时的 DHCP服务器当前 IP地址存在子网冲突做出处理。
比如在图 1所示的场景下, 客户端 150与 A、 B、 C三个 DHCP服务器都建立了通信连接, 其中 DHCP服务器 A 110是应用在本发明实施例中的 DHCP服务器, 其向网络申请了子网段 并在子网段内给自身分配了第一 IP地址, 并向客户端 150分配了子网段中与第一 IP地址 不同的第二 IP地址, 并收到客户端 150发送的连接消息后, 建立起与该客户端 150的通信 连接之后, 对该客户端 150进行监听, DHCP服务器 B和 C 120, 130是现有技术中的 DHCP 服务器。
首先, 在 301, 客户端 150检测与之相连的这三个 DHCP服务器的当前 IP地址是否存在 子网冲突。客户端 150分别将其收到的每个 DHCP服务器发送过来的网关地址, 即服务器当 前 IP地址, 与子网掩码进行运算, 运算所得的是各个 DHCP服务器获得网络批准, 可以自 由分配 IP地址的 IP地址段。 客户端也可用被分配的 IP地址与子网掩码进行运算所得 IP 地址段。 客户端将这些 IP地址段进行比较, 当 DHCP服务器 A 110所在 IP地址段与 DHCP 服务器 B所在 IP地址段存在重合或部分重合时, DHCP服务器 A和 B 110, 120的当前 IP 地址之间即存在子网冲突。
当 DHCP服务器 A 110所在 IP地址段与 DHCP服务器 C 130所在 IP地址段存在重合或 部分重合时, 客户端 150如果想给处在重合部分涵盖的某 IP地址的设备进行通信, 则不知 该选择 DHCP服务器 A 110或是 DHCP服务器 C 130做为网关。 因此所以有可能会发给任意 的网络, 造成问题。 所以此种 IP地址段部分重合的情况下, DHCP服务器 A和 C 110, 120 的当前地址之间即存在子网冲突。 当 DHCP服务器 B和 C 120, 130也都是能应用在本发明中的 DHCP服务器时, 因在 DHCP 服务器 A 110与客户端 150取得连接之前, 已经由客户端 150进行运算和比较过, 所以本 次不需进行 DHCP服务器 B和 C 120, 130之间的子网段比较。
实际过程中, 当客户端 150检测到 DHCP服务器 A 110与 DHCP服务器 B 120当前 IP地 址存在子网冲突时, 检测服务器设备类型。 例如, 在 203, 当检测到 DHCP服务器 B 120是 无法自动给自身重分 IP地址的服务器类型即现有 DHCP服务器时,发送子网冲突消息给 DHCP 服务器 A 110。 在 303, 服务器 A 110接收到该子网冲突消息。 当发生子网冲突的两个 DHCP 服务器都是应用在本发明中的 DHCP服务器时, 客户端可以随机给其中任一 DHCP服务器发 送子网冲突消息, 也可以设置为给客户端后接入(或者先接入) 的 DHCP服务器发送子网冲 突消息。
在 304, 监听到来自客户端 150的子网冲突消息的 DHCP服务器 A 110, 判断得出冲突 消息指示为 DHCP服务器 A 110当前 IP地址与 DHCP服务器 B 120当前 IP地址之间存在子 网冲突时, DHCP服务器 A 110自动切换子网段, 在 305在新的子网段内给自身分配第三 IP 地址, 并在 306在该新的子网段内给该客户端 150分配新的 IP地址, 发送给客户端 150。
在 307, 客户端 150收到 DHCP服务器 A 110给客户端 150重新分配的 IP地址, 以及
DHCP服务器 A 110的第三 IP地址后, 在 301继续检测是否存在子网冲突。 通过客户端 150 对 IP地址段的运算和子网冲突检测, 以及与 DHCP服务器的通信, 使服务器之间出现子网 冲突时, DHCP服务器自动切换子网段, 重新分配服务器自身的 IP地址, 再重新分配客户 端 IP地址, 避免了现有技术中通过人工的手动修改服务器 IP地址的麻烦, 使用者无需具 有相当的网络知识且无需对服务器的操作系统有一定了解。
本发明提供的更优化的实施例是将上述两个实施例的方案相结合。 在图 2所示的实施 例中, 当 DHCP服务器 A 110与其他同时与该客户端 150相连的 DHCP服务器, 比如 DHCP服 务器 B 120存在 IP地址冲突时, 该客户端 150发送的连接消息, 有可能发给 DHCP服务器 A 110, 也可能发给 DHCP服务器 B 120。 如果连接消息发送给 DHCP服务器 A 110, 则在建 立通信连接的过程中, DHCP服务器 A 110不会得出连接同一客户端的服务器之间存在 IP 地址冲突的监听结果, 即不会得出这些服务器当前 IP地址存在子网冲突的结果, 更不会切 换子网段并重新分配自身和该客户端的 IP地址。 收到连接消息的 DHCP服务器 A 110并不 关闭监听, 而是继续保持监听。 此种情况下结合图 3的实施例, DHCP服务器 A 110与该客 户端建立起通信连接, 该客户端在与新接入的服务器 (本例为 DHCP服务器 A) 建立通信连 接时, 检测 DHCP服务器 A 110当前 IP地址和与自身连接的其他服务器当前 IP地址之间, 是否存在子网冲突。
如果存在子网冲突, 该客户端发送子网冲突消息, 通知其中可应用于本发明的 DHCP服 务器, 本实施例中为 DHCP服务器 A 110。 DHCP服务器 A 110接到冲突消息后, 自动切换子 网段, 给自身重新分配 IP地址, 再给客户端重新分配的 IP地址。 或者, 新连接到客户端 的 DHCP服务器 A 110对客户端 150进行监听, 由客户端将 DHCP服务器 B和 C 120, 130的 网络配置信息发给 DHCP服务器 A 110, 由 DHCP服务器 A 110对子网段范围进行运算, 判 断 DHCP服务器 B与 A之间, 以及 DHCP服务器 C与 A之间是否存在子网冲突, 当 DHCP服务 器 A运算结果表明上述子网段至少存在部分重合时,即监听结果表明 DHCP服务器 A的当前 IP地址与 DHCP服务器 B或 C存在子网冲突。
为了降低 DHCP服务器的子网冲突发生的几率, 也省去人工改动 DHCP服务器 IP地址的 繁琐, 本发明提供的另一方法实施例是 DHCP服务器随机分配 IP地址段, 在该地址段内给 自身分配 IP地址。在该地址段内给 DHCP服务器自身分配 IP地址, 一般来说是选择地址段 内特定地址比如段内首个 IP地址, 或者在段内随机选择 IP地址。
因同一类型同一批次的 DHCP服务器的出厂设置都相同, IP地址段早已写定在服务器 中,启用时需要手工改动。如果采用启用时随机分配 IP地址段的方法,一则无需手工改动, 二则随机分配从而产生 IP地址冲突的几率也更小。 而随机分配的方式不只在 DHCP服务器 启动时使用, 也可与上面的三个实施例结合起来使用。 比如在分配第一 IP地址时使用, 或 者在重新分配即分配第三 IP地址时使用,或者在分配第一 IP地址和第三 IP地址时都使用。
为了尽量减少 DHCP服务器的子网冲突存在的可能性和省去人工改动 DHCP服务器 IP地 址的繁琐, 本发明还提供一种 IP地址名单的方法实施例。建立一个 IP地址或地址段名单, 将市面上常见、 通用的路由器和其他 IP地址分配设备出厂设置的 IP地址段列入名单, 在 给 DHCP服务器自身分配 IP地址段时避开此名单, 比如直接越过此名单中的地址段, 或当 分配 IP地址段后, 检测该 IP地址段处在此名单中, 或与此名单地址段范围有至少部分重 合时, 重新分配 IP地址段。
与上述随机分配的实施例结合起来可以有多种组合方式, 比如 DHCP服务器 A启用时可 避开 IP地址段名单, 并为自身随机分配其他 IP地址段, 或仅进行随机分配 IP地址段。 在 监听结果表明子网冲突时, DHCP服务器可以随机分配 IP地址段, 也可以在避开 IP地址段 名单的基础上随机分配 IP地址段。一种更优的实施例是,当检测结果表明发生子网冲突时, 将引起冲突的 IP地址和 /或引起冲突的 IP地址所在的子网段加入 IP地址段名单中, 以便 分配时能直接避免冲突。 具体实现方式为, 将网关地址(即服务器当前 IP地址)和子网掩 码加入 IP地址段名单。比如 DHCP服务器 A与 DHCP服务器 B的当前 IP地址存在子网冲突, 即第一 IP地址与 IP地址 B存在子网冲突, DHCP服务器 A收到这个监听结果, 将 " IP地址 B十子网掩码"加入 IP地址段名单。 这样, DHCP服务器 A在切换 IP地址段时, 就会避开 IP地址 B所在的地址段, 从而进行第三 IP地址和客户端 IP地址的分配了。 当然, 最后这 种添加 IP地址段的方式, 较适合建立一个临时空间来保存此类 IP地址段, 在本次关闭或 下一次启用 DHCP服务器 A时或定时将临时空间清空, 当然, 也可以不自动清空, 而使用人 工清空。
本发明同时提供可应用于上述方法实施例的 DHCP服务器的装置实施例。 如图 4所示,
DHCP服务器 A 410包括服务器地址分配模块 411、客户端地址分配模块 412和监听模块 413。 其中, 服务器地址分配模块 411, 用于对 DHCP服务器 A自身分配 IP地址; 客户端地址分 配模块 412, 用于对与 DHCP服务器 A 410相连的客户端 450分配第二 IP地址; 监听模块 413, 用于对被分配了第二 IP地址的客户端 450进行监听, 并在监听结果表明 DHCP服务器 A 410的当前 IP地址与 DHCP服务器 B 420的当前 IP地址存在 IP地址冲突时, 通知服务 器地址分配模块 411对 DHCP服务器 A 410重新分配 IP地址, 上述 DHCP服务器 B 420也与 被分配了第二 IP地址的客户端 450相连。
在一个较优的实施例中, 监听模块 413内可以包含一个定时器 (未示出), DHCP服务 器 A 410进一步包含一个检测模块 (未示出), 在检测到有客户端与 DHCP服务器 A 410建 立物理连接后, 通知客户端地址分配模块 412给该客户端分配 IP地址。对监听模块 413内 的定时器预设一定时间, 当监听模块 413在预设时间内未接收到来自该客户端 450的连接 消息时, 通知服务器地址分配模块 411, 通知内容表明 DHCP服务器 A 410与其他与该客户 端相连的 DHCP服务器当前 IP地址存在 IP地址冲突, 服务器地址分配模块切换 IP地址段 并给自身重新分配 IP地址。
在一个较优的实施例中, 监听模块 413接收到来自被分配了第二 IP地址的客户端的
IP地址冲突消息, 该冲突消息指示 DHCP服务器 A410与其他与该客户端相连的 DHCP服务 器 (比如 DHCP服务器 B 420) 的当前 IP地址存在 IP地址冲突。 监听模块 413将此冲突消 息通知服务器地址分配模块 411, 服务器地址分配模块 411切换 IP地址段并给自身重新分 配 IP地址。 另一个较优的实施例将上述两个实施例结合起来, 监听模块 413不但通过预定时间内 未收到来自客户端 450的连接消息判断出 DHCP服务器 A 410与其他与该客户端 450相连的 DHCP服务器的当前 IP地址存在 IP地址冲突, 并通知服务器地址分配模块 411, 而且可将 来自客户端的 IP地址冲突消息通知服务器地址分配模块 411。 服务器地址分配模块 411接 到这些消息时, 切换 IP地址段, 并从该地址段中给自身重新分配 IP地址, 之后从该地址 段中给该客户端重新分配 IP地址。
本发明也提供这样的装置实施例: DHCP服务器 A 410包含服务器地址分配模块 411, 其对服务器自身 IP地址段的分配是随机的, 其对地址段内的 IP地址的选择也可以是随机 的, 或是特定的, 比如选择该地址段首的 IP地址。
本发明也提供这样的装置实施例: DHCP服务器 A 410包含存储模块 (未示出) 和服务 器地址分配模块 411。 存储模块用于存储 IP地址清单, 服务器地址分配模块 411在分配服 务器 IP地址段时, 避开 IP地址清单中的地址段。服务器地址分配模块 411可以在 DHCP服 务器 A启用时的分配中, 避开 IP地址清单中的地址段; 也可以收到 IP地址冲突消息之后 的重新分配中, 避开 IP地址清单中的地址段; 也可以一直使用避开 IP地址清单中的地址 段的方式。
在此基础上更优的实施例是将随机分配和 IP地址清单与第一个和第二个装置实施例相 结合, 这存在多种结合方式, 在此只作举例。 比如在 DHCP服务器 A 410启用时的分配中, 服务器地址分配模块 411避开 IP地址清单中的地址段,再随机分配 DHCP服务器 A的 IP地 址段。 比如服务器地址分配模块 411在收到 IP地址冲突消息时, 采用避开 IP地址清单中 的地址段, 再随机分配 DHCP服务器 A的 IP地址段的方式。 DHCP服务器 A 410也可以进一 步包含 IP地址段添加模块(未示出), 在服务器地址分配模块 411收到 IP地址冲突的监听 结果时, 将 DHCP服务器 A的当前 IP地址段加入存储模块中。 更优的是, 在存储模块中设 置一块临时存储空间, DHCP服务器 A的当前 IP地址段 (或者是 DHCP服务器 B当前所在的 IP地址段) 被加入至临时存储空间中, 待下次 DHCP服务器 A启用时清空临时存储空间中 的 IP地址段。
本发明还提供一种网络系统的实施例,包含可执行上述方法实施例的 DHCP服务器 A和 客户端。 例如客户端可以是便携式计算机, 服务器端可以是手机 (包括: 智能手机) 或平 板电脑等移动终端, 实现一台便携式计算机与多部手机或平板电脑相连。 服务器端也可以 是平板电脑, 包括显示单元, 客户端是便携式计算机, 不包括显示单元, 服务器和客户端 能通过有线(比如 USB口或其他类型的接口)方式互相连接, 也能通过无线(WiFi或蓝牙) 方式互相连接, 所述服务器的显示单元能显示服务器和 /或客户端的数据。具体是当服务器 独立工作时, 显示单元能显示服务器的数据; 当服务器和客户端物理 (有线或无线) 连接 时, 显示单元能单独显示客户端的数据或者单独显示服务器的数据或者同时显示服务器和 客户端的数据。
进一步, 所述客户端包括第一主机模块和第一接口模块,
第一主机模块包括: 第一处理单元 (比如, CPU和 EC), 第一存储单元 (比如, 硬盘和 内存), 第一输入单元 (比如, 键盘);
第一接口模块通过转轴和所述第一主机模块连接, 所述第一接口模块能绕所述第一主 机模块旋转。
所述服务器包括第二主机模块和第二接口模块,
第二主机模块包括: 第二处理单元 (比如, CPU和 MCU), 第二存储单元 (比如, 硬盘 和内存), 显示单元, 第二输入单元 (比如, 和所述显示单元重叠设置的触摸感应单元); 第二接口单元和所述第二主机模块刚性连接。
当所述第一接口单元和所述第二接口单元刚性连接后, 所述服务器和所述第一接口单 元可同步绕所述第一主机模块旋转, 形成类似目前传统笔记本电脑形态的系统。
以上所述仅是本发明的优选实施方式, 应当指出, 对于本技术领域的普通技术人员来 说, 在不脱离本发明原理的前提下, 还可以作出若干改进和润饰, 这些改进和润饰也应视 为本发明的保护范围。

Claims

权利要求
1、 一种 IP地址分配方法, 包括:
给第一服务器分配第一 IP地址;
给与所述第一服务器相连接的客户端分配第二 IP地址;
对所述被分配为第二 IP地址的所述客户端进行监听;
当监听结果表明所述第一 IP地址与第二服务器的当前 IP地址存在子网冲突时,给所述 第一服务器分配第三 IP地址; 其中, 所述第二服务器与被分配为第二 IP地址的所述客户 端相连接。
2、 如权利要求 1所述的 IP地址分配方法, 其中, 所述第一 IP地址与第二服务器的当 前 IP地址存在子网冲突包括: 所述第一 IP地址与所述第二服务器的当前 IP地址相同, 在 预设时间之内未接收到所述客户端的连接消息。
3、 如权利要求 1所述的地址分配方法, 其中, 给与所述第一服务器相连接的客户端分 配第二 IP地址之前进一步包括: 检测到所述客户端的物理接入;
给与所述第一服务器相连接的客户端分配第二 IP地址之后进一步包括: 启动对所述客 户端的监听。
4、 如权利要求 1所述的地址分配方法, 其中, 所述监听结果表明第一 IP地址与第二 服务器的当前 IP地址存在子网冲突包括: 接收到来自所述客户端的消息为子网冲突消息, 所述子网冲突消息指示所述第一服务器所在子网与所述第二服务器所在子网存在子网冲 突。
5、 如权利要求 1所述的地址分配方法, 其中, 所述第一 IP地址与第二服务器的当前 IP地址存在子网冲突进一步包括: 在预设时间之内接收到所述客户端的连接消息之后, 维 持监听;
接收到来自所述客户端的子网冲突消息, 所述子网冲突消息指示第一服务器所在子网 与所述第二服务器所在子网存在子网冲突。
6、 如权利要求 1所述的地址分配方法, 其中, 所述给第一服务器分配第一 IP地址和 / 或给第一服务器分配第三 IP地址为随机分配。
7、 如权利要求 6所述的地址分配方法, 其中, 所述随机分配包括:
随机分配 IP地址段, 并将所述 IP地址段内的一 IP地址分配给所述第一服务器。
8、 如权利要求 1所述的地址分配方法, 进一步包括: 获得 IP地址段清单; 所述给所述第一服务器分配所述第一 IP地址和 /或给所述第一服务器分配所述第三 IP 地址时, 避开所述 IP地址段清单中的地址。
9、 如权利要求 8所述的地址分配方法, 进一步包括:
当监听结果表明所述第一 IP地址与所述第二服务器的当前 IP地址存在子网冲突时, 将所述第二服务器的当前 IP地址和子网掩码加入所述 IP地址名单。
10、 一种分配 IP地址的服务器, 包括:
服务器地址分配模块, 用于对所述服务器自身分配第一 IP地址;
客户端地址分配模块, 用于对所述服务器相连接的客户端分配第二 IP地址; 监听模块, 用于对所述客户端进行监听, 并在监听结果表明所述服务器的第一 IP地 址与第二服务器的当前 IP地址存在子网冲突时,通知所述服务器地址分配模块对所述服务 器分配第三 IP地址; 其中, 所述第二服务器与所述客户端连接且不同于所述服务器。
11、 如权利要求 10所述的服务器, 其中, 所述监听模块在预设时间之内所述监听模块 未接收到所述客户端的连接消息时,得出所述服务器的第一 IP地址与所述第二服务器的当 前 IP地址存在 IP地址冲突的结果, 再由所述 IP地址冲突的结果, 得出所述服务器的第一 IP地址与所述第二服务器的当前 IP地址存在子网冲突的监听结果。
12、 如权利要求 11所述的服务器, 其中, 所述监听模块在预设时间之内未接收到所述 客户端的连接消息之后保持监听; 在接收到来自所述客户端的子网冲突消息, 所述子网冲 突消息指示所述服务器的第一 IP地址与第二服务器的当前 IP地址存在子网冲突时, 得出 所述服务器的第一 IP地址与第二服务器的当前 IP地址存在子网冲突的监听结果。
13、 如权利要求 10所述的服务器, 其中, 所述监听结果表明所述服务器的第一 IP地 址与第二服务器的当前 IP地址存在子网冲突包括:接收到来自所述客户端的消息为子网冲 突消息, 所述子网冲突消息指示所述服务器的第一 IP地址与所述第二服务器的当前 IP地 址存在子网冲突。
14、 如权利要求 10所述的服务器, 其中, 所述服务器进一步包括: 检测模块, 用于在 检测到所述客户端与所述服务器建立物理连接后, 通知所述客户端地址分配模块;
所述客户端地址分配模块还用于, 在给所述客户端分配第二 IP地址后, 通知所述监听 模块启动对所述客户端的监听。
15、 如权利要求 10所述的服务器, 其中, 所述服务器地址分配模块具体用于, 使用随 机方式分配第一 IP地址和 /或第三 IP地址。
16、 如权利要求 10所述的服务器, 其中, 所述服务器进一步包括存储模块, 用于存储 IP地址段清单;
所述服务器地址分配模块进一步用于, 从所述存储模块获得所述 IP地址清单, 在分配 第一 IP地址和 /或第三 IP地址时避开所述 IP地址段清单中包含的 IP地址范围。
17、 如权利要求 16所述的服务器, 其中, 所述服务器进一步包括 IP地址段添加模块, 用于接收到监听模块的监听结果通知时,将所述第二服务器当前 IP地址和子网掩码存入所 述 IP地址段清单; 其中, 所述监听结果为所述服务器的第一 IP地址与第二服务器的当前 IP地址存在子网冲突。
18、 一种网络系统, 包括第一服务器和一个客户端, 其中
所述第一服务器用于给自身分配第一 IP地址, 并给所述客户端分配第二 IP地址, 此 时所述客户端与所述第一服务器相连;
所述第一服务器还用于对所述客户端进行监听, 并在监听结果表明所述第一 IP地址 与第二服务器的当前 IP地址存在子网冲突时, 给自身分配第三 IP地址; 其中, 所述第二 服务器与所述客户端连接且不同于所述第一服务器。
19、 如权利要求 18所述的系统, 其中, 所述客户端用于对给所述客户端分配 IP地址 的服务器的当前 IP地址和子网掩码进行运算, 当所述第一 IP地址和所述第二服务器的当 前 IP地址发生子网冲突时, 向所述第一服务器发送子网冲突消息, 指示所述第一 IP地址 和所述第二服务器的当前 IP地址发生子网冲突。
20、 如权利要求 18所述的系统, 其中, 所述客户端用于接收到给所述客户端分配 IP 地址的服务器发送连接消息; 所述第一服务器进一步用于, 在预设时间之内未收到所述客 户端的连接消息时, 得出所述第一 IP地址与所述第二服务器的当前 IP地址存在子网冲突 的监听结果。
21、 如权利要求 19所述的系统, 其中, 所述客户端不含显示单元, 所述服务器中的显 示单元用来显示所述客户端和 /或所述服务器的数据。
PCT/CN2011/083222 2010-12-13 2011-11-30 Ip地址分配方法、装置以及系统 WO2012079461A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US13/993,225 US9100303B2 (en) 2010-12-13 2011-11-30 Methods, devices, and systems for allocating IP address

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010601017.4 2010-12-13
CN201010601017.4A CN102571996B (zh) 2010-12-13 2010-12-13 Ip地址分配方法、装置以及网络系统

Publications (1)

Publication Number Publication Date
WO2012079461A1 true WO2012079461A1 (zh) 2012-06-21

Family

ID=46244084

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/083222 WO2012079461A1 (zh) 2010-12-13 2011-11-30 Ip地址分配方法、装置以及系统

Country Status (3)

Country Link
US (1) US9100303B2 (zh)
CN (1) CN102571996B (zh)
WO (1) WO2012079461A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103716416A (zh) * 2012-09-29 2014-04-09 北京搜狐互联网信息服务有限公司 一种云计算平台下的ip配置方法及装置

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5994261B2 (ja) * 2012-01-31 2016-09-21 ブラザー工業株式会社 通信装置
CN105323177A (zh) * 2014-07-28 2016-02-10 国基电子(上海)有限公司 路由器和路由方法
CN106254571B (zh) * 2016-08-05 2020-12-18 新华三技术有限公司 一种客户端ip地址分配方法及装置
EP3451633B1 (en) * 2017-08-30 2021-04-28 Canon Kabushiki Kaisha Image capturing apparatus, client apparatus, and method
US10547587B2 (en) 2018-03-19 2020-01-28 Didi Research America, Llc Method and system for near real-time IP user mapping
CN108512947A (zh) * 2018-03-21 2018-09-07 英业达科技有限公司 Dhcp动态分配方法、系统及访问终端
CN108712513B (zh) * 2018-03-27 2021-09-17 Oppo广东移动通信有限公司 网络地址设置方法、装置、终端设备及存储介质
US10708225B2 (en) * 2018-07-31 2020-07-07 Hewlett Packard Enterprise Development Lp Resolving uplink interface overlap for a network switching device
US12069024B2 (en) 2019-01-17 2024-08-20 Hewlett Packard Enterprise Development Lp Short-term lease allocation for network address conflict reduction in DHCP failover deployments
JP7321712B2 (ja) * 2019-01-30 2023-08-07 キヤノン株式会社 通信装置、通信装置の制御方法およびプログラム
US11012406B2 (en) 2019-04-01 2021-05-18 International Business Machines Corporation Automatic IP range selection

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1961536A (zh) * 2005-03-10 2007-05-09 惠普开发有限公司 服务器系统、服务器设备及其方法
US20100094954A1 (en) * 2008-10-10 2010-04-15 Samsung Electronics Co., Ltd. Method and apparatus for resolving ip address collision in remote access service

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7443862B2 (en) * 2002-01-22 2008-10-28 Canon Kabushiki Kaisha Apparatus connected to network, and address determination program and method
KR100948383B1 (ko) * 2003-03-04 2010-03-22 삼성전자주식회사 Ad hoc 네트워크 환경에서의 효율적인 ip 주소할당 및 중복 검출 방법
CN1553350A (zh) * 2003-06-06 2004-12-08 鸿富锦精密工业(深圳)有限公司 动态主机配置方法
US7633855B2 (en) * 2005-11-03 2009-12-15 Cisco Technology, Inc. System and method for resolving address conflicts in a network
CN101355594A (zh) * 2008-09-09 2009-01-28 中兴通讯股份有限公司 一种分配ip地址时地址冲突的检测方法

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1961536A (zh) * 2005-03-10 2007-05-09 惠普开发有限公司 服务器系统、服务器设备及其方法
US20100094954A1 (en) * 2008-10-10 2010-04-15 Samsung Electronics Co., Ltd. Method and apparatus for resolving ip address collision in remote access service

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103716416A (zh) * 2012-09-29 2014-04-09 北京搜狐互联网信息服务有限公司 一种云计算平台下的ip配置方法及装置
CN103716416B (zh) * 2012-09-29 2017-02-22 北京搜狐互联网信息服务有限公司 一种云计算平台下的ip配置方法及装置

Also Published As

Publication number Publication date
US9100303B2 (en) 2015-08-04
CN102571996A (zh) 2012-07-11
CN102571996B (zh) 2014-11-05
US20130275588A1 (en) 2013-10-17

Similar Documents

Publication Publication Date Title
WO2012079461A1 (zh) Ip地址分配方法、装置以及系统
KR100628493B1 (ko) 통신장치
EP3117565B1 (en) Changing topology of wireless peer-to-peer group
EP2230876B1 (en) Method and apparatus for setting up network for IP communication in a mobile terminal
CN107113892B (zh) 一种网关设备自动组网的方法及装置
KR20100136255A (ko) 디지털 기기간에 무선랜 자동 연결을 위한 방법 및 이를 위한 디지털 기기
JP2017517171A (ja) 高速ipアドレス割り当てのための方法および装置
JP2002368763A (ja) ネットワーク装置及びサーバ装置及びクライアント装置及びネットワークのipアドレス付与方法及びプログラム
WO2018196468A1 (zh) 一种实现数据业务的方法、装置及终端
WO2011085586A1 (zh) 隧道建立方法、设备及网络系统
WO2018103400A1 (zh) 无线保真Wi-Fi连接方法及相关产品
JP5551805B2 (ja) インターネットにアクセスする方法および装置
US10505890B2 (en) Network access method, system and terminal device, and computer storage medium
WO2013143433A1 (zh) 一种无线数据共享的方法及实现共享的终端
JP5737367B2 (ja) ネットワークモード選択方法及び装置
JP6037446B2 (ja) ネットワーク装置およびネットワーク装置の制御方法
CN111669309B (zh) 一种建立VxLAN的方法及无线控制器、交换机
JP2005150794A (ja) コンピュータ装置及びコンピュータプログラム
JP2008227663A (ja) Ip通信装置及びこれを備えたip通信システム並びにipアドレス設定方法
US20220086048A1 (en) Communication management system, management server, vpn server, terminal, communication management method, and program
US10574837B2 (en) Information processing apparatus for data communication with external apparatus and control method for the same, and storage medium
JP5617729B2 (ja) 通信装置及びネットワーク接続方法
KR101762862B1 (ko) 폐쇄망에서의 클라이언트 단말 자동 설정 방법 및 자동 설정 시스템
WO2020087450A1 (zh) 一种无线保真Wi-Fi接入方法、装置、电子设备及存储介质
CN111683368A (zh) 利用ssid的配对方法、音视频数据传输系统及设备

Legal Events

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

Ref document number: 11848347

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 13993225

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11848347

Country of ref document: EP

Kind code of ref document: A1