gemcneill Posted November 19, 2008 Share Posted November 19, 2008 Is there an easy way to assign ips in win2k3 with out doing it one ip at a time. I have done this now for a while and I was just thinking it would be nice if there was a way. If not I will just have to get better at my 10 key. George Link to comment Share on other sites More sharing options...
SickPuppy Posted November 19, 2008 Share Posted November 19, 2008 They have to be assigned one at a time, no shortcut that I know of. Link to comment Share on other sites More sharing options...
studeggle Posted November 19, 2008 Share Posted November 19, 2008 Probably not what you are looking for, but if you are moving machines around or replacing them regularly you can utilize batch scripts to set the connection information on a machine. I do have some prewritten batch scripts I keep saved and edit as needed for new equipment. Here is a priliminary one that is fairly clean and easy to work with. @ECHO OFF set varip=65.88.48.77 set varsm=255.255.255.224 set vargw=65.88.48.65 set vardns1=66.78.202.254 set vardns2=66.78.210.254 set varhome=www.google.com REM ***** You don’t need to change anything below this line! ****** ECHO This fanciness is brought to you by Saman Sadeghi! ECHO Setting IP Address and Subnet Mask netsh int ip set address name = "Local Area Connection" source = static addr = %varip% mask = %varsm% ECHO Setting Gateway netsh int ip set address name = "Local Area Connection" gateway = %vargw% gwmetric = 1 ECHO Setting Primary DNS netsh int ip set dns name = "Local Area Connection" source = static addr = %vardns1% ECHO Setting Secondary DNS netsh int ip add dns name = "Local Area Connection" addr = %vardns2% ECHO Here are the new settings for %computername%: netsh int ip show config pause Link to comment Share on other sites More sharing options...
HIS-MOTHER Posted November 19, 2008 Share Posted November 19, 2008 Probably not what you are looking for, but if you are moving machines around or replacing them regularly you can utilize batch scripts to set the connection information on a machine. I do have some prewritten batch scripts I keep saved and edit as needed for new equipment. Here is a priliminary one that is fairly clean and easy to work with. @ECHO OFF set varip=65.88.48.77 set varsm=255.255.255.224 set vargw=65.88.48.65 set vardns1=66.78.202.254 set vardns2=66.78.210.254 set varhome=www.google.com REM ***** You don’t need to change anything below this line! ****** ECHO This fanciness is brought to you by Saman Sadeghi! ECHO Setting IP Address and Subnet Mask netsh int ip set address name = "Local Area Connection" source = static addr = %varip% mask = %varsm% ECHO Setting Gateway netsh int ip set address name = "Local Area Connection" gateway = %vargw% gwmetric = 1 ECHO Setting Primary DNS netsh int ip set dns name = "Local Area Connection" source = static addr = %vardns1% ECHO Setting Secondary DNS netsh int ip add dns name = "Local Area Connection" addr = %vardns2% ECHO Here are the new settings for %computername%: netsh int ip show config pause Don't forget if you are adding more then 1 IP then you need to add these lines for each additional IP. set varip2=65.88.48.77 set varip3=65.88.48.77 set varip4=65.88.48.77 ETC.. changing each line for a different IP. Make sure you don't typo anything or when you run that script you will lose connection to the box. Proof read your edits 3 or 4 times. Link to comment Share on other sites More sharing options...
Monk Posted November 19, 2008 Share Posted November 19, 2008 A range: for /L %a in (1,1,254) do netsh in ip add address "Local Area Connection" 1.2.3.%a 255.255.255.0 Manually: netsh in ip add address "Local Area Connection" 10.0.0.2 255.0.0.0 netsh in ip add address "Local Area Connection" 10.0.0.3 255.0.0.0 netsh in ip add address "Local Area Connection" 10.0.0.4 255.0.0.0 netsh in ip add address "Local Area Connection" 10.0.0.5 255.0.0.0 netsh in ip add address "Local Area Connection" 10.0.0.6 255.0.0.0 Link to comment Share on other sites More sharing options...
gemcneill Posted December 4, 2008 Author Share Posted December 4, 2008 I am not quite following the syntax you posted. Can you break this command down for me. for /L %a in (1,1,254) do netsh in ip add address "Local Area Connection" 1.2.3.%a 255.255.255.0 George Link to comment Share on other sites More sharing options...
KingJ Posted December 4, 2008 Share Posted December 4, 2008 for /L %a in (1,1,254) Start a for loop with variable %a from 1 to 254 in increments of 1 do netsh in ip add address "Local Area Connection" Add an ip address to the connection named "Local Area Connection" 1.2.3.%a 255.255.255.0 IP 1.2.3.%a, where a is the current value of %a in the loop. Use subnet mask 255.255.255.0 In other words, that command adds the IPs 1.2.3.1 > 1.2.3.254 to the adaptor Local Area Network connection. Link to comment Share on other sites More sharing options...
maddanny Posted December 4, 2008 Share Posted December 4, 2008 I think it's not a good idea using your primary interface for doing this. On all my servers i'm creating a loopback interface and bind my extra ips on it. Why ? The main reason (but please dont repeat it) it's because sometimes i clicked on "disable" item from right-click menu of the network card instead of "Manage firewall" Link to comment Share on other sites More sharing options...
KingJ Posted December 4, 2008 Share Posted December 4, 2008 The main reason (but please dont repeat it) it's because sometimes i clicked on "disable" item from right-click menu of the network card instead of "Manage firewall" Oops. That could be potentially fatal I have a shortcut on the desktop to the Windows firewall interface. You can also automate adding rules to it from the commandline just like you have done for IPs: FOR /L %%A IN (27000,1,27040) DO netsh firewall add portopening UDP %%A "SRCDS Port "%%A Link to comment Share on other sites More sharing options...
maddanny Posted December 4, 2008 Share Posted December 4, 2008 Fatal not really, we have a IP KVM on all servers For all firewall stuff we're using TCAdmin features for some games but we have an install script that opens all games ports by default. Link to comment Share on other sites More sharing options...
Derek Posted January 29, 2009 Share Posted January 29, 2009 Monks way > all ways. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.