Skip to main content

changing static ip address

More
20 years 4 months ago #2198 by balachandar
how to change static ip address from command prompt ..
More
20 years 4 months ago #2200 by Neon
Replied by Neon on topic Re: changing static ip address
nnbnbThat's a VERY good question I often wondered that myself until I stumbled upon a website talking about that.

Alright for Windows 2000/XP there is a command for just that:

NETSH

Well since I got that off a site I'll just paste the dump here

How can I configure my IP address and other settings from the command prompt?

In Windows 2000 (and in XP) you can use the NETSH utility to do just that, and much more. Netsh.exe is a tool an administrator can use to configure and monitor Windows-based computers at a command prompt.

You can use the Netsh.exe tool to perform the following tasks:

Configure interfaces.

Configure routing protocols.

Configure filters.

Configure routes.

Configure remote access behavior for Windows-based remote access routers that are running the Routing and Remote Access Server (RRAS) Service.

Display the configuration of a currently running router on any computer.

Use the scripting feature to run a collection of commands in batch mode against a specified router.



For example:
To save your current IP settings:

netsh -c interface dump > c:\data\interface.txt

To restore (or configure) your settings from a text file:

netsh -f c:\data\interface.txt

If you need to plug your laptop into different networks, you can save and restore the appropriate network configuration using netsh.exe. When you have your laptop correctly configured for your office network, you can save the network configuration for later restoration.

netsh -c interface dump > c:\configs\officeinterface.txt

Now lets say you take it home and reconfigure it correctly for you home network. To save you home network configuration for later use:

netsh -c interface dump > c:\configs\homeinterface.txt

OK. Now you take the laptop back to the office and you need to reconfigure for the office environment: nic address, wins, gateway address... Use the following command to restore your office network interface:

netsh -f c:\configs\officeinterface.txt

At end of day, you take it home. To setup for home, run:

netsh -f c:\configs\homeinterface.txt

As you can imagine, this is very valuable if you have get your laptop to function in multiple network locations.

You can also use the NETSH command in Windows 2000 or XP to script the process of changing a computer from a static IP address to Dynamic Host Configuration Protocol (DHCP) or vice versa. The NETSH command accomplishes this task without the need to restart the computer. This feature is particularly useful for laptops that move from one environment to another, when it is necessary to use statically assigned IP addresses at one location and DHCP assigned IP addresses at another.

To switch the specified adapter from a static address to DHCP, type the following command:

netsh interface ip set address "Local Area Connection" dhcp

To display all of the adapters in the computer with their current IP addresses to determine the correct adapter name, type the following command:

netsh interface ip show config

To change to a static address, type the following command:

netsh interface ip set address "Local Area Connection" static ipaddr subnetmask gateway metric

Note: Replace ipaddr with the static IP address, subnetmask with the subnet mask, gateway with the default gateway and, if necessary, metric with the appropriate metric. The following example changes the interface "Local Area Connection" to a static address of 192.168.0.10 with a subnet mask of 255.255.255.0, and the interface has a default gateway of 192.168.0.1 with a metric of 1:

netsh interface ip set address "Local Area Connection" static 192.168.0.10 255.255.255.0 192.168.0.1 1


Thats from www.petri.co.il/configure_tcp_ip_from_cmd.htm by the way :)
More
20 years 4 months ago #2201 by Neon
Replied by Neon on topic Re: changing static ip address
ADD: To be honest I didn't think windows would be friendly enough to actually add that command :o

Also if you go to the URL I supplied, you will notice that great amount of other things the site offers about Microsoft stuff as it’s a MCSE site :)
More
20 years 4 months ago #2204 by sahirh
*Yoda*
This Neon,... strong in the force he is.... many windows tricks knows he...

*Luke*
But Master, how come you didn't know how to do this ?

*Yoda*
A saying there is -- in the forums of firewall.cx things will be learnt.

*Luke*
Now I understand master ! I will not fail, I will change my IP address from the command prompt.


I was watching Attack Of The Clones on DVD... like you guys din't figure. Nice tip Neon.

Sahir Hidayatullah.
Firewall.cx Staff - Associate Editor & Security Advisor
tftfotw.blogspot.com
More
20 years 4 months ago #2210 by tfs
Replied by tfs on topic Re: changing static ip address
Wait a minute.

What happened to Gandalph?

Thanks,

Tom
More
20 years 4 months ago #2225 by sahirh
LOTR still hasn't come here !!! I think it might release mid-Jan. Getting impatient now.

Sahir Hidayatullah.
Firewall.cx Staff - Associate Editor & Security Advisor
tftfotw.blogspot.com
Time to create page: 0.149 seconds