4

I would like to have it so that my computer sets its IP address statically depending on which network that it is connected to. I have 3 Networks that I regularly use and it seems that with Windows I can only set a static IP for each interface. I am aware of DHCP tables, but unfortunately one of the routers crashes every time I even open the DHCP table list. I use Linux and Android on a regular basis, and they let you do this. For some reason with Windows I can't seem to figure out how. Am I missing something or is there some software I can install which will handle this for me?


In the related questions, I found this: Unique IP address settings (static/dhcp) per wireless network?

So this question is probably considered a duplicate, but It only gives you 6 free connections, after that you have to pay 20 euros for the full version. I would prefer a free solution though or a way to do it natively in windows. Something as simple as this should be free.

1
  • Do you have access to the dhcpd.conf (config file) on each network? If you had access you could tell the DHCP server if you encounter MAC address 12:34:56:78:9a:bc (whatever) give it this IP address. Each dhcp server on the 3 networks would have a different entry for the same MAC address. The DHCP server would then always hand out the same IP for that MAC address no matter what OS it was running. Does this work for you?
    – cybernard
    Sep 11, 2013 at 2:36

2 Answers 2

1

Suggesting an alternative


You can use a batch file to re-configure your interface with required settings and just have the settings you want pre-defined

All you need to do is setup the variables and for each network and then open the batch files and go

Interface example:

Batch interface

Code:

@echo off
cls
echo option 1: Network 1
echo option 2: Network 2
echo option 3: Network 3
choice /c 123 /m "Please select an option above: "

SET option=%ERRORLEVEL%
IF %option% == 1 goto n1
IF %option% == 2 goto n2
IF %option% == 3 goto n3
exit

:n1
netsh interface ip set address name="Local Area Connection" static 192.168.0.100 255.255.255.0 192.168.0.1
netsh interface ip set dns "Local Area Connection" static 8.8.8.8
netsh interface ip add dns "Local Area Connection" 8.8.4.4 INDEX=2
echo Completed
pause
exit

:n2
netsh interface ip set address name="Local Area Connection" static 192.168.1.100 255.255.255.0 192.168.1.1
netsh interface ip set dns "Local Area Connection" static 8.8.8.8
netsh interface ip add dns "Local Area Connection" 8.8.4.4 INDEX=2
echo Completed
pause
exit

:n3
netsh interface ip set address name="Local Area Connection" static 10.28.46.100 255.0.0.0 10.0.0.1
netsh interface ip set dns "Local Area Connection" static 8.8.8.8
netsh interface ip add dns "Local Area Connection" 8.8.4.4 INDEX=2
echo Completed
pause
exit
2
  • 1
    I want it to be automatic.
    – WalterM
    Sep 10, 2013 at 22:07
  • 2
    I've prefaced the answer with "Suggesting an alternative" if no suitable answer you have a fall-back. also remember community help "Keep an open mind The answer to your question may not always be the one you wanted"
    – 50-3
    Sep 10, 2013 at 22:14
0

I think what you are asking for is not possible, and the batch file is probably a good option.

When you set a static IP on your adapter, you are telling it the IP to use. This is in order so that it doesn't have to do discovery to find that out.

Without discovery, how is it supposed to notice you plugged it into a different network?

This is what DHCP is actually for - discovery and configuration. I don't believe there's any other standardised way to do some kind of discovery about what you are connected to in order to choose IP settings.

It works for WiFi because the SSID identifies the network you are connecting to, and so the client can use that to choose settings.

Your best bet is to fix the broken router / DHCP server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .