To change to static IP:
----------------------------------------------------------------
This changes the IP address and Default Gateway:
netsh int ip set address "local area connection" static {192.168.0.101} 255.255.255.0 {192.168.0.254} 1
This changes DNS:
netsh int ip set dns "local area connection" static {192.168.0.254} primary
----------------------------------------------------------------
You will want to change the values between the curly braces, but do not use the curly braces when you run the command.
----------------------------------------------------------------
To change the interface back to DHCP (get IP automatically) use this command:
netsh int ip set address "local area connection" dhcp
DNS:
netsh int ip set dns "local area connection" dhcp
----------------------------------------------------------------
============================
I would recommend you view the help for this command, it will shed much more insight on what you're actually doing.
The netsh command allows you to change many things such the firewall configuration to the ip addresses.
You can get help for the netsh command by adding each word of the command and adding /?. For example:
=================================
C:\Documents and Settings\2xod>netsh /?
Usage: netsh [-a AliasFile] [-c Context] [-r RemoteMachine]
[Command | -f ScriptFile]
The following commands are available:
Commands in this context:
? - Displays a list of commands.
add - Adds a configuration entry to a list of entries.
bridge - Changes to the `netsh bridge' context.
delete - Deletes a configuration entry from a list of entries.
diag - Changes to the `netsh diag' context.
dump - Displays a configuration script.
exec - Runs a script file.
firewall - Changes to the `netsh firewall' context.
help - Displays a list of commands.
interface - Changes to the `netsh interface' context.
ras - Changes to the `netsh ras' context.
routing - Changes to the `netsh routing' context.
set - Updates configuration settings.
show - Displays information.
winsock - Changes to the `netsh winsock' context.
The following sub-contexts are available:
bridge diag firewall interface ras routing winsock
To view help for a command, type the command, followed by a space, and then
type ?.
=================================
C:\Documents and Settings\2xod>netsh int /?
The following commands are available:
Commands in this context:
? - Displays a list of commands.
add - Adds a configuration entry to a table.
delete - Deletes a configuration entry from a table.
dump - Displays a configuration script.
help - Displays a list of commands.
ip - Changes to the `netsh interface ip' context.
ipv6 - Changes to the `netsh interface ipv6' context.
portproxy - Changes to the `netsh interface portproxy' context.
reset - Resets information.
set - Sets configuration information.
show - Displays information.
The following sub-contexts are available:
ip ipv6 portproxy
To view help for a command, type the command, followed by a space, and then
type ?.
=================================
C:\Documents and Settings\2xod>netsh int ip /?
The following commands are available:
Commands in this context:
? - Displays a list of commands.
add - Adds a configuration entry to a table.
delete - Deletes a configuration entry from a table.
dump - Displays a configuration script.
help - Displays a list of commands.
reset - Resets TCP/IP and related components to a clean state.
set - Sets configuration information.
show - Displays information.
To view help for a command, type the command, followed by a space, and then type ?.
=================================
C:\Documents and Settings\2xod>netsh int ip set /?
The following commands are available:
Commands in this context:
set address - Sets the IP address or default gateway to the specified interface.
set dns - Sets DNS server mode and addresses.
set wins - Sets WINS server mode and addresses.
=================================
C:\Documents and Settings\2xod>netsh int ip set address /?
Usage: set address [name=]<string>
[[source=]dhcp |
[source=] static [addr=]IP address [mask=]IP subnet mask]
[[gateway=]<IP address>|none [gwmetric=]integer]
Parameters:
Tag Value
name - The name of the interface.
source - One of the following values:
dhcp: Sets DHCP as the source for configuring IP
addresses for the specific interface.
static: Sets the source for configuring IP addresses
to local static configuration.
gateway - One of the following values:
<IP address>: A specific default gateway for the
static IP address you are setting.
none: No default gateways are set.
gwmetric - The metric for the default gateway. This field should
not be set if gateway is set to 'none'.
The following options are used only if source is 'static':
addr - An IP address for the specified interface.
mask - The subnet mask for the specified IP address.
Remarks: Used to change the IP address configuration mode from either DHCP to
static mode or static mode to DHCP. Adds IP addresses on an
interface with static IP address or adds default gateways.
Examples:
set address name="Local Area Connection" source=dhcp
set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1
C:\Documents and Settings\2xod>
=================================
If you ever mess up the configuration you can always modify the settings through the graphical interface of the control panel. From Start > Control Panel > Switch to Classic View, and open Network Connections
Before running these commands, look at your existing (working) IP configuration with the ipconfig command:
This will show you the Default Gateway and DNS entries to put in the commands above where the {braces} are.
================================
C:\Documents and Settings\2xod>ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : computar
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) PRO/1000 XT Server Adapter
Physical Address. . . . . . . . . : 00-02-B3-B5-D6-J3
Dhcp Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.0.101
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.2
DNS Servers . . . . . . . . . . . : 192.168.0.2
C:\Documents and Settings\2xod>
================================
now select-1. obtain ip address automatically
2. obtain dns automatically.
hope it helped... i also faced the same problem..
I am facing one such problem in windows 7!!
the problem is if i revert it back to automaitic configuration it is not getting reverted back!! :(..
It is remembering my ip and subnet mask.
so i am not able to even connect to my lan..
what is the solution for this?
---
http://interpret.astana-translation.ath.cx
if you can thankyou very much
ip 192.68.0.1
subnet 255.255.255.0
gateway 192.168.0.254
preferred dns 25.166.0.13
altenate dns 16.50.55.2
how can i configure this on windows98?
thank you
http://www.bellbestpuma.com
http://www.okeywecan.com
http://www.bellbest.com
very very thanks for you, to give me the information about netsh and its application in changing the ip address through cmd promt
ipconfig <ip address? <subnet mask>
in linux
netconfig
was giving an error The following command was not found: int ipv4 set dnsservers "Local Area Connection" static 192.168.xxx.xxx primary
After a bit of debugging i found that a 's' is extra in that command for me... it worked when it was changed to
Thanks again
In XP works fine, but in windows 7 neither changes with Ipv4 nor another commands works
netsh interface ip set address name="LAN" source=static addr=10.175.5.181 mask=255.255.0.0 gateway=10.175.1.1 gwmetric1
netsh interface ip set dns name="LAN" source=static addr=10.10.1.46
netsh interface ip add dns name="LAN" addr=10.10.1.52
I thank you a lot for any support.
All the best
Rene
This is my batch file which works fine in XP, so please I beg you support to get it works in windows 7
netsh interface ip set address name="LAN" source=static addr=10.175.5.181 mask=255.255.0.0 gateway=10.175.1.1 gwmetric1
netsh interface ip set dns name="LAN" source=static addr=10.10.1.46
netsh interface ip add dns name="LAN" addr=10.10.1.52
Thank you very much any support
All the best
netsh interface set interaface name="Plugged Local Area Connection" admin=ENABLED
I've tried many variations and always get something like:
One or more essential parameters not specified
The syntax supplied for this command is not valid. Check help for the correct sy
ntax.
Any suggestions?
Thanks in advance.
Information what you are provided is very use full for me thank you for that and one more how to remove ip address using dos command please send a mail.
Thank you
PUTTI RAMESH
Im using dhcp and i want to configure static ip through command prompt, and i tried ur above command, it didn't work.
Pls Help
Annachi
Kindly let me know
How to change IP address by command prompt in Windows XP and Windows Vista.
After I run each command I get an answer 'the requested operation requires elevation' and when I check the ip has not changed.
So, when you execute these NETSH commands from the command prompt, do they just last for the current session or are they made permanent to the system so are still in effect when you reboot?
I just want to know if the Ip address is assigned by the DHCP server i.e 169.254.x.x
And even if the ip release and ip renew commmand is also not assigning the required ip address of the network i.e 19.168.x.x. Then which command would work to change the DHCP ip address to the required one.
Your reply will be helpful.
Thanks for previous answer