A kind of visualization distribution method of clustered node IP address
Technical field
The present invention relates to network communication technology field, more particularly, to a kind of visualization distribution side of clustered node IP address
Method.
Background technology
In the prior art, IP address distribution and management technique scheme are as follows:
In large-scale network-estabilishing, employ DHCP Server+Snooping+Option82 technology and enter row address distribution, tool
For body,
DHCP Client:I.e. clustered node (is subsequently collectively referred to as clustered node or DHCP Client, herein with DHCP
Server distinguishes), by the interaction of the message of DHCP protocol, to DHCP Server applied address;
DHCP Server:I.e. address server, the Address requests of response DHCP Client, select from unappropriated address
Select and distribute to DHCP Client.
DHCP Snooping:I.e. frame switch, between DHCP Client and DHCP Server, DHCP
Snooping, in the DHCP DISCOVER message that DHCP Client sends, can insert a referred to as information word of Option82
Section.Sub- option (Sub-option) part therein, can carry out self-defined filling by switch, and filling content includes at present:
The information such as VLAN ID, interface name, MAC.
DHCP Server receives the DHCP request containing above- mentioned information, by suboption-value with address pool (containing multiple continuous
IP address) mated, enter the distribution of row address, as shown in table 1:
Table 1
In the prior art scheme, distribute specific to the address in address pool, be using the time sequencing method of salary distribution.With three
As a example the cluster of individual node (in same frame, Position Number is 1,2,3), electric sequence is (1,3,2), then address
Allocation result is as shown in table 2:
Node location is numbered |
Address |
1 |
192.168.0.1 |
2 |
192.168.0.3 |
3 |
192.168.0.2 |
Table 2
With the rise of big data business, the increasing service needed that calculates calculates on a large scale in data center deployment
Node cluster, the scale of even up to up to ten thousand.Under such a scenario, need to select rational technology to carry out IP address distribution
And management, it is allowed to enable following demand:
A) IP address visualization, you can intuitively node physical location is determined according to IP address, including room, frame,
The information such as shelf position, connected switch ports themselves number, are easy to the operation such as equipment routing inspection, upgrading, maintenance;
B) automatically, efficiently give all node distribution IP address it is not necessary to lasting manual intervention, and should be once to divide
Join, once and for all;
C) IP address is fixed for a long time, and after changing network interface card or whole machine, this node address keeps constant, keeps effect of visualization
Integrity.
But, in prior art, IP address distribution and management technique scheme are unable to reach the corresponding relation of address and position,
Also controlled distribution cannot be realized.
Content of the invention
In view of above-mentioned analysis, the present invention is intended to provide a kind of visualization distribution method of clustered node IP address, in order to
Solve the corresponding relation that IP address distribution and management technique scheme in prior art are unable to reach address and position, also cannot realize
The problem of controlled distribution.
The purpose of the present invention is mainly achieved through the following technical solutions:
A kind of clustered node IP address visualizes distribution method, comprises the steps:
Step 1:Clustered node passes through frame switch and sends DHCP DISCOVER message to DHCP Server;
Step 2:Frame switch inserts containing the ground representing clustered node physical location in DHCP DISCOVER message
The Option82 information field of location, the DHCP DISCOVER message after insertion Option82 information field is transmitted to DHCP
Server;Wherein, described physical location includes room number, shelf number, the interior order of frame;
Step 3:DHCP Server, according to the Option82 information field in the DHCP DISCOVER message receiving, enters
The distribution of row address, sends DHCP OFFER message to clustered node;
Step 4:After frame switch receives DHCP OFFER message, refresh local log, by described DHCP
OFFER message is transmitted to clustered node.
Described step 2 also includes following sub-step:
Sub-step 2.1:Frame switch, according to own physical position, represents the value of room number in pre-configured good address format
With the value representing shelf number;
Sub-step 2.2:Frame switch determines expression in address format according to clustered node in the order up and down in frame
The value of order in frame;
Sub-step 2.3:Frame switch includes following field in locally created local record table, record information:A field list
Show the value of organization number, B field represents the value of room number, C field represents the value of shelf number, and D field represents order in frame
Value, MAC field represents the physical address of clustered node, and mode field represents residing shape during clustered node applied address
State;Now the value of A is set to sky, state is set to Requesting;
Sub-step 2.4:Frame switch adds Option82 letter in the DHCP DISCOVER message that clustered node sends
Breath field, including the value of A, B, C, D and MAC.
Described switch, when setting up local record table, finds that this list item has existed, and the value of A is not empty, then exchange
Machine determines whether:
If the MAC information in DHCP DISCOVER message is consistent with record in list item, obtain the value of A;
If record is inconsistent in the MAC information in DHCP DISCOVER message and list item, obtains the value of A, and refresh
MAC.
Described step 3 also includes following sub-step:
Sub-step 3.1:DHCP Server parses the value of tri- fields of B, C, D in Option82 information field, adds
On DHCP Server, the value of pre-configured field A, is assembled into sufficient address:A.B.C.D;
Sub-step 3.2:Before entering row address distribution, DHCP Server carries out value model to above-mentioned tri- fields of B, C, D
Enclose reasonableness check;
Sub-step 3.3:If span reasonableness check passes through, whether DHCP Server is allocated into address
Row checks.
Described sub-step 3.3 further includes:
If address is unallocated, DHCP Server directly specifies this address in DHCP OFFER message, and in DHCP
The lease information of this address is recorded on Server;
If address is distributed, and the MAC and DHCP DISCOVER message of the clustered node being recorded is consistent, then DHCP
Server directly specifies this address in DHCP OFFER message, and refreshes the lease information of this address;
If address is distributed, and the MAC and DHCP DISCOVER message of the clustered node being recorded is inconsistent, then DHCP
Server sends detection messages to distributing address.
Described DHCP Server further includes to distributing address transmission detection messages:
DHCP Server sends Echo Request or ARP Request detection messages to the address dispensing;
If there is reply the address dispensing, terminate this assigning process;
If the address dispensing is not replied, DHCP Server specifies this address in DHCP OFFER message, and brushes
MAC information in this address lease new.
Methods described is further comprising the steps:
Clustered node sends DHCP REQUEST message to DHCP Server, confirms to select DHCP Server to provide for it
IP address;
Selected DHCP Server sends DHCP ACK message to corresponding clustered node, will report in DHCP OFFER
Corresponding clustered node given by the IP address lease preparing in literary composition.
Described clustered node breaks down, and when needing to change network interface card or the replacing of whole machine, is done directly replacing, and netting twine connects
Same port on frame switch, IP address is constant.
When described DHCP Server breaks down, whether the state that frame exchanges the local list item of machine check is for a long time
Requesting, judges whether DHCP Server distributes address and replied;
If DHCP Server is not replied, after clustered node sends repeatedly request, frame exchanges machine check originally
Other address list items of ground record, from other list items being in Offered state, obtain the value of A field, constitute address
A.B.C.D.
Described frame switch replaces DHCP Server, actively distributes address and reply to clustered node, and remembers local
Record this address, state is set to Temp;
Frame switch persistently detects whether DHCP Server resumes work, after DHCP Server resumes work, machine
Frame switch replace clustered node to DHCP Server send DHCP DISCOVER message, be easy to DHCP Server record or
Refresh lease information.
The present invention has the beneficial effect that:
Only need change DHCP Snooping and DHCP Server realization it is not necessary to modification DHCP Client it is ensured that
The feasibility of the technical program and suitability;
Only be there is the IP address of network significance, changed into the address format containing physical location information, can be direct
Raised position location efficiency;
By way of automatization, realize the distribution of fixed ip address, even if in the MAC change that maintenance leads to, according to
So can be allocated according to original IP;
Only need to carry out relatively simple configuration in frame switch and DHCP Server server, save configuration
Workload, and follow-up maintenance workload is negligible.
Other features and advantages of the present invention will illustrate in the following description, and, partial becoming from description
Obtain it is clear that or being understood by implementing the present invention.The purpose of the present invention and other advantages can be by the explanations write
In book, claims and accompanying drawing, specifically noted structure is realizing and to obtain.
Brief description
Accompanying drawing is only used for illustrating the purpose of specific embodiment, and is not considered as limitation of the present invention, in whole accompanying drawing
In, identical reference markss represent identical part.
Fig. 1 is the interaction schematic diagram of clustered node and DHCP Server;
Fig. 2 is frame switch processes DHCP DISCOVER message flow chart;
Fig. 3 is DHCP Server distribution address flow chart.
Specific embodiment
To specifically describe the preferred embodiments of the present invention below in conjunction with the accompanying drawings, wherein, accompanying drawing constitutes the application part, and
It is used for together with embodiments of the present invention explaining the principle of the present invention.
Step 1-4 clustered node is as shown in Figure 1 with the interaction schematic diagram of DHCP Server.
Step 1, clustered node DHCP Client, by frame switch DHCP Snooping to address server DHCP
Server sends DHCP DISCOVER message;
Discovery phase (dhcp client broadcast transmission DHCP DISCOVER message in a network, finds DHCP Server,
IP address requesting lease).
Step 2, frame switch DHCP Snooping, in the DHCP DISCOVER message that DHCP Client sends
The Option82 information field containing the address representing clustered node physical location for the insertion, after inserting Option82 information field
DHCP DISCOVER message be transmitted to DHCP Server;Wherein, described physical location includes room number, shelf number, frame
Interior order, specifically, as shown in Fig. 2 include following sub-step:
Sub-step 2.1, frame switch according to own physical position, B, C in pre-configured good address format (i.e. A.B.C.D)
This two values.
The order up and down in frame determines address format (i.e. A.B.C.D) according to node for sub-step 2.2, frame switch
The value of middle D.
The node order of connection in each port of frame switch and frame, and sequence consensus up and down in frame for the node,
It is consequently formed corresponding relation, the final value determining D.
That is, the server cluster for data center is disposed and management mode, sets up server geographic position data storehouse, will
The physical location of server is mapped in IP address, as the field of IP address;Specifically, in IP address standard format write
On the basis of (decimal scale point point-score form A.B.C.D), physical location is mapped in IP address, is split into 4 levels:
It should be noted that:Such structure can be merged according to actual scale or be simplified, such as in only one of which
In the case of room:
Simultaneously need to being pointed out that:The targeted data center's cluster of the present embodiment, is all with independent one substantially
Double layer network mode is run, and deployment is private net address, and has enough address spaces.
The present embodiment carries out dividing level with 8 bit lengths, on other occasions, can select other according to actual quantity
Length divide, but corresponding technique effect may have certain reduction.
Sub-step 2.3, frame switch include in locally created local record table, record information
A Value |
B Value |
C Value |
D Value |
MAC |
State |
Now the value of A is sky, and state is Requesting.
If switch, when setting up local record table, finds that this list item has existed, and the value of A is not empty, and this is described
On port, address is crossed in existing node application, then switch needs to be determined whether:
If the MAC information in DHCP DISCOVER message is consistent with record in list item, illustrate that this scene is DHCP
Client does address and renews a contract, then obtain the value of A;
If record is inconsistent in the MAC information in DHCP DISCOVER message and list item, illustrate that this scene is to change
(because frame switch is direct-connected with DHCP Client, switch can judge node device according to the change of port status
Whether it is more exchange device), then obtain the value of A, and refresh MAC.
Sub-step 2.4, frame switch add in the DHCP DISCOVER message that DHCP Client sends
Option82 information field, format content includes the value of A, B, C, D and MAC, 1 byte of each field length, and now the value of A is
Empty.
Step 3, DHCP Server, according to Option82 information field in the DHCP DISCOVER message receiving, are carried out
The distribution of address, sends DHCP OFFER message to clustered node;Specifically, as shown in figure 3, including following sub-step:
Sub-step 3.1, DHCP Server receive the DHCP request containing Option82 information field, parse
The value of tri- fields of B, C, D in Option82 information field, adds pre-configured field A on DHCP Server
Value, is assembled into sufficient address:A.B.C.D.
Sub-step 3.2, enter row address distribution before, DHCP Server carries out value model to above-mentioned tri- fields of B, C, D
Enclose reasonableness check.
If sub-step 3.3 span reasonableness check passes through, DHCP Server is carried out to whether address is distributed
Check;
If address is unallocated, DHCP Server directly specifies this address in DHCP OFFER message, and in DHCP
The lease information of this address is recorded on Server.
If address has dispensed (lease that there is this address), and the MAC of DHCP Client being recorded with
DHCP DISCOVER message is consistent, illustrates that this situation enters the renewed treaty of row address for DHCP Client, then DHCP Server is direct
Specify this address in DHCP OFFER message, and refresh lease information of this address etc.;
If address has dispensed, but the MAC and DHCP DISCOVER message of the DHCP Client being recorded
Inconsistent, illustrate to there may exist the situation changing server, because DHCP Server and DHCP Client is indirectly connected (passing through
DHCP Snooping is indirectly connected with) it is impossible to direct judgement conclusion, so needing DHCP Server further to be detected.
DHCP Server first sends the detection messages such as Echo Reqest or ARP Request to raw address:
If there are reply, then explanation origin node presence, this DHCP DISCOVER message is probably error message, then terminate
This assigning process.
Without reply, then illustrate that origin node may replace, then DHCP Server is directly in DHCP
Specify this address in OFFER message, and refresh MAC information in this address lease etc..
After step 4, DHCP Snooping receive DHCP OFFER message, obtain the A field in address information, and refresh
Local log, state is set to Offered;Described DHCP OFFER message is transmitted to DHCP Client.
(DHCP Client passed through DHCP REQUEST message and confirmed to select DHCP Server to be it step 5, choice phase
The IP address providing).
(selected Dynamic Host Configuration Protocol server passes through DHCP ACK message in DHCP OFFER message for step 6, the stage of recognition
Corresponding DHCP Client given by the IP address lease preparing).
In a preferred embodiment of the invention,
When certain clustered node breaks down, when needing to change network interface card or the replacing of whole machine, it is done directly replacing, and netting twine is even
It is connected on the same port on frame switch.Assume that the address having been dispensed into is 1.2.3.4, for frame switch
Speech, because port is constant, the sub- option in address that it is filled in Option82 is constant, its local record table of switch query, can
To obtain the value of A, B, C, D4 field, the therefore content of the sub- option in address is still 1.2.3.4.DHCP Server receives request
Afterwards, according to above-mentioned sub- option content, if the value of organization number A keeps constant, continue the address of distribution 1.2.3.4 for it,
Process is same as above.
In another preferred embodiment of the invention, when DHCP Server breaks down, clustered node DHCP
The DHCP request that Client sends will timely respond to, and now frame switch DHCP Snooping is handled as follows:
Frame switch DHCP Snooping checks whether the state of local list item is Requesting for a long time, judges
Whether Server distributes address and is replied.
If DHCP Server is not replied, after DHCP Client sends repeatedly request, DHCP
Snooping checks other address list items of local record, from other list items being in Offered state, obtains A field
Value, constitutes address A.B.C.D;
DHCP Snooping replaces DHCP Server, actively gives DHCP Client distribution address and reply, and local
Record this address, state is set to Temp;
DHCP Snooping persistently detects whether DHCP Server resumes work, after DHCP Server resumes work,
DHCP Snooping replaces DHCP Client to send DHCP DISCOVER message, is easy to DHCP Server record or refreshes rent
About information.
In sum, embodiments provide a kind of clustered node IP address visualization distribution method it is achieved that IP
Address and the one-to-one corresponding of node physical location, that is, achieve the manual intervention it is not necessary to lasting that visualizes of IP address, certainly
Move, be efficiently all node distribution IP address, and IP address is fixed for a long time, after changing network interface card or whole machine, this node address
Keep constant, keep the integrity of effect of visualization.
Because IP address and physical location have corresponding relation, lease table can be polymerized by DHCP Server
Management, represents following information:
Electric ratio on the node of each machine room or frame, can be from the ruuning situation macroscopically holding whole cluster;
Clustered node changes number of times and ratio, can reveal that humiture, powder that node failure rate and physical location brought
The relation of the factors such as dirt.
It will be understood by those skilled in the art that realizing all or part of flow process of above-described embodiment method, can be by meter
Calculation machine program to complete come the hardware to instruct correlation, and described program can be stored in computer-readable recording medium.Wherein, institute
Stating computer-readable recording medium is disk, CD, read-only memory or random access memory etc..
The above, the only present invention preferably specific embodiment, but protection scope of the present invention is not limited thereto,
Any those familiar with the art the invention discloses technical scope in, the change or replacement that can readily occur in,
All should be included within the scope of the present invention.