none
Setting static ip address's on three nic's

    Question

  • Dear All,

    I am trying to set static ip addresses on my three network interfaces that i have on my nodes.

    We have a policy in the company that we need to use static ip addresses on servers, and are not allowed to use dhcp.

    I have tried getting this to work by using a batch file and the netsh command.

    Each node needs to get a specific ip address on each interface.

    For example :

    The node named "Node01"

    Should have these ip addresses statically setup in windows :

    Enterprise : 10.211.43.2

    Private : 192.168.0.2

    Application 192.168.1.2

    What i have tried so far does not work well.

    I name each node before deployment, and i have a batch file that basically looks like this :

    ----------------------------IP.BAT--------------------------------

    @echo off

    cls

     

    :COMMON

    echo %COMPUTERNAME%

    if /i "%COMPUTERNAME%" EQU "NODE01" goto NODE01

     

    :NODE01

     echo node01

    netsh interface set interface name="Local Area Connection" newname= "Enterprise"

    netsh interface ip set address name="Enterprise" source=static addr=10.211.43.2 mask=255.255.254.0 gateway=10.211.43.254 gwmetric=10

    netsh interface set interface name="Local Area Connection 4" newname= "Application"

    netsh interface ip set address name="Application" source=static addr=192.168.1.2 mask=255.255.255.0

    netsh interface set interface name="Local Area Connection 2" newname= "Private"

    netsh interface ip set address name="Private" source=static addr=192.168.0.2 mask=255.255.255.0

    rem netsh interface set interface "Local Area Connection 3" disable

    goto END

     

    :END

    exit

    -------------------------------------------------------------------------

     

    The problem is that Windows does not assign the network connections consistently, i.e sometimes the adapter connected to the exterprise network is named "Local Area Connection" , the next time it is named "Local Area Connection 2" etc

    So my first question is, is there a way to get windows to assign a certain network connection name to a certain adapter?

    Or is there somebody out there kind enough to offer an alternative script/method for this? , perhaps a way of doing this based on each adapters mac address?

     

    Best Regards

    Patric

     

    Wednesday, July 6, 2011 7:01 AM

All replies

  • Using DHCP for just these compute nodes is the ideal solution.  It's pretty impossible to guess what the GUID will be for a NIC adapter on a given machine when it's being installed, and it won't be the same across all of your compute nodes.  Think of the compute nodes as clients to the head node.  You can use DHCP reservations and tie the IPs to the MAC address of each NIC, that's about all you can do, but if you have to go chase down the MAC address on each system, you are almost better off just manually setting the static configuration on each system if you can't use DHCP.
    • Proposed as answer by Rob-HPC Friday, August 5, 2011 6:19 PM
    Friday, August 5, 2011 3:11 PM
  • Hi,

    Yes using static dhcp or plain dhcp would make life easier, but it is not allowed on servers in my company, servers need to have a static ip set in the OS config.

    So i am still looking for help on this.

    I have since my last post tried another method that is supposed to set the static ip address based on a known mac address, but it does not work either, i.e every other installation it randomly selects another adapter even though it correctly identifies the adapter with the specified mac address.

    here is a copy of that script :

    ----------------------------IP.BAT--------------------------------

    @echo off

    cls

     

    :COMMON

    echo %COMPUTERNAME%

    if /i "%COMPUTERNAME%" EQU "NODE01" goto NODE01

    NODE01
    echo node01
    wmic /output:NICNameUNICODE1.txt nic where MACAddress="78:E3:B5:0A:27:64" get NetConnectionID /FORMAT:LIST
    type NICNameUNICODE1.txt > NICName1.txt
    for /F "skip=2 tokens=1,2 delims==" %%i in (NICName1.txt) do netsh interface set interface name="%%j" newname="Enterprise"
    netsh interface ip set address name="Enterprise" source=static addr=10.211.43.223 mask=255.255.254.0 gateway=10.211.43.254 gwmetric=10
    netsh interface ip set dns name="Enterprise" source=static addr=10.211.0.92 register=PRIMARY
    netsh interface ip add dns name="Enterprise" addr=10.211.0.100 index=2
    c:
    cd\
    del NIC*.txt /Q
    goto END

    :END

    exit

    -------------------------------------------------------------------------

     

    Br

    Patric

     

    Tuesday, August 16, 2011 8:22 AM
  • Hi Patric,

    Well you next best bet is to use a custom unattended.xml, and assign the NICs using the NetLUID.

    http://technet.microsoft.com/en-us/library/cc748905(WS.10).aspx

    You can extract the NetLuid using nicstats which is provided in the WinDDK.

    http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=11800

    This method is still not reliable between different builds of the image, but if you using the same image you should be okay. Again this method is cumbersome, because you will need to build a different node template per node, and set the node template to a customer unattend.xml. 

    Thanks,

    Ben

     

    Tuesday, August 23, 2011 12:51 AM
  • Can you tell the company that DHCP is a required piece of HPC Server, so if they want to use HPC resources, they will need to give you a waiver for a DHCP server?  Maybe you could put the HPC servers behind a firewall, to make sure the DHCP traffic doesn't go anywhere?
    Tuesday, August 30, 2011 8:52 PM