Jump to content

Assign Static IP


Recommended Posts


You should be able to configure it as a part of the WINNT.SIF file. I'm not at all familiar with this particular portion of the file, but here is my best-guess effort at how to set it up. I make no guarantees that this will work.

[Networking]
   InstallDefaultComponents=No

[NetAdapters]
   Adapter1=params.Adapter1

[params.Adapter1]
   INFID=*

[NetProtocols]
   MS_TCPIP=params.MS_TCPIP

[params.MS_TCPIP]
AdapterSections = params.MS_TCPIP.Adapter1


[params.MS_TCPIP.Adapter1]
   SpecificTo=Adapter1
   DHCP=No
   IPAddress = 1.1.1.1
   SubnetMask = 255.255.248.0
   DefaultGateway = 2.2.2.2
   DNSServerSearchOrder = 193.1.1.3,193.1.1.44
   WINS = No

Of course, this code isn't meant to be used as-is, but substitute in the values you want for the dummy IPs that are listed and it should set you up with a nice, shiny static IP.

You can easily do this in your winnt.sif - read the helpfile ref.chm

"Easy" is relative. I pieced together the above code from the helpfile combined with astalavista's sif that he has posted in another thread. I figure I'm doing well to understand about 1 line in 3. :P

Link to comment
Share on other sites

i personally use this batch after install (more flexible for different pc's)

@echo off

:NW_CHOOSE

ECHO.

ECHO 1. STATIC

ECHO 2. DHCP

ECHO 3. Cancel

SET /P NW_CONF=[Do you want to use DHCP or specify a static IP? (Select 1 or 2)]

IF /I "%NW_CONF%" == "1" GOTO NW_INPUT

IF /I "%NW_CONF%" == "2" GOTO NW_SET_DHCP

IF /I "%NW_CONF%" == "3" GOTO END

:NW_INPUT

SET /P STATIC_IP=[iP:]

SET /P SUBNET=[subnet Mask:]

SET /P GATEWAY=[Default Gateway:]

SET /P DNS=[DNS Server:]

ECHO.

ECHO You specified:

ECHO IP Address: %STATIC_IP%

ECHO Subnet Mask: %SUBNET%

ECHO Default Gateway: %GATEWAY%

ECHO DNS Server: %DNS%

:NW_CONFIRM

ECHO.

SET /P NW_CONF=[is this correct? Y/N:]

IF /I "%NW_CONF%" == "Y" GOTO NW_SET_STATIC

IF /I "%NW_CONF%" == "N" GOTO NW_INPUT

GOTO NW_CONFIRM

:NW_SET_STATIC

netsh int ip add address "Local Area Connection" %STATIC_IP% %SUBNET%

netsh int ip add address "Local Area Connection" gateway=%GATEWAY% gwmetric=1

netsh int ip add dns "Local Area Connection" %DNS%

GOTO END

:NW_SET_DHCP

netsh int ip set add "Local Area Connection" dhcp

GOTO END

:END

will set ip, subnet, gateway and dns.

Link to comment
Share on other sites

no problem, also use this for naming afterwards. i just have both copied to the desktop and run them after full install.

@echo off

:NW_CHOOSE

ECHO.

SET /P NW_CONF=[Do you want to change the computer name Y/N:]

IF /I "%NW_CONF%" == "Y" GOTO NW_INPUT

IF /I "%NW_CONF%" == "N" GOTO END

:NW_INPUT

SET /P NAME=[NAME:]

ECHO.

ECHO You specified:

ECHO NAME: %NAME%

:NW_CONFIRM

ECHO.

SET /P NW_CONF=[is this correct? Y/N:]

IF /I "%NW_CONF%" == "Y" GOTO NW_SET_NAME

IF /I "%NW_CONF%" == "N" GOTO NW_INPUT

GOTO NW_CONFIRM

:NW_SET_NAME

compname.exe /c %NAME%

GOTO END

:END

you will also need the attached file: compname.exe (put in system32 under $oem$ )

compname.rar

Link to comment
Share on other sites

:NW_SET_STATIC

netsh int ip add address "Local Area Connection" %STATIC_IP% %SUBNET%

netsh int ip add address "Local Area Connection" gateway=%GATEWAY% gwmetric=1

netsh int ip add dns "Local Area Connection" %DNS%

GOTO END

dnrc, I see your script sets the gateway separately from the ip and mask. I also, noticed that you cannot set them at the same time although the commandline help indicates that you can in one of the examples.

I thought I would just point this out in case people didn't just copy your script verbatim and tried to use the example from NETSH.EXE.

HTH

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...