2

Im trying to change a machine ip address vi CMD 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 changed (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 pay to change the ip permanently via CMD.

Any ideas?

edotan
  • 1,876
  • 13
  • 39
  • 57
  • You need to specify the default gateway and metric as well as the address and mask. See the examples in the answers already posted. (The help syntax says these are optional, but they're not.) – Harry Johnston Mar 26 '12 at 23:04

2 Answers2

1

Try this: netsh interface ip set address name=”<network connection name>” static <static IP> <network mask> <default gateway>

which looks like:

netsh interface ip set address name=”Ethernet Network Connection” static 192.168.0.10 255.255.255.0 192.168.0.1

Information from here

cutrightjm
  • 344
  • 2
  • 13
1

Most of the examples I've seen of setting a static IP through netsh don't use the source= and addr= parts. Have you tried like this?

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

Where 192.168.0.100 is your IP, 192.168.0.1 is your default gateway, and 1 is the metric?

Grant
  • 17,859
  • 14
  • 72
  • 103