共用方式為


Assign a Specific IP Address to Each Compute Node (Create DHCP Reservations)

 

Applies To: Windows HPC Server 2008

In certain scenarios, you may want to have specific IP addresses for each compute node in your Windows HPC Server 2008 cluster. For example, you may have an application running on your cluster for which you need to specify the IP addresses of your compute nodes. An efficient way to accomplish this is to create reservations of IP addresses on the Dynamic Host Configuration Protocol (DHCP) server, so that when each node is turned on and requests an IP address from the DHCP server, it is assigned the IP address that you specify.

DHCP reservations of IP addresses are based on Media Access Control (MAC) addresses. Each reserved IP address is linked to the MAC address of the network adapter to which that IP address will be assigned. For this reason, you will need a list of the MAC address of each network adapter in your compute nodes. After you have compiled a list with the MAC addresses, you can write a script that creates the DHCP reservations.

Note


One way to collect the MAC addresses of the network adapters in your compute nodes is to export a node XML file. When you export a node XML file, it includes information about each compute node, including the MAC address of each network adapter on the node. For more information, see Step 1: Generate a Base Node XML File in the Creating a Node XML File in Windows HPC Server 2008 Step-by-Step Guide (https://go.microsoft.com/fwlink/?LinkID=154294).

Using the add reservedip command of netsh

If you have enabled DHCP server on the head node of your cluster, you can use in your script the add reservedip command of the netsh command-line tool. The following is the syntax for this command:

netsh DHCP server scope <Scope> add reservedip <IPaddress> <MACaddress> [ClientName] [ClientComment]

Where:

  • <Scope> is the DHCP scope of the cluster network for which you want to create IP address reservations. For example, 10.0.0.0 or 10.1.0.0. You can see a list of available scopes by running on the head node the following command from a Command Prompt window:

    netsh DHCP server show scope
    
  • <IPaddress> is the IP address that you want to assign to the compute node. The IP address that you specify must be within the range of the scope that you specify for <scope>.

  • <MACaddress> is the MAC address of the network adapter for which you want to specify the IP address.

  • [ClientName] is an optional parameter that you might want to use to specify the name of the compute node.

  • [ClientComment] is an optional parameter that you might want to use to specify information about the location of the compute node, or to specify similar information about the compute node. If the value that you specify for this parameter contains blank spaces, you have to enclose the value in quotation marks.

For more information about the add reservedip command of the netsh command-line tool, see “Netsh DHCP server scope” in Netsh commands for DHCP (https://go.microsoft.com/fwlink/?LinkID=154295).

Important


Do not create a DHCP reservation for the IP address that is assigned to your DHCP server. If you enabled the DHCP server on the head node of your cluster, do not create a DHCP reservation for the IP address of the head node.

Note


The two optional parameters, [ClientName] and [ClientComment], are only visible in the context of the DHCP server and do not affect or change the DHCP reservations in any practical way.

Example script

The script that you write to create the DHCP reservations can be a simple batch file with a netsh command for each reservation, or it could be a more complex script that parses a file that contains the list of MAC addresses and then runs the netsh command for each MAC address. The following is an example of a simple batch file script that includes a netsh command for each reservation for ten compute nodes:

netsh DHCP server scope 10.0.0.0 add reservedip 10.0.1.1 001E0BDAE564
netsh DHCP server scope 10.0.0.0 add reservedip 10.0.1.2 001E0BDAD950
netsh DHCP server scope 10.0.0.0 add reservedip 10.0.1.3 001E0B70530A
netsh DHCP server scope 10.0.0.0 add reservedip 10.0.1.4 001E0BDADA23
netsh DHCP server scope 10.0.0.0 add reservedip 10.0.1.5 001E0BDB047E
netsh DHCP server scope 10.0.0.0 add reservedip 10.0.2.1 001E0BDB15A1
netsh DHCP server scope 10.0.0.0 add reservedip 10.0.2.2 001E0BDAC478
netsh DHCP server scope 10.0.0.0 add reservedip 10.0.2.3 001E0BDAF7FC
netsh DHCP server scope 10.0.0.0 add reservedip 10.0.2.4 001E0BD5DA35
netsh DHCP server scope 10.0.0.0 add reservedip 10.0.2.5 001E0BDAFA3D

Additional references

Advanced Deployment Operations in Windows HPC Server 2008