Background technology
DHCP is that a kind of network manager of making can manage the local net network communication protocol with the distributing IP address concentratedly, and in IP network, each equipment that connects Internet all needs the distributing IP address.DHCP makes the network manager when certain computer moves on to other position in the network, can obtain new IP address from monitoring of centre junction point and distributing IP address.In order to achieve the above object, needing DHCP server (Dynamic Host Configuration Protocol server end) and DHCP client (dhcp client) to work in coordination with accomplishes.DHCP server is responsible for distributing, safeguards that LAN IP address, DHCP client are work station application, renewal IP address.
DHCP has used the notion of lease, or is called the term of validity of Computer IP address, and the rental period is indefinite.DHCP server is to the three kinds of methods that are assigned of IP address: manual allocation, distribute and dynamic assignment automatically, to satisfy different IP address need.Manual allocation is that specific work station is bound fixed ip address, and the address can be not expired; Be assigned to the just use forever of IP address in case be assigned as automatically; The IP address that dynamic assignment and impermanent use are assigned to, as long as lease expires, client must discharge this IP address, uses to give other work station.
In the information that DHCP server safeguards, the MAC Address of the network equipment (physical address)---IP address is wherein most important lan address distributed intelligence to information.MAC Address is the hardware address of the network equipment; The network equipment when dispatching from the factory by the globally unique MAC Address of factory settings; DHCP is that the MAC Address of each application distributes an IP address when the distributing IP address; MAC Address and IP address are one to one and are unique in whole local area network like this, have avoided network address collision, have guaranteed normally carrying out of network service.DHCP server end is safeguarded the correspondence table of IP address and MAC Address, and MAC Address is unique in the local area network (LAN), and DHCP server can not distribute a plurality of IP address simultaneously for same MAC Address.
IP address of a network equipment (or the corresponding LAN IP address of MAC Address); This can satisfy the demand of network service under normal conditions; But system needs single MAC Address to dispose a plurality of IP address sometimes, and promptly single MAC Address---many IP address is corresponding.In the prior art, need support another name (alias) for supporting many IP address network interface, each of the network equipment called all configurable I P addresses, is equivalent to a physical equipment like this and fictionalized a plurality of logical device, and the IP address of each logical device is all different.Management is automatically no longer come by the DHCP agreement in the IP address of local area network (LAN) in this case; But get involved unified configuration: in local area network (LAN), close the DHCP service by the network manager; The artificial planning IP address assignment is to avoid IP address conflict in the local area network (LAN), and corresponding IP address information is called and disposed to manual foundation for each network interface in the local area network (LAN).There is following shortcoming in this method: configuration information can't recover automatically when the network equipment was restarted; When the IP address that the local web network equipment increases is not enough, need plan configuration again to the IP address manual work of whole network, be unsuitable for large-scale application; Do not bring into play the superiority of DHCP consultative management LAN IP address.
Summary of the invention
The object of the present invention is to provide a kind of IP address configuration method, be intended to solve the problem that same device mac address is disposed a plurality of IP address.
The present invention is achieved in that a kind of IP address configuration method, and described method comprises:
A, DHCP server distribute an address location to the DHCP client of request IP address, and the representative IP address of this address location is sent to this DHCP client;
B, this DHCP client derive the related IP address in this address location according to this relevance of representing related IP address in IP address and this address location, should represent the IP address to give the network equipment with related IP address assignment.
More specifically, wherein also comprise before the step a:
A0, this DHCP server are divided into one or more than one address location with the IP address in its address pool; Each address location comprises generation Table I P address and one or more than one related IP address, this representative IP address with this perhaps more than one related IP address possess relevance.
More specifically, this representative IP address possesses following relevance with this or more than one related IP address:
This representative IP address is continuous IP address with this or more than one related IP address, and this represent the IP address is first IP address in this contiguous ip address.
More specifically, this representative IP address possesses following relevance with this or more than one related IP address:
This representative IP address is continuous IP address with this or more than one related IP address, and this represent the IP address is last the IP address in this contiguous ip address.
More specifically, wherein step a also comprises:
This DHCP server sets up the MAC of this DHCP client and the one-to-one relationship between this representative IP address.
More specifically, among the said step b, derive the related IP address in this address location according to the division rule of address location.
More specifically, among the said step b, by representing the IP address to postpone or adding respectively on the IP address that one arranges numerical value and can obtain related IP address represent.
The present invention overcomes the deficiency of prior art; The technical scheme that provides is: DHCP server is divided into a plurality of address locations with the IP address in the address pool; Related IP address with two or more is an address location, and with the representative IP address of the some IP address in each address location as this address location.As DHCP client during to DHCP server request IP address; DHCP server sets up the one-to-one relationship between the MAC that represents IP address and DHCP client; And the representative IP address of certain address location sent to DHCP client; DHCP client according to this representative IP address and with this address location in the relevance of other IP addresses derive the related IP address in this address location, to satisfy the demand of many IP of DHCP client address.Technical scheme provided by the invention can be divided the address location size according to actual needs, satisfies client varying number IP address need; And need not to revise existing DHCP request message form, information interaction keeps existing DHCP protocol architecture fully, compatible existing dhcp address distribution mechanism, and versatility is good; A plurality of IP address need of DHCP client only need can satisfy through one-time request, and minimizing DHCP server at double and DHCP client's is mutual, and network management efficiency improves; DHCP client supports many IP disconnection reconnecting, improves communication reliability; DHCP client to the maintenance of IP address location just as single ip address is safeguarded that the concertedness between the IP address is strong.
Embodiment
Technical scheme provided by the invention is: DHCP server is divided into a plurality of address locations with the IP address in the address pool; Related IP address with two or more is an address location, and with the representative IP address of the some IP address in each address location as this address location.As DHCP client during to DHCPserver request IP address; DHCP server sets up the one-to-one relationship between the MAC that represents IP address and DHCP client; And the representative IP address of certain address location sent to DHCP client; DHCPclient according to this representative IP address and with this address location in the relevance of other IP addresses derive the related IP address in this address location, to satisfy the demand of many IP of DHCP client address.
In order to make the object of the invention, technical scheme and advantage clearer,, the present invention is further elaborated below in conjunction with accompanying drawing and embodiment.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
Concrete when realizing technical scheme provided by the invention, DHCP server carries out granularity division to the IP address in the address pool, is a unit granularity with two or more relevant IP address, as an address location.In the IP address pool as shown in Figure 1 example 3 address locations, each address location comprises 3 IP addresses, 3 IP addresses in each address location are continuous; The representative IP address that is this address location with first IP address in each address location (during practical application technical scheme of the present invention, representing the IP address also can be last perhaps middle one):
The IP address that address location one comprises is respectively:
10.120.105.20
10.120.105.21
10.120.105.22
The representative IP address of address location one is 10.120.105.20.
The IP address that address location two comprises is respectively:
10.120.105.44
10.120.105.45
10.120.105.46
The representative IP address of address location two is 10.120.105.44.
The IP address that address location three comprises is respectively:
10.120.105.252
10.120.105.253
10.120.105.254
The representative IP address of address location three is 10.120.105.252.
In the same address location, 3 IP addresses can also adopt other rule that 3 IP addresses are divided in the same address location except (shown in three above-mentioned address locations) can using continuous IP address, like example two:
The IP address that address location one comprises is respectively:
10.120.105.20
10.120.105.98
10.120.105.176
The representative IP address of address location one is 10.120.105.20.
The IP address that address location two comprises is respectively:
10.120.105.21
10.120.105.99
10.120.105.177
The representative IP address of address location two is 10.120.105.21.
The IP address that address location three comprises is respectively:
10.120.105.23
10.120.105.100
10.120.105.178
The representative IP address of address location three is 10.120.105.23.
As DHCP client during to DHCP server request IP address, DHCP server will distribute an address location to each DHCPclien, and the representative IP address of this address location will be sent to corresponding DHCPclient.DHCP server sets up the one-to-one relationship between the MAC that represents IP address and DHCP client.
On behalf of the relevance of other IP addresses in IP address and this address location, DHCP client can derive other IP addresses according to this after receiving the representative IP address of DHCP server transmission.
As shown in Figure 2; Suppose DHCP client1 (its MAC is 00:0C:43:30:52:77), DHCP client2 (its MAC is 00:22:68:80:76:31) and DHCP client3 (its MAC is 00:0C:43:90:37:67) to DHCP server request IP address, DHCP server carries out following distribution:
Address location one is distributed to DHCP client1; And will represent IP address 10.120.105.20 to send to DHCP client1, set up the one-to-one relationship between the MAC (00:0C:43:30:52:77) that should represent IP address (10.120.105.20) and DHCP client1;
Address location two is distributed to DHCP client2; And will represent IP address 10.120.105.44 to send to DHCP client2, set up the one-to-one relationship between the MAC (00:22:68:80:76:31) that should represent IP address (10.120.105.44) and DHCP client2;
Address location three is distributed to DHCP client3; And will represent IP address 10.120.105.252 to send to DHCP client3, set up the one-to-one relationship between the MAC (00:0C:43:90:37:67) that should represent IP address (10.120.105.252) and DHCP client3.
DHCP client1, DHCP client2 and DHCP client3 can derive the related IP address that each represents the IP address after receiving the representative IP address of DHCP sever transmission respectively, are example with DHCP client1, and its derivation is following:
The representative IP address that DHCP client1 receives is 10.120.105.20, and DHCP client1 can derive the related IP address of representing the IP address according to following rule:
1) represent corresponding address unit, IP address to comprise 3 IP addresses;
2) 3 IP addresses representing corresponding address unit, IP address to comprise are continuous;
3) representing the IP address is in continuous 3 IP addresses first;
Can derive related IP address thus and be respectively 10.120.105.21 and 10.120.105.22, DHCPclient1 can distribute with related IP address representing the IP address thus.In like manner, DHCP client2 also can derive related IP address according to the representative IP address that receives with DHCP client2.
DHCP client1 is relevant with the division rule of address location according to the rule of the related IP address of representing the IP address to derive.Like the contiguous ip address unit, by other member who represents the IP address to postpone to obtain same address location.Like the address location division methods of example two, DHCP client1 is according to representing the IP address, on representing the IP address, adds 78 and 156 two other related IP addresses that can obtain in the same address location respectively.
Embodiment of the invention flow chart is as shown in Figure 3, specifically comprises the steps:
1, DHCP server is divided into a plurality of address locations with its IP address pool, and each address location comprises that one is represented IP address and one or more than one related IP address;
2, DHCP client is to DHCPserver request IP address; DHCP server distributes an address location to give this DHCP client; The representative IP address of this address location is sent to this DHCP client, set up the one-to-one relationship between the MAC of this representative IP address and this DHCP client;
3, DHCP client according to the representative IP address that receives and with related IP address between relevance, derive IP address with this representative IP address correlation;
4, on behalf of the IP address, DHCPclient should give the network equipment with related IP address assignment.
Fig. 4 is the application scenarios sketch map of the embodiment of the invention, is making up static NAT (network address translation) afterwards, and whole network environment has just been built.Use home network IP address when communicating by letter between the domestic terminal apparatus; When terminal equipment will be communicated by letter with subzone network, when promptly striding across gateway, home network IP address transition was cell networks IP address, converted 10.120.105.20 into like the IP address 192.168.10.10 of domestic terminal apparatus 1.
In above-mentioned process, DHCP server can divide the size of address location according to actual needs, and each address location can comprise 1 or a plurality of related addresses, to satisfy the demand of client varying number IP address; When DHCP client asks many IP address and DHCP server to DHCPclient distributing IP address to DHCP server; Need not to revise existing DHCP message format; Information interaction keeps existing DHCP protocol architecture fully, compatible existing dhcp address distribution mechanism, and versatility is good; And a plurality of IP address need of DHCP client only need can satisfy through one-time request, and minimizing DHCP server at double and DHCP client's is mutual, and network management efficiency improves; DHCP client supports many IP disconnection reconnecting, improves communication reliability; DHCP client to the maintenance of IP address location just as single ip address is safeguarded that the concertedness between the IP address is strong.
The above is merely preferred embodiment of the present invention, not in order to restriction the present invention, all any modifications of within spirit of the present invention and principle, being done, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.