Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing IP address via command line on Windows XP

I'm trying to change a machine IP address via cmd.exe with this code:

netsh int ip set address name="Local Area Connection" source=static addr=???.???.???.??? mask=255.255.255.0

The problem that the IP doesn't change (checked by ipconfig) but doesn't not changed on the DHCP. Thus when I restart the machine, the IP is returned to DHCP.

I need a way to change the IP permanently via command line.

Any ideas?

like image 287
Oren Yakobi Avatar asked Mar 26 '12 07:03

Oren Yakobi


People also ask

What is IP Config In cmd?

IPCONFIG stands for Internet Protocol Configuration. This is a command-line application which displays all the current TCP/IP (Transmission Control Protocol/Internet Protocol) network configuration, refreshes the DHCP (Dynamic Host Configuration Protocol) and DNS (Domain Name Server).


1 Answers

You can use the command below:

netsh interface ip set address name="Local Area Connection" static 192.168.0.100 255.255.255.0 192.168.0.1 1

where

  • the 192.168.0.100 is the IP address
  • the netmask is 255.255.255.0
  • and the gateway is 192.168.0.1

You can also have the DNS configured automatically by DHCP using following command:

netsh interface ip set dns "Local Area Connection" dhcp
like image 71
Nedal Safadi Avatar answered Oct 02 '22 18:10

Nedal Safadi