Work Holly Week II (Part I) Configuring the network with Netsh

miércoles, 2 de abril de 2008

Both UNIX and Windows can configure the network connection on a console, in Windows there Netsh while UNIX is done with ifconfig.

Configuring network with Netsh in Windows.

Netsh is a use of command line for Windows that enables us to configure the Internet connection from the console, allows you to save the current configuration in a package .cmp which we can restore it later.

To run netsh only have to write to the console commands netsh and prompt change.

C:\netsh
netsh>

Writing netsh>? It shows a list of all actions that can be done with this command.



Let's save the current configuration of network computer, the first left netsh writing bye.

Now on the console wrote:

C:\netsh dump > C:\ConfigRed.cmp



Now we can modify the configuration as if he desires to return to the earlier we can restore our copy
.cmp

That is the current configuration of this team:


We will modify the connection with netsh commands to check its operation.

To change our connection wrote:

C:\netsh interface ip set address "conexión de área local" static 192.168.1.50 255.255.255.0 192.168.1.1 1

Where the outline of the command is as follows


netsh interface ip set address[name conection] [New Local IP] [Subnet Mask]
[Gateway default] [1].

Also, we can change the configuration of DNS (ip set dns)

Pressing is amended to accept that we can see our connection with the command ipconfig


We shall now proceed to restore the previous configuration, to write this on the console:


Setting connection to start Windows.

We can configure the computer connect to the Internet to login to it in Windows can write a script .bat to be run at the beginning with netsh commands configuration.

Create a file and edit scriptNetsh.bat, for example that we assign an IP router desired write:

netsh interface ip set address "red_inalambrica" source=STATIC 192.168.0.100 255.255.255.0 192.168.0.1 0
netsh interface ip set dns "red_inalambrica" source=STATIC 192.168.0.1

Or for instance to give us an Auto IP:

netsh interface ip set address "Conexion" source=dhcp
netsh interface ip set
dns "Conexion" source=dhcp


Save the file and run it if we can see that our connection is configured with the data that we have written in the file.

Download the script scriptNetsh.bat (Beware! Keep in mind that when running this script your settings will be amended)

For this script to be executed login we can proceed in two ways, one is placing the programmes of initiation (For Windows XP: Home> All Programs> Start), adding that folder directly into our script this will be executed automatically at the beginning Session.

Another way is register in our system, this method is safer than the previous one because it is difficult to see the registry (in the previous case could be eliminated Start), so we will be more confident that the user does not remove it involuntarily .

To register get the registry editor (Run> Redegit), once open look for the following route:

HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/Run



We added a new entry binary (Edit> New> Value alphanumeric) he indicated the name of courage, and the path to the bat. We can hide the bat in any folder system.


Once added, we can restart the computer to check its operation.

To me it has worked perfectly in this way :)

Extracted from http://es.wikipedia.org/wiki/Netsh

In the next inning as is done in linux.

0 comentarios: