Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to change my IP using CMD command?
Posted
Updated 22-Oct-13 21:40pm
v2

Use the netsh command;

<br />
netsh interface ip set address name="Local Area Connection" static <ipaddress> <netmask> <gateway> 1<br />
</gateway></netmask></ipaddress>


Assuming you want to change it for the adapter called Local Area Connection, and you want to set the IP to 192.168.1.42 using 192.168.1.1 as gateway and 255.255.255.0 as the mask:
<br />
netsh interface ip set address name="Local Area Connection" static 192.168.1.42 255.255.255.0 192.168.1.1 1<br />


Hope this helps,
Fredrik
 
Share this answer
 
Comments
Tom Marvolo Riddle 23-Oct-13 3:31am    
My 5!
The command is:
to change IP 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

to change DNS:
netsh int ip set dns "local area connection" static 192.168.0.254 primary

This is assuming 3 things.
1) The network adapter you're trying to change the IP for is "local area connection". It could also be "local area connection 2" or "wireless network connection". Look in your control panel for the correct name
2) The IP you want to set is 192.168.0.101, change this to whatever IP to want to use.
3) The default gateway and dns are the same IP. If you are using some kind of router they usually are. Change this to match your network config found with the command ipconfig /all

You will need to run both commands to change the IP.

For further reference in details, you can visit This[^] Link.
 
Share this answer
 
Mmmm...
So you can try VPN?!
Here download link http://www.idcloak.com/vpn-price/unmetered-vpn-service-pricing.html ...
It is for free and it works great!
Hope I help you!
 
Share this answer
 
Here is an example if you want to change IP to 192.168.142.102, subnet mask to 255.255.255.0 and gataway to 192.168.142.1
C#
netsh interface ip set address "Local Area Connection" static 192.168.142.102 255.255.255.0 192.168.142.1 2 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900