Force a static IP address only for a specific network in Windows 8

1

I am a developer. I need to have a static IP address when I'm at my office, and would like to use my DHCP at home.

Making a reservation on the office's DHCP isn't possible (the router they have doesn't allow that).

I've looked up through Google to see if there is something that could suit my needs but haven't found any (Maybe it's because I don't know the name of the technology I'm looking for).

So my question is: Is there a way to automatically switch from a static address to a dynamic depending on the network?

patxy

Posted 2013-08-27T07:05:25.673

Reputation: 169

If you're a developer, why don't you write your own command to detect it when Windows logs in? – Dave – 2013-08-27T07:48:46.203

Answers

3

You must change IP manually or with a script. You can also write a program that changes IP depending on network. Below is a batch script for that purpose

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

phuclv

Posted 2013-08-27T07:05:25.673

Reputation: 14 930

All you need to do is have the script ran when at login time, easily achieved via task scheduler. I removed the "No" from your answer. + 1 – Dave – 2013-08-27T07:38:54.400

A startup script is good but not everyone shuts down/logs off their computer when going home, so maybe sometimes the IP doesn't change correctly, in that case maybe running the script manually is needed. But the best solution is that he writes his own IP changing program – phuclv – 2013-08-27T08:43:16.853

But you can fire it at log on (or start up as you point out), even on a workstation un-lock! :) – Dave – 2013-08-27T08:51:34.207