Networking Forums

Networking Forums > Computer Networking > Windows Networking > Easy way of changing IP addresses using a script

Reply
Thread Tools Display Modes

Easy way of changing IP addresses using a script

 
 
stuart.robert.watson@googlemail.com
Guest
Posts: n/a

 
      01-24-2008, 08:39 AM
We are changing ISPs at the weekend. Unfortunately the IP addresses
were not made provider independent so we have to go round and change
the IP addresses on all the boxes.

Is there an easy way of changing the IP Address, subnet mask and
default gateway, via a script.

The IP address will be changing from

xxx.xxx.203.201 to xxx.xxx.203.201 so its only the 1st 2 octets that
are changing.

Thanks
 
Reply With Quote
 
 
 
 
spidernik84
Guest
Posts: n/a

 
      01-24-2008, 12:17 PM
(E-Mail Removed) wrote in news:a18ac479-d630-45a0-
abbc-(E-Mail Removed):


> Is there an easy way of changing the IP Address, subnet mask and
> default gateway, via a script.


You could use netsh.exe, present in win2k and winxp

Create a file named "script.txt" and put this code in it after modifying
the values as required:

-----8<-CUT HERE -----

interface
ip
set address name="LAN connection name" source=static addr=192.168.1.2
gateway=192.168.1.1 mask=255.255.255.0 gwmetric=0
set dns name="LAN connection name" source=static addr=212.31.224.5
register=primary
add dns name="LAN connection name" addr=81.88.224.130
quit


-----8<-CUT HERE -----


And execute this:

netsh exec script.txt



Cheers


--
- per aspera sic itur ad astra -

http://spidernik84.altervista.org

Togli "TIFREGO" per contattarmi...
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
script for filtering mac addresses in dnsmasq.conf with iptables bl8n8r Linux Networking 0 07-04-2007 06:37 PM
script for changing gateway ip address J Windows Networking 3 03-13-2006 02:40 PM
Changing server IP addresses amadjeski Windows Networking 2 02-20-2006 05:20 AM
Changing Static IP Addresses Mike G Windows Networking 8 01-09-2006 05:52 PM
Changing MAC Addresses RWade Windows Networking 1 11-03-2003 10:09 PM



1 2 3 4 5 6 7 8 9 10 11