Jump to content
xisto Community
Sign in to follow this  
jarro2002

How To: Ip Configuration Script (win Xp) If you travel a lot with your laptop, and need to switch between diff

Recommended Posts

How To: IP Configuration Script (win XP)


If you travel a lot with your laptop, and need to switch between
different IP's in different locations, this script is for you.

There are many programs that handle this task very well,
but they cost sometimes pretty big money. This tutorial will show you how to
make your own IP Configuration Script for free.

This script is for a static ip address configuration and
is based on a little program called "NETSH.EXE" which is supplied with Windows.

How it works.


Microsoft Windows XP - Using Netsh
Netsh.exe is a command-line scripting utility that allows you to,
either locally or remotely, display or modify the network configuration of a computer
that is currently running. Netsh.exe also provides a scripting
feature that allows you to run a group of commands in batch mode
against a specified computer. Netsh.exe can also save a configuration
script in a text file for archival purposes or to help you configure other servers.


OK. Let's get down to the business.

First of all, will need to create a batch (.bat) file and a text file (.txt)
I will explain the contens of the text file later on.

1. In our batch file, wee will put the code as follows.

@echo offnetsh.exe exec textfile.txtif not errorlevel 1 goto allokecho.echo		   ERROR !!!echo.pausegoto end:allokecho.echo NETSH exec .......... OK!echo.:end

In the second line of our batch file wee execute NETSH.exe with a command-line parameter.
The command-line parameter is the path and name of our text file
(or just the name if both files will bee stored in the same directory)

In the next lines of the batch file is a simple error handler.


2. In our text file, wee will put the code as follows.

interface ipset address name="Wireless" source=static addr=10.3.123.123 mask=255.255.0.0set address name="Wireless" gateway=10.1.0.0 gwmetric=0set dns name="Wireless" source=static addr=88.77.77.3add dns name="Wireless" addr=163.29.251.110add dns name="Wireless" addr=194.244.159.1add dns name="Wireless" addr=195.130.20.131set wins name="Wireless" source=static addr=none

The "interface ip" command branches to a submenu in the NETSH.exe program.
The "set address name" command configures the IP, the sub-net mask and the default gateway address.
The name "Wireless" is an example interface name, change it to the interface name you want to configure.
In the fourth and lower lines, the "addr" values are the IP addresses of your DNS servers.
In the last line, the "addr" value is the WINS server IP address.

NOTE: Remember to save the text file under the same name you have specifiedin the batch file,
and to save the batch file with the .BAT extention.


This is my first tutorial and i hope
it will be useful for someone.

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.